Jump to content
GreenSock

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

Can you hook up the TweenMax animation tick to an outside timer?

Recommended Posts

I'm working on integrating TweenMax into a Scaleform project and I need to change TweenMax so that it ticks based on the game timer passed in from C++. How would I go about setting something like this up?

 

I implemented something similar to this in GTween by changing staticInit() to take in a MovieClip that the ticker shape gets added to, which also contains the game timer variable that is used in staticTick() instead of calling getTimer(). So far the only similarity in TweenMax is that it has a ticker:Shape, but I can't figure out what to do with it.

Link to comment
Share on other sites

Don't you love it when you spend all this time writing up a question and then immediately solve it? :)

 

Managed to solve this by adding a new static variable to the Animation class, public static var getTimerOverride:Function = null;. When this function is not null, everywhere that getTimer() is called is replaced by a call to getTimerOverride(). Then during initialization I just apply a custom function to get the game timer provided from C++ and then it's good to go.

 

Simple enough.

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