pub enum ScrollPhysics {
Exponential {
decay_per_ms: f32,
},
FrictionSpline {
friction: f32,
pixels_per_inch: f32,
},
}Expand description
How free scrolling decelerates after a fling.
This models deceleration only. Boundary behavior — bouncing, edge glow, clamping — is the scroll container’s policy: the container is the one that knows its extents.
Variants§
Exponential
Exponential velocity decay, the UIScrollView model:
velocity(t) = v₀ · decay_per_msᵐˢ.
Fields
FrictionSpline
The friction spline of Android’s OverScroller: fling duration and
distance follow a logarithmic deceleration law, and progress along
the fling follows a cubic-Bezier ease-out curve. Transcribed from
AOSP’s SplineOverScroller (Apache-2.0).
Implementations§
Source§impl ScrollPhysics
impl ScrollPhysics
Sourcepub fn android() -> Self
pub fn android() -> Self
Android scroll feel: OverScroller with stock friction, at Android’s
nominal density of 160 density-independent pixels per inch — the
right pairing when fling distances are in logical pixels. Platforms
that fling in physical pixels, or know the display’s true density in
their logical space, should construct
ScrollPhysics::FrictionSpline directly.
Trait Implementations§
Source§impl Clone for ScrollPhysics
impl Clone for ScrollPhysics
Source§fn clone(&self) -> ScrollPhysics
fn clone(&self) -> ScrollPhysics
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for ScrollPhysics
Source§impl Debug for ScrollPhysics
impl Debug for ScrollPhysics
Source§impl PartialEq for ScrollPhysics
impl PartialEq for ScrollPhysics
impl StructuralPartialEq for ScrollPhysics
Auto Trait Implementations§
impl Freeze for ScrollPhysics
impl RefUnwindSafe for ScrollPhysics
impl Send for ScrollPhysics
impl Sync for ScrollPhysics
impl Unpin for ScrollPhysics
impl UnsafeUnpin for ScrollPhysics
impl UnwindSafe for ScrollPhysics
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> 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 more