🌈 Create new beautiful Compose Gradients with our new wesite ->
Class

FloatSpringSpec

FloatSpringSpec animation uses a spring animation to animate a Float value.

Source set: Common
public class FloatSpringSpec(
    public val dampingRatio: Float = Spring.DampingRatioNoBouncy,
    public val stiffness: Float = Spring.StiffnessMedium,
    private val visibilityThreshold: Float = Spring.DefaultDisplacementThreshold,
) : FloatAnimationSpec

FloatSpringSpec animation uses a spring animation to animate a Float value. Its configuration can be tuned via adjusting the spring parameters, namely damping ratio and stiffness.

Parameters

dampingRatio damping ratio of the spring. Defaults to Spring.DampingRatioNoBouncy
stiffness Stiffness of the spring. Defaults to Spring.StiffnessMedium
visibilityThreshold The value threshold such that the animation is no longer significant. e.g. 1px for translation animations. Defaults to Spring.DefaultDisplacementThreshold

Functions

getValueFromNanos

Source set: Common
override fun getValueFromNanos(
        playTimeNanos: Long,
        initialValue: Float,
        targetValue: Float,
        initialVelocity: Float,
    ): Float

getVelocityFromNanos

Source set: Common
override fun getVelocityFromNanos(
        playTimeNanos: Long,
        initialValue: Float,
        targetValue: Float,
        initialVelocity: Float,
    ): Float

getEndVelocity

Source set: Common
override fun getEndVelocity(
        initialValue: Float,
        targetValue: Float,
        initialVelocity: Float,
    ): Float

getDurationNanos

Source set: Common
override fun getDurationNanos(
        initialValue: Float,
        targetValue: Float,
        initialVelocity: Float,
    ): Long