pub struct Timeline { /* private fields */ }Expand description
A timeline that schedules multiple animations at specific offsets.
Implements Animation where value() returns overall progress (0.0–1.0).
Implementations§
Source§impl Timeline
impl Timeline
Sourcepub fn add(
self,
offset: Duration,
animation: impl Animation + 'static,
) -> Timeline
pub fn add( self, offset: Duration, animation: impl Animation + 'static, ) -> Timeline
Add an animation event at an absolute offset (builder pattern).
Sourcepub fn add_labeled(
self,
label: &str,
offset: Duration,
animation: impl Animation + 'static,
) -> Timeline
pub fn add_labeled( self, label: &str, offset: Duration, animation: impl Animation + 'static, ) -> Timeline
Add a labeled animation event at an absolute offset (builder pattern).
Sourcepub fn then(self, animation: impl Animation + 'static) -> Timeline
pub fn then(self, animation: impl Animation + 'static) -> Timeline
Add an event relative to the last event’s offset (builder pattern).
If no events exist, the offset is 0.
Sourcepub fn set_duration(self, d: Duration) -> Timeline
pub fn set_duration(self, d: Duration) -> Timeline
Set the total duration explicitly (builder pattern).
If not called, duration is inferred as max(event.offset).
A zero duration is clamped to 1ns.
Sourcepub fn set_loop_count(self, count: LoopCount) -> Timeline
pub fn set_loop_count(self, count: LoopCount) -> Timeline
Set the loop count (builder pattern).
Source§impl Timeline
impl Timeline
Sourcepub fn seek(&mut self, time: Duration)
pub fn seek(&mut self, time: Duration)
Seek to an absolute time position.
Clamps to [0, total_duration]. Resets all animations and re-ticks them up to the seek point so their state is consistent.
Sourcepub fn seek_label(&mut self, label: &str) -> bool
pub fn seek_label(&mut self, label: &str) -> bool
Seek to a labeled event’s offset.
Returns true if the label was found, false otherwise (no-op).
Sourcepub fn state(&self) -> PlaybackState
pub fn state(&self) -> PlaybackState
Current playback state.
Sourcepub fn current_time(&self) -> Duration
pub fn current_time(&self) -> Duration
Current time position.
Sourcepub fn event_count(&self) -> usize
pub fn event_count(&self) -> usize
Number of events in the timeline.
Sourcepub fn event_value(&self, label: &str) -> Option<f32>
pub fn event_value(&self, label: &str) -> Option<f32>
Get the animation value for a specific labeled event.
Returns None if the label doesn’t exist.
Sourcepub fn event_value_at(&self, index: usize) -> Option<f32>
pub fn event_value_at(&self, index: usize) -> Option<f32>
Get the animation value for an event by index.
Returns None if index is out of bounds.
Trait Implementations§
Source§impl Animation for Timeline
impl Animation for Timeline
Source§fn is_complete(&self) -> bool
fn is_complete(&self) -> bool
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<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
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>, which can then be
downcast into Box<dyn 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>, which 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> 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> 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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> 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
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().