Source set: Common
public class VectorizedSpringSpec<V : AnimationVector> private constructor(
public val dampingRatio: Float,
public val stiffness: Float,
anims: Animations,
) : VectorizedFiniteAnimationSpec<V> by VectorizedFloatAnimationSpec(anims) {
/**
* 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].
*
* @param dampingRatio damping ratio of the spring. [Spring.DampingRatioNoBouncy] by default.
* @param stiffness stiffness of the spring. [Spring.StiffnessMedium] by default.
* @param visibilityThreshold specifies the visibility threshold for each dimension.
*/
public constructor(
dampingRatio: Float = Spring.DampingRatioNoBouncy,
stiffness: Float = Spring.StiffnessMedium,
visibilityThreshold: V? = null,
) : this(
dampingRatio,
stiffness,
createSpringAnimations(visibilityThreshold, dampingRatio, stiffness),
)
}
VectorizedSpringSpec uses spring animations to animate (each dimension of) AnimationVectors.