Jump to content
Search Community

How do I kill a timeline correctly?

agamemnus test
Moderator Tag

Go to solution Solved by Diaco,

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

So I have...:
var timeline = new TimelineLite ()

Then timeline.from a few times, and timeline.fromTo once, and timeline.to once. Each one has {onUpdate: onUpdate ..}.

In the onUpdate, I run TweenMax.killTweensOf(timeline) if certain conditions are met. I logged it and it's run hundreds of times, but the timeline keeps going.

What's up with that? Anything obvious I missed?

 

(I'd rather not post my code...)

Link to comment
Share on other sites

It's tough to say without seeing your code or a simplified example, but I suspect you might be misunderstanding what killTweensOf() does. It allows you to kill the tweens of a particular target, but it looks like you're passing it an instance of a TimelineLite and expecting it to kill() the instance itself. What you're doing would kill tweens of that timeline (literally, like if you were tweening its timeScale with another tween or something). I bet you meant to do this:

timeline.kill();

Right?

 

(that's a long-winded way of saying exactly what Diaco.AW said) :)

  • Like 3
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...