Skip to main content

AnimationGroup

Struct AnimationGroup 

Source
pub struct AnimationGroup { /* private fields */ }
Expand description

A collection of named animations with shared lifecycle control.

Implements Animationvalue() returns the average progress of all members, and is_complete() is true when every member has finished.

Implementations§

Source§

impl AnimationGroup

Source

pub fn new() -> Self

Create an empty animation group.

Source

pub fn add(self, label: &str, animation: impl Animation + 'static) -> Self

Add a named animation to the group (builder pattern).

If label already exists, the previous animation is replaced.

Source

pub fn insert(&mut self, label: &str, animation: Box<dyn Animation>)

Insert a named animation (mutating).

If label already exists, the previous animation is replaced.

Source

pub fn remove(&mut self, label: &str) -> bool

Remove a named animation. Returns true if found and removed.

Source§

impl AnimationGroup

Source

pub fn start_all(&mut self)

Reset all animations to their initial state.

Source

pub fn cancel_all(&mut self)

Reset all animations (alias for consistency with “cancel” semantics).

Source

pub fn len(&self) -> usize

Number of animations in the group.

Source

pub fn is_empty(&self) -> bool

Whether the group is empty.

Source

pub fn all_complete(&self) -> bool

Whether every animation in the group has completed.

Source

pub fn overall_progress(&self) -> f32

Average progress across all animations (0.0–1.0).

Returns 0.0 for an empty group.

Source

pub fn get(&self, label: &str) -> Option<&dyn Animation>

Get a reference to a named animation’s value.

Source

pub fn get_mut(&mut self, label: &str) -> Option<&mut Box<dyn Animation>>

Get a mutable reference to a named animation.

Source

pub fn get_at(&self, index: usize) -> Option<&dyn Animation>

Get a reference to an animation by index.

Source

pub fn iter(&self) -> impl Iterator<Item = (&str, &dyn Animation)>

Iterator over (label, animation) pairs.

Source

pub fn labels(&self) -> impl Iterator<Item = &str>

Labels of all animations in the group.

Trait Implementations§

Source§

impl Animation for AnimationGroup

Source§

fn tick(&mut self, dt: Duration)

Advance the animation by dt.
Source§

fn is_complete(&self) -> bool

Whether the animation has reached its end.
Source§

fn value(&self) -> f32

Current output value, clamped to [0.0, 1.0].
Source§

fn reset(&mut self)

Reset the animation to its initial state.
Source§

fn overshoot(&self) -> Duration

Time elapsed past completion. Used by composition types to forward remaining time (e.g., Sequence forwards overshoot from first to second). Returns Duration::ZERO for animations that never complete.
Source§

impl Debug for AnimationGroup

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for AnimationGroup

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.