图片立体旋转特效

综合前面学习的3d旋转制作技巧写的第一个简单的图片旋转特效,源码

<html>
    <head>

        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width,inital-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=7">
        <title>小朋友的日常</title>
        <style>
            body{
                background-color: black;
            }
            .wrap{
                width:230px;    /*div区域宽度 是 250 像素*/
                height:300px;      
                margin: 200px auto;  /*可以让div居中*/
                position: relative;  /*相对定位*/
                transform-style: preserve-3d; /*3d样式*/
                transform: rotateX(-12deg);
                animation:xpy 20s infinite;  /*注意名称要与下面的@keyframes中的xpy一致,infinite表示一直旋转*/
                animation-timing-function: linear;/*匀速*/
            }
            .p{          /*定义p的位置*/
                position: absolute;   /*绝对定位的位置,指下面时绝对位置*/
                left: 0;
                right: 0;
                width: 100%;
                height:100%;
            }
            .p:nth-child(1){
                transform:rotateY(0deg) translateZ(275px);/*Y轴上旋转零度,Z轴上移动275*/
            }
            .p:nth-child(2){
                transform:rotateY(45deg) translateZ(275px);
            }
            .p:nth-child(3){
                transform:rotateY(90deg) translateZ(275px);
            }
            .p:nth-child(4){
                transform:rotateY(135deg) translateZ(275px);
            }
            .p:nth-child(5){
                transform:rotateY(180deg) translateZ(275px);
            }
            .p:nth-child(6){
                transform:rotateY(225deg) translateZ(275px);
            }
            .p:nth-child(7){
                transform:rotateY(270deg) translateZ(275px);
            }
            .p:nth-child(8){
                transform:rotateY(315deg) translateZ(275px);
            }
            @keyframes xpy{  /*定义一个动画效果为:xpy,使 div 元素匀速向下移动*/
                from{
                    transform: rotateX(-12deg) rotateY(0deg);
                }
                to{
                    transform: rotateX(-12deg) rotateY(360deg);
                }
            }
        </style>
    </head>
    <body>
        <div class="wrap">

            <div class="p">
                <img src="E:\photos\1.jpg" width="230" height="300">
            </div>
            <div class="p">
                <img src="E:\photos\2.jpg" width="230" height="300">
            </div>
            <div class="p">
                <img src="E:\photos\3.jpg" width="230" height="300">
            </div>
            <div class="p">
                <img src="E:\photos\4.jpg" width="230" height="300">
            </div>
            <div class="p">
                <img src="E:\photos\5.jpg" width="230" height="300">
            </div>
            <div class="p">
                <img src="E:\photos\6.jpg" width="230" height="300">
            </div>
            <div class="p">
                <img src="E:\photos\xmc2.jpg" width="230" height="300">
            </div>
            <div class="p">
                <img src="E:\photos\xmc3.jpg" width="230" height="300">
            </div>
        </div>
    </body>
</html>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值