3d魔方動(dòng)畫(huà)

<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <style>
        .parent{
            width: 100px;
            height: 100px;
            border: 10px solid black;
            padding: 100px;
            margin: 30px auto;
        }
        .son{
            position: relative;
            width: 100px;
            height: 100px;
            transition: 1s;
            transform-style: preserve-3d;
            perspective:500px;
            transform-origin: center center 50px;
            animation: 1s move6 5s both linear  infinite;
        }
        .son div{
            position: absolute;
            width: 100px;
            height: 100px;
        }
        .son div:nth-child(1){
           animation: 1s move1 both;
        }
        .son div:nth-child(2){
            animation: 1s move2 1s both;
        }
        .son div:nth-child(3){
            animation: 1s move3 2s both;
        }
        .son div:nth-child(4){
            animation: 1s move4 3s both;
        }
        .son div:nth-child(5){
            animation: 1s move5 4s both;
        }
        .son div:nth-child(6){
            background: yellow;
        }
        @keyframes move1 {
            100%{
                position: absolute;
                top: -100px;
                width: 100px;
                height: 100px;
                background: magenta;

                transform-origin: bottom;
                transform: rotateX(-90deg);
            }
        }
        @keyframes move2 {
            100%{
                position: absolute;
                left: -100px;
                width: 100px;
                height: 100px;
                background: greenyellow;
                transform-origin: right;
                transform: rotateY(90deg);
            }
        }
        @keyframes move3 {
            100%{
                position: absolute;
                top: 100px;
                width: 100px;
                height: 100px;
                background: lemonchiffon;
                transform-origin: top;
                transform: rotateX(90deg);
            }
        }
        @keyframes move4 {
            100%{
                position: absolute;
                left: 100px;
                width: 100px;
                height: 100px;
                background: mediumblue;
                transform-origin: left;
                transform: rotateY(-90deg);
            }
        }
        @keyframes move5 {
            100%{
                position: absolute;
                width: 100px;
                height: 100px;
                background: lightcoral;
                transform: translateZ(100px);
            }
        }
        @keyframes move6 {
            100%{
                transform: rotateX(360deg) rotateY(360deg);
            }
        }
    </style>
</head>
<body>
<div class="parent">
    <div class="son">
        <div>1</div>
        <div>2</div>
        <div>3</div>
        <div>4</div>
        <div>5</div>
        <div>6</div>
    </div>
</div>
</body>
</html>
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容