Home  >  Article  >  Web Front-end  >  What defines rotation animation in css3 animation

What defines rotation animation in css3 animation

WBOY
WBOYOriginal
2022-03-22 15:46:021900browse

In css3, you can use @keyframes rules, animation and transform attributes to define rotation animation; animation attributes are used to bind element animation effects, @keyframes rules are used to set element animation actions, and transform attributes are used to set elements rotation style.

What defines rotation animation in css3 animation

The operating environment of this tutorial: Windows 10 system, CSS3&&HTML5 version, Dell G3 computer.

What is used to define rotation animation in css3 animation

With the @keyframes rule, you can create animations.

The principle of creating animation is to gradually change one set of CSS styles into another set of styles. The

animation property is a shorthand property for setting six animation properties:

animation: name duration timing-function delay iteration-count direction;

What defines rotation animation in css3 animation

The transform property applies a 2D or 3D transformation to an element. This property allows us to rotate, scale, move or tilt the element.

otate(angle) defines 2D rotation, specifying the angle in the parameter.

The example is as follows:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        div{
            width:100px;
            height:100px;
            background-color:pink;
            animation:fadenum 5s infinite;
        }
        @keyframes fadenum{
   100%{transform:rotate(360deg);}
}
    </style>
</head>
<body>
    <div></div>
</body>
</html>

Output result:

What defines rotation animation in css3 animation

(Learning video sharing: css video tutorial)

The above is the detailed content of What defines rotation animation in css3 animation. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn