animate
fun animate(key: Any, enabler: Boolean, duration: Int, initialProgress: Float = 0.0f, easing: Easing = FastOutSlowInEasing, onProgressChange: (Float) -> Unit = {}, onFinish: () -> Unit = {}): State<Float>
Runs a tween animation and exposes its progress as a State.
The animation starts when enabler becomes true and animates from initialProgress to 1f over duration milliseconds. When enabler is false the returned state is immediately 1f.
Return
A State<Float> that emits the current animation progress (0f → 1f).
Parameters
key
A unique key that triggers restart of the animation when changed.
enabler
When false the animation is skipped and progress is instantly 1f.
duration
Duration of the tween animation in milliseconds.
initial Progress
Starting progress value (default 0f).
easing
The easing curve to use (default FastOutSlowInEasing).
on Progress Change
Callback invoked on each frame with the current progress value.
on Finish
Callback invoked once the animation reaches 1f.