update method
Updates this animation, ticking the lifeTime by an amount dt
(in seconds).
Implementation
void update(double dt) {
clock += dt;
elapsed += dt;
if (isSingleFrame || _done) {
return;
}
while (clock >= currentFrame.stepTime) {
if (isLastFrame) {
if (loop) {
clock -= currentFrame.stepTime;
currentIndex = 0;
} else {
_done = true;
onComplete?.call();
return;
}
} else {
clock -= currentFrame.stepTime;
currentIndex++;
}
}
}