Skip to content
Animation

InfiniteTransition

Loop an animation indefinitely

rememberInfiniteTransition drives one or more values that animate forever. Pair it with infiniteRepeatable and RepeatMode.Reverse to ping-pong a value back and forth — perfect for pulsing, breathing, or shimmering effects.

InfiniteTransition demos rendered in Compose Playground
Pixel-accurate preview · light theme

Examples

01

Pulse

An infinitely repeating tween reverses to pulse the alpha.

Kotlin
val transition = rememberInfiniteTransition(label = "pulse")
val alpha by transition.animateFloat(
    initialValue = 1f,
    targetValue = 0.2f,
    animationSpec = infiniteRepeatable(
        animation = tween(800),
        repeatMode = RepeatMode.Reverse
    ),
    label = "alpha"
)
Box(
    Modifier.size(96.dp).alpha(alpha)
        .clip(RoundedCornerShape(16.dp))
        .background(Color(0xFF6750A4))
)