Full version: jsB@nk » Multimedia » Events » Simple Falling Snow
URL: https://www.javascriptbank.com/simple-falling-snow.html
This is a smple script to create the falling snow effect on your web pages.
Full version: jsB@nk » Multimedia » Events » Simple Falling Snow
URL: https://www.javascriptbank.com/simple-falling-snow.html
<script>var snowCount=650/5;var speed = new Array(snowCount);var iterateNumber=0;function fillSpeed(){ for (var i=0;i<snowCount;i++) { speed[i]=Math.round(Math.random()*3);// document.write(speed[i] + "<BR>"); }}function GenerateDocument(){ var Lcalc=0;var Tcalc=0; for (var i=0;i<snowCount;i++) { Lcalc=(document.body.clientWidth/2 - 650/2) + (i*5); Tcalc=2 var Text ="<DIV style='width:1;height:1;font-size:1px;color:black;display:none;z-index:1;position:absolute;background:white;left:" + Lcalc + ";top:" +Tcalc + "'></DIV>"; document.all.newYearBlock.innerHTML=document.all.newYearBlock.innerHTML+Text; } }function displaySnow(){ for (var i=1;i<document.all.tags("DIV").length;i++) { document.all.tags("DIV")[i].style.display="block"; }} function FallingSnow() { for (var i=1;i<document.all.tags("DIV").length;i++) { if (speed[i]==Math.round(Math.random()*3)) document.all.tags("DIV")[i].style.posTop= 3+ document.all.tags("DIV")[i].style.posTop;if (document.all.tags("DIV")[i].style.posTop>130) document.all.tags("DIV")[i].style.posTop=Math.round(Math.random()*50);} iterateNumber++; } function Init() { fillSpeed(); GenerateDocument(); displaySnow(); window.tm=setInterval("FallingSnow();",1); }</script><!-- This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->
<body onload="Init();" bgcolor="black" text=white><div id="newYearBlock"></div></body><!-- This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->