Skip to main content

Parallel

Struct Parallel 

Source
pub struct Parallel<T: Animatable> { /* private fields */ }
Expand description

Runs child animations together and composes their output values.

Implementations§

Source§

impl<T: Animatable> Parallel<T>

Source

pub fn new(initial: T, compose: impl Fn(&[T]) -> T + 'static) -> Self

Creates an empty parallel animation with an output compositor.

Source

pub fn with(self, animation: impl Animation<T>) -> Self

Appends an animation and returns the updated parallel composition.

Source

pub fn push(&mut self, animation: impl Animation<T>)

Appends an animation to the parallel composition.

Source

pub fn len(&self) -> usize

Returns the number of child animations.

Source

pub fn is_empty(&self) -> bool

Returns whether the composition contains no child animations.

Trait Implementations§

Source§

impl<T: Animatable> Animation<T> for Parallel<T>

Source§

fn value(&self) -> &T

Returns the animation’s current value.
Source§

fn state(&self) -> AnimationState

Returns the animation’s lifecycle state.
Source§

fn duration(&self) -> Option<Duration>

Returns the total duration when it is finite and known.
Source§

fn tick(&mut self, delta: Duration)

Advances the animation by delta.
Source§

fn advance(&mut self, delta: Duration) -> Duration

Advances the animation and returns any unconsumed duration.
Source§

fn pause(&mut self)

Pauses a running animation.
Source§

fn resume(&mut self)

Resumes a paused animation.
Source§

fn cancel(&mut self)

Cancels the animation.
Source§

fn seek(&mut self, progress: f32)

Seeks to normalized progress within the animation.
Source§

fn finish(&mut self)

Moves the animation to its completed state.
Source§

fn retarget(&mut self, _target: &T) -> bool

Attempts to continue the animation toward a new target. Read more
Source§

fn is_active(&self) -> bool

Returns whether the animation is currently running.

Auto Trait Implementations§

§

impl<T> !RefUnwindSafe for Parallel<T>

§

impl<T> !Send for Parallel<T>

§

impl<T> !Sync for Parallel<T>

§

impl<T> !UnwindSafe for Parallel<T>

§

impl<T> Freeze for Parallel<T>
where T: Freeze,

§

impl<T> Unpin for Parallel<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for Parallel<T>
where T: UnsafeUnpin,

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.