<script type="text/javascript"> // <![CDATA[ var speed=33; // kelajuan snow jatuh,, nombor lebih kecil lebih laju var flakes=100; //bilangan snow var colour="#96c"; //warna snow var slush=20; //tinggi snow yang terbentuk di bawah blog /***************************\ * Let It Snow Effect * *(c)2004-11 mf2fm web-design* * http://www.mf2fm.com/rv * *nak lebih tutorial http://syahminaahmad.blogspot.com * * DON'T EDIT BELOW THIS BOX * \***************************/ var flks=new Array(); var flkx=new Array(); var flky=new Array(); var fldy=new Array(); var slss=new Array(); var slsh=new Array(); var swide, shigh, boddie; window.onload=function() { if (document.getElementById) { boddie=document.createElement("div"); boddie.style.position="fixed"; boddie.style.top="0px"; boddie.style.left="0px"; boddie.style.width="1px"; boddie.style.height="1px"; boddie.style.overflow="visible"; boddie.style.backgroundColor="transparent"; document.body.appendChild(boddie); set_width(); for (var i=0; i<flakes; i++) { flks[i]=createDiv(3, 3, colour); flkx[i]=3*Math.floor(Math.random()*swide/3); flky[i]=Math.floor(Math.random()*shigh); fldy[i]=2+Math.floor(Math.random()*4); flks[i].style.left=flkx[i]+"px"; flks[i].style.top=flky[i]+"px"; boddie.appendChild(flks[i]); } setInterval("let_it_snow()", speed); }} function createDiv(height, width, colour) { var div=document.createElement("div"); div.style.position="absolute"; div.style.height=height+"px"; div.style.width=width+"px"; div.style.overflow="hidden"; div.style.backgroundColor=colour; return (div); } window.onresize=set_width; function set_width() { var sw_min=999999; var sh_min=999999; if (document.documentElement && document.documentElement.clientWidth) { if (document.documentElement.clientWidth>0) sw_min=document.documentElement.clientWidth; if (document.documentElement.clientHeight>0) sh_min=document.documentElement.clientHeight; } if (typeof(self.innerWidth)!="undefined" && self.innerWidth) { if (self.innerWidth>0 && self.innerWidth<sw_min) sw_min=self.innerWidth; if (self.innerHeight>0 && self.innerHeight<sh_min) sh_min=self.innerHeight; } if (document.body.clientWidth) { if (document.body.clientWidth>0 && document.body.clientWidth<sw_min) sw_min=document.body.clientWidth; if (document.body.clientHeight>0 && document.body.clientHeight<sh_min) sh_min=document.body.clientHeight; } if (sw_min==999999 || sh_min==999999) { sw_min=800; sh_min=600; } swide=sw_min-3; shigh=sh_min; if (slush) { if (swide/3>slss.length) for (i=slss.length; i<swide/3; i++) { if (!slsh[i]) slsh[i]=3; slss[i]=createDiv(slsh[i], 3, colour); boddie.appendChild(slss[i]); } for (i=0; i<swide/3; i++) { slss[i].style.height=slsh[i]+"px"; slss[i].style.top=shigh-slsh[i]+"px"; slss[i].style.left=3*i+"px"; } if (i<slss.length && slss[i].style.left!="-3px") for (; i<slss.length; i++) slss[i].style.left="-3px"; } } function let_it_snow(c) { var i, x, o=0, z=0; for (i=0; i<flakes; i++) { flky[i]+=fldy[i]; x=Math.floor(flkx[i]/3); if (slush) { o+=slsh[x]; if (flky[i]>=shigh-slsh[x]) { if (x<swide && slsh[x]>slsh[x+1]+3) x++; else if (x>0 && slsh[x]>slsh[x-1]+3) x--; slss[x].style.top=shigh-(slsh[x]+=3)+"px"; slss[x].style.height=slsh[x]+"px"; flky[i]=shigh; } } if (flky[i]>=shigh || flkx[i]>swide) { flky[i]=0; fldy[i]=2+Math.floor(Math.random()*4); flkx[i]=3*Math.floor(Math.random()*swide/3); flks[i].style.left=flkx[i]+"px"; z++; } flks[i].style.top=flky[i]+"px"; } if (o>flakes*slush) for (i=0; i<slsh.length; i++) if (slsh[i]>3) slsh[i]--; if (z || o>flakes*slush) set_width(); } // ]]> </script>
Friday, 20 April 2012
::TUTORIAL Buat Effect Snow Pada Blog::
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment