Mark Xie Mark Xie - 25 days ago 7
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
http://rmp-api-server.herokuapp.com/demo/index.html
(There is an animation that follows the cursor.)

Answer

I used that on my portfolio page about a year and a half back I guess. The link is: https://codeaffair.com/portfolio/ 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!

Comments