amapic Posted January 23, 2023 Share Posted January 23, 2023 I made here a basic animation of a div which is following the cursor as it enters or leaves a space: https://codesandbox.io/p/sandbox/eloquent-almeida-wujeen it works quite well (not perfectly). Not to trigger the enter and the leave animation together, I made some control with isActive() and then I launch restart(). But what are actually the good practice about this subject ? See the Pen by (@) on CodePen Link to comment Share on other sites More sharing options...
Rodrigo Posted January 23, 2023 Share Posted January 23, 2023 Hi, A few things, you're not reverting your GSAP Context instance in the return of the useEffect hook, I strongly recommend using that cleanup section to revert your context and remove event listeners. I recommend you to take a look at this example so you can extract some ideas from it: https://greensock.com/react-advanced#imperative-communication Let us know if you have more questions. Happy Tweening! 1 Link to comment Share on other sites More sharing options...
amapic Posted January 24, 2023 Author Share Posted January 24, 2023 thanks for all 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