Fix animation rendering to show final frame at 100% progress

Previously, the animation loop would exit before rendering the final
frame at progress=1.0. The loop checked is_complete() before rendering,
so the last visible frame was at (total_frames-1)/total_frames progress
(~96-97%).

Changed the loop to:
1. Render the current frame
2. Check if complete and break
3. Advance to next frame

This ensures the final frame at progress=1.0 is rendered before exiting,
completing the animation properly.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-09 04:02:11 +01:00
parent 6ce7ce03c6
commit 09665d3250

View File

@@ -34,7 +34,7 @@ impl<'a> Renderer<'a> {
let mut timeline = Timeline::new(self.timeline.duration_ms(), self.timeline.fps()); let mut timeline = Timeline::new(self.timeline.duration_ms(), self.timeline.fps());
timeline.start(); timeline.start();
while !timeline.is_complete() { loop {
let frame_start = std::time::Instant::now(); let frame_start = std::time::Instant::now();
// Calculate progress with easing // Calculate progress with easing
@@ -78,7 +78,12 @@ impl<'a> Renderer<'a> {
} }
} }
// Wait for next frame // Check if animation is complete before advancing
if timeline.is_complete() {
break;
}
// Advance to next frame and wait
timeline.next_frame(); timeline.next_frame();
let frame_duration = timeline.frame_duration(); let frame_duration = timeline.frame_duration();
let elapsed = frame_start.elapsed(); let elapsed = frame_start.elapsed();