CDN Link: Include the following GSAP library in your HTML code.
- We have taken a div tag named snake which is an instance of the full snake. We have taken circle, we can take another shape by using simple CSS.
- We have created more divs to give the length of the snake. We can include more div tags to increase its length.
- e.clientX: Get the horizontal coordinate.
- e.clientY: Get the vertical coordinate.
- stagger :For delay in animation (0.05 sec), we can see the snake.
- gsap.to(“.snake”): It will track the snake with reference to pointer coordinates.
Output: Click here to see live code output
As you can see from the above output, we have created a snake that follows our mouse pointer making it look like a Snake-like effect.
My Personal Notes arrow_drop_up
Please Login to comment...