Jump to content
Joe Hakooz

KillTweensOf doesn't call onComplete

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!

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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

 

Thanks!

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

In this case you would just kill the timeline.

 

fancy_animate.kill();

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.