美文网首页HTML+CSS+JS效果特效
纯css样式的立体正方形特效

纯css样式的立体正方形特效

作者: 小姜先森o0O | 来源:发表于2017-02-22 21:04 被阅读0次
    <!doctype html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Document</title>
        <style>
            #box{
                width:500px;
                height: 500px;
                margin:0 auto;
                position: relative;
                transform-style: preserve-3d;
                animation-name: r;
                animation-duration: 5s;
                animation-timing-function: linear;
                animation-iteration-count: infinite;        
            }
            #box div{
                width: 200px;
                height: 200px;
                position: absolute;
                line-height: 200px;
                text-align: center;
                font-weight: bold;
                font-size: 100px;
                top:250px;
                left:200px;
                opacity: 0.8;
                
            }
            #a{ 
                background: red;
                transform-origin:right;
                transform:rotateY(270deg) rotateX(180deg);
    
            }
            #b{
                background: blue;
                opacity: 0.8;
            }
            #c{
                background: yellow;
                transform-origin:left;
                transform:rotateY(90deg) rotateX(180deg);
            }
            #d{
                background: green;
                transform-origin:top;
                transform:rotateX(-90deg);
            }
            #e{
                background: purple;
                transform-origin:bottom;
                transform:rotateX(-270deg) rotateY(180deg);
            }
            #f{
                background: orange;
                transform:translateZ(-200px);
            }
            @keyframes r{
              0%   { transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg); }
              100% { transform: rotateX(360deg) rotateY(360deg) rotateZ(360deg) }
            }
        </style>
    </head>
    <body>
    <div id = "box">
        <div id="f">6</div>
        <div id="a">2</div>
        <div id="b">3</div>
        <div id="c">4</div>
        <div id="d">1</div>
        <div id="e">5</div>
    </div>
    </body>
    </html>
    

    相关文章

      网友评论

        本文标题:纯css样式的立体正方形特效

        本文链接:https://www.haomeiwen.com/subject/hwzmwttx.html