repeatable
public fun <T> repeatable(
iterations: Int,
animation: DurationBasedAnimationSpec<T>,
repeatMode: RepeatMode = RepeatMode.Restart,
initialStartOffset: StartOffset = StartOffset(0),
): RepeatableSpec<T>
Creates a RepeatableSpec
that plays a DurationBasedAnimationSpec
(e.g. TweenSpec
,
KeyframesSpec
) the amount of iterations specified by iterations
.
The iteration count describes the amount of times the animation will run. 1 means no repeat.
Recommend infiniteRepeatable
for creating an infinity repeating animation.
Note: When repeating in the RepeatMode.Reverse
mode, it's highly recommended to have an
odd number of iterations. Otherwise, the animation may jump to the end value when it finishes
the last iteration.
initialStartOffset
can be used to either delay the start of the animation or to fast forward
the animation to a given play time. This start offset will not be repeated, whereas the delay
in the animation
(if any) will be repeated. By default, the amount of offset is 0.
Parameters
iterations | the total count of iterations, should be greater than 1 to repeat. |
animation | animation that will be repeated |
repeatMode | whether animation should repeat by starting from the beginning (i.e. RepeatMode.Restart ) or from the end (i.e. RepeatMode.Reverse ) |
initialStartOffset | offsets the start of the animation |
Deprecated This method has been deprecated in favor of the repeatable function that accepts start offset.
public fun <T> repeatable(
iterations: Int,
animation: DurationBasedAnimationSpec<T>,
repeatMode: RepeatMode = RepeatMode.Restart,
): RepeatableSpec<T>