let c=init("canvas"),w=canvas.width=window.innerWidth,h=canvas.height=window.innerHeight;class firefly{constructor(){this.x=Math.random()*w,this.y=Math.random()*h,this.s=2*Math.random(),this.ang=2*Math.random()*Math.PI,this.v=this.s*this.s/4}move(){this.x+=this.v*Math.cos(this.ang),this.y+=this.v*Math.sin(this.ang),this.ang+=20*Math.random()*Math.PI/180-10*Math.PI/180}show(){c.beginPath(),c.arc(this.x,this.y,this.s,0,2*Math.PI),c.fillStyle="#fddba3",c.fill()}}let f=[];function draw(){if(f.length<100)for(let b=0;b<10;b++)f.push(new firefly);for(let a=0;a<f.length;a++)f[a].move(),f[a].show(),(f[a].x<0||f[a].x>w||f[a].y<0||f[a].y>h)&&f.splice(a,1)}let mouse={},last_mouse={};function init(d){let a=document.getElementById(d),b=a.getContext("2d"),e=a.width=window.innerWidth,g=a.height=window.innerHeight;return b.fillStyle="rgba(30,30,30,1)",b.fillRect(0,0,e,g),b}function loop(){window.requestAnimFrame(loop),c.clearRect(0,0,w,h),draw()}canvas.addEventListener("mousemove",function(a){last_mouse.x=mouse.x,last_mouse.y=mouse.y,mouse.x=a.pageX-this.offsetLeft,mouse.y=a.pageY-this.offsetTop},!1),window.requestAnimFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){window.setTimeout(a)}},window.addEventListener("resize",function(){w=canvas.width=window.innerWidth,h=canvas.height=window.innerHeight,loop()}),loop(),setInterval(loop,1e3/60)