Hi! I'm having some issues with the onComplete and onReverseComplete callbacks for tweens of 0 duration added to a timeline.
Generally, they work as I expected, but sometimes they do not get called, or onComplete gets called when onReverseComplete should have been called.
Since they work OK most times, my app kind of relies on them being called at the right times, but I started getting some issues becuase it seems they aren't.
In my app, the animations are created dynamically, so reproducing it is somewhat complicated, but I built and attached an example that shows the issue.
The code goes like:
var valueAnimation = TweenLite.to(
document.getElementById("value"),
0.5, { innerText: 300 }, { innerText: 0 });
var textAnimation = new TweenLite({}, 0, {
immediateRender: true,
onComplete: function() {
document.getElementById('button').innerText = "Reverse";
},
onReverseComplete: function() {
document.getElementById('button').innerText = "Play forward";
}
});
timeline = new TimelineLite({ paused: false, autoRemoveChildren: false })
timeline.add(textAnimation);
timeline.add(valueAnimation);
timeline.play();
To reproduce it, open the reverse_test.html file and follow the instructions.
Looking for similar issues, I read that onReverseCompleted was not called on child animations since what is actually reverted is the parent timeline; but the issue is that, most times, it's being called, and I ended up counting on it.
Please, let me know if I can provide any additional info.
Thanks!
reverse_test.zip