1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
| <!DOCTYPE html> <html lang="en">
<head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <style> body { perspective: 2000px; }
#box { width: 300px; height: 300px; margin: 0 auto; position: relative; margin-top: 200px; transform-style: preserve-3d; animation: run 5s linear infinite; } @keyframes run { 0%{transform: rotate3d(0,0,0,0deg);} 25%{transform: rotate3d(0,0,1,90deg);} 50%{transform: rotate3d(0,1,0,180deg);} 75%{transform: rotate3d(0,1,1,270deg);} 100%{transform: rotate3d(1,0,0,360deg);} } #box div { width: 300px; height: 300px; line-height: 300px; position: absolute; border: 1px solid black; text-align: center; font-size: 30px; transition: all 2s; overflow: hidden; } #box div img { width: 100%; height: 100%;
} .top { transform: rotateX(90deg) translateZ(150px); }
.bottom { transform: rotateX(90deg) translateZ(-150px); }
.left { transform: rotateY(90deg) translateZ(-150px); }
.right { transform: rotateY(90deg) translateZ(150px); }
.front { transform: translateZ(150px); }
.back { transform: translateZ(-150px); } #box:hover .top { transform: rotateX(90deg) translateZ(300px); border-radius: 150px; } #box:hover .bottom { transform: rotateX(90deg) translateZ(-300px); border-radius: 150px; } #box:hover .left { transform: rotateY(90deg) translateZ(-300px); border-radius: 150px; } #box:hover .front { transform: translateZ(300px); border-radius: 150px; } #box:hover .right { transform: rotateY(90deg) translateZ(300px); border-radius: 150px; } #box:hover .back { transform: translateZ(-300px); border-radius: 150px; } </style> </head>
<body> <div id="box"> <div class="left"><img src="../img/baby.jpg" alt=""></div> <div class="right"><img src="../img/baby.jpg" alt=""></div> <div class="top"><img src="../img/baby.jpg" alt=""></div> <div class="bottom"><img src="../img/baby.jpg" alt=""></div> <div class="front"><img src="../img/baby.jpg" alt=""></div> <div class="back"><img src="../img/baby.jpg" alt=""></div> </div> </body>
</html>
|