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

KeyframesWithSplineSpec

KeyframesWithSplineSpec creates a keyframe based DurationBasedAnimationSpec using the Monotone cubic Hermite spline to interpolate between the values in config.

Source set: Common
public class KeyframesWithSplineSpec<T>(public val config: KeyframesWithSplineSpecConfig<T>) :
    DurationBasedAnimationSpec<T>

KeyframesWithSplineSpec creates a keyframe based DurationBasedAnimationSpec using the Monotone cubic Hermite spline to interpolate between the values in config.

KeyframesWithSplineSpec may be used to animate any n-dimensional values, but you'll likely use it most to animate positional 2D values such as Offset. For example:

You may also provide a periodicBias value (between 0f and 1f) to make a periodic spline. Periodic splines adjust the initial and final velocity to be the same. This is useful to create smooth repeatable animations. Such as an infinite pulsating animation:

The periodicBias value (from 0.0 to 1.0) indicates how much of the original starting and final velocity are modified to achieve periodicity:

  • 0f: Modifies only the starting velocity to match the final velocity
  • 1f: Modifies only the final velocity to match the starting velocity
  • 0.5f: Modifies both velocities equally, picking the average between the two

Functions

vectorize

Source set: Common
override fun <V : AnimationVector> vectorize(
        converter: TwoWayConverter<T, V>
    ): VectorizedDurationBasedAnimationSpec<V>

Members

KeyframesWithSplineSpecConfig

Source set: Common
public class KeyframesWithSplineSpecConfig<T> :
        KeyframesSpecBaseConfig<T, KeyframesSpec.KeyframeEntity<T>>()

Keyframe configuration class for KeyframesWithSplineSpec.

Since keyframesWithSpline uses the values across all the given intervals to calculate the shape of the animation, KeyframesWithSplineSpecConfig does not allow setting a specific ArcMode between intervals (compared to KeyframesSpecConfig used for keyframes).

Functions

createEntityFor

Source set: Common
override fun createEntityFor(value: T): KeyframesSpec.KeyframeEntity<T>