pub struct AnimationState { /* private fields */ }Expand description
Retained prepared-clip playback using Kit’s controllable executor clock.
Controls are inherited from core::AnimationState; use now(cx) for them.
Implementations§
Source§impl AnimationState
impl AnimationState
Sourcepub fn new(initial: Target) -> Self
pub fn new(initial: Target) -> Self
Creates a player at a static initial target. Retain it between renders.
Sourcepub fn now(&self, cx: &App) -> Duration
pub fn now(&self, cx: &App) -> Duration
Current native timestamp for pause/play/seek/speed/restart controls. Returns zero before the first native frame; no system clock is mixed in.
Methods from Deref<Target = AnimationState>§
Sourcepub fn sample(
&mut self,
animation: &Animation,
now: Duration,
reduced_motion: bool,
) -> Frame
pub fn sample( &mut self, animation: &Animation, now: Duration, reduced_motion: bool, ) -> Frame
Samples a retained prepared clip; cloning an Animation preserves its identity.
Rebuilding a clip intentionally restarts it. Reduced motion finishes even infinite clips.
Sourcepub fn pause(&mut self, now: Duration)
pub fn pause(&mut self, now: Duration)
Pauses playback; call the host’s notify method after controls change.
Sourcepub fn stop(&mut self, now: Duration)
pub fn stop(&mut self, now: Duration)
Stops at the current presentation. Use play to resume, or restart to reset.
Sourcepub fn seek(&mut self, time: Duration, now: Duration)
pub fn seek(&mut self, time: Duration, now: Duration)
Seeks to a virtual playhead, including initial delay and repeats.
Sourcepub fn set_speed(
&mut self,
speed: f64,
now: Duration,
) -> Result<(), AnimationError>
pub fn set_speed( &mut self, speed: f64, now: Duration, ) -> Result<(), AnimationError>
Changes playback speed; negative speed is supported after seeking forward.
Sourcepub fn completion(&mut self) -> Completion ⓘ
pub fn completion(&mut self) -> Completion ⓘ
A completion future for this run. Sampling drives it; replacement,
restart, explicit cancellation and owner drop resolve Cancelled.
Sourcepub fn cancel(&mut self, now: Duration)
pub fn cancel(&mut self, now: Duration)
Pauses playback and cancels completion observers. play may resume the
retained trajectory; a new observer can follow that resumed run.
Sourcepub fn is_complete(&self) -> bool
pub fn is_complete(&self) -> bool
Whether the last sample reached its endpoint.
Sourcepub fn is_playing(&self) -> bool
pub fn is_playing(&self) -> bool
Whether controls permit time to advance.
Trait Implementations§
Source§impl Debug for AnimationState
impl Debug for AnimationState
Source§impl Default for AnimationState
impl Default for AnimationState
Source§impl Deref for AnimationState
impl Deref for AnimationState
Auto Trait Implementations§
impl Freeze for AnimationState
impl RefUnwindSafe for AnimationState
impl Send for AnimationState
impl Sync for AnimationState
impl Unpin for AnimationState
impl UnsafeUnpin for AnimationState
impl UnwindSafe for AnimationState
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> 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().