This is a very clever stuff: all just in 270 lines of JavaScript code. Don't just look at it, play with it! You can tear it apart! My geeky mind couldn't rest until I figured out how it is possible to do this with such short code: it uses
verlet integration.