This code is forked from my other particle-simulation "3d under the carpet" ( http://jsdo.it/tmake/1IRf
It implements the basic math to simulate the behaviour of a Swarm.
How to play
See the box for information about the controls.
Double click to throw food into the basin and see how the swarm swims towards it as it passes.