Share Posted January 15, 2017 See the attached code pen. On initialisation, the height and width variables will get updated to reflect the size of the box. Click play 1, and the box will increase in size to double the size of the width variable. It'll update the variable after the animation completes. Click play 2, and the box will decrease in size by halving the width variable. Again, it'll update the variable after the animation completes. Play 1 works as expected. Play 2 halves the original variable width. I get that that is expected behaviour, as when the timeline is initialised, it caches the values in the timeline object, but I thought invalidating the timeline was supposed to recheck the values that the variable references? Am I not understanding what invalidate() does correctly? And if so, is there a way to force the timeline to use the update variable value? I'd rather avoid creating the timeline within a function if I can as I'd like to keep things clean, and I'd also really like to understand what invalidate does exactly. Many thanks! See the Pen YNGqZV by anon (@anon) on CodePen Link to comment Share on other sites More sharing options...
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
Already have an account? Sign in here.Sign In Now