这期内容当中小编将会给大家带来有关怎么在CSS3中实现3D酷炫立方体变换动画,文章内容丰富且以专业的角度为大家分析和叙述,阅读完这篇文章希望大家可以有所收获。
代码如下:
<!DOCTYPE html><html lang="zh"><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>3D旋转</title> <style> .wrapper { perspective: 500px; margin: 100px auto 0; width: 200px; height: 200px; } .box { position: relative; transform-style: preserve-3d; width: 200px; height: 200px; animation: move 8s linear infinite; } div[class^="item"] { position: absolute; top: 0; left: 0; width: 200px; height: 200px; text-align: center; line-height: 200px; } .item1 { transform: translateZ(100px); background-color: rgba(255, 0, 0, 0.6); } .item2 { transform: translateZ(-100px); background-color: rgba(72, 42, 245, 0.6); } .item3 { transform: rotateX(90deg) translateZ(100px); background-color: rgba(217, 230, 36, 0.6); } .item4 { transform: rotateX(90deg) translateZ(-100px); background-color: rgba(58, 7, 51, 0.6); } .item5 { transform: rotateY(90deg) translateZ(-100px); background-color: rgba(241, 142, 75, 0.6); } .item6 { transform: rotateY(90deg) translateZ(100px); background-color: rgba(125, 178, 238, 0.6); } @keyframes move { 0% { transform: rotateX(0) rotateY(0) rotateZ(0); } 100% { transform: rotateX(360deg) rotateY(360deg) rotateZ(360deg); } } </style></head><body> <div class="wrapper"> <div class="box"> <div class="item1">1</div> <div class="item2">2</div> <div class="item3">3</div> <div class="item4">4</div> <div class="item5">5</div> <div class="item6">6</div> </div> </div></body></html>
上述就是小编为大家分享的怎么在CSS3中实现3D酷炫立方体变换动画了,如果刚好有类似的疑惑,不妨参照上述分析进行理解。如果想知道更多相关知识,欢迎关注编程网行业资讯频道。