DurationBasedAnimationSpec that interpolates 2-dimensional values using arcs of quarter of an Ellipse.

To interpolate with keyframes use KeyframesSpecConfig.using with an ArcMode.

 

As such, it's recommended that ArcAnimationSpec is only used for positional values such as: Offset, IntOffset or androidx.compose.ui.unit.DpOffset.

 

The orientation of the arc is indicated by the given mode.

Do note, that if the target value being animated only changes in one dimension, you'll only be able to get a linear curve.

Similarly, one-dimensional values will always only interpolate on a linear curve.

import androidx.compose.animation.core.ArcAnimationSpec
import androidx.compose.animation.core.ArcMode.Companion.ArcAbove
import androidx.compose.ui.geometry.Offset

// Will interpolate the Offset in arcs such that the curve of the quarter of an Ellipse is above
// the center.
ArcAnimationSpec<Offset>(mode = ArcAbove)
See also
ArcMode
keyframes

Summary

Public constructors

<T : Any?> ArcAnimationSpec(
    mode: ArcMode,
    durationMillis: Int,
    delayMillis: Int,
    easing: Easing
)
Cmn

Public functions

open operator Boolean
equals(other: Any?)
Cmn
open Int
Cmn
open VectorizedDurationBasedAnimationSpec<V>
<V : AnimationVector> vectorize(converter: TwoWayConverter<T, V>)

Creates a VectorizedAnimationSpec with the given TwoWayConverter.

Cmn

Public properties

Int

Time the animation waits before starting.

Cmn
Int

Duration of the animation.

Cmn
Easing

Easing applied on the animation curve.

Cmn
ArcMode

Orientation of the arc.

Cmn

Public constructors

ArcAnimationSpec

<T : Any?> ArcAnimationSpec(
    mode: ArcMode = ArcBelow,
    durationMillis: Int = DefaultDurationMillis,
    delayMillis: Int = 0,
    easing: Easing = FastOutSlowInEasing
)
Parameters
mode: ArcMode = ArcBelow

Orientation of the arc.

durationMillis: Int = DefaultDurationMillis

Duration of the animation. DefaultDurationMillis by default.

delayMillis: Int = 0

Time the animation waits before starting. 0 by default.

easing: Easing = FastOutSlowInEasing

Easing applied on the animation curve. FastOutSlowInEasing by default.

Public functions

equals

open operator fun equals(other: Any?): Boolean

hashCode

open fun hashCode(): Int

vectorize

open fun <V : AnimationVector> vectorize(converter: TwoWayConverter<T, V>): VectorizedDurationBasedAnimationSpec<V>

Creates a VectorizedAnimationSpec with the given TwoWayConverter.

The underlying animation system operates on AnimationVectors. T will be converted to AnimationVector to animate. VectorizedAnimationSpec describes how the converted AnimationVector should be animated. E.g. The animation could simply interpolate between the start and end values (i.e.TweenSpec), or apply spring physics to produce the motion (i.e. SpringSpec), etc)

Parameters
converter: TwoWayConverter<T, V>

converts the type T from and to AnimationVector type

Public properties

delayMillis

val delayMillisInt

Time the animation waits before starting. 0 by default.

durationMillis

val durationMillisInt

Duration of the animation. DefaultDurationMillis by default.

easing

val easingEasing

Easing applied on the animation curve. FastOutSlowInEasing by default.

mode

val modeArcMode

Orientation of the arc.