码迷,mamicode.com
首页 > 其他好文 > 详细

上升的方块动态背景

时间:2017-06-14 16:09:43      阅读:91      评论:0      收藏:0      [点我收藏+]

标签:height   class   blog   length   round   box   orm   lin   idt   

技术分享

 

 

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Glunefish</title>
    <link rel="stylesheet" href="css/style.css">
   <style>
        
* {
        margin: 0; padding: 0; border: none; outline: 0; 
    }
    body{
        width: 100vw;
        height: 100vh;
        background: url(img/bg.png) no-repeat;
        background-size: cover;
    }
    #F-dynamicbg-box {
        width: 100vw;
        height: 100vh;
        position: absolute;
        top: 0;
        left: 0;
        overflow: hidden;
    }
    #F-dynamicbg-box > div {
        z-index: -9999;
        background-color: rgba(255,255,255,.1);
        position: absolute;
        top: 105vh;
        animation: dynamicDiv 30s linear infinite;
    }
    #F-dynamicbg-box > div:nth-of-type(1) { animation-delay: 1s }
    #F-dynamicbg-box > div:nth-of-type(2) { animation-delay: 3s }
    #F-dynamicbg-box > div:nth-of-type(3) { animation-delay: 6s }
    #F-dynamicbg-box > div:nth-of-type(4) { animation-delay: 9s }
    #F-dynamicbg-box > div:nth-of-type(5) { animation-delay: 12s }
    #F-dynamicbg-box > div:nth-of-type(6) { animation-delay: 4s }
    #F-dynamicbg-box > div:nth-of-type(7) { animation-delay: 15s }
    #F-dynamicbg-box > div:nth-of-type(8) { animation-delay: 18s }
    #F-dynamicbg-box > div:nth-of-type(9) { animation-delay: 20s }
    #F-dynamicbg-box > div:nth-of-type(10) { animation-delay: 16s }


    @keyframes dynamicDiv {
        form { top: 105vh; transform: scale(1.2); }
        to { top: -13vh; transform: scale(1) rotate(60deg); }
    }

 

   


  </style></head>
<body>
    <div id="F-dynamicbg-box">
        <div></div>
        <div></div>
        <div></div>
        <div></div>
        <div></div>
        <div></div>
        <div></div>
        <div></div>
        <div></div>
        <div></div>
    </div>
</body>
<script>
   
 var box = document.getElementById(‘F-dynamicbg-box‘),
            div = box.getElementsByTagName(‘div‘),
            math = [0,1];for (var i=0;i<div.length;i++) {
                math[1] = F_getSJS(100,40,9)                   
                if(math[1] != math[2]){
                    div[i].style.width = math[1] + ‘px‘;
                    div[i].style.height = math[1] + ‘px‘;
                    math[2] = math[1];
                }
            }

            for(var i=0;i<div.length;i++){
                div[i].style.left = F_getSJS(85,15,8) + ‘vw‘;
                div[i].style.transform = ‘rotate(‘ + F_getSJS(360,5,9) + ‘deg)‘;
            }
   


</script </html>
 

上升的方块动态背景

标签:height   class   blog   length   round   box   orm   lin   idt   

原文地址:http://www.cnblogs.com/li-123/p/7008858.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!