最新文章专题视频专题问答1问答10问答100问答1000问答2000关键字专题1关键字专题50关键字专题500关键字专题1500TAG最新视频文章推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37视频文章20视频文章30视频文章40视频文章50视频文章60 视频文章70视频文章80视频文章90视频文章100视频文章120视频文章140 视频2关键字专题关键字专题tag2tag3文章专题文章专题2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章专题3
当前位置: 首页 - 科技 - 知识百科 - 正文

怎样用CSS3和JS做出上升的方块动态背景

来源:懂视网 责编:小采 时间:2020-11-27 18:49:46
文档

怎样用CSS3和JS做出上升的方块动态背景

怎样用CSS3和JS做出上升的方块动态背景:我们知道CSS3是可以做出很多酷炫的动画的,那么如果CSS3和JS结合起来使用那该有多么强大呢?今天教大家怎样用CSS和JS制作出上升的方块的动态背景,一起来看一下。HTML:<!DOCTYPE html> <html> <head> <meta c
推荐度:
导读怎样用CSS3和JS做出上升的方块动态背景:我们知道CSS3是可以做出很多酷炫的动画的,那么如果CSS3和JS结合起来使用那该有多么强大呢?今天教大家怎样用CSS和JS制作出上升的方块的动态背景,一起来看一下。HTML:<!DOCTYPE html> <html> <head> <meta c

我们知道CSS3是可以做出很多酷炫的动画的,那么如果CSS3和JS结合起来使用那该有多么强大呢?今天教大家怎样用CSS和JS制作出上升的方块的动态背景,一起来看一下。

HTML:

<!DOCTYPE html>
<html>
 <head> 
 <meta charset="UTF-8">
 <title>Glunefish</title>
 <link rel="stylesheet" href="css/style.css">
 </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>
</html>

CSS:

* { 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); } }
JS:( JS初始化div形态 )
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) F_getSJS 请移步博客之前的取随机数了解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)'; }

所有的代码都在这里了,感兴趣的朋友可以自己动手操作一下,,更多精彩请关注Gxl网其它相关文章!

相关阅读:

HTML里的最后一行文字显示不全怎么处理

CSS网页错位怎么处理

CSS3的loading特效怎么制作

文档

怎样用CSS3和JS做出上升的方块动态背景

怎样用CSS3和JS做出上升的方块动态背景:我们知道CSS3是可以做出很多酷炫的动画的,那么如果CSS3和JS结合起来使用那该有多么强大呢?今天教大家怎样用CSS和JS制作出上升的方块的动态背景,一起来看一下。HTML:<!DOCTYPE html> <html> <head> <meta c
推荐度:
标签: 背景 动画 js
  • 热门焦点

最新推荐

猜你喜欢

热门推荐

专题
Top