pub struct AnimationSequence<T: Animatable> { /* private fields */ }Expand description
Optimized animation sequence that uses shared immutable data and atomic counters to avoid cloning sequences on step transitions
Implementations§
Source§impl<T: Animatable> AnimationSequence<T>
impl<T: Animatable> AnimationSequence<T>
Sourcepub fn with_capacity(_capacity: u8) -> Self
pub fn with_capacity(_capacity: u8) -> Self
Creates a new animation sequence with specified capacity hint Note: This is kept for API compatibility but doesn’t pre-allocate since we use Arc<[T]>
Sourcepub fn from_steps(steps: Vec<AnimationStep<T>>) -> Self
pub fn from_steps(steps: Vec<AnimationStep<T>>) -> Self
Creates a new animation sequence from a vector of steps
Sourcepub fn with_on_complete<F>(steps: Vec<AnimationStep<T>>, on_complete: F) -> Self
pub fn with_on_complete<F>(steps: Vec<AnimationStep<T>>, on_complete: F) -> Self
Creates a new animation sequence with a completion callback
Sourcepub fn reserve(&mut self, _additional: u8)
pub fn reserve(&mut self, _additional: u8)
Reserve additional capacity (kept for API compatibility, but no-op since we use Arc<[T]>)
Sourcepub fn then(self, target: T, config: AnimationConfig) -> Self
pub fn then(self, target: T, config: AnimationConfig) -> Self
Adds a new step to the sequence and returns a new sequence This creates a new Arc with all steps to maintain immutability
Sourcepub fn on_complete<F: FnOnce() + Send + 'static>(self, f: F) -> Self
pub fn on_complete<F: FnOnce() + Send + 'static>(self, f: F) -> Self
Sets a completion callback
Sourcepub fn advance_step(&self) -> bool
pub fn advance_step(&self) -> bool
Advances to the next step in the sequence Returns true if advanced, false if already at the end
Sourcepub fn current_step_index(&self) -> u8
pub fn current_step_index(&self) -> u8
Gets the current step index
Sourcepub fn current_step(&self) -> u8
pub fn current_step(&self) -> u8
Gets the current step index (kept for backward compatibility)
Sourcepub fn current_config(&self) -> Option<&AnimationConfig>
pub fn current_config(&self) -> Option<&AnimationConfig>
Gets the configuration for the current step
Sourcepub fn current_target(&self) -> Option<T>
pub fn current_target(&self) -> Option<T>
Gets the target value for the current step
Sourcepub fn current_step_data(&self) -> Option<&AnimationStep<T>>
pub fn current_step_data(&self) -> Option<&AnimationStep<T>>
Gets the current step data
Sourcepub fn steps(&self) -> &[AnimationStep<T>]
pub fn steps(&self) -> &[AnimationStep<T>]
Gets all steps (for backward compatibility)
Sourcepub fn is_complete(&self) -> bool
pub fn is_complete(&self) -> bool
Checks if the sequence is complete (at the last step)
Sourcepub fn total_steps(&self) -> usize
pub fn total_steps(&self) -> usize
Gets the total number of steps
Sourcepub fn execute_completion(&self)
pub fn execute_completion(&self)
Executes the completion callback if present This method is thread-safe and can be called without ownership