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

VectorizedSpringSpec

public final class VectorizedSpringSpec<V extends AnimationVector> implements VectorizedFiniteAnimationSpec


VectorizedSpringSpec uses spring animations to animate (each dimension of) AnimationVectors.

Summary

Public constructors

<V extends AnimationVector> VectorizedSpringSpec(
    float dampingRatio,
    float stiffness,
    V visibilityThreshold
)

Creates a VectorizedSpringSpec that uses the same spring constants (i.e. dampingRatio and stiffness on all dimensions.

Public methods

final float
final float

Inherited methods

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

Calculates the duration of an animation.

@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.

@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.

From androidx.compose.animation.core.VectorizedFiniteAnimationSpec
boolean

Whether or not the VectorizedAnimationSpec specifies an infinite animation.

Public constructors

VectorizedSpringSpec

public <V extends AnimationVector> VectorizedSpringSpec(
    float dampingRatio,
    float stiffness,
    V visibilityThreshold
)

Creates a VectorizedSpringSpec that uses the same spring constants (i.e. dampingRatio and stiffness on all dimensions. The optional visibilityThreshold defines when the animation should be considered to be visually close enough to target to stop. By default, Spring.DefaultDisplacementThreshold is used on all dimensions of the AnimationVector.

Parameters
float dampingRatio

damping ratio of the spring. Spring.DampingRatioNoBouncy by default.

float stiffness

stiffness of the spring. Spring.StiffnessMedium by default.

V visibilityThreshold

specifies the visibility threshold for each dimension.

Public methods

getDampingRatio

public final float getDampingRatio()

getStiffness

public final float getStiffness()