Trynix Posted February 12, 2022 Share Posted February 12, 2022 Hi everyone!! In the attached codepen, I declare a variable before timeline animation (which starts paused anyway), and then I update the value of the variable and call the timeline with .invalidate().restart() (which in the actual implementation will trigger via a button click) hoping that the animation will run with the new value in mind, but it doesn't. Am I misunderstanding the purpose of invalidate()? How do I get the timeline to read the updated value? See the Pen KKyqbWN by mazayadigital (@mazayadigital) on CodePen Link to comment Share on other sites More sharing options...
akapowl Posted February 12, 2022 Share Posted February 12, 2022 Hello @Trynix Try using a function-based value for the innerText // try this innerText: () => toVal // instead of this innerText: toVal See the Pen ExbXGJO by akapowl (@akapowl) on CodePen 2 Link to comment Share on other sites More sharing options...
Trynix Posted February 12, 2022 Author Share Posted February 12, 2022 1 minute ago, akapowl said: Hello @Trynix Try using a functional value for the innerText // try this innerText: () => toVal // instead of this innerText: toVal Thank you!! I'll definitely do that for now. But just to ensure my understanding and concepts are accurate, isn't invalidate() supposed to wipe all variables the timeline has read clean, so that it reads them again? Link to comment Share on other sites More sharing options...
akapowl Posted February 12, 2022 Share Posted February 12, 2022 I think it flushes recorded start and end values, but to make sure it reads new values to work with, you would have to do so by using function-based values. See the Pen dyZRaoy by akapowl (@akapowl) on CodePen 4 Link to comment Share on other sites More sharing options...
mikel Posted February 12, 2022 Share Posted February 12, 2022 Just an alternative ... See the Pen ExbXrWz by mikeK (@mikeK) on CodePen Happy tweening ... Mikel 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