29 karma · joined August 8, 2011
If a particle ever reaches the exact mouse coordinates, its position is randomly generated anywhere on the screen.
When rendering the particles, it simply draws a line between the previous and the new position. So when a particle is transported to a random place, it create the rays that appear around the cursor.
There's no real complexity in the maths involved, but I remember spending quite some time tweaking the random ranges to get something nice.
(the WebGL animation is part of an interactive installation)
A more clever way to code that animation would be to pass the mouse position to the GL shaders that would compute themselves the particle positions, and I think modern GPUs are very optimized for that kind of stuff.
Please don't be too rude, cause it was my first WebGL experiment.
If you want to benchmark the same page with 80000 particles, try this link : http://minimal.be/lab/fluGL/index80000.html