basyg

How to emulate "tween.complete(true)"?

Recommended Posts

Hello! I'm refactoring an old code. How can I reliably replace "tween.complete(true)"?

 

Also I replaced "tween.complete(false)" by

if (tween.repeat) {
  tween.repeat(0);
}
tween.totalProgress(1);

Is it right?

Share this post


Link to post
Share on other sites

Thank you for the answer!

I tested "tween.totalProgress(1)" and found "tween.repeat(0)" is redundat.

 

But "complete(skipRender:Boolean = false)" has the argument "skipRender". How to repeat the behavior of "skipRender true"?

I can't provide an example because didn't find the old js version of gsap.

I found only the ActionScript 3 source https://github.com/orta/virtualapps/blob/master/src/gs/TweenLite.as

It seems "complete(true)" completes tweens without setting tweens to a finish state.

Share this post


Link to post
Share on other sites

thanks for the additional info and link.

That version pre-dates my involvement around here by a few years.

I suspect @GreenSock can offer some better help.

Share this post


Link to post
Share on other sites

Hi @basyg. Could you explain a practical use case for this? I'm struggling to think of one. If, for example, you just want the onComplete to be called (without actually rendering the tween values at all), why not just call the onComplete yourself? Maybe if you describe your scenario better we could offer a suggestion. 

Share this post


Link to post
Share on other sites

Hello!

 

I don't know much because I'm just refactoring an old code to the latest gsap.

I think there is a need to stop/kill tweens (animation of characters) at they middle state but with firing complete handlers.

Share this post


Link to post
Share on other sites

Okay, well then I have two thoughts:

 

1) Just kill() the tween(s) and call their onComplete manually like tween.vars.onComplete();

 

2) OR you could nest the tweens in a TimelineLite/Max which has your onComplete. Then you could timeline.clear().progress(1). 

Share this post


Link to post
Share on other sites
17 hours ago, GreenSock said:

1) Just kill() the tween(s) and call their onComplete manually like tween.vars.onComplete(); 

This is work. Thank you!

Share this post


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