pub struct TimeBasedProgress { /* private fields */ }Expand description
Time-based progress calculator for converting time to progress values.
This helper struct provides utilities for calculating progress based on elapsed time, making it easier to integrate with time-based animations while maintaining the external timeline control design.
Implementations§
Source§impl TimeBasedProgress
impl TimeBasedProgress
Sourcepub fn new(duration_ms: Milliseconds) -> Self
pub fn new(duration_ms: Milliseconds) -> Self
Create a new time-based progress calculator.
§Arguments
duration_ms- Animation duration in milliseconds
Sourcepub fn new_looping(duration_ms: Milliseconds) -> Self
pub fn new_looping(duration_ms: Milliseconds) -> Self
Create a new looping time-based progress calculator.
§Arguments
duration_ms- Animation duration in milliseconds
Sourcepub fn progress_from_time<T: TimeProvider>(
&mut self,
time_provider: &T,
) -> Progress
pub fn progress_from_time<T: TimeProvider>( &mut self, time_provider: &T, ) -> Progress
Sourcepub fn progress_from_elapsed(&self, elapsed_ms: Milliseconds) -> Progress
pub fn progress_from_elapsed(&self, elapsed_ms: Milliseconds) -> Progress
Sourcepub fn is_complete<T: TimeProvider>(&self, time_provider: &T) -> bool
pub fn is_complete<T: TimeProvider>(&self, time_provider: &T) -> bool
Check if the animation is complete (non-looping only).
§Arguments
time_provider- Time provider to get current time
Sourcepub fn duration_ms(&self) -> Milliseconds
pub fn duration_ms(&self) -> Milliseconds
Get the animation duration.
Sourcepub fn set_duration_ms(&mut self, duration_ms: Milliseconds)
pub fn set_duration_ms(&mut self, duration_ms: Milliseconds)
Set the animation duration.
Sourcepub fn is_looping(&self) -> bool
pub fn is_looping(&self) -> bool
Check if the animation is set to loop.
Sourcepub fn set_looping(&mut self, looping: bool)
pub fn set_looping(&mut self, looping: bool)
Set whether the animation should loop.
Trait Implementations§
Source§impl Clone for TimeBasedProgress
impl Clone for TimeBasedProgress
Source§fn clone(&self) -> TimeBasedProgress
fn clone(&self) -> TimeBasedProgress
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for TimeBasedProgress
impl RefUnwindSafe for TimeBasedProgress
impl Send for TimeBasedProgress
impl Sync for TimeBasedProgress
impl Unpin for TimeBasedProgress
impl UnwindSafe for TimeBasedProgress
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
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Casts the value.
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
Source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
Source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Casts the value.
Source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
Source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
Source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> UnwrappedAs for T
impl<T> UnwrappedAs for T
Source§fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
Source§fn unwrapped_cast_from(src: Src) -> Dst
fn unwrapped_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> WrappingAs for T
impl<T> WrappingAs for T
Source§fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
Source§fn wrapping_cast_from(src: Src) -> Dst
fn wrapping_cast_from(src: Src) -> Dst
Casts the value.