InfiniteRepeatableSpec

Class

Common
public class InfiniteRepeatableSpec<T>(
    public val animation: DurationBasedAnimationSpec<T>,
    public val repeatMode: RepeatMode = RepeatMode.Restart,
    public val initialStartOffset: StartOffset = StartOffset(0),
) : AnimationSpec<T>

InfiniteRepeatableSpec repeats the provided animation infinite amount of times. It will never naturally finish. This means the animation will only be stopped via some form of manual cancellation. When used with transition or other animation composables, the infinite animations will stop when the composable is removed from the compose tree.

For non-infinite repeating animations, consider RepeatableSpec.

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

animationthe AnimationSpec to be repeated
repeatModewhether animation should repeat by starting from the beginning (i.e. RepeatMode.Restart) or from the end (i.e. RepeatMode.Reverse)
initialStartOffsetoffsets the start of the animation

Secondary Constructors

public constructor(
    animation: DurationBasedAnimationSpec<T>,
    repeatMode: RepeatMode = RepeatMode.Restart,
) : this(animation, repeatMode, StartOffset(0))