500字范文,内容丰富有趣,生活中的好帮手!
500字范文 > JS实现模拟风力的雪花飘落效果【javascript】

JS实现模拟风力的雪花飘落效果【javascript】

时间:2023-04-17 19:45:47

相关推荐

JS实现模拟风力的雪花飘落效果【javascript】

web前端|js教程

JS,模拟风力,雪花飘落

web前端-js教程

本文实例讲述了JS实现模拟风力的雪花飘落效果。分享给大家供大家参考。具体实现方法如下:

魅思网站源码,ubuntu安装米聊,tomcat8分配内存,家里突然爬虫变多,php对接微信支付教程学习,宁乡seo服务lzw

雪花飘啊飘* {margin:0; padding:0; vertical-align:top;}.xue{position:absolute;color:#fff;}

级风

var box = document.getElementById("box");var i= 0,c,d,wind_time;var all = 0,other = 0,wind=0;box.style.width = 1000px;document.getElementById("wind_button").onclick = function(){clearTimeout(wind_time);wind = 0;wind = parseInt(document.getElementById("wind_id").value);wind_run(wind);}function gogo(){var a = document.createElement("div");a.innerHTML = .;a.id = "xue" + i;a.className = "xue";a.style.top = parseInt(box.style.height) * (Math.random() > 0.3 ? Math.random() : 0) + px;if(wind != 0){var ss = Math.random() > Math.abs(wind*0.025) ? Math.random() : (wind > 0 ? 0 : 1) ;}else{var ss = Math.random()}a.style.left = parseInt(box.style.width) * ss + px;box.appendChild(a);godown(a.id,a.id,8*Math.random());i++;all++;var x = 100 * Math.random()* Math.random();setTimeout(gogo(),x);};function removeElement(_element){//移除标签的函数var _parentElement = _element.parentNode;if(_parentElement){_parentElement.removeChild(_element);};};function godown(a,e,speed){if(speed < 3){speed = 3}var a1 =document.getElementById(a);a1.style.top = parseInt(a1.style.top) + speed +px;if(parseInt(a1.style.top) < parseInt(box.style.height)){e = setTimeout("godown(\""+a+"\",\""+e+"\","+speed+")",20)}else{clearTimeout(e);removeElement(a1);speed=null;other++;document.getElementById(bb).innerHTML = "区域内还有"+(all-other)+"个雪花点."};};function wind_run(wind){var a = document.getElementById("box").getElementsByTagName(div);for(var i = 0;i 0.1){wind_time = setTimeout("wind_run("+wind+")",20)}else{clearTimeout(wind_time);wind = 0;};};gogo();

qq源码网,vscode补全双大括号,ubuntu 麒麟13,tomcat指定应用路径,爬虫黄勇,php 打开网址,沈阳seo优化排名哪家好,个人信息在线提交网站源码,家装门窗自适应企业官网源码模板lzw

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。