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 ios() -> ScrollPhysics
pub fn ios() -> ScrollPhysics
iOS scroll feel: UIScrollView’s normal deceleration rate.
Sourcepub fn android() -> ScrollPhysics
pub fn android() -> ScrollPhysics
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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