BouncyPressSpring class

Spring physics for the press animation.

A spring responds to the finger mid-animation: pressing again during a release reverses smoothly from wherever the button is, carrying its speed, instead of restarting a fixed curve. With a dampingRatio below 1, the button overshoots on release before settling.

When a spring is set, the animation's duration and curves are not used. Under the system "reduce motion" setting, the button moves instantly.

Annotations

Constructors

BouncyPressSpring({double stiffness = 500, double dampingRatio = 0.5, double mass = 1})
Creates a spring.
const

Properties

dampingRatio → double
How quickly motion dies away. Below 1 overshoots and bounces, 1 settles as fast as possible without overshoot, and above 1 is sluggish.
final
hashCode → int
The hash code for this object.
no setteroverride
mass → double
The mass on the spring. Higher feels heavier and slower.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
stiffness → double
How strongly the spring pulls toward its target. Higher is faster.
final

Methods

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.
override

Constants

bouncy → const BouncyPressSpring
A visible bounce on release.
gentle → const BouncyPressSpring
Slow and soft, with no overshoot.
snappy → const BouncyPressSpring
Quick, with a hint of overshoot.