{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}

VectorizedSnapSpec

public final class VectorizedSnapSpec<V extends AnimationVector> implements VectorizedDurationBasedAnimationSpec


VectorizedSnapSpec immediately snaps the animating value to the end value.

Summary

Public constructors

<V extends AnimationVector> VectorizedSnapSpec(int delayMillis)

Public methods

int

the amount of time (in milliseconds) that the animation should wait before it starts.

int

duration is the amount of time while animation is not yet finished.

@NonNull V
getValueFromNanos(
    long playTimeNanos,
    @NonNull V initialValue,
    @NonNull V targetValue,
    @NonNull V initialVelocity
)

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

@NonNull V
getVelocityFromNanos(
    long playTimeNanos,
    @NonNull V initialValue,
    @NonNull V targetValue,
    @NonNull V initialVelocity
)

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

Inherited methods

From androidx.compose.animation.core.VectorizedAnimationSpec
@NonNull V
getEndVelocity(
    @NonNull V initialValue,
    @NonNull V targetValue,
    @NonNull V initialVelocity
)

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

From androidx.compose.animation.core.VectorizedDurationBasedAnimationSpec
long
getDurationNanos(
    @NonNull V initialValue,
    @NonNull V targetValue,
    @NonNull V initialVelocity
)

Calculates the duration of an animation.

From androidx.compose.animation.core.VectorizedFiniteAnimationSpec
boolean

Whether or not the VectorizedAnimationSpec specifies an infinite animation.

Public constructors

VectorizedSnapSpec

public <V extends AnimationVector> VectorizedSnapSpec(int delayMillis)
Parameters
int delayMillis

the amount of time (in milliseconds) that the animation should wait before it starts. Defaults to 0.

Public methods

getDelayMillis

public int getDelayMillis()

the amount of time (in milliseconds) that the animation should wait before it starts. Defaults to 0.

getDurationMillis

public int getDurationMillis()

duration is the amount of time while animation is not yet finished.

getValueFromNanos

public @NonNullgetValueFromNanos(
    long playTimeNanos,
    @NonNull V initialValue,
    @NonNull V targetValue,
    @NonNull V initialVelocity
)

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

Parameters
long playTimeNanos

time since the start of the animation

@NonNull V initialValue

start value of the animation

@NonNull V targetValue

end value of the animation

@NonNull V initialVelocity

start velocity of the animation

getVelocityFromNanos

public @NonNullgetVelocityFromNanos(
    long playTimeNanos,
    @NonNull V initialValue,
    @NonNull V targetValue,
    @NonNull V initialVelocity
)

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

Parameters
long playTimeNanos

time since the start of the animation

@NonNull V initialValue

start value of the animation

@NonNull V targetValue

end value of the animation

@NonNull V initialVelocity

start velocity of the animation