VectorizedInfiniteRepeatableSpec


This animation takes another VectorizedDurationBasedAnimationSpec and plays it infinite times.

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

<V : AnimationVector> VectorizedInfiniteRepeatableSpec(
    animation: VectorizedDurationBasedAnimationSpec<V>,
    repeatMode: RepeatMode,
    initialStartOffset: StartOffset
)
Cmn

Public functions

open Long
getDurationNanos(initialValue: V, targetValue: V, initialVelocity: V)

Calculates the duration of an animation.

Cmn
open V
getValueFromNanos(
    playTimeNanos: Long,
    initialValue: V,
    targetValue: V,
    initialVelocity: V
)

Calculates the value of the animation at given the playtime, with the provided start/end values, and start velocity.

Cmn
open V
getVelocityFromNanos(
    playTimeNanos: Long,
    initialValue: V,
    targetValue: V,
    initialVelocity: V
)

Calculates the velocity of the animation at given the playtime, with the provided start/end values, and start velocity.

Cmn

Public properties

open Boolean

Whether or not the VectorizedAnimationSpec specifies an infinite animation.

Cmn

Inherited functions

From androidx.compose.animation.core.VectorizedAnimationSpec
open V
getEndVelocity(initialValue: V, targetValue: V, initialVelocity: V)

Calculates the end velocity of the animation with the provided start/end values, and start velocity.

Cmn

Public constructors

VectorizedInfiniteRepeatableSpec

<V : AnimationVector> VectorizedInfiniteRepeatableSpec(
    animation: VectorizedDurationBasedAnimationSpec<V>,
    repeatMode: RepeatMode = RepeatMode.Restart,
    initialStartOffset: StartOffset = StartOffset(0)
)
Parameters
animation: VectorizedDurationBasedAnimationSpec<V>

the VectorizedAnimationSpec describing each repetition iteration.

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

getDurationNanos

open fun getDurationNanos(initialValue: V, targetValue: V, initialVelocity: V): Long

Calculates the duration of an animation. For duration-based animations, this will return the pre-defined duration. For physics-based animations, the duration will be estimated based on the physics configuration (such as spring stiffness, damping ratio, visibility threshold) as well as the initialValue, targetValue values, and initialVelocity.

Parameters
initialValue: V

start value of the animation

targetValue: V

end value of the animation

initialVelocity: V

start velocity of the animation

getValueFromNanos

open fun getValueFromNanos(
    playTimeNanos: Long,
    initialValue: V,
    targetValue: V,
    initialVelocity: V
): V

Calculates the value of the animation at given the playtime, with the provided start/end values, and start velocity.

Parameters
playTimeNanos: Long

time since the start of the animation

initialValue: V

start value of the animation

targetValue: V

end value of the animation

initialVelocity: V

start velocity of the animation

getVelocityFromNanos

open fun getVelocityFromNanos(
    playTimeNanos: Long,
    initialValue: V,
    targetValue: V,
    initialVelocity: V
): V

Calculates the velocity of the animation at given the playtime, with the provided start/end values, and start velocity.

Parameters
playTimeNanos: Long

time since the start of the animation

initialValue: V

start value of the animation

targetValue: V

end value of the animation

initialVelocity: V

start velocity of the animation

Public properties

isInfinite

open val isInfiniteBoolean

Whether or not the VectorizedAnimationSpec specifies an infinite animation. That is, one that will not finish by itself, one that needs an external action to stop. For examples, an indeterminate progress bar, which will only stop when it is removed from the composition.