Animations & Transitions
Use declarative, native-thread animations to give feedback, show relationships between screens and guide attention without hurting frame rate.
Intermediate · about 7 hours · difficulty 3/5
Learn first: Components, Props & Styling, Navigation Patterns
Motion on mobile is functional: it confirms a tap, shows where a sheet came from, and hides loading. The rule of thumb is short, purposeful and interruptible (roughly 150 to 350 ms for most UI changes).
The frame budget
Screens refresh 60 to 120 times a second, so each frame has about 16 ms (or 8 ms at 120 Hz). Animations that run on the JavaScript or main thread stutter whenever that thread is busy. Prefer engines that run animation work on the UI or render thread.
Tools by stack
- React Native: Reanimated runs animations as worklets on the UI thread:
const x = useSharedValue(0); x.value = withSpring(100);then read it inuseAnimatedStyle. Layout animations (entering,exiting) animate mounts and unmounts. The built-inAnimatedAPI works withuseNativeDriver: truefor transform and opacity. - Flutter: implicit widgets (
AnimatedContainer,AnimatedOpacity) for simple cases,AnimationControllerplusTweenfor explicit control, andHerofor shared elements. - Compose:
animate*AsState,AnimatedVisibility,updateTransitionandSharedTransitionLayout. - SwiftUI:
withAnimation { },.animation(_:value:),matchedGeometryEffectandPhaseAnimator.
What to animate
Animate transform and opacity, which are cheap. Animating width, height or layout triggers re-layout every frame. Use springs for natural motion, and respect the system Reduce Motion setting by shortening or removing non-essential animation.
Vector animations
Lottie plays After Effects exports on every platform, handy for onboarding and empty states. Keep files small and avoid them in long lists.
Good enough to move on: you can animate a card expanding into a detail view at a steady frame rate and turn it off when Reduce Motion is on.
Key concepts
- Frame budget and UI thread
- Reanimated shared values: React Native
- Implicit vs explicit animations
- Layout and enter/exit animations
- Shared element transitions
- Spring physics and easing
- Reduce Motion support
- Lottie vector animations
Mini project
Build a product grid where tapping a card smoothly expands it into a detail screen, list items animate in on mount, and all motion is reduced when the system setting is on.
Check yourself
Why does animating translateX usually stay smooth while animating width can drop frames, and what thread should an animation ideally run on?
Free resources
- React Native Reanimated (Software Mansion)
- Flutter: Introduction to animations (Flutter)
- Compose: Animations (Android Developers)