pub struct Decay {
pub rate: f64,
}Expand description
A fling that coasts: a velocity that keeps rate of itself every millisecond, as a scroll
view decelerates. 0.998 is the platforms’ usual scroll rate; lower stops sooner.
Fields§
§rate: f64The share of the velocity kept per millisecond, below 1.
Implementations§
Source§impl Decay
impl Decay
Sourcepub fn step(self, state: &mut SpringState, dt: f64)
pub fn step(self, state: &mut SpringState, dt: f64)
Advances state by dt seconds: the value moves by the distance covered while the
velocity fell.
Sourcepub fn stopped(self, state: SpringState) -> bool
pub fn stopped(self, state: SpringState) -> bool
Whether the fling has stopped: its speed is below a point per second.
Sourcepub fn rest(self, state: SpringState) -> f64
pub fn rest(self, state: SpringState) -> f64
Where a fling from state comes to rest: the distance left is the velocity over the
share lost per second.
Trait Implementations§
impl Copy for Decay
impl StructuralPartialEq for Decay
Auto Trait Implementations§
impl Forget for Decay
impl Freeze for Decay
impl Move for Decay
impl RefUnwindSafe for Decay
impl Send for Decay
impl Sync for Decay
impl Unpin for Decay
impl UnsafeUnpin for Decay
impl UnwindSafe for Decay
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
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> ⓘ
Converts
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> ⓘ
Converts
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 more