maoux Posted April 30 Share Posted April 30 I'd like the cursor to snap to the size of the button when I hover over it, and then return to its original size when I move away from it. See the Pen LYvoPLV by Mau-Dumapias (@Mau-Dumapias) on CodePen Link to comment Share on other sites More sharing options...
mvaneijgen Posted April 30 Share Posted April 30 What have you tried already? We love to see what you can come up with, that way we can see your thought process and thus better help you understand the tools! I would add another addEventListener to use button to check if the mouse is entering or leaving and then you could use something like https://gsap.com/docs/v3/Plugins/MotionPathPlugin/static.getRelativePosition()/ to move the element from it current position to the center one. Also check out the quickSetter() in GSAP, a much more performant way of having things animate on mouse move. https://gsap.com/docs/v3/GSAP/gsap.quickSetter()/ Hope it helps and happy tweening! 2 Link to comment Share on other sites More sharing options...
Rodrigo Posted April 30 Share Posted April 30 This demo by @GreenSock should help: See the Pen eYjNGrz by GreenSock (@GreenSock) on CodePen Happy Tweening! 1 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