Jump to content
GreenSock

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

Using an alternative clock for tweening.

Recommended Posts

Hi

 

I am currently making a Flash animation which is like an interactive music video. In the Chrome version of Flash, there is sometimes a delay when the song starts playing, which causes the animations to run ahead of the song. In my own classes I can fix this easily, by replacing the clock function getTimer() with a function which simply checks SoundChannel.position(). This function returns in milliseconds the position in the song. Therefore, I am guaranteed that all timings are synced with the song, regardless of any browser idiosyncrasies. Is there a way to do this with my tweens to? Simply replace the clock function used for tweening? For instance, I have a pulsating tween with auto-repeat, which must be in sync with the beat.

Link to comment
Share on other sites

Hi and welcome to the GreenSock forums,

 

No, there isn't a way to tell GSAP's internal timing mechanism to use a completely different clock or anything like that. 

 

However, every tween and timeline has a play() method that you can use to force it to play from a particular time

 

To make your tween play at a time of 1.5 seconds do

myPulse.play(1.5)

or you can also set the time()

myPulse.time(1.5)

note: time() will respect the paused state. 

 

perhaps you can repeatedly force-feed the tween the time from which it should play at moderate intervals just to make sure it adjusts to the sound time should some timing failure in the flash player occur. 

 

Not entirely sure how well it will work, but its worth a try.

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