pub struct AnimationSequence<T: Animatable> { /* private fields */ }Expand description
Animation sequence that keeps step data simple and stores only the mutable execution state behind a mutex for shared access.
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.
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 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
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
Trait Implementations§
Source§impl<T: Animatable> Clone for AnimationSequence<T>
Cloning AnimationSequence preserves the queued steps and current_step_index,
but resets the inner SequenceState::on_complete callback to None.
Callers that clone an AnimationSequence must re-register on_complete
on the cloned instance when they need completion behavior there too.
impl<T: Animatable> Clone for AnimationSequence<T>
Cloning AnimationSequence preserves the queued steps and current_step_index,
but resets the inner SequenceState::on_complete callback to None.
Callers that clone an AnimationSequence must re-register on_complete
on the cloned instance when they need completion behavior there too.