Swarm animation with JavaScript