CSS/HTML制作在网页中持续旋转的六面体

注:
更改图片路径即可实现重新引用

效果图:
CSS/HTML制作在网页中持续旋转的六面体
源码:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>复仇者联盟</title>
    <link rel="stylesheet" href="./css/reset.css">
    <style>
        html{
            perspective: 1000px;
        }
        .cube{
            width: 200px;
            height: 200px;
            position: relative;
            margin: 200px auto;
            /* 设置3d变形效果 */
            transform-style: preserve-3d;
            transform: rotateY(45deg) rotateX(45deg);
            /* background-color: rosybrown; */
            animation: run 2s linear infinite;
            
        }
        .cube div{
            width: 200px;
            height: 200px;
            /* 设置元素透明度 */
            opacity: 0.7;
            position: absolute;
        }
        .cube .box1{
            transform: rotateY(-90deg) translateZ(100px); 
        }
        .cube .box2{
            transform: rotateY(90deg) translateZ(100px);
        }
        .box3{
            transform: rotateY(180deg) translateZ(100px);
        }
        .cube .box4{
            transform: rotateX(90deg) translateZ(100px);
        }
        .cube .box5{
            transform: rotateX(-90deg) translateZ(100px);
        }
        .box6{
            transform: translateZ(100px);
        }


        @keyframes run{
            from{
                transform: rotateX(0deg) rotateY(0deg);
            }
            to{
                transform: rotateX(360deg) rotateY(360deg);
            }
        }
    </style>
</head>
<body>
    <div class="cube">
        <div class="box1">
            <img src="./img/14/1.jpg" alt="">
        </div>
        <div class="box2">
            <img src="./img/14/2.jpg" alt="">
        </div>
        <div class="box3">
            <img src="./img/14/3.jpg" alt="">
        </div>
        <div class="box4">
            <img src="./img/14/4.jpg" alt="">
        </div>
        <div class="box5">
            <img src="./img/14/5.jpg" alt="">
        </div>
        <div class="box6">
            <img src="./img/14/6.jpg" alt="">
        </div>
    </div>
</body>
</html>

积跬步,至千里!加油,学习人!

上一篇:技术大咖云集,全力助阵“用技术驱动企业提效”专场论坛


下一篇:小demo 旋转木马