Jump to content
GreenSock

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

TweenMax useFrame Fixed Framerate?

Recommended Posts

Hello,

 

I'm using TweenMax in a game I'm making for scripted events. While stress testing, I noticed TweenMax tweens get ahead when the game dips below the intended 30 fps. I tried setting the tweens to use frames, thinking it would tick at the game's current fps, but it still appears to update at a fixed framerate. The only difference being the number i enter for the delay or duration.

 

Another thing I tried was setting TweenMax.globalTimeScale to the current fps divided by 30 every frame, but tweens never seem to initialize when using this method.

 

In short, my game doesn't use a fixed framerate and was wondering if TweenMax is able to do the same.

 

Thanks for your time!

Link to comment
Share on other sites

I'm a bit confused here - TweenMax was engineered specifically to ensure that timing is prioritized and I can't imagine how TweenMax tweens could "get ahead" or how setting a globalTimeScale could cause tweens not to work at all...ever (I assume that's what you meant by "never initialize"). Can you provide a reduced test case that clearly demonstrates the issue? The simpler the better please. 

 

TweenMax will update itself at whatever frame rate your swf runs at. You shouldn't need to mess with that at all. And every time it updates, it remains perfectly synchronized with the clock/time - it's not frame-based unless you set useFrames:true on your tweens (which you're welcome to do of course). It almost sounds like maybe you have your own logic that is frames-based (thus when frames get dropped, your stuff lags behind) whereas TweenMax is time-based, thus it is honoring exact timing and not slowing down when the frame rate drops. That's just a guess. 

 

To be clear, let's say you start a 1-second tween and then your swf slows down so that the next update/tick happens 0.5 seconds later...TweenMax would render that tween as if it is halfway finished. It does NOT base everything on a per-frame amount of change (well, unless you set useFrames:true). 

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