pub struct FrameClock { /* private fields */ }Expand description
Shared frame clock owned by the runtime.
Every view animation samples this clock instead of calling
Instant::now() on its own. That gives one coherent timestamp per frame,
deterministic tests, global speed control and reduced-motion support.
Implementations§
Source§impl FrameClock
impl FrameClock
pub fn new() -> Self
pub fn elapsed(&self) -> Duration
pub fn elapsed_secs(&self) -> f32
pub fn dt(&self) -> Duration
pub fn dt_secs(&self) -> f32
pub fn frame(&self) -> u64
pub fn speed(&self) -> f32
pub fn set_speed(&mut self, speed: f32)
pub fn reduced_motion(&self) -> bool
pub fn set_reduced_motion(&mut self, reduced: bool)
pub fn is_manual(&self) -> bool
pub fn set_manual(&mut self, manual: bool)
Sourcepub fn advance(&mut self)
pub fn advance(&mut self)
Advance from the wall clock. Manual clocks do not advance implicitly.
Sourcepub fn advance_by(&mut self, dt: Duration)
pub fn advance_by(&mut self, dt: Duration)
Advance by an explicit duration. Used by tests and deterministic hosts.
pub fn reset(&mut self)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FrameClock
impl RefUnwindSafe for FrameClock
impl Send for FrameClock
impl Sync for FrameClock
impl Unpin for FrameClock
impl UnsafeUnpin for FrameClock
impl UnwindSafe for FrameClock
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