What is the code for 3D rotation animation effect in HTML5

WBOY
Release: 2022-01-23 14:46:51
Original
3809 people have browsed it

In HTML5, the code for the 3D rotation animation effect is "element {animation: name time}@keyframes name {100%{transform:rotate3d(x,y,z,rotation angle);}}"; The animation attribute is used to specify the animation properties of the element.

What is the code for 3D rotation animation effect in HTML5

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

What is the 3D rotation animation effect code in html5

You can use the animation attribute and the @keyframes rule to achieve the animation effect of element scaling. Through the @keyframes rule, animation can be created.

The principle of creating animation is to gradually change one set of CSS styles into another set of styles. You can change this set of CSS styles multiple times during the animation.

Specify the time when the change occurs as a percentage, or through the keywords "from" and "to", which are equivalent to 0% and 100%. 0% is the start time of the animation, 100% is the end time of the animation. For best browser support, you should always define 0% and 100% selectors.

There is also a transform attribute used to set the scaling effect of elements. The transform property applies a 2D or 3D transformation to an element. This property allows us to rotate, scale, move or tilt the element.

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;
            overflow:hidden;
            animation:fadenum 5s ;
        }
        @keyframes fadenum{
          100%{transform:rotateY(70deg);}
}
    </style>
</head>
<body>
    <div><img src="1118.02.png" alt=""></div>
</body>
</html>
Copy after login

Output result:

What is the code for 3D rotation animation effect in HTML5

##Recommended tutorial: "

html video tutorial

The above is the detailed content of What is the code for 3D rotation animation effect in HTML5. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template