Share Posted October 12, 2020 Hello, looking at the api, the only kill function requires me to know which tween I wish to kill: https://greensock.com/docs/v3/GSAP/gsap.killTweensOf() However, I have single page app and if a user were to click around before an animation is completed the animation continues (which doesn't make sense to the user). I would like to kill all running animations on any new view the user selects, without having to hard cord (and know in advance) every single possible set of animations I would need to kill. Is there anyway to do this? This site is for demo purposes / prototyping only internally to our company so I'm focused on whatever is easiest as possible to not get random animations running as a user clicks through. Any suggestions are appreciated both in quick fixes or programmatic paradigms! Link to comment Share on other sites More sharing options...
Share Posted October 12, 2020 Hey Ron. You can use .killTweensOf() to do that. Just pass in "*" as the target to select all DOM elements. Or a more scoped selector if you only want to kill the ones under a given section. 3 Link to comment Share on other sites More sharing options...
Share Posted October 12, 2020 The only problem with the "*" solution is that'll only kill tweens of elements that can currently be found in the DOM, so if you truly want to kill all tweens I'd do something like this: gsap.globalTimeline.getChildren().forEach(t => t.kill()); 3 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