getDurationNanos

abstract fun getDurationNanos(initialValue: Float, targetValue: Float, initialVelocity: Float): Long

Calculates the duration of an animation. For duration-based animations, this will return the pre-defined duration. For physics-based animations, the duration will be estimated based on the physics configuration (such as spring stiffness, damping ratio, visibility threshold) as well as the initialValue, targetValue values, and initialVelocity.

Note: this may be a computation that is expensive - especially with spring based animations

Parameters

initialValue

start value of the animation

targetValue

end value of the animation

initialVelocity

start velocity of the animation