图片3D旋转

 

<!DOCTYPE html5>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>3D旋转幻灯片</title>
</head>
<style type="text/css">
    body{
        perspective:500px;
        perspective-origin:50% 30%;/*坐标基点(X,Y)*/
        background: #ff9;
        overflow: hidden;/*隐藏溢出*/
    }
    #zhuan{
        position: relative;
        width: 900px;
        height: 350px;
        margin: 150px auto;
        transform-style:preserve-3d;
        animation:xuanzhuan 9s steps(35) infinite;
    }
    @keyframes xuanzhuan{
            to{
                transform:rotateY(1080deg);
            }
        }
    #zhuan div{
        position: absolute;
        width: 100px;
        height: 111px;
        left: calc(50% - 50px);
        bottom: 50%;
        transform-origin:50% 0;

        background-repeat: no-repeat;
        transform-style:preserve-3d;
        background-size: 1200px 111px;
    }

    #zhuan div:after{
        content: "";
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        transform-origin:50% 100%;
        transform:rotateX(90deg) translateZ(-3px) translateY(-5px);
        box-shadow: inset 0px -100px 100px -100px #000;
    }

    #zhuan div:nth-child(0){
        transform:rotateY(0deg) translateZ(-300px);
        background-image: url(1.jpg);
    }
    #zhuan div:nth-child(1){
        transform:rotateY(30deg) translateZ(-300px);
        background-image: url(1.jpg);
    }
    #zhuan div:nth-child(2){
        transform:rotateY(60deg) translateZ(-300px);
        background-image: url(1.jpg);
    }
    #zhuan div:nth-child(3){
        transform:rotateY(90deg) translateZ(-300px);
        background-image: url(1.jpg);
    }
    #zhuan div:nth-child(4){
        transform:rotateY(120deg) translateZ(-300px);
        background-image: url(1.jpg);
    }
    #zhuan div:nth-child(5){
        transform:rotateY(150deg) translateZ(-300px);
        background-image: url(1.jpg);
    }

    #zhuan div:nth-child(6){
        transform:rotateY(180deg) translateZ(-300px);
        background-image: url(1.jpg);
    }
    #zhuan div:nth-child(7){
        transform:rotateY(210deg) translateZ(-300px);
        background-image: url(1.jpg);
    }
    #zhuan div:nth-child(8){
        transform:rotateY(240deg) translateZ(-300px);
        background-image: url(1.jpg);
    }
    #zhuan div:nth-child(9){
        transform:rotateY(270deg) translateZ(-300px);
        background-image: url(1.jpg);
    }
    #zhuan div:nth-child(10){
        transform:rotateY(300deg) translateZ(-300px);
        background-image: url(1.jpg);
    }
    #zhuan div:nth-child(11){
        transform:rotateY(330deg) translateZ(-300px);
        background-image: url(1.jpg);
    }
    #zhuan div:nth-child(12){
        transform:rotateY(360deg) translateZ(-300px);
        background-image: url(1.jpg);
    }
</style>
<body>
    <div id="zhuan">
        <div></div>
        <div></div>
        <div></div>
        <div></div>
        <div></div>
        <div></div>

        <div></div>
        <div></div>
        <div></div>
        <div></div>
        <div></div>
        <div></div>
    </div>
</body>
</html>

 

你可能感兴趣的:(图片3D旋转)