RepeatableSpec


RepeatableSpec takes another DurationBasedAnimationSpec and plays it iterations times. For creating infinitely repeating animation spec, consider using InfiniteRepeatableSpec.

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.

Summary

Public constructors

<T : Any?> RepeatableSpec(
    iterations: Int,
    animation: DurationBasedAnimationSpec<T>,
    repeatMode: RepeatMode,
    initialStartOffset: StartOffset
)
Cmn

Public functions

open operator Boolean
equals(other: Any?)
Cmn
open Int
Cmn
open VectorizedFiniteAnimationSpec<V>
<V : AnimationVector> vectorize(converter: TwoWayConverter<T, V>)

Creates a VectorizedAnimationSpec with the given TwoWayConverter.

Cmn

Public properties

DurationBasedAnimationSpec<T>

the AnimationSpec to be repeated

Cmn
StartOffset

offsets the start of the animation

Cmn
Int

the count of iterations.

Cmn
RepeatMode

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

Cmn

Public constructors

RepeatableSpec

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

the count of iterations. Should be at least 1.

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)

initialStartOffset: StartOffset = StartOffset(0)

offsets the start of the animation

Public functions

equals

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

hashCode

open fun hashCode(): Int

vectorize

open fun <V : AnimationVector> vectorize(converter: TwoWayConverter<T, V>): VectorizedFiniteAnimationSpec<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

Public properties

animation

val animationDurationBasedAnimationSpec<T>

the AnimationSpec to be repeated

initialStartOffset

val initialStartOffsetStartOffset

offsets the start of the animation

iterations

val iterationsInt

the count of iterations. Should be at least 1.

repeatMode

val repeatModeRepeatMode

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