animateToPosition

fun animateToPosition(positionPx: Float, velocityPxPerSec: Float? = null, animationRange: ClosedFloatingPointRange<Float>? = null, endListener: (canceled: Boolean) -> Unit? = null)

Performs an animation to move a view to positionPx with velocityPxPerSec.

Parameters

positionPx

Final position in pixels.

velocityPxPerSec

Movement velocity in pixels per seconds.

animationRange

Minimum and maximum position to be animated. For more details, see DynamicAnimation.setMinValue and DynamicAnimation.setMaxValue.

endListener

An action to be executed when animation ends or has been canceled.