pub struct ClampingScrollSimulation { /* private fields */ }Expand description
The rest of the animation layer: tweens chained and curved, the scroll simulations and
their constants.
A fling that decelerates like Android’s OverScroller, then stops dead.
The curve is the one Android’s SplineOverScroller uses for a fling: distance
and duration are derived from the release velocity, and the position follows
1 − (1 − t)^r over that duration. It never leaves the content: reaching
an edge is the caller’s business (see the clamping scroll policy), which is
what makes it the right model for a platform with no bounce.
Adjusted, as Flutter’s is, to be ballistic — deceleration depends only on the current velocity, never on how long ago the motion started — so a fling can be restarted mid-flight from its own state alone.
Implementations§
Source§impl ClampingScrollSimulation
impl ClampingScrollSimulation
Sourcepub fn new(
position: f32,
velocity: f32,
tolerance: Tolerance,
) -> ClampingScrollSimulation
pub fn new( position: f32, velocity: f32, tolerance: Tolerance, ) -> ClampingScrollSimulation
A fling from position at velocity (px/s), with Android’s friction.
Sourcepub fn with_friction(
position: f32,
velocity: f32,
friction: f32,
tolerance: Tolerance,
) -> ClampingScrollSimulation
pub fn with_friction( position: f32, velocity: f32, friction: f32, tolerance: Tolerance, ) -> ClampingScrollSimulation
The same fling, with the friction coefficient made explicit: higher means it stops sooner and travels less far.
Trait Implementations§
Source§impl Clone for ClampingScrollSimulation
impl Clone for ClampingScrollSimulation
Source§fn clone(&self) -> ClampingScrollSimulation
fn clone(&self) -> ClampingScrollSimulation
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more