pub struct TypedState<T, const N: usize> { /* private fields */ }Expand description
Kit executor clock around a shared, independently sampled typed state.
Implementations§
Source§impl<T: MotionData<N>, const N: usize> TypedState<T, N>
impl<T: MotionData<N>, const N: usize> TypedState<T, N>
Sourcepub fn new(value: T) -> Self
pub fn new(value: T) -> Self
Seeds the native presentation; use matching property masks in its clips.
Sourcepub fn now(&self, cx: &App) -> Duration
pub fn now(&self, cx: &App) -> Duration
Native control timestamp. Do not mix this clock with manual samples.
Sourcepub fn frame(
&mut self,
clip: &TypedAnimation<T, N>,
window: &mut Window,
cx: &App,
) -> TypedFrame<T>
pub fn frame( &mut self, clip: &TypedAnimation<T, N>, window: &mut Window, cx: &App, ) -> TypedFrame<T>
Samples the shared clip and schedules only while active.
Methods from Deref<Target = TypedState<T, N>>§
Sourcepub fn sample(
&mut self,
clip: &TypedAnimation<T, N>,
now: Duration,
reduced: bool,
) -> TypedFrame<T>
pub fn sample( &mut self, clip: &TypedAnimation<T, N>, now: Duration, reduced: bool, ) -> TypedFrame<T>
Samples at one explicit monotonic epoch. Panics if the clip’s mask differs from the seed’s mask; create a new retained state for a different shape.
Sourcepub fn velocities(&self) -> [f64; N]
pub fn velocities(&self) -> [f64; N]
Per-channel physical velocity.
Sourcepub fn restart(&mut self, now: Duration)
pub fn restart(&mut self, now: Duration)
Restarts every channel; cancels previous completion observers.
Sourcepub fn set_speed(
&mut self,
speed: f64,
now: Duration,
) -> Result<(), AnimationError>
pub fn set_speed( &mut self, speed: f64, now: Duration, ) -> Result<(), AnimationError>
Validates and changes speed for all channels transactionally.
Sourcepub fn completion(&mut self) -> Completion ⓘ
pub fn completion(&mut self) -> Completion ⓘ
Observes completion/cancellation. All channels share the same clip timing.
Sourcepub fn is_animating(&self) -> bool
pub fn is_animating(&self) -> bool
Whether the last sample requires another frame.
Trait Implementations§
Source§impl<T, const N: usize> Deref for TypedState<T, N>
impl<T, const N: usize> Deref for TypedState<T, N>
Auto Trait Implementations§
impl<T, const N: usize> Freeze for TypedState<T, N>where
TypedState<T, N>: Freeze,
impl<T, const N: usize> RefUnwindSafe for TypedState<T, N>where
TypedState<T, N>: RefUnwindSafe,
impl<T, const N: usize> Send for TypedState<T, N>where
TypedState<T, N>: Send,
impl<T, const N: usize> Sync for TypedState<T, N>where
TypedState<T, N>: Sync,
impl<T, const N: usize> Unpin for TypedState<T, N>where
TypedState<T, N>: Unpin,
impl<T, const N: usize> UnsafeUnpin for TypedState<T, N>where
TypedState<T, N>: UnsafeUnpin,
impl<T, const N: usize> UnwindSafe for TypedState<T, N>where
TypedState<T, N>: UnwindSafe,
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
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>
Convert
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>
Convert
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)
Convert
&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)
Convert
&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> ⓘ
Converts
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> ⓘ
Converts
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 more