JS1K

#2: the original

Source for demo by Lars Rönnbäck. See also description.

eval("F=.95;D=40;K=2e-5;T=255;A=Math.abs;P=2*Math.PI;C=document.body.children[0];C.width=C.height=W=H=600;X=Y=300;N=[I=0];N[n=1]={x:X,y:Y_7M=[0];onkeydown_0N[i=++n]={x:X,y:Y_7_8j=n;k=N[j];j--)if(!k.m&&!M[j]){N[++n]={x:(X-k.x)/2,y:(Y-k.y)/2_7M[n]=[i,j]_1down_0i=G.getImageData(X,Y,1,1).data[2];if(k=N[I=_4?0:i]){k.m=!k.m;k.v=k.w=0_1move_0X_5X;Y_5Y;if(k=N[I]){k.x=X;k.y=Y;k.m=0_1up_0I=0};G=C.getContext('2d');setInterval(Q_0with(G){stroke_6_9a(80,80,80,.4)';fill_6_8i=n;k=N[i];i--)with(k){if(m&&i!=I){_8j=n;o=N[j];j--)if((t=A_2+A_3)<2*D&&i!=j){t=t?t*t:1;v+=_2/t;w+=_3/t}if(_4)_8j=0;o=N[_4[j]];j++){t=A_2+A_3;v-=r=K*_2*t;w-=s=K*_3*t;o.v+=r;o.w+=s}x+=v*=F;y+=w*=F;x=x>W?W:x<0?0:x;y=y>H?H:y<0?0:y}beginPath();if(_4){o=N[_4[0]];p=N[_4[1]];moveTo(o.x,o.y);quadraticCurveTo(x,y,p.x,p.y)}else{arc(x,y,D/3,0,P,0);_9('+!m*T+','+m*T+','+i+')';fill()}stroke()}}},9)".replace(/_(.)/g,function(m,i){return"=function(e){_}};C.onmouse_(x-o.x)_(y-o.y)_M[i]_=e.client_Rect(0,0,W,H);_,v:0,w:0,m:1};_for(_fillStyle='rgb".split("_")[i]}))