Source for demo by antimatter15. See also description.
var a=document.getElementById("c");document.body.setAttribute("style","margin:0;left:0;top:0;padding:0");a.width=innerWidth;a.height=innerHeight;var c=a.getContext("2d"),f=[[300,100,10,-0.2,0],[300,300,10,0.2,0]],h=-1; setInterval(function(){if(h>0)f[h][2]+=0.1;c.clearRect(0,0,innerWidth,innerHeight);for(var d=f.length,b=d,e;b--;){for(e=d;e--;)if(e!=b&&b!=h&&e!=h){var i=f[e][0]-f[b][0],j=f[e][1]-f[b][1],g=i*i+j*j,k=Math.sqrt(g);g=f[e][2]/g;f[b][3]+=i/k*g;f[b][4]+=j/k*g}f[b][0]+=f[b][3];f[b][1]+=f[b][4];c.fillStyle="hsl("+Math.min(300,Math.floor(50*Math.sqrt(f[b][3]*f[b][3]+f[b][4]*f[b][4])))+",100%,40%)";c.beginPath();c.arc(f[b][0],f[b][1],f[b][2],0,Math.PI*2,true);c.fill()}},0); document.body.onmousedown=function(d){h=f.length;f.push([d.clientX,d.clientY,2,0,0]);return false};document.body.onmouseup=function(d){f[h][3]=(d.clientX-f[h][0])/100;f[h][4]=(d.clientY-f[h][1])/100;h=-1;return false}