4 ms·
Cool. I wonder what the governing equation for the particles is... Also, If I open developer console in Chrome (docked at the bottom), it seems the mouse posit
by amelius 12y ago
Cool. I wonder what the governing equation for the particles is...
Also, If I open developer console in Chrome (docked at the bottom), it seems the mouse position is off like 100 pixels or so.
- boblemarin 12y agoThe particles are attracted by the position of the mouse, each having a slightly different (randomized) attraction factor. 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.
- amelius 12y agoOkay, thanks for sharing. But still, I'm wondering why the orbits of the particles always end up being roughly the same size.
- corysama 12y agoHave you seen this VR demo: http://youtu.be/fAhzW4blqvM http://youtu.be/fAhzW4blqvM ? It looks similar enough that I bet it's inspired by yours. Yours is a very fun demo. I tried modifying it to move more work to the GPU. I had the CPU only update a subset of the particles each frame and the GPU would interpolate a curve to fill in the missing frame updates. It sorta worked. It was N-times faster and could do more particles. But, the interpolated curves were progressively less responsive and fun.