Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
Joe Hakooz

KillTweensOf doesn't call onComplete

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

Hello,

Not sure if this is a bug or by design. I suspect the latter of course :)

 

In the AS version, KillTweensOf has a second parameter that will call the onComplete function. Here is a thread about that... http://forums.greensock.com/topic/1932-can-a-killed-tween-still-trigger-oncomplete/

 

In the JS version, KillTweensOf does not have this parameter. I'm curious, should it be there?

 

My work around was to use KillAll which does use the onComplete param. This worked for my situation but I could see this being a problem for others.

 

Thanks!

Link to comment
Share on other sites

Hi Joe,

 

I just grabbed this off the "new features" list on http://www.greensock.com/v12

 

I think it will help de-mystify the missing complete param in v12...

 

 

 

25. The complete parameter of killTweensOf() has been removed because it created confusion when only specific properties were defined using the vars parameter. For example, if the old method was called like TweenLite.killTweensOf(myObject, true, {y:true}), was the whole tween supposed to be forced to completion or only the y property? Adding the ability to only force the y property to completion would require too much kb (file size) and it wouldn’t solve the confusion issue, so I removed the parameter altogether. If you want to force all the tweens of a particular object to completion, simply use the TweenLite.getTweensOf() to get an array of them, and loop through it and do myTween.goto( myTween.duration() ) first. The revised method works just like the old one:

 

//kills ALL tweens of myObject immediately
TweenLite.killTweensOf(myObject);

//kills only the "y" and "x" portions of any tweens of myObject
TweenLite.killTweensOf(myObject, {y:true, x:true});

  • Like 2
Link to comment
Share on other sites

Nice catch Carl. I can live with that for sure.

 

Thanks!

Link to comment
Share on other sites

And by the way, there was a typo in the post that used "goto()" but it should have said "seek()" because apparently "goto" is reserved in JavaScript so we had to switch the name. Sorry about any confusion there.

  • Like 1
Link to comment
Share on other sites

  • 3 years later...

hi. Is it possible to kill all teens of a named timeline?

 

e.g:

fancy_animate = new TimelineMax();

TweenMax.killTweensOf(fancy_animate);

 

is this valid?

 

thanks.

Link to comment
Share on other sites

In this case you would just kill the timeline.

 

fancy_animate.kill();

  • Like 1
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.
×