Function

keyframesWithSpline

Creates a KeyframesWithSplineSpec animation, initialized with init.

keyframesWithSpline

Source set: Common
public fun <T> keyframesWithSpline(
    init: KeyframesWithSplineSpec.KeyframesWithSplineSpecConfig<T>.() -> Unit
): KeyframesWithSplineSpec<T>

Creates a KeyframesWithSplineSpec animation, initialized with init.

For more details on implementation, see KeyframesWithSplineSpec.

Use overload that takes a Float parameter to use periodic splines.

Example:

Parameters

init Initialization function for the KeyframesWithSplineSpec animation

keyframesWithSpline

Source set: Common
public fun <T> keyframesWithSpline(
    @FloatRange(0.0, 1.0) periodicBias: Float,
    init: KeyframesWithSplineSpec.KeyframesWithSplineSpecConfig<T>.() -> Unit,
): KeyframesWithSplineSpec<T>

Creates a periodic KeyframesWithSplineSpec animation, initialized with init.

Use overload without periodicBias parameter for the non-periodic implementation.

A periodic spline is one such that the starting and ending velocities are equal. This makes them 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

Parameters

periodicBias A value from 0f to 1f, indicating how much the starting or ending velocities are modified respectively to achieve periodicity.
init Initialization function for the KeyframesWithSplineSpec animation
Jetpack Compose beyond MaterialFree components, screens and templates for apps that don’t look like Google’s. Copy them into your app, or let your coding agent add them.Browse for free

Content updated: