Class

InterruptionAwareAnimationSpec

A FiniteAnimationSpec that uses animationSpec for uninterrupted animations and switches to interruptionSpec when a Transition, animateValueAsState, or Animatable.animateTo animation is interrupted mid-flight.

Source set: Common
public class InterruptionAwareAnimationSpec<T>(
    public val animationSpec: FiniteAnimationSpec<T>,
    public val interruptionSpec: FiniteAnimationSpec<T> = animationSpec,
) : FiniteAnimationSpec<T>

A FiniteAnimationSpec that uses animationSpec for uninterrupted animations and switches to interruptionSpec when a Transition, animateValueAsState, or Animatable.animateTo animation is interrupted mid-flight.

When a Transition is interrupted mid-flight, most FiniteAnimationSpec implementations (such as TweenSpec or KeyframesSpec, which ignore initial velocity) fall back to a default SpringSpec to avoid abrupt velocity discontinuities. Wrapping a spec in InterruptionAwareAnimationSpec overrides this fallback so Transition instead uses interruptionSpec (which defaults to animationSpec) and passes the current in-flight value and velocity to it. Similarly, when used with Animatable.animateTo or animate*AsState APIs (such as animateFloatAsState or animateValueAsState), animationSpec is used when starting from rest and interruptionSpec is used when the target value changes while an animation is already in-flight.

Functions

vectorize

Source set: Common
override fun <V : AnimationVector> vectorize(
        converter: TwoWayConverter<T, V>
    ): VectorizedFiniteAnimationSpec<V>

equals

Source set: Common
override fun equals(other: Any?): Boolean

hashCode

Source set: Common
override fun hashCode(): Int
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: