Jump to content

OnComplete event with chained tweens


Pomdap
 Share

Recommended Posts

Hi,

 

I was looking at the chained tweens example and I tryed to add an onCompete event at the end of the tween but it's look like the event is dispatched after the end of the first tween.

var tween = this.game.add.tween(this.phaser).to({ alpha: 1 }, 1000, Phaser.Easing.Sinusoidal.InOut, true).to({ alpha: 0 }, 1000, Phaser.Easing.Sinusoidal.InOut, false, 1000).onComplete.add(this.onAnimationDone, this);

I found this solution on the forum wich is not ellegant, but at least functional:

var tween = this.game.add.tween(this.phaser).to({ alpha: 1 }, 1000, Phaser.Easing.Sinusoidal.InOut).to({ alpha: 0 }, 1000, Phaser.Easing.Sinusoidal.InOut, false, 1000).start();		tween._lastChild.onComplete.add(this.onAnimationDone, this);

I would like to know if it is the expected behavior or if there is a better way to do that ?

 

Thank you.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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