Skip to main content

FiniteAnimation

Trait FiniteAnimation 

Source
pub trait FiniteAnimation<Value>: Signal<Value> {
    // Required method
    fn duration(&self) -> Duration;

    // Provided methods
    fn delay(self, offset: Duration) -> Delay<Self>
       where Self: Sized { ... }
    fn try_delay(self, offset: Duration) -> Result<Delay<Self>, ValidationError>
       where Self: Sized { ... }
    fn speed(self, factor: f64) -> Speed<Self>
       where Self: Sized { ... }
    fn try_speed(self, factor: f64) -> Result<Speed<Self>, ValidationError>
       where Self: Sized { ... }
    fn then<Next: FiniteAnimation<Value>>(self, next: Next) -> Then<Self, Next>
       where Self: Sized { ... }
    fn reverse(self) -> Reverse<Self>
       where Self: Sized { ... }
    fn repeat(self, count: u32) -> Repeat<Self>
       where Self: Sized { ... }
    fn ping_pong(self) -> PingPong<Self>
       where Self: Sized { ... }
    fn boxed_finite(self) -> Arc<dyn FiniteAnimation<Value>> ⓘ
       where Self: Sized + 'static { ... }
}
Expand description

A Signal with a nonnegative, stable duration.

Finite animations hold their endpoint values outside [0, duration]. Sequencing combinators exist only here, so an unbounded signal cannot be delayed, sequenced or repeated by construction.

Required Methods§

Source

fn duration(&self) -> Duration

Returns the nonnegative duration.

Provided Methods§

Source

fn delay(self, offset: Duration) -> Delay<Self>
where Self: Sized,

Delays the animation, holding its initial value before the offset.

§Panics

Panics on duration overflow; see Self::try_delay.

Source

fn try_delay(self, offset: Duration) -> Result<Delay<Self>, ValidationError>
where Self: Sized,

Delays like Self::delay, reporting duration overflow.

Source

fn speed(self, factor: f64) -> Speed<Self>
where Self: Sized,

Changes playback speed by a finite, strictly positive factor. Durations round to the nearest tick; a collapsed animation becomes instantaneous.

§Panics

Panics for an invalid factor or unrepresentable duration; see Self::try_speed.

Source

fn try_speed(self, factor: f64) -> Result<Speed<Self>, ValidationError>
where Self: Sized,

Changes speed like Self::speed, reporting an invalid factor or unrepresentable duration.

Source

fn then<Next: FiniteAnimation<Value>>(self, next: Next) -> Then<Self, Next>
where Self: Sized,

Runs two animations in sequence. The second owns their shared boundary. Duration overflow panics at construction.

Source

fn reverse(self) -> Reverse<Self>
where Self: Sized,

Reverses the animation.

Source

fn repeat(self, count: u32) -> Repeat<Self>
where Self: Sized,

Plays the animation count times. Intermediate boundaries restart; the final boundary holds the target. Zero repeats hold the initial value. Duration overflow panics at construction.

Source

fn ping_pong(self) -> PingPong<Self>
where Self: Sized,

Plays the animation forward then backward, ending at its initial value. Duration overflow panics at construction.

Source

fn boxed_finite(self) -> Arc<dyn FiniteAnimation<Value>> ⓘ
where Self: Sized + 'static,

Shares a type-erased animation, retaining sampling, duration and combinators.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<Value> FiniteAnimation<Value> for Arc<dyn FiniteAnimation<Value> + '_>

Implementors§

Source§

impl FiniteAnimation<PathSample> for FollowPath

Source§

impl<FirstValue, SecondValue, First, Second> FiniteAnimation<(FirstValue, SecondValue)> for Zip<First, Second>
where First: FiniteAnimation<FirstValue>, Second: FiniteAnimation<SecondValue>,

Source§

impl<Input, Output, Source, Function> FiniteAnimation<Output> for Map<Source, Function, Input>
where Source: FiniteAnimation<Input>, Function: Fn(Input) -> Output + Send + Sync,

Source§

impl<Value, First: FiniteAnimation<Value>, Next: FiniteAnimation<Value>> FiniteAnimation<Value> for Then<First, Next>

Source§

impl<Value, Source: FiniteAnimation<Value>> FiniteAnimation<Value> for Delay<Source>

Source§

impl<Value, Source: FiniteAnimation<Value>> FiniteAnimation<Value> for PingPong<Source>

Source§

impl<Value, Source: FiniteAnimation<Value>> FiniteAnimation<Value> for Repeat<Source>

Source§

impl<Value, Source: FiniteAnimation<Value>> FiniteAnimation<Value> for Reverse<Source>

Source§

impl<Value, Source: FiniteAnimation<Value>> FiniteAnimation<Value> for Speed<Source>

Source§

impl<Value: Interpolate + Send + Sync> FiniteAnimation<Value> for Keyframes<Value>

Source§

impl<Value: Interpolate + Send + Sync> FiniteAnimation<Value> for Tween<Value>