package dev.inmo.micro_utils.android.pickers import androidx.compose.animation.core.* internal suspend fun Animatable.fling( initialVelocity: Float, animationSpec: DecayAnimationSpec, adjustTarget: ((Float) -> Float)?, block: (Animatable.() -> Unit)? = null, ): AnimationResult { val targetValue = animationSpec.calculateTargetValue(value, initialVelocity) val adjustedTarget = adjustTarget?.invoke(targetValue) return if (adjustedTarget != null) { animateTo( targetValue = adjustedTarget, initialVelocity = initialVelocity, block = block ) } else { animateDecay( initialVelocity = initialVelocity, animationSpec = animationSpec, block = block, ) } }