FloatExponentialDecaySpec

Class

Common
public class FloatExponentialDecaySpec(
    @FloatRange(from = 0.0, fromInclusive = false) frictionMultiplier: Float = 1f,
    @FloatRange(from = 0.0, fromInclusive = false) absVelocityThreshold: Float = 0.1f,
) : FloatDecayAnimationSpec

This is a decay animation 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.

Parameters

frictionMultiplierThe friction multiplier, indicating how quickly the animation should stop. This should be greater than 0, with a default value of 1.0.
absVelocityThresholdThe speed at which the animation is considered close enough to rest for the animation to finish.