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§
Provided Methods§
Sourcefn delay(self, offset: Duration) -> Delay<Self>where
Self: Sized,
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.
Sourcefn try_delay(self, offset: Duration) -> Result<Delay<Self>, ValidationError>where
Self: Sized,
fn try_delay(self, offset: Duration) -> Result<Delay<Self>, ValidationError>where
Self: Sized,
Delays like Self::delay, reporting duration overflow.
Sourcefn speed(self, factor: f64) -> Speed<Self>where
Self: Sized,
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.
Sourcefn try_speed(self, factor: f64) -> Result<Speed<Self>, ValidationError>where
Self: Sized,
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.
Sourcefn then<Next: FiniteAnimation<Value>>(self, next: Next) -> Then<Self, Next>where
Self: Sized,
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.
Sourcefn repeat(self, count: u32) -> Repeat<Self>where
Self: Sized,
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.
Sourcefn ping_pong(self) -> PingPong<Self>where
Self: Sized,
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.
Sourcefn boxed_finite(self) -> Arc<dyn FiniteAnimation<Value>> ⓘwhere
Self: Sized + 'static,
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".