Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 
 
 

2 rindas
3.4 KiB

  1. (function(t,r){function d(s){s.pause=!0,s.sc.find(".snowflakes_wrapper").remove(),s.c.removeData("snowflakes")}function f(s){s.snowflakes=[];for(var n=s.w*s.h/15e5;s.snowflakes.length<s.particleMaxPer*n;)s.snowflakes.push(c(s))}function w(s){window.requestAnimationFrame(function(){if(s!=r&&s.ctx!=r&&s.destroyed!=1&&s.pause!=1){s.ctx.clearRect(0,0,2700,2500);var n=s.h/3,p=s.h/3*2,e;for(e in s.snowflakes)if(!(0>s.snowflakes[e].y+.1*s.snowflakes[e].r&&s.summer==1||s.snowflakes[e].y>s.h+s.snowflakes[e].r&&s.summer==1)){s.snowflakes[e].delta+=s.snowflakes[e].delta==Math.PI/2?-s.snowflakes[e].delta:Math.random()/500-.01,s.summer?s.snowflakes[e].y+=s.snowflakes[e].speed/50+.1*s.snowflakes[e].r:s.snowflakes[e].y+=s.snowflakes[e].speed/100+.1*s.snowflakes[e].r,s.snowflakes[e].x+=.1*Math.sin(s.snowflakes[e].delta)*s.snowflakes[e].r,s.snowflakes[e].y>s.h+s.snowflakes[e].r&&s.summer!=1&&(s.snowflakes[e]=c(s),s.snowflakes[e].y=0-s.snowflakes[e].r);var o=s.snowflakes[e].y-n,i=s.snowflakes[e].r,l=s.snowflakes[e].alpha;(0<o||s.summer==1)&&(o=1-o/p,i=s.snowflakes[e].r*o,l=s.snowflakes[e].alpha*o),i=.1>i?.1:i,l=.1>l?.1:l,s.snowflakes[e].x=s.snowflakes[e].x>s.w+s.snowflakes[e].r?0:s.snowflakes[e].x<-i?s.w:s.snowflakes[e].x,s.ctx.beginPath(),s.ctx.arc(s.snowflakes[e].x,s.snowflakes[e].y,i,2*Math.PI,!1),s.ctx.fillStyle="rgba(255,255,255,"+l+")",s.ctx.fill()}w(s)}})}function c(s){var n={};return n.delta=(s.particleSinus[0]+Math.random()*(s.particleSinus[1]-s.particleSinus[0]))*Math.round(2*Math.random()-1),n.r=s.particlaSize[0]+Math.random()*(s.particlaSize[1]-s.particlaSize[0]),n.alpha=s.particleOpacity[0]+Math.random()*(s.particleOpacity[1]-s.particleOpacity[0]),n.speed=(s.particleSpeed[0]+Math.random()*(s.particleSpeed[1]-s.particleSpeed[0]))*n.r/3,n.x=Math.random()*s.w,n.y=Math.random()*-s.h,n}t.fn.extend({letItSnow:function(s){var n={particleMaxPer:400,particlaSize:[.2,6],particleOpacity:[.3,1],particleSpeed:[30,100],particleSinus:[1,100]};return s!="destroy"&&s!="stop"&&s!="play"&&s!="summer"&&s!="winter"&&(s=t.extend(!0,{},n,s)),this.each(function(){if(t.inArray(s,["destroy","stop","play","winter","summer"])!=-1){switch(s){case"destroy":s=t(this).data("snowflakes"),s!=r&&d(s);break;case"stop":s=t(this).data("snowflakes"),s!=r&&(s.pause=!0);break;case"play":s=t(this).data("snowflakes"),s!=r&&(s.pause=!1,w(s));break;case"summer":s=t(this).data("snowflakes"),s!=r&&(s.summer=!0);break;case"winter":s=t(this).data("snowflakes"),s!=r&&(s.summer=!1)}return!1}return s.c=t(this),s.sc=s.selector!=r?t(this).find(s.selector):s.c,s.sc.length==0||s.c.data("snowflakes")!=r?!1:(s.sc.find(".snowflakes_wrapper").remove(),s.sc.append('<div class="snowflakes_wrapper" style="position:relative;z-index:0"><div class="snowflakes_wrapper_inner" style="overflow:hidden;position:relative"><canvas width="2700" height="2500" style="position:relative;" class="snowflake_canvas"></canvas></div></div>'),s.sw=s.sc.find(".snowflakes_wrapper_inner"),s.sw.data("caller_container",s.c),s.canvas=s.sc.find(".snowflake_canvas"),s.dimension!=self?s.sizer=s.c:s.sizer=s.sc,s.w=s.sizer.width(),s.h=s.sizer.height(),s.sc.find(".snowflakes_wrapper_inner").css({width:s.w,height:s.h}),s.canvas=s.canvas[0],s.snowflakes=[],s.ctx=s.canvas.getContext("2d"),f(s),w(s),s.c.data("snowflakes",s),void t(window).resize(function(){clearTimeout(s.timer),s.timer=setTimeout(function(){s.w=s.sizer.width(),s.h=s.sizer.height(),s.sc.find(".snowflakes_wrapper_inner").css({width:s.w,height:s.h}),f(s)},50)}))})}})})(jQuery);