3D立体墙照片

handlebars 复制代码
<!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>
        html,
        body {
            margin: 0;
            padding: 0;
        }
        
        * {
            box-sizing: border-box;
        }
        
        body {
            background-color: #2f3542;
        }
        
        main {
            display: flex;
            align-items: center;
            justify-content: center;
            height: 100vh;
        }
        
        .cube {
            width: 250px;
            height: 250px;
            transform-style: preserve-3d;
            animation: rotate-cobe 10s ease-in-out infinite;
        }
        
        .cube>div {
            width: 250px;
            height: 250px;
            background-size: cover;
            background-position: center center;
            opacity: 0.8;
            position: absolute;
            box-shadow: inset 0 0 4px 2px rgba(106, 106, 106, 0.4);
        }
        /* 前 */
        
        .cube .img1 {
            background-image: url("https://ns-strategy.cdn.bcebos.com/ns-strategy/upload/fc_big_pic/part-00323-3881.jpg");
            transform: translateZ(125px);
        }
        /* 右 */
        
        .cube .img2 {
            background-image: url("https://img0.baidu.com/it/u=3607416692,1659289502&fm=253&fmt=auto&app=120&f=JPEG?w=1200&h=750");
            transform: rotateY(90deg) translateZ(125px);
        }
        /* 左 */
        
        .cube .img3 {
            background-image: url("https://img2.baidu.com/it/u=667685406,1155663261&fm=253&fmt=auto&app=138&f=JPEG?w=889&h=500");
            transform: rotateY(-90deg) translateZ(125px);
        }
        /* 下 */
        
        .cube .img4 {
            background-image: url("https://img2.baidu.com/it/u=1547725493,4110294476&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=500");
            transform: rotateX(90deg) translateZ(125px);
        }
        /* 上 */
        
        .cube .img5 {
            background-image: url("https://img1.baidu.com/it/u=2345344959,2598464592&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=313");
            transform: rotateX(-90deg) translateZ(125px);
        }
        /* 后 */
        
        .cube .img6 {
            background-image: url("https://img1.baidu.com/it/u=475796613,1666623793&fm=253&fmt=auto&app=120&f=JPEG?w=1140&h=641");
            transform: rotateY(180deg) translateZ(125px);
        }
        
        @keyframes rotate-cobe {
            0% {
                transform: rotateX(0deg) rotateY(0deg);
            }
            20% {
                /* 右边图片 */
                transform: rotateY(-90deg);
            }
            40% {
                /* 上 */
                transform: rotateX(-90deg);
            }
            60% {
                /* 左 */
                transform: rotateY(90deg);
            }
            80% {
                /* 下 */
                transform: rotate(90deg);
            }
            100% {
                transform: rotateX(0deg) rotateY(0deg);
            }
        }
    </style>
</head>

<body>
    <main>
        <div class="cube">
            <div class="img1"></div>
            <div class="img2"></div>
            <div class="img3"></div>
            <div class="img4"></div>
            <div class="img5"></div>
            <div class="img6"></div>
        </div>
    </main>
</body>

</html>
相关推荐
前端小崔4 小时前
从零开始学习three.js(18):一文详解three.js中的着色器Shader
前端·javascript·学习·3d·webgl·数据可视化·着色器
Yvonne爱编码6 小时前
CSS- 4.1 浮动(Float)
前端·css·html·github·html5·hbuilder
有事没事实验室7 小时前
CSS 浮动与定位以及定位中z-index的堆叠问题
前端·css·开源
读心悦8 小时前
5000 字总结CSS 中的过渡、动画和变换详解
前端·css·tensorflow
Yvonne爱编码10 小时前
CSS- 4.2 相对定位(position: relative)
前端·css·状态模式·html5·hbuilder
白小白灬11 小时前
Vue主题色切换实现方案(CSS 变量 + 类名切换)
前端·css·vue.js
哎呦你好11 小时前
HTML 颜色全解析:从命名规则到 RGBA/HSL 值,附透明度设置与场景应用指南
前端·css·html
GanGuaGua12 小时前
Vue3:脚手架
前端·javascript·css·vue.js·vue
酷爱码15 小时前
css中的 vertical-align与line-height作用详解
前端·css
小妖66615 小时前
css 中 content: “\e6d0“ 怎么变成图标的?
前端·css