CSS3动画 3DBOX

先看个效果图羡慕

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>旋转盒子</title>
    <meta charset="utf-8" />
    <style>
        * {
            margin: 0px;
            padding: 0px;
        }
        @keyframes box {
            100% {
                transform: rotate3d(100,100,100,360deg);
            }
        }
        #box {
            position: absolute;
            top: 30%;
            left: 50%;
            /*position:relative;*/
            perspective: 2000px;
            perspective-origin: 500px -300px;
            animation: box 5s linear 7s infinite both;
            transform-style: preserve-3d;
        }
        .item {
            position: absolute;
            border: 1px solid #000000;
            opacity: 0.5;
            width: 200px;
            height: 200px;
            font-size: 100px;
            background-color: #7b8efb;
            text-align: center;
            line-height: 200px;
        }
        @keyframes box1 {
            100% {
                transform: rotateY(-90deg);
            }
        }
        #box1 {
            z-index: 6;
            transform-origin: left;
            animation: box1 1s linear 1s both;
        }
        @keyframes box2 {
            100% {
                transform: rotateY(90deg);
            }
        }
        #box2 {
            z-index: 5;
            transform-origin: right;
            animation: box2 1s linear 2s both;
        }
        @keyframes box3 {
            100% {
                transform: rotateX(90deg);
            }
        }
        #box3 {
            z-index: 4;
            transform-origin: top;
            animation: box3 1s linear 3s both;
        }
        @keyframes box4 {
            100% {
                transform: rotateX(-90deg);
            }
        }
        #box4 {
            z-index: 3;
            transform-origin: bottom;
            animation: box4 1s linear 4s both;
        }
        @keyframes box5 {
            100% {
                transform: translateZ(200px);
            }
        }
        #box5 {
            z-index: 2;
            animation: box5 1s linear 5s both;
        }
        @keyframes box6 {
            100% {
                transform: rotateY(180deg);
            }
        }
        #box6 {
            animation: box6 1s linear 6s both;
        }
    </style>
</head>
<body>
    <div id="box">
        <div class="item" id="box1">1</div>
        <div class="item" id="box2">2</div>
        <div class="item" id="box3">3</div>
        <div class="item" id="box4">4</div>
        <div class="item" id="box5">5</div>
        <div class="item" id="box6">6</div>
    </div>
</body>
</html>


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值