18.一透视perspective:500px值越小,离屏幕越近。二①3D旋转transform: rotateX/②Y(45deg)③transform: rotate3d(1,1,0,90deg)

目录

一:透视 : perspective:500px;值越小,离屏幕越近

加透视和不加透视的区别:

二:3D旋转要加透视的

①X轴45度(deg):

②Y轴45度(deg):

③Z轴45deg



一:透视 : perspective:500px;值越小,离屏幕越近

18.一透视perspective:500px值越小,离屏幕越近。二①3D旋转transform: rotateX/②Y(45deg)③transform: rotate3d(1,1,0,90deg)

加透视和不加透视的区别:

18.一透视perspective:500px值越小,离屏幕越近。二①3D旋转transform: rotateX/②Y(45deg)③transform: rotate3d(1,1,0,90deg)

 

二:3D旋转要加透视的

18.一透视perspective:500px值越小,离屏幕越近。二①3D旋转transform: rotateX/②Y(45deg)③transform: rotate3d(1,1,0,90deg)

①X轴45度(deg):

<style>
        body {
            perspective: 300px;
        }

        img {
            display: block;
            margin: 100px auto;
            transition: all 1s;
        }

        img:hover {
            transform: rotateX(45deg);
        }
    </style>
</head>

<body>
    <img src="../media/pig.jpg" alt="">
</body>

②Y轴45度(deg):

<style>
        body {
            perspective: 500px;
        }

        img {
            display: block;
            margin: 100px auto;
            transition: all 1s;
        }

        img:hover {
            transform: rotateY(45deg);
        }
    </style>
</head>

<body>
    <img src="../media/pig.jpg" alt="">
</body>

③Z轴45deg

 <style>
        body {
            perspective: 500px;
        }

        img {
            display: block;
            margin: 100px auto;
            transition: all 1s;
        }

        img:hover {
            /* transform: rotateZ(180deg); */
            /* transform: rotate3d(x,y,z,deg); */
            /* transform: rotate3d(1, 0, 0, 45deg); */
            /* transform: rotate3d(0, 1, 0, 45deg); */
            transform: rotate3d(1, 1, 0, 45deg);
        }
    </style>
</head>

<body>
    <img src="../media/pig.jpg" alt="">
</body>

上一篇:Python 调用动态链接库教程(return/指针)


下一篇:css3基础---perspective景深进阶