VectorizedSpringSpec

Class

Common
public class VectorizedSpringSpec<V : AnimationVector>
private constructor(
    public val dampingRatio: Float,
    public val stiffness: Float,
    anims: Animations,
) : VectorizedFiniteAnimationSpec<V> by VectorizedFloatAnimationSpec(anims)

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

Secondary Constructors

public constructor(
    dampingRatio: Float = Spring.DampingRatioNoBouncy,
    stiffness: Float = Spring.StiffnessMedium,
    visibilityThreshold: V? = null,
) : this(
    dampingRatio,
    stiffness,
    createSpringAnimations(visibilityThreshold, dampingRatio, stiffness),
)

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

dampingRatiodamping ratio of the spring. Spring.DampingRatioNoBouncy by default.
stiffnessstiffness of the spring. Spring.StiffnessMedium by default.
visibilityThresholdspecifies the visibility threshold for each dimension.