# 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.

## Code Examples

### InterruptionAwareAnimationSpecSample

```kotlin
@Sampled
@Composable
fun InterruptionAwareAnimationSpecSample(expanded: Boolean) {
    // Use a 300ms tween for regular transitions, and a shorter 100ms tween when the transition
    // is interrupted mid-flight instead of falling back to a default spring.
    val transition = updateTransition(targetState = expanded, label = "BoxExpansion")
    val size by
        transition.animateDp(
            transitionSpec = {
                InterruptionAwareAnimationSpec(
                    animationSpec = tween(durationMillis = 300),
                    interruptionSpec = tween(durationMillis = 100),
                )
            },
            label = "Size",
        ) { isExpanded ->
            if (isExpanded) 120.dp else 48.dp
        }
    Box(Modifier.size(size).background(Color.Blue))
}
```
