Jump to content
GreenSock

Dum

Ticker & Multiple EaselJS stages

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've got multiple stages running different animation sequences. For the most part there doesn't seem to be a performance hit for using 

onUpdate:updateStage(specificStage)

when there is only a few tweens running at a time (this still is probably overdrawing though, right?)

 

It's when I need to do a few hundred tweens concurrently that **** hits the fan with this method, so I looked into setting up TweenLite.ticker to handle the stage updates, but I don't want to update ALL of the stages if only one of them needs to be updated at a time.

 

Are there any good solutions to this? Or will I have to set up some sort of boolean flags series for which stage to update in the tick function?

Link to comment
Share on other sites

Ok so for those from google, the best solution I came up with is having multiple event listeners on ticker and remove them when necessary.

 

TweenLite.ticker.addEventListener("tick", stage1.update, stage1);
TweenLite.ticker.removeEventListener("tick", stage1.update);


TweenLite.ticker.addEventListener("tick", stage2.update, stage2);
TweenLite.ticker.removeEventListener("tick", stage2.update);
 
  • Like 1
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.
×