Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
ccutler

TweenMax.globalTimeScale

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

I am currently porting over a flash project that utilizes the globalTimeScale property of TweenMax and it appears that globalTimeScale is not available in the JS version.

 

Do you have any suggestions for a workaround? (Unfortunately I cannot use an instance in this scenario, I need to be able to affect ALL tweens).

 

Thanks,

-Chris

Link to comment
Share on other sites

That was deprecated in favor of using the newer (and in my opinion, more flexible) TimelineLite.exportRoot(). The nice thing about that is it allows you to control all of the existing tweens as a whole without necessarily affecting future tweens that get created. For example, imagine you've got a bunch of things animating in a game and then you want to open a modal window that animates on and slows everything else to 1/10th the normal speed. You wouldn't want your tweens of the modal window to be affected - you'd just want all the other stuff to be affected. So you can do:

var tl = TimelineLite.exportRoot();
TweenLite.to(tl, 1, {timeScale:0.1});

And then when you're ready, you can tween timeScale back to 1 and things will play as they normally did. 

Link to comment
Share on other sites

Hey Jack,

Thanks for your reply. Unfortunately that won't work for my scenario.

I need to be able to affect ALL tweens at all times, even those created in the future.

 

Is there currently a way to do this? We were fairly reliant on the globalTimeScale functionality.

 

Can I suggest a reimplementation of this feature?

 

I can go and recreate the functionality, but I would rather not maintain my own version of your library ;)

 

If I do need to recreate this on my own - do you have any pointers as to how to go about the best way to implement this?

 

Thanks,

-Chris

Link to comment
Share on other sites

I can see how in some rare situations, TweenMax.globalTimeScale() could be more useful than TimelineLite.exportRoot(). Just keep in mind that if you mess with the globalTimeScale, it also affects delayedCalls. 

 

I've attached a preview of the upcoming 1.10.2 release, and it's got TweenMax.globalTimeScale() in there. Would you mind giving it a shot and letting me know if it works well for you? 

1.10.2_preview3.zip

  • Like 2
Link to comment
Share on other sites

Thanks! You rock! I am going to download and test shortly. I will report back with the results in a bit.

 

(Thanks for the warning - having the delayedCalls affected is also expected behavior)

Link to comment
Share on other sites

This seems to work great! Thanks again!

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.
×