pub struct Motion {
pub tracks: Vec<Track>,
pub duration: f32,
pub delay: f32,
pub end_delay: f32,
pub ease: Easing,
pub loops: Loop,
pub alternate: bool,
pub reversed: bool,
}Expand description
A set of tracks that run together, with shared timing.
Fields§
§tracks: Vec<Track>§duration: f32Milliseconds each track gets, before per-keyframe overrides.
delay: f32Milliseconds of stillness before the tracks start. The tracks hold
their from value throughout — which is what makes a staggered
entrance stay hidden until its turn.
end_delay: f32Milliseconds of stillness after the tracks finish, inside the iteration — so a loop pauses at the end instead of snapping back.
ease: Easing§loops: Loop§alternate: boolPlay every other iteration backwards.
reversed: boolPlay the whole thing backwards.
Implementations§
Source§impl Motion
impl Motion
pub fn new() -> Self
Sourcepub fn tween(
self,
prop: Prop,
from: impl Into<AnimValue>,
to: impl Into<AnimValue>,
) -> Self
pub fn tween( self, prop: Prop, from: impl Into<AnimValue>, to: impl Into<AnimValue>, ) -> Self
A single leg from from to to.
Sourcepub fn keyframes<K: IntoKeyframe>(
self,
prop: Prop,
from: impl Into<AnimValue>,
frames: impl IntoIterator<Item = K>,
) -> Self
pub fn keyframes<K: IntoKeyframe>( self, prop: Prop, from: impl Into<AnimValue>, frames: impl IntoIterator<Item = K>, ) -> Self
A multi-leg path for one property. The legs are destinations, or
Keyframes when a leg needs its own duration or easing.
pub fn track(self, track: Track) -> Self
Sourcepub fn duration(self, ms: f32) -> Self
pub fn duration(self, ms: f32) -> Self
Milliseconds. Springs ignore it — they run for their settle time.
pub fn delay(self, ms: f32) -> Self
pub fn end_delay(self, ms: f32) -> Self
pub fn ease(self, easing: Easing) -> Self
pub fn loops(self, loops: Loop) -> Self
pub fn repeat(self, times: u32) -> Self
pub fn repeat_forever(self) -> Self
pub fn alternate(self, alternate: bool) -> Self
pub fn reversed(self, reversed: bool) -> Self
Sourcepub fn iteration_ms(&self) -> f32
pub fn iteration_ms(&self) -> f32
The duration of one pass, delays included.
Sourcepub fn total_ms(&self) -> f32
pub fn total_ms(&self) -> f32
The duration of every pass together, or f32::INFINITY when it loops
forever.
Sourcepub fn sample_into(&self, t: f32, frame: &mut Frame)
pub fn sample_into(&self, t: f32, frame: &mut Frame)
Sample into an existing frame. Later writers win, which is how a
Sequence layers overlapping motions.
Source§impl Motion
impl Motion
Sourcepub fn enter(kind: TransitionKind) -> Self
pub fn enter(kind: TransitionKind) -> Self
The entrance Transition plays, as a motion you
can retime, delay, stagger or drop into a Sequence.
Sourcepub fn enter_from(kind: TransitionKind, distance: f32) -> Self
pub fn enter_from(kind: TransitionKind, distance: f32) -> Self
Motion::enter with the slide distance spelled out.
Sourcepub fn exit(kind: TransitionKind) -> Self
pub fn exit(kind: TransitionKind) -> Self
The mirror of Motion::enter — ends invisible and displaced.
pub fn exit_to(kind: TransitionKind, distance: f32) -> Self
Sourcepub fn as_margins(self) -> Self
pub fn as_margins(self) -> Self
Re-express Prop::X/Prop::Y as margins.
Those two are relative insets, which is the right way to move an
element in flow — it slides and its neighbours do not care. But an
element pinned with absolute() is its inset, so animating one
would drag it off its pin and leave it wherever the motion ended.
Margins offset a pinned element from where it was pinned, which is
the same visible motion without the fight.
Trait Implementations§
impl StructuralPartialEq for Motion
Auto Trait Implementations§
impl Freeze for Motion
impl RefUnwindSafe for Motion
impl Send for Motion
impl Sync for Motion
impl Unpin for Motion
impl UnsafeUnpin for Motion
impl UnwindSafe for Motion
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().