Hi,
Before I start, my code is written in TypeScript which compiles into JS.
I have managed to get a yoyo animation to work as expected:
public dab(): void {
TweenMax.to(sprite.scale, 0.5, {
x: 1.5,
y: -1.5,
ease: Power2.easeOut,
yoyo: true,
repeat: 1,
repeatDelay: 0.1,
onReverseComplete: this.handleYoyoComplete(),
onReverseCompleteScope: this
// onRepeatComplete: this.handleYoyoComplete,
// onRepeatCompleteScope: this
})
}
protected handleYoyoComplete(): void {
console.log("YOYO COMPLETE!");
}
However, the method 'handleYoyoComplete()' gets called when the sprite is fully stretched out, before the yoyo starts but after the initial tween. I've tried onComplete, onReverseComplete, and onRepeatComplete. I have tried these all with and without the parenthesis (i.e. onReverseComplete: this.handleYoyoComplete() and onReverseComplete: this.handleYoyoComplete.
Ultimately, is there a way of calling a method when the yoyo is fully complete?
Thanks for reading, all help will be most appreciated.