pub struct Tween<Value> { /* private fields */ }Expand description
A finite endpoint-to-endpoint interpolation with double-precision progress.
use motion_core::prelude::*;
use motion_core::{
DisplayList, RasterLimits, ResourceStore, ValidatedDisplayList, MAX_PATH_VERBS,
MAX_STROKE_VERBS, MAX_SVG_PATH_BYTES, sample_offsets,
};
let movement = Tween::new(Point::ORIGIN, Point::new(100.0, 40.0), 2.seconds());
assert_eq!(movement.sample(1.seconds().after_origin()), Point::new(50.0, 20.0));
assert_eq!(movement.sample(Time::from_seconds(-1.0)), Point::ORIGIN);Implementations§
Trait Implementations§
Source§impl<Value: Interpolate + Send + Sync> FiniteAnimation<Value> for Tween<Value>
impl<Value: Interpolate + Send + Sync> FiniteAnimation<Value> for Tween<Value>
Source§fn 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. Read more
Source§fn 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.Source§fn 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. Read more
Source§fn 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.Source§fn 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.
Source§fn 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.Source§fn 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.
Source§fn 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.
Source§impl<Value: Interpolate + Send + Sync> Signal<Value> for Tween<Value>
impl<Value: Interpolate + Send + Sync> Signal<Value> for Tween<Value>
Source§fn sample(&self, time: Time) -> Value
fn sample(&self, time: Time) -> Value
Samples without advancing a clock or changing playback state.
Source§fn map<Output, Function>(self, function: Function) -> Map<Self, Function, Value>
fn map<Output, Function>(self, function: Function) -> Map<Self, Function, Value>
Transforms values without changing timing.
Auto Trait Implementations§
impl<Value> !RefUnwindSafe for Tween<Value>
impl<Value> !UnwindSafe for Tween<Value>
impl<Value> Forget for Tween<Value>
impl<Value> Freeze for Tween<Value>where
Value: Freeze,
impl<Value> Move for Tween<Value>
impl<Value> Send for Tween<Value>where
Value: Send,
impl<Value> Sync for Tween<Value>where
Value: Sync,
impl<Value> Unpin for Tween<Value>where
Value: Unpin,
impl<Value> UnsafeUnpin for Tween<Value>where
Value: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more