Google is committed to advancing racial equity for Black communities. See how.

SnapSpec

@Immutable class SnapSpec<T> : AnimationSpec<T>
kotlin.Any
   ↳ androidx.compose.animation.core.SnapSpec

SnapSpec describes a jump-cut type of animation. It immediately snaps the animating value to the end value.

Summary

Public constructors
<init>(delay: Int = 0)

SnapSpec describes a jump-cut type of animation.

Public methods
VectorizedDurationBasedAnimationSpec<V>
vectorize(converter: TwoWayConverter<T, V>)

Creates a VectorizedAnimationSpec with the given TwoWayConverter.

Properties
Int

the amount of time (in milliseconds) that the animation should wait before it starts.

Public constructors

<init>

SnapSpec(delay: Int = 0)

SnapSpec describes a jump-cut type of animation. It immediately snaps the animating value to the end value.

Parameters
delay: Int = 0 the amount of time (in milliseconds) that the animation should wait before it starts. Defaults to 0.

Public methods

vectorize

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

Properties

delay

val delay: Int

the amount of time (in milliseconds) that the animation should wait before it starts. Defaults to 0.