var canvas, ctx, birds, tot, radius; tot=50; birds=[]; radius=140; function Bird(n){ this.pos={ x:Math.random()*canvas.width, y:Math.random()*canvas.height }; this.acc={ x:Math.random()*4-2, y:Math.random()*4-2 }; this.color='rgb('+((Math.random() * 127 + 128) | 0)+', '+((Math.random() * 127 + 128) | 0)+', '+((Math.random() * 127 + 128) | 0)+')'; } Bird.prototype.connect=function(){ for(var j=0; jcanvas.width&&this.acc.x>0)) this.acc.x*=-1; if((this.pos.y<0&&this.acc.y<0)||(this.pos.y>canvas.height&&this.acc.y>0)) this.acc.y*=-1 }; function reset(){ canvas=document.getElementById('animation'); canvas.width=window.innerWidth; canvas.height=window.innerHeight; ctx=canvas.getContext('2d'); ctx.strokeStyle='gray'; } function createBirds(){ for(var i=0; i