html5#3D图片旋转

直接上代码

<!doctype html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
  <meta name="Generator" content="EditPlus®">
  <meta name="Author" content="">
  <meta name="Keywords" content="关键词,关键字">
  <meta name="Description" content="描述信息">
  <title>标题</title>


  <style type="text/css">

        <!--内外边距设置为0-->

        *{margin:0;padding:0;}

         <!--设置容器定义的top大小,字体大小(font-size:),字体类型(font-family),字体颜色(color)-->

.top{width:400px;height:100px;margin:60px auto;font-size:30px;font-family:"华文行楷";color:#00ff33}

        <!--设置背景图片(background:url),-->

body{background:url("images/3.jpg");background-size:cover;}
        <!--设置容器大小,( perspective 属性定义 3D 元素距视图的距离),-->

.box{width:310px;height:310px;margin:auto;perspective:800px;}

        <!--设置3d视图时间-->

.pic{position:relative;transform-style:preserve-3d;/*3d*/animation: play 10s linear infinite;}

        <!--去掉ul中li的·号,绝对定位(position:absolute;)-->

.box ul li{list-style:none;position:absolute;top:0;left:0;}

       <!--设置旋转方向-->
@keyframes play{
from{transform:rotateY(0deg);}
to{transform:rotateY(360deg);}
}
   </style>
 </head>
 <body>
<!--div盒子 容器层-->
<div class="top"><marquee behavior=alternate>时光不老我们不散</marquee></div>


<div class="box">
<div class="pic">
<ul>
<!--图片标签四要素-->
<li> <img src="images/1.png" height="" width="" alt="描述"/></li>
<li> <img src="images/2.png" height="" width="" alt="描述"/></li>
<li> <img src="images/3.png" height="" width="" alt="描述"/></li>
<li> <img src="images/4.png" height="" width="" alt="描述"/></li>
<li> <img src="images/5.png" height="" width="" alt="描述"/></li>
<li> <img src="images/6.png" height="" width="" alt="描述"/></li>
</ul>

</div>
</div>


<!--引用jq官方类库-->
<script src="js/jquery-1.11.1.min.js"></script>
<script>
//拿到每一个li

$(".pic ul li").each(function(i){

                    //根据y轴旋转

var deg = 360/$(".pic ul li").size();
$(this).css({"transform":"rotateY("+deg*i+"deg)translateZ(216px)"
})
});



</script>
 </body>
</html>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值