Android 12 Developer Preview is here! Try it out, and give us your feedback!

InfiniteRepeatableSpec

class InfiniteRepeatableSpec<T> : AnimationSpec<T>
kotlin.Any
   ↳ androidx.compose.animation.core.InfiniteRepeatableSpec

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.

Summary

Public constructors
<init>(animation: DurationBasedAnimationSpec<T>, repeatMode: RepeatMode = RepeatMode.Restart)

InfiniteRepeatableSpec repeats the provided animation infinite amount of times.

Public methods
Boolean
equals(other: Any?)

Int

VectorizedAnimationSpec<V>
vectorize(converter: TwoWayConverter<T, V>)

Creates a VectorizedAnimationSpec with the given TwoWayConverter.

Properties
DurationBasedAnimationSpec<T>

the AnimationSpec to be repeated

RepeatMode

whether animation should repeat by starting from the beginning (i.

Public constructors

<init>

InfiniteRepeatableSpec(
    animation: DurationBasedAnimationSpec<T>,
    repeatMode: RepeatMode = RepeatMode.Restart)

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.

Parameters
animation: DurationBasedAnimationSpec<T> the AnimationSpec to be repeated
repeatMode: RepeatMode = RepeatMode.Restart whether animation should repeat by starting from the beginning (i.e. RepeatMode.Restart) or from the end (i.e. RepeatMode.Reverse)

Public methods

equals

fun equals(other: Any?): Boolean

hashCode

fun hashCode(): Int

vectorize

fun <V : AnimationVector> vectorize(converter: TwoWayConverter<T, V>): VectorizedAnimationSpec<V>

Creates a VectorizedAnimationSpec with the given TwoWayConverter.

The underlying animation system operates on AnimationVectors. T will be converted to AnimationVector to animate. VectorizedAnimationSpec describes how the converted AnimationVector should be animated. E.g. The animation could simply interpolate between the start and end values (i.e.TweenSpec), or apply spring physics to produce the motion (i.e. SpringSpec), etc)

Parameters
converter: TwoWayConverter<T, V> converts the type T from and to AnimationVector type

Properties

animation

val animation: DurationBasedAnimationSpec<T>

the AnimationSpec to be repeated

repeatMode

val repeatMode: RepeatMode

whether animation should repeat by starting from the beginning (i.e. RepeatMode.Restart) or from the end (i.e. RepeatMode.Reverse)