<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <section>
        <div></div>
        <div></div>
        <div></div>
        <div></div>
        <div></div>
        <div></div>

    </section>
</body>

</html>

<style>
    body {
        perspective: 500px;

    }

    section {
        transform-style: preserve-3d;
        width: 200px;
        height: 200px;
        margin: 100px auto;
        position: relative;
        animation: go 10s linear infinite;
        background-color: yellow;

    }

    section:hover {
        animation-play-state: paused;
    }

    div {
        position: absolute;
        width: 100%;
        height: 100%;
    }

    div:nth-child(1) {
        background-color: red;
        transform: translateZ(200px)
    }

    div:nth-child(2) {
        background-color: aquamarine;
        transform: rotateY(60deg) translateZ(200px);

    }

    div:nth-child(3) {
        background-color: bisque;
        transform: rotateY(120deg) translateZ(200px);

    }

    div:nth-child(4) {
        background-color: yellowgreen;
        transform: rotateY(180deg) translateZ(200px);

    }

    div:nth-child(5) {
        background-color: wheat;
        transform: rotateY(240deg) translateZ(200px);

    }

    div:nth-child(6) {
        background-color: tomato;
        transform: rotateY(300deg) translateZ(200px);

    }

    @keyframes go {
        100% {
            transform: rotateY(360deg);
        }

    }
</style>

 

posted on 2023-09-04 00:17  码农-编程小子  阅读(99)  评论(0编辑  收藏  举报