首页 > 网站 > WEB开发 > 正文

CSS3+JavaScript效果:胶卷式放映

2024-04-27 15:17:20
字体:
来源:转载
供稿:网友

<!DOCTYPE html>

<html>

<head lang="en">

   <meta charset="UTF-8">

   <title>胶卷式放映</title>

   <style type="text/CSS" id="style1">

       * {

           margin: 0;

           padding: 0

       }

       body{

           background: black;

       }

       #wrap {

           width: 150px;

           height: 120px;

           margin: 200px auto;

           perspective: 2000px;

       }

       #wrap ul {

           width: 100%;

           height: 100%;

            transform-style: PReserve-3d;

           animation:move 12s 3.2s infinite ;

       }

       #wrap ul li {

           top: 0;

           left: 0;

           position: absolute;

           width: 148px;

           height: 118px;

           line-height: 118px;

           text-align: center;

           font-size: 118px;

           background: grey;

           border: 1px solid #ccc;

           box-shadow: 1px 1px 3px rgba(255, 255, 255, 0.2);

           border-radius: 5px;

            overflow: hidden;

       }

       .shadow{

           width: 1200px;

           height: 1200px;

           position: absolute;

           left: 50%;

           top: 50%;

           margin-left: -600px;

           margin-top: -600px;

            background: radial-gradient(600px 600pxat center,rgba(50,50,50,0.8),rgba(0,0,0,0));

           transform: rotateX(90deg) translateZ(-150px);

       }

   </style>

</head>

<body>

<div id="wrap">

   <ul>

       <li> !</li>

       <li>群</li>

       <li>22 </li>

       <li>落</li>

       <li>部</li>

       <li>习</li>

       <li>学</li>

       <li>端</li>

       <li>前</li>

       <li>群</li>

       <li>加</li>

       <li>书</li>

       <li>子</li>

       <li>电</li>

       <li>习</li>

       <li>学</li>

       <li>端</li>

       <li>前</li>

   </ul>

   <div class="shadow"></div>

</div>

</body>

</html>

<script>

   var oLis = document.querySelectorAll("#wrap li");

   var oStyle = document.querySelector("#style1");

   var len=oLis.length;

   var aaa=null;

   for (var i = 1; i <=len; i++) {

       (function(i){

          window.setTimeout(function(){

               oStyle.innerHTML

                       += " #wrap ulli:nth-child("

                       + i

                       +"){transform:rotateY("

                       +(len-i) * (360/len)

                       + "deg)translateZ(500px);transition:0.7s;transition-delay:"

                       +(i*0.1)

                       +"s}";

          },100);

       })(i);

    }

 

   for(i=0;i<=len;i++){

       aaa+=100/len*i+"%{transform:rotateY("+-360/len*i+"deg);}"

    }

   oStyle.innerHTML+="@keyframes move {"+aaa+"}";

</script>

需要web前端课程工具和电子书,可以加: 33群105601600;  22群120342833

【内容展示有限,可以加群下载,群文件会定期更新学习资料,以及练手小案例】


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表