Jump to content

Tween callback taking forever to be called


tokumaru
 Share

Recommended Posts

Hey, guys! The other day I was making a bunch of animations using tweens and noticed how inconsistent the timing was regarding the onComplete callback... Sometimes it'd take over a second after the tween was visually finished for the callback function to be called, sometimes it'd happen right away, but it was generally very inconsistent.

Is there any reason for this? Is there anything I can do to make tweens more reliable?

My overall experience with tweens in Phaser has been a little frustrating so far... Reusing a tween has proven to be nearly impossible due to the timing inconsistencies, so I've been mostly creating new tweens whenever necessary, but I'm also not sure how to dispose of them properly when they're done so I don't end up with thousands of tween instances in memory.

How do you guys usually work with tweens in Phaser?

Link to comment
Share on other sites

That sounds unusual.

Make sure you're not targeting the same object with several tweens at once or stacking up several onComplete callbacks on the same tween.

If you're creating new tweens as needed (which is fine), stop any previous tweens on the same object. As long as you remove/nullify any of your own references to old tweens, it should work fine.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...