0PricingLogin
Jetpack Compose Academy · Lesson

animate*AsState for Simple Tweens

Animate a single value automatically.

Animation, the Easy Way

Compose can animate changes for you. The simplest tool is the animate*AsState family, which smoothly moves a value from old to new. ✨

What animateDpAsState Does

When your target value changes, animateDpAsState returns a State that glides toward it over a few frames instead of jumping.

val size by animateDpAsState(targetValue = if (big) 200.dp else 100.dp)

All lessons in this course

  1. animate*AsState for Simple Tweens
  2. AnimatedVisibility & Crossfade
  3. updateTransition for Coordinated Motion
  4. Gesture-Driven Animations
← Back to Jetpack Compose Academy