|
|
+!function(t){var n,e,r,a,o,i,d,h,s,v,c,f,l,m,x,u,y,M=(e="snow",r="width:100%;height:100%;position:fixed; \t\t\ttop:0px;left:0px;z-index:999999;pointer-events:none; \t\t\t-moz-pointer-events:none;-webkit-pointer-events:none; \t\t\t-o-pointer-events:none; \t\t",a=25,d=i=o=255,h=.8,v=!(s=50),l=f=c=null,u=[],y=x=m=0,(n=t).addEventListener?(n.addEventListener("load",w,!1),n.addEventListener("resize",b,!1)):n.attachEvent&&(n.attachEvent("onload",w),n.attachEvent("onresize",b)),{});function p(){m=n.innerWidth,x=n.innerHeight,f.width=m,f.height=x}function g(){u=[];for(var t=0;t<s;t++)u.push({x:Math.random()*m,y:Math.random()*x,r:4*Math.random()+1,d:Math.random()*s})}function E(){l.clearRect(0,0,m,x),l.fillStyle="rgba("+o+", "+i+", "+d+", "+h+")",l.beginPath();for(var t=0;t<s;t++){var n=u[t];l.moveTo(n.x,n.y),l.arc(n.x,n.y,n.r,0,2*Math.PI,!0)}l.fill(),function(){y+=.01;for(var t=0;t<s;t++){var n=u[t];n.y+=Math.cos(y+n.d)+1+n.r/2,n.x+=2*Math.sin(y),(n.x>m+5||n.x<-5||n.y>x)&&(0<t%3?u[t]={x:Math.random()*m,y:-10,r:n.r,d:n.d}:0<Math.sin(y)?u[t]={x:-5,y:Math.random()*x,r:n.r,d:n.d}:u[t]={x:m+5,y:Math.random()*x,r:n.r,d:n.d})}}()}function w(){(c=document.getElementsByTagName("body")[0])&&(f=document.createElement("canvas"),l=f.getContext("2d"),f.setAttribute("id",e),f.setAttribute("style",r),c.insertBefore(f,c.firstChild),1)&&(p(),g(),setInterval(E,a),v=!0)}function b(){v&&(p(),g())}t.snow=M}(window);
|