pub struct ScrollClock { /* private fields */ }Expand description
A Clock implementation backed by scroll-position changes.
Each call to set_scroll stores a normalised
delta; the next call to Clock::delta consumes and returns it.
§Example
use animato_driver::{Clock, AnimationDriver};
use animato_driver::scroll::ScrollClock;
let mut clock = ScrollClock::new(0.0, 1000.0);
clock.set_scroll(250.0);
let dt = clock.delta(); // ≈ 0.25
assert!((dt - 0.25).abs() < 0.001);Implementations§
Source§impl ScrollClock
impl ScrollClock
Sourcepub fn set_scroll(&mut self, pos: f32)
pub fn set_scroll(&mut self, pos: f32)
Register a new scroll position and accumulate the normalised delta.
Multiple calls before Clock::delta accumulate (they do not cancel
each other out — only magnitudes are summed).
Sourcepub fn scroll_position(&self) -> f32
pub fn scroll_position(&self) -> f32
Current scroll position in user units.
Trait Implementations§
Source§impl Clock for ScrollClock
impl Clock for ScrollClock
Source§impl Clone for ScrollClock
impl Clone for ScrollClock
Source§fn clone(&self) -> ScrollClock
fn clone(&self) -> ScrollClock
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ScrollClock
impl Debug for ScrollClock
Auto Trait Implementations§
impl Freeze for ScrollClock
impl RefUnwindSafe for ScrollClock
impl Send for ScrollClock
impl Sync for ScrollClock
impl Unpin for ScrollClock
impl UnsafeUnpin for ScrollClock
impl UnwindSafe for ScrollClock
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