pub struct Timeline { /* private fields */ }Expand description
Prepared tracks for separate Kit elements, using the shared timeline engine.
Track insertion allocates; sampling reuses a Kit frame buffer. Retain the
timeline, add tracks once, and use now(cx) for playback controls.
Implementations§
Source§impl Timeline
impl Timeline
Sourcepub fn at(&mut self, at: Duration, animation: Animation) -> usize
pub fn at(&mut self, at: Duration, animation: Animation) -> usize
Adds an absolute track and returns its stable frame index.
Sourcepub fn then(&mut self, animation: Animation) -> Result<usize, AnimationError>
pub fn then(&mut self, animation: Animation) -> Result<usize, AnimationError>
Appends after the last finite track. Infinite predecessors return an error.
Sourcepub fn label(&mut self, name: impl Into<String>) -> Result<(), AnimationError>
pub fn label(&mut self, name: impl Into<String>) -> Result<(), AnimationError>
Records a unique label at the current finite sequence cursor.
Sourcepub fn at_label(
&mut self,
name: &str,
offset: Duration,
animation: Animation,
) -> Result<usize, AnimationError>
pub fn at_label( &mut self, name: &str, offset: Duration, animation: Animation, ) -> Result<usize, AnimationError>
Adds a track relative to an existing label, returning its frame index.
Sourcepub fn now(&self, cx: &App) -> Duration
pub fn now(&self, cx: &App) -> Duration
Current native timestamp. Returns zero before the first frame call.
Sourcepub fn restart(&mut self, now: Duration)
pub fn restart(&mut self, now: Duration)
Starts all prepared tracks over using this owner’s clock.
Sourcepub fn seek(&mut self, playhead: Duration, now: Duration)
pub fn seek(&mut self, playhead: Duration, now: Duration)
Holds every track at an absolute playhead, including backward seeks.
Sourcepub fn set_speed(
&mut self,
speed: f64,
now: Duration,
) -> Result<(), AnimationError>
pub fn set_speed( &mut self, speed: f64, now: Duration, ) -> Result<(), AnimationError>
Sets a finite rate; negative values play backward.
Sourcepub fn sample(&mut self, now: Duration, reduced_motion: bool) -> &[Frame]
pub fn sample(&mut self, now: Duration, reduced_motion: bool) -> &[Frame]
Samples one explicit epoch without allocating. Do not mix with native time.
Sourcepub fn frame(&mut self, window: &mut Window, cx: &App) -> &[Frame]
pub fn frame(&mut self, window: &mut Window, cx: &App) -> &[Frame]
Samples native time and schedules even when only a future track is pending.
Sourcepub fn is_animating(&self) -> bool
pub fn is_animating(&self) -> bool
Whether the last sample needs another frame (including future tracks).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Timeline
impl RefUnwindSafe for Timeline
impl Send for Timeline
impl Sync for Timeline
impl Unpin for Timeline
impl UnsafeUnpin for Timeline
impl UnwindSafe for Timeline
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().