继续浏览精彩内容
慕课网APP
程序员的梦工厂
打开
继续
感谢您的支持,我会继续努力的
赞赏金额会直接到老师账户
将二维码发送给自己后长按识别
微信支付
支付宝支付

C3-简单实现立方体+旋转+特效

凯文欧巴iii
关注TA
已关注
手记 13
粉丝 14
获赞 214
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
        <style>
            .container{
                width: 500px;
                margin: 50px auto;
            }
            .cub{
                position: relative;
                width: 100px;
                height: 100px;
                transform-style: preserve-3d;
                -webkit-transform-style: preserve-3d;
                transition: all 5s linear;
            }
            .cub div{
                width: 100px;
                height: 100px;
                position: absolute;
                left: 0;
                top: 0;
                transform-style: preserve-3d;
                -webkit-transform-style: preserve-3d;
                border: 1px solid #46B8DA;
                opacity: 0.5;
            }
            .one{
                transform: rotateY(0deg) translateZ(50px);
            }
            .two{
                transform: rotateY(180deg) translateZ(50px);
            }
            .three{
                transform: rotateX(90deg) translateZ(50px);
            }
            .four{
                transform: rotateX(-90deg) translateZ(50px);
            }
            .five{
                transform: rotateY(90deg) translateZ(50px);
            }
            .six{
                transform: rotateY(-90deg) translateZ(50px);
            }
            .cub:hover{
                transform: rotateX(360deg) rotateY(360deg);
                -webkit-transform: rotateX(360deg) rotateY(360deg);
            }

            .cub:hover .one{
                transform: rotateY(0deg) translateZ(100px);
            }
            .cub:hover .two{
                transform: rotateY(180deg) translateZ(100px);
            }
            .cub:hover .three{
                transform: rotateX(90deg) translateZ(100px);
            }
            .cub:hover .four{
                transform: rotateX(-90deg) translateZ(100px);
            }
            .cub:hover .five{
                transform: rotateY(90deg) translateZ(100px);
            }
            .cub:hover .six{
                transform: rotateY(-90deg) translateZ(100px);
            }
        </style>
    </head>
    <body>
        <div class="container">
            <div class="cub">
                <div class="one" style="background-color: #FFC0CB"></div>
                <div class="two" style="background-color: #449D44"></div>
                <div class="three" style="background-color:#46B8DA"></div>
                <div class="four" style="background-color: #9E90EE"></div>
                <div class="five" style="background-color: #C0A16B"></div>
                <div class="six" style="background-color: #D6E9C6"></div>
            </div>
        </div>
    </body>
</html>
打开App,阅读手记
15人推荐
发表评论
随时随地看视频慕课网APP