From 4c3fe8d8f741fbd09696480a8ccea27748a11ef3 Mon Sep 17 00:00:00 2001 From: Camden Dixie O'Brien Date: Thu, 2 Oct 2025 17:42:25 +0100 Subject: [PATCH] Handle skipped keyframes --- animation.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/animation.c b/animation.c index 23e401d..138dcd4 100644 --- a/animation.c +++ b/animation.c @@ -110,7 +110,8 @@ void animation_update( animation_state_t *state, const model_t *model, uint32_t dt_us) { state->elapsed_us += dt_us; - if (state->elapsed_us >= state->duration_us) { // Move to next keyframe + while (state->elapsed_us >= state->duration_us) { + assert(state->duration_us != 0); state->elapsed_us -= state->duration_us; state->current_keyframe = state->next_keyframe; load_keyframe(state, model);