An animation created with
Spring(), InterpolatingSpring(), EaseIn(), EaseInOut(), EaseOut(), Linear(), Bouncy(), or Snappy(). If omitted, a default spring animation is used.A function containing state mutations. All UI changes resulting from these mutations will be animated.
Returns
AComponent that executes the body function within the animation context.
Usage
Default animation
With a spring animation
With an easing curve
Notes
- Multiple state changes within the same
withAnimationblock are batched into a single animated transition. - The animation context applies to all UI changes resulting from the state mutations, not just the direct parent view.
- If no animation is specified, a default spring animation is used.
- For details on available animation constructors and their options, see animations.
See Also
- animations — all animation constructors and chainable modifiers
- useState — component-local state