4
-child(1) { -webkit-transform: /*rotateY(0deg)*/ translateZ(2.5em /* half the side length, 5em in this case */); } .face:nth-child(2) { - webkit-transform: rotateY(90deg) translateZ(2.5em); } .face:nth-child(3) { -webkit-transform: rotateY(180deg) translateZ(2.5em); } .face:nth-child(4) { -webkit-transform: rotateY(270deg) translateZ(2.5em); }
Let the cube rotate
.cube--ani { -webkit-animation: rot 4s linear infinite; } @-webkit-keyframes rot { to { -webkit-transform: rotateY(-330deg) rotateX(370deg); } }
An animation rot
is defined here
Rotate from the starting position to Y-axis -330deg X-axis 370deg
And loop infinite times, 4s each time
OK!
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