MomentumDecay class final

How one part of a gesture's momentum slows from its release speed.

Speeds and distances are in the part's unit: logical pixels for pan, zoom levels for zoom, and degrees for bearing and pitch. A setting whose bit isn't set takes the part's default, which GestureMomentum lists. min_speed is finite and not negative, and every other number is finite and positive. A friction decay can serve every release, as a preset that matches a platform's scrolling. An eased glide takes its direction from the part's velocity, and its distance and duration from the caller's plan.

See mln_momentum_decay in the C API reference.

Constructors

MomentumDecay({MomentumDecayModel? model, double? halfLifeMs, double? stopSpeed, double? distance, double? durationMs, UnitBezier? easing, double? minSpeed, double? maxSpeed, double? maxDistance})
const

Properties

distance → double?
Required for MomentumDecayModel.ease.
final
durationMs → double?
Required for MomentumDecayModel.ease.
final
easing → UnitBezier?
For MomentumDecayModel.ease, the share of distance covered over the share of duration_ms. Its control points are between 0 and 1, so the glide never passes its distance. Defaults to (0, 0, 0.25, 1), the curve that camera animations ease along by default. Android's scroll fling follows (0.175, 0.5, 0.35, 1).
final
halfLifeMs → double?
For MomentumDecayModel.friction, how long the speed takes to halve.
final
hashCode → int
The hash code for this object.
no setterinherited
maxDistance → double?
The farthest the part moves. A friction release that would move farther starts slower, so it ends sooner, and a planned glide moves at most this far over its duration.
final
maxSpeed → double?
For MomentumDecayModel.friction, a faster release counts as this.
final
minSpeed → double?
A slower release starts no momentum.
final
model → MomentumDecayModel?
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
stopSpeed → double?
For MomentumDecayModel.friction, the speed at which it ends.
final

Methods

copyWith({MomentumDecayModel? model, double? halfLifeMs, double? stopSpeed, double? distance, double? durationMs, UnitBezier? easing, double? minSpeed, double? maxSpeed, double? maxDistance}) → MomentumDecay
A copy of this value with the given members replaced.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
override

Operators

operator ==(Object other) → bool
The equality operator.
inherited