Ivan Mocs Posted January 12, 2023 Share Posted January 12, 2023 position does not match the cursor position when the page is scrolled. the position of the image is even away from the cursor and not in the center of the cursor See the Pen poZPVgV by adeivan (@adeivan) on CodePen Link to comment Share on other sites More sharing options...
Solution GreenSock Posted January 12, 2023 Solution Share Posted January 12, 2023 That's because you're using event.x/y instead of event.pageX/pageY. Also, I'm not sure why you're animating EVERY image on every mousemove event. Wouldn't it be more efficient to just animate the container? I'd recommend using gsap.quickTo() for the mousemove stuff too in order to maximize performance rather than creating a whole new tween on every event: See the Pen ExpmLXB by GreenSock (@GreenSock) on CodePen Better? 1 1 Link to comment Share on other sites More sharing options...
Ivan Mocs Posted January 12, 2023 Author Share Posted January 12, 2023 ahh i see, thanks Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now