Mark Xie Mark Xie - 9 months ago 51
Javascript Question

How to create an animation like the link below using canvas?

I am curious about how to create a canvas effect like the link below
(There is an animation that follows the cursor.)

Answer Source

I used that on my portfolio page about a year and a half back I guess. The link is: You can check the source, nothing is minified. Basically, the idea is to create many translucent circles on the page at random positions.

At every iteration of a draw method, move those circles some distance with respect to their original position(not the updated position). Draw lines on every circle to its 2-3 nearest neighbours. Done!