androidx.compose.animation.core
DecayAnimationSpec
Interface · from org.jetbrains.compose.animation:animation-core:1.12.2
No hand-written docs yet.
DecayAnimationSpec stores the specification of an animation, including 1) the data type to be animated, and 2) the animation configuration (i.e. VectorizedDecayAnimationSpec) that will be used once the data (of type T) has been converted to AnimationVector.
interface DecayAnimationSpec<T>
How to get one
Ready-made values and functions that return it
BottomAppBarScrollBehavior:flingAnimationSpecFloatingToolbarScrollBehavior:flingAnimationSpecTopAppBarScrollBehavior:flingAnimationSpec
Used by
Parameters that take a DecayAnimationSpec.
BottomAppBarDefaults.exitAlwaysScrollBehavior(flingAnimationSpec)CarouselDefaults.multiBrowseFlingBehavior(decayAnimationSpec)FloatingToolbarDefaults.exitAlwaysScrollBehavior(flingAnimationSpec)PagerDefaults.flingBehavior(decayAnimationSpec)SearchBarDefaults.enterAlwaysSearchBarScrollBehavior(flingAnimationSpec)TopAppBarDefaults.enterAlwaysScrollBehavior(flingAnimationSpec)TopAppBarDefaults.exitUntilCollapsedScrollBehavior(flingAnimationSpec)
Functions
vectorize
fun <V : AnimationVector> vectorize(typeConverter: TwoWayConverter<T, V>): VectorizedDecayAnimationSpec<V>
Creates a VectorizedDecayAnimationSpec with the given TwoWayConverter.
Library docs
DecayAnimationSpec stores the specification of an animation, including 1) the data type to be
animated, and 2) the animation configuration (i.e. VectorizedDecayAnimationSpec) 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``IntOffset.Companion.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).