Jump to content
Search Community

Problem with gsap.context() and revert

misticvm test
Moderator Tag

Go to solution Solved by Rodrigo,

Recommended Posts

Hi,

 

You have an odd setup IMHO. Why you have a useEffect listening for a change in a ref when you could just create a method and call it from the onComplete callback. Also right now you're toggling the isTweening value twice, when you animate the texts and when you animate the slides. 

 

I think this is a far better approach that uses GSAP Context correctly in order to properly cleanup all your GSAP instances in case the component is unmounted:

https://codesandbox.io/s/withered-cookies-oe6smp?file=/src/App.js

 

Hopefully this helps.

Happy Tweening!

  • Thanks 1
Link to comment
Share on other sites

  • Solution

Hi,

 

Yeah for some reason codesandbox is being weird, it wouldn't be the first time 🤷‍♂️

 

Instead of finding a way to make the sandbox link work I ported the example to Stackblitz:

https://stackblitz.com/edit/stackblitz-starters-91fcze?description=A create-react-app project based on react and react-dom&file=src%2FApp.js&title=React Starter

 

I recommend you that for future questions just use Stackblitz, far more stable and less troubles than in codesandbox.

 

Happy Tweening!

  • Thanks 1
Link to comment
Share on other sites

12 hours ago, Rodrigo said:

I recommend you that for future questions just use Stackblitz, far more stable and less troubles than in codesandbox.

Ok, i get it. I´ll use it the next time. I appreciate the help. i will take a look to the code. 

Thank you very much.

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...