Jump to content
Search Community

how to make a image follow my cursor.

nahueldev23 test
Moderator Tag

Recommended Posts

Hi,

 

You're setting the position of the image to absolute when the mouse enters and the X and Y positions you apply on the element are based on that initial position. Is better to not change that and consider the difference between the mouse position when it enters the element and the initial position of the image.

 

Here is a live example:

https://codesandbox.io/s/multiple-image-mouse-follow-in-parph-forked-hk9211?file=/src/TextWithImage.js

 

Hopefully this is enough to get you started.

 

Happy Tweening!

  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...