css3旋转简易六面体

  <style>
        *{margin: 0;}
        .all{width: 200px;height: 200px;position: relative;left: 50%;margin-left: -100px;top: 200px;perspective: 3000px;-webkit-perspective:3000px;-webkit-transform-style:preserve-3d;transform-style:preserve-3d;}
        .box{width: 200px;height: 200px;position: absolute;-webkit-transform-style:preserve-3d;transform-style:preserve-3d;}
        .box div{margin: 0;width: 200px;height: 200px;color: #fff;font-size: 30px;text-align: center;line-height: 200px;position: absolute;top: 0;left: 0;opacity: 0.7;}
        .front{transform: translateZ(100px)}
        .back{transform: translateZ(-100px)}
        .left{transform: translateX(-100px) rotateY(-90deg);}
        .right{transform: translateX(100px) rotateY(90deg);}
        .top{transform: translateY(100px) rotateX(90deg);}
        .bottom{transform: translateY(-100px) rotateX(-90deg);}


        .safa{animation: xx 5s infinite linear;-webkit-animation: xx 5s infinite linear;}
        @keyframes xx{
            0%{transform: rotate3d(0,1,0,0deg)}
            /*25%{transform: rotate3d(1,1,1,50deg)}*/
            /*50%{transform: rotate3d(1,0,1,120deg)}*/
            /*75%{transform: rotate3d(0,1,1,90deg)}*/
            100%{transform: rotate3d(0,1,0,360deg)}
        }
    </style>

    <div class="all">
        <div class="box safa">
            <div class="front" style="background-color: cadetblue">1</div>
            <div class="back" style="background-color: #145345">2</div>
            <div class="left" style="background-color: #789523">3</div>
            <div class="right" style="background-color: #132457">4</div>
            <div class="top" style="background-color: #325465">5</div>
            <div class="bottom" style="background-color: red">6</div>
        </div>
    </div>


转载于:https://my.oschina.net/u/2478033/blog/513181

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值