exponentialDecay
Function
Common
public fun <T> exponentialDecay(
@FloatRange(from = 0.0, fromInclusive = false) frictionMultiplier: Float = 1f,
@FloatRange(from = 0.0, fromInclusive = false) absVelocityThreshold: Float = 0.1f,
): DecayAnimationSpec<T>
Creates a decay animation spec where the friction/deceleration is always proportional to the
velocity. As a result, the velocity goes under an exponential decay. The constructor parameter,
frictionMultiplier
, can be tuned to adjust the amount of friction applied in the decay. The
higher the multiplier, the higher the friction, the sooner the animation will stop, and the
shorter distance the animation will travel with the same starting condition.
absVelocityThreshold
describes the absolute value of a velocity threshold, below which the
animation is considered finished.
Parameters
frictionMultiplier | The decay friction multiplier. This must be greater than 0 . |
absVelocityThreshold | The minimum speed, below which the animation is considered finished. Must be greater than 0 . |