Jump to content
Search Community

Using invalidate() to have timeline re-read javascript variable - doesn't work

Trynix test
Moderator Tag

Recommended Posts

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

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

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