Hello,
I've set up a timeline which has several nested animations within it. On one of the nested animations I'd like to fire an onComplete callback function so that I can change a bit of code. The problem is, the onComplete function triggers as soon as the animation begins, rather than after it. I've attached the code so you can see what I mean:
function playScene1() {
var tl = new TimelineLite();
tl.to(hand, .6, {
x: "-= 100%",
y: "+= 0%",
repeat: 1,
yoyo: true,
repeatDelay: 0,
ease: Power1.easeInOut
}, 0);
tl.to(globe, .6, {
x: "+= 160%",
y: "+= 0%",
repeat: 0,
yoyo: false,
repeatDelay: 0,
delay: .6,
ease: Power1.easeInOut
}, 0);
tl.to(hand, .6, {
x: "-= 100%",
y: "+= 0%",
repeat: 1,
yoyo: true,
repeatDelay: 0,
ease: Power1.easeInOut
}, 1.2);
tl.to(globe, .6, {
x: "-= 160%",
y: "+= 0%",
repeat: 0,
yoyo: false,
repeatDelay: 0,
delay: .6,
ease: Power1.easeInOut,
onComplete: exampleCallback()
}, 1.2);
tl.play();
}
exampleCallback() is fired as soon as the timeline begins, I'd like to inject my own function after it's finished animating. Sorry if I've missed something very simple here