3D旋转

<!DOCTYPE html>

<head>

<title>Document</title>

<style>

        body {

            perspective: 500px;

            background-color: black;

        }


        section {

            position: relative;

            margin: 250px auto;

            height: 100px;

            width: 100px;

            /* background-color: pink; */

            transform-style: preserve-3d;

            animation: rotate 6s linear infinite;

        }


        section div {

            position: absolute;

            top: 0;

            left: 0;

            height: 100%;

            width: 100%;

            border: 1px solid #fff;

            transform: translateZ(50px);

        }


        img {

            display: block;

            height: 100%;

            width: 100%;

        }


        section div:nth-child(n+7) {

            opacity: 0.8;

        }


        section div:nth-child(1) {

            /* 正面 */

            transform: translateZ(50px);

        }


        section div:nth-child(2) {

            /* 背面 */

            transform: rotateX(180deg) translateZ(50px);

        }


        section div:nth-child(3) {

            /* 右面 */

            transform: rotateY(90deg) translateZ(50px);

        }


        section div:nth-child(4) {

            /* 左面 */

            transform: rotateY(270deg) translateZ(50px);

        }


        section div:nth-child(5) {

            /* 上面 */

            transform: rotateX(90deg) translateZ(50px);

        }


        section div:nth-child(6) {

            /* 下面 */

            transform: rotateX(-90deg) translateZ(50px);

        }


        section:hover div:nth-child(7) {

            /* 正面 */

            transform: translateZ(200px);

        }


        section:hover div:nth-child(8) {

            /* 背面 */

            transform: rotateX(180deg) translateZ(200px);

        }


        section:hover div:nth-child(9) {

            /* 右面 */

            transform: rotateY(90deg) translateZ(200px);

        }


        section:hover div:nth-child(10) {

            /* 左面 */

            transform: rotateY(270deg) translateZ(200px);

        }


        section:hover div:nth-child(11) {

            /* 上面 */

            transform: rotateX(90deg) translateZ(200px);

        }


        section:hover div:nth-child(12) {

            /* 下面 */

            transform: rotateX(-90deg) translateZ(200px);

        }


        @keyframes rotate {

            0% {

                transform: rotateX(0) rotateY(0);

            }

            100% {

                transform: rotateX(360deg) rotateY(360deg);

            }

        }

</style>

</head>

<body>

<!-- <audio src="Lin-G - 설빙마을.mp3" controls autoplay loop></audio> -->

<section>

<div>./img/屏幕截图(18).png"alt=""></div>

<div>1.gif"alt=""></div>

<div>1.gif"alt=""></div>

<div>1.gif"alt=""></div>

<div>1.gif"alt=""></div>

<div>1.gif"alt=""></div>

<div>1.gif"alt=""></div>

<div>1.gif"alt=""></div>

<div>1.gif"alt=""></div>

<div>1.gif"alt=""></div>

<div>1.gif"alt=""></div>

<div>1.gif"alt=""></div>

</section>

</body>

</html>

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容