repeatable

fun <T> repeatable(iterations: Int, animation: DurationBasedAnimationSpec<T>, repeatMode: RepeatMode = RepeatMode.Restart, initialStartOffset: StartOffset = StartOffset(0)): FiniteAnimationSpec<T>

Creates a FiniteAnimationSpec that repeats animation for a fixed number of iterations.

repeatable<Float>(iterations = 3, animation = tween(300.ms))
repeatable<Float>(iterations = 2, animation = tween(500.ms), repeatMode = RepeatMode.Reverse)

Parameters

iterations

Number of times to repeat. Must be positive.

animation

The duration-based animation to repeat (springs are not repeatable — a cycle needs a known length).

repeatMode

Whether to restart or reverse on each iteration.

initialStartOffset

A one-time shift of the start time (delay or fast-forward) applied to the first cycle only.