# RepeatableSpec

Artifact: [androidx.compose.animation:animation-core](https://developer.android.com/jetpack/androidx/releases/compose-animation) [View Source](https://cs.android.com/search?q=file:androidx/compose/animation/core/AnimationSpec.kt+class:androidx.compose.animation.core.RepeatableSpec) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-animation#1.0.0) Common/All
- Cmn

  ```
  class RepeatableSpec<T : Any?> : FiniteAnimationSpec<T>
  ```

*** ** * ** ***

`https://developer.android.com/reference/kotlin/androidx/compose/animation/core/RepeatableSpec` takes another `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/DurationBasedAnimationSpec` and plays it `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/RepeatableSpec#(kotlin.Int,androidx.compose.animation.core.DurationBasedAnimationSpec,androidx.compose.animation.core.RepeatMode,androidx.compose.animation.core.StartOffset)` times. For creating infinitely repeating animation spec, consider using `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/InfiniteRepeatableSpec`.

**Note** : When repeating in the `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/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.

`https://developer.android.com/reference/kotlin/androidx/compose/animation/core/RepeatableSpec#(kotlin.Int,androidx.compose.animation.core.DurationBasedAnimationSpec,androidx.compose.animation.core.RepeatMode,androidx.compose.animation.core.StartOffset)` 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 `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/RepeatableSpec#(kotlin.Int,androidx.compose.animation.core.DurationBasedAnimationSpec,androidx.compose.animation.core.RepeatMode,androidx.compose.animation.core.StartOffset)` (if any) will be repeated. By default, the amount of offset is 0.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/package-summary#repeatable(kotlin.Int,androidx.compose.animation.core.DurationBasedAnimationSpec,androidx.compose.animation.core.RepeatMode,androidx.compose.animation.core.StartOffset)` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/InfiniteRepeatableSpec` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/package-summary#infiniteRepeatable(androidx.compose.animation.core.DurationBasedAnimationSpec,androidx.compose.animation.core.RepeatMode,androidx.compose.animation.core.StartOffset)` |   |

## Summary

| ### Public constructors |
|---|---|
| `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/compose/animation/core/RepeatableSpec#RepeatableSpec(kotlin.Int,androidx.compose.animation.core.DurationBasedAnimationSpec,androidx.compose.animation.core.RepeatMode,androidx.compose.animation.core.StartOffset)( iterations: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, animation: https://developer.android.com/reference/kotlin/androidx/compose/animation/core/DurationBasedAnimationSpec<T>, repeatMode: https://developer.android.com/reference/kotlin/androidx/compose/animation/core/RepeatMode, initialStartOffset: https://developer.android.com/reference/kotlin/androidx/compose/animation/core/StartOffset )` | Cmn |

| ### Public functions |
|---|---|---|
| `open operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/RepeatableSpec#equals(kotlin.Any)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/RepeatableSpec#hashCode()()` | Cmn |
| `open https://developer.android.com/reference/kotlin/androidx/compose/animation/core/VectorizedFiniteAnimationSpec<V>` | `<V : https://developer.android.com/reference/kotlin/androidx/compose/animation/core/AnimationVector> https://developer.android.com/reference/kotlin/androidx/compose/animation/core/RepeatableSpec#vectorize(androidx.compose.animation.core.TwoWayConverter)(converter: https://developer.android.com/reference/kotlin/androidx/compose/animation/core/TwoWayConverter<T, V>)` Creates a `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/VectorizedAnimationSpec` with the given `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/TwoWayConverter`. | Cmn |

| ### Public properties |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/DurationBasedAnimationSpec<T>` | `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/RepeatableSpec#animation()` the `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/AnimationSpec` to be repeated | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/StartOffset` | `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/RepeatableSpec#initialStartOffset()` offsets the start of the animation | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/RepeatableSpec#iterations()` the count of iterations. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/RepeatMode` | `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/RepeatableSpec#repeatMode()` whether animation should repeat by starting from the beginning (i.e. `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/RepeatMode#Restart`) or from the end (i.e. `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/RepeatMode#Reverse`) | Cmn |

## Public constructors

### RepeatableSpec

Cmn Added in [1.10.0](https://developer.android.com/jetpack/androidx/releases/compose-animation#1.10.0)

```
<T : Any?> RepeatableSpec(
    iterations: Int,
    animation: DurationBasedAnimationSpec<T>,
    repeatMode: RepeatMode = RepeatMode.Restart,
    initialStartOffset: StartOffset = StartOffset(0)
)
```

| Parameters |
|---|---|
| `iterations: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the count of iterations. Should be at least 1. |
| `animation: https://developer.android.com/reference/kotlin/androidx/compose/animation/core/DurationBasedAnimationSpec<T>` | the `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/AnimationSpec` to be repeated |
| `repeatMode: https://developer.android.com/reference/kotlin/androidx/compose/animation/core/RepeatMode = RepeatMode.Restart` | whether animation should repeat by starting from the beginning (i.e. `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/RepeatMode#Restart`) or from the end (i.e. `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/RepeatMode#Reverse`) |
| `initialStartOffset: https://developer.android.com/reference/kotlin/androidx/compose/animation/core/StartOffset = StartOffset(0)` | offsets the start of the animation |

## Public functions

### equals

Cmn

```
open operator fun equals(other: Any?): Boolean
```

### hashCode

Cmn

```
open fun hashCode(): Int
```

### vectorize

Cmn

```
open fun <V : AnimationVector> vectorize(converter: TwoWayConverter<T, V>): VectorizedFiniteAnimationSpec<V>
```

Creates a `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/VectorizedAnimationSpec` with the given `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/TwoWayConverter`.

The underlying animation system operates on `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/AnimationVector`s. `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/AnimationSpec` will be converted to `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/AnimationVector` to animate. `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/VectorizedAnimationSpec` describes how the converted `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/AnimationVector` should be animated. E.g. The animation could simply interpolate between the start and end values (i.e.`https://developer.android.com/reference/kotlin/androidx/compose/animation/core/TweenSpec`), or apply spring physics to produce the motion (i.e. `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/SpringSpec`), etc)

| Parameters |
|---|---|
| `converter: https://developer.android.com/reference/kotlin/androidx/compose/animation/core/TwoWayConverter<T, V>` | converts the type `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/AnimationSpec` from and to `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/AnimationVector` type |

## Public properties

### animation

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-animation#1.0.0)

```
val animation: DurationBasedAnimationSpec<T>
```

the `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/AnimationSpec` to be repeated

### initialStartOffset

Cmn Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/compose-animation#1.1.0)

```
val initialStartOffset: StartOffset
```

offsets the start of the animation

### iterations

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-animation#1.0.0)

```
val iterations: Int
```

the count of iterations. Should be at least 1.

### repeatMode

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-animation#1.0.0)

```
val repeatMode: RepeatMode
```

whether animation should repeat by starting from the beginning (i.e. `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/RepeatMode#Restart`) or from the end (i.e. `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/RepeatMode#Reverse`)