### Overview Add frame-based animation for 2D sprites using sprite sheet sequences. ### Current State _No response_ ### Scope **Goals:** - Define animation clips (frame sequence, timing) - Play/pause/stop animation - Configurable frame rate - Loop and ping-pong modes - Animation events (on frame, on complete) **Non-Goals:** - Skeletal 2D animation - Sprite atlas management ### Proposed API ```rust pub struct SpriteAnimation { frames: Vec<SpriteFrame>, frame_duration: f32, current_frame: usize, elapsed: f32, mode: AnimationMode, playing: bool, } pub struct SpriteFrame { pub uv_min: [f32; 2], pub uv_max: [f32; 2], } pub enum AnimationMode { Once, Loop, PingPong, } impl SpriteAnimation { pub fn new(frames: Vec<SpriteFrame>, fps: f32) -> Self; pub fn with_mode(self, mode: AnimationMode) -> Self; pub fn play(&mut self); pub fn pause(&mut self); pub fn stop(&mut self); pub fn update(&mut self, dt: f32) -> bool; // true if frame changed pub fn current_frame(&self) -> &SpriteFrame; pub fn is_finished(&self) -> bool; } ``` ### Acceptance Criteria - [ ] Frames advance at specified rate - [ ] Loop mode repeats indefinitely - [ ] Once mode stops at last frame - [ ] PingPong reverses at ends - [ ] Frame UVs usable for rendering ### Affected Crates lambda-rs ### Notes - Integrate with sprite/2D rendering system - Consider animation definition format (JSON/RON)
Activity