JS1K

#2: the original

Source for demo by Derek Hammer.

m=Math.random,
c=document.getElementById('c'),
n=c.getContext('2d'),
r=function(x,y,s){n.fillStyle="#eeeeee";n.beginPath();n.arc(x,y,s==null?m()*4:s,0,99);n.closePath();n.fill();},
t=c.width=c.height=500,
s=function(x,y){n.fillStyle="#111111";n.beginPath();n.arc(x,250,30+(x-150)/4,0,99);n.closePath();n.fill();},
z=function(x){t=c.width=c.width;
while(t--) r(m()*500,m()*500);
s(x, x>300);r(-55,250,300);
if(x < 500) window.setTimeout(function(){z(x+2)}, 50)},
w=function(x){r(280+x-25,250,300);window.setTimeout(
function(){
if(x > -300) {
t=c.width=c.width;
while(t--) {
r(m()*500,m()*500); 
}
w(x-5)
} else {
z(x*-1 - 150, 50);
}
}, 50)},
v=function(x,y){r(280+x-25,250,x);window.setTimeout(function(){x<300?v(x+1, y-300):w(x)}, y-300)};
while(t--) r(m()*500,m()*500)
r(280,250,25)
window.setTimeout(function(){v(25+1, 1000)}, 1000);