3D旋转相册

代码如下

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <title>Document</title>

    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <style>
        .box {
            width: 200px;
            height: 200px;
            top: 250px;
            margin: 100px auto;
            position: relative;
            left: 50%;
            margin-left: -100px;
            transform-style: preserve-3d;
            /* transform: rotateY(-30deg) rotateX(57deg); */
            animation: rotate1 10s;
            animation-iteration-count: infinite;
            animation-timing-function: linear;
        }

        @keyframes rotate1 {
            from {
                transform: rotateY(0) rotateX(0);
            }

            to {
                transform: rotateY(360deg) rotateX(360deg);
                transition: all 0.6s;
            }
        }

        .box>div {
            width: 200px;
            height: 200px;
            opacity: .8;
            background-repeat: no-repeat;
            background-size: cover;
            position: absolute;

        }

        .up {
            background-color: red;
            background-image: url("img/1.jpg");
            transform: rotateX(90deg) translateZ(100px);
            animation: move_up 3s;
            animation-iteration-count: infinite;
            animation-timing-function: linear;
        }

        @keyframes move_up {
            0% {
                transform: rotateX(90deg) translateZ(100px);
                width: 200px;
                height: 200px;
            }

            50% {
                transform: rotateX(90deg) translateZ(300px);
                width: 400px;
                height: 400px;
            }

            100% {
                transform: rotateX(90deg) translateZ(100px);
                width: 200px;
                height: 200px;
            }
        }


        .down {
            background-color: blue;
            background-image: url("img/2.jpg");
            transform: rotateX(90deg) translateZ(-100px);
            animation: move_down 3s;
            animation-iteration-count: infinite;
            animation-timing-function: linear;
        }

        @keyframes move_down {
            0% {
                width: 200px;
                height: 200px;
                transform: rotateX(90deg) translateZ(-100px);
            }

            50% {
                width: 400px;
                height: 400px;
                transform: rotateX(90deg) translateZ(-300px);
            }

            100% {
                width: 200px;
                height: 200px;
                transform: rotateX(90deg) translateZ(-100px);
            }
        }


        .left {
            background-color: rgb(157, 255, 0);
            background-image: url("img/3.jpg");
            transform: rotateY(90deg) translateZ(100px);
            animation: move_left 3s;
            animation-iteration-count: infinite;
            animation-timing-function: linear;
        }

        @keyframes move_left {
            0% {
                width: 200px;
                height: 200px;
                transform: rotateY(90deg) translateZ(100px);
            }

            50% {
                width: 400px;
                height: 400px;
                transform: rotateY(90deg) translateZ(300px);
            }

            100% {
                width: 200px;
                height: 200px;
                transform: rotateY(90deg) translateZ(100px);
            }
        }

        .right {
            background-color: rgb(80, 247, 211);
            background-image: url("img/4.jpg");
            transform: rotateY(90deg) translateZ(-100px);
            animation: move_right 3s;
            animation-iteration-count: infinite;
            animation-timing-function: linear;
        }

        @keyframes move_right {
            0% {
                width: 200px;
                height: 200px;
                transform: rotateY(90deg) translateZ(-100px);
            }

            50% {
                width: 400px;
                height: 400px;
                transform: rotateY(90deg) translateZ(-300px);
            }

            100% {
                width: 200px;
                height: 200px;
                transform: rotateY(90deg) translateZ(-100px);
            }
        }

        .front {
            background-color: rgb(162, 0, 255);
            background-image: url("img/5.jpg");
            transform: translateZ(100px);
            animation: move_front 3s;
            animation-iteration-count: infinite;
            animation-timing-function: linear;
        }

        @keyframes move_front {
            0% {
                width: 200px;
                height: 200px;
                transform: translateZ(100px);
            }

            50% {
                transform: translateZ(300px);
                height: 400px;
                width: 400px;
            }

            100% {
                width: 200px;
                height: 200px;
                transform: translateZ(100px);
            }
        }

        .back {
            background-color: rgb(255, 115, 0);
            background-image: url("img/6.jpg");
            transform: translateZ(-100px);
            animation: move_back 3s;
            animation-iteration-count: infinite;
            animation-timing-function: linear;
        }

        @keyframes move_back {
            0% {
                width: 200px;
                height: 200px;
                transform: translateZ(-100px);
            }

            50% {
                width: 400px;
                height: 400px;
                transform: translateZ(-300px);
            }

            100% {
                width: 200px;
                height: 200px;
                transform: translateZ(-100px);
            }
        }
    </style>
</head>

<body>
    <div class="box">
        <div class="up"></div>
        <div class="down"></div>
        <div class="left"></div>
        <div class="right"></div>
        <div class="front"></div>
        <div class="back"></div>
    </div>
</body>

</html>

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值