var w=c.width=window.innerWidth,h=c.height=window.innerHeight,ctx=c.getContext("2d"),count=w*h/6e3|0,speed=3,range=120,lineAlpha=.05,particles=[],huePart=360/count;for(var i=0;i<count;++i)particles.push(new Particle(huePart*i|0));function Particle(t){this.x=Math.random()*w;this.y=Math.random()*h;this.vx=(Math.random()-.5)*speed;this.vy=(Math.random()-.5)*speed;this.hue=t}Particle.prototype.update=function(){this.x+=this.vx;this.y+=this.vy;if(this.x<0||this.x>w)this.vx*=-1;if(this.y<0||this.y>h)this.vy*=-1};function checkDist(t,e,i){var h=t.x-e.x,a=t.y-e.y;return h*h+a*a<=i*i}function anim(){window.requestAnimationFrame(anim);ctx.fillStyle="rgba(255, 255, 255, .05)";ctx.fillRect(0,0,w,h);for(var t=0;t<particles.length;++t){var e=particles[t];e.update();for(var i=t+1;i<particles.length;++i){var a=particles[i];if(checkDist(e,a,range)){ctx.strokeStyle="hsla(hue, 80%, 50%, alp)".replace("hue",(e.hue+a.hue+3)/2%360).replace("alp",lineAlpha);ctx.beginPath();ctx.moveTo(e.x,e.y);ctx.lineTo(a.x,a.y);ctx.stroke()}}}}anim();