Known direct subclasses
FiniteAnimationSpec

FiniteAnimationSpec is the interface that all non-infinite AnimationSpecs implement, including: TweenSpec, SpringSpec, KeyframesSpec, RepeatableSpec, SnapSpec, etc.

FloatAnimationSpec

FloatAnimationSpec interface is similar to VectorizedAnimationSpec, except it deals exclusively with floats.

InfiniteRepeatableSpec

InfiniteRepeatableSpec repeats the provided animation infinite amount of times.

Known indirect subclasses
ArcAnimationSpec

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

DurationBasedAnimationSpec

This describes AnimationSpecs that are based on a fixed duration, such as KeyframesSpec, TweenSpec, and SnapSpec.

FloatSpringSpec

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

FloatTweenSpec

FloatTweenSpec animates a Float value from any start value to any end value using a provided easing function.

KeyframesSpec

KeyframesSpec creates a VectorizedKeyframesSpec animation.

KeyframesWithSplineSpec

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

RepeatableSpec

RepeatableSpec takes another DurationBasedAnimationSpec and plays it iterations times.

SnapSpec

SnapSpec describes a jump-cut type of animation.

SpringSpec

Creates a SpringSpec that uses the given spring constants (i.e. dampingRatio and stiffness.

TweenSpec

Creates a TweenSpec configured with the given duration, delay, and easing curve.


AnimationSpec stores the specification of an animation, including 1) the data type to be animated, and 2) the animation configuration (i.e. VectorizedAnimationSpec) that will be used once the data (of type T) has been converted to AnimationVector.

Any type T can be animated by the system as long as a TwoWayConverter is supplied to convert the data type T from and to an AnimationVector. There are a number of converters available out of the box. For example, to animate androidx.compose.ui.unit.IntOffset the system uses IntOffset.VectorConverter to convert the object to AnimationVector2D, so that both x and y dimensions are animated independently with separate velocity tracking. This enables multidimensional objects to be animated in a true multi-dimensional way. It is particularly useful for smoothly handling animation interruptions (such as when the target changes during the animation).

Summary

Public functions

VectorizedAnimationSpec<V>
<V : AnimationVector> vectorize(converter: TwoWayConverter<T, V>)

Creates a VectorizedAnimationSpec with the given TwoWayConverter.

Cmn

Public functions

vectorize

fun <V : AnimationVector> vectorize(converter: TwoWayConverter<T, V>): VectorizedAnimationSpec<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