欢迎光临散文网 会员登陆 & 注册

【HTML+CSS】3d旋转相册

2023-02-16 11:15 作者:昌航小葉さん  | 我要投稿

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>Document</title>

    <style>

        *{

            padding: 0;

            margin: 0;

            box-sizing: border-box;

       

        }

        body{

            background-color: pink;

            perspective: 1600px;

           

        }

        @keyframes xuanzhuan{

            0%{

                transform: rotateY(0);

            }

            100%{

                transform: rotateY(360deg);

            }


        }

        section{

            position: relative;

            width: 360px;

            height: 360px;

            transform-style: preserve-3d;

            margin: 150px auto;

            background-attachment: fixed;

            background-position: center center;

            animation:  xuanzhuan 9s linear infinite;

            background-size: cover;background-image: url(tp4.jpg);

        }

        section:hover{

            animation-play-state: paused;

        }

        section .tp1{

            position: absolute;

            top: 0;

            left: 0;

            width: 100%;

            height: 100%;

            background-attachment: fixed;

            background-position: center center;

            background-size: cover;

            background-image: url(tp1.jpg);

        }

        section .tp2{

            position: absolute;

            top: 0;

            left: 0;

            width: 100%;

            height: 100%;

            background-attachment: fixed;

            background-position: center center;

            background-size: cover;background-image: url(tp2.jpg);

        }

        section .tp3{

            position: absolute;

            top: 0;

            left: 0;

            width: 100%;

            height: 100%;

            background-attachment: fixed;

            background-position: center center;

            background-size: cover;background-image: url(tp3.jpg);

        }

        section .tp4{

            position: absolute;

            top: 0;

            left: 0;

            width: 100%;

            height: 100%;

            background-attachment: fixed;

            background-position: center center;

            background-size: cover;background-image: url(1.gif);

        }

        section .tp5{

            position: absolute;

            top: 0;

            left: 0;

            width: 100%;

            height: 100%;

            background-attachment: fixed;

            background-position: center center;

            background-size: cover;background-image: url(2.gif);

        }

        section .tp6{

            position: absolute;

            top: 0;

            left: 0;

            width: 100%;

            height: 100%;

            background-attachment: fixed;

            background-position: center center;

            background-size: cover;background-image: url(3.gif);

        }

        section div:nth-child(1){

            transform: rotateY(60deg) translateZ(350px);

        }

        section div:nth-child(2){

            transform: rotateY(120deg) translateZ(350px);

        }

        section div:nth-child(3){

            transform: rotateY(180deg) translateZ(350px);

        }

        section div:nth-child(4){

            transform: rotateY(240deg) translateZ(350px);

        }

        section div:nth-child(5){

            transform: rotateY(300deg) translateZ(350px);

        }

        section div:nth-child(6){

            transform: rotateY(360deg) translateZ(350px);

        }


       

     

    </style>

</head>

<body>

    <section>

        <div class="tp1"></div>

        <div class="tp2"></div>

        <div class="tp3"></div>

        <div class="tp4"></div>

        <div class="tp5"></div>

        <div class="tp6"></div>

    </section>

</body>

</html>

感谢支持!!!

你的三连就是对我创作的最大激励!!

因录制时出现了一点小差错可能会影响观看体验 望理解

素材来源:百度图片搜索


【HTML+CSS】3d旋转相册的评论 (共 条)

分享到微博请遵守国家法律