Capítulo 125 de 142

Chapter 125: Vue animations with Motion for Vue

Core Idea

Animate UIs in Motion for Vue with motion components. Animate CSS, transforms, & SVGs. Use variants for orchestration, gestures, and keyframes.

Key Concepts

  • Basic animations: You'll perform almost all animations on a <motion /> component.
  • Animatable values: Motion can animate any CSS value
  • Value type conversion: In general
  • Transforms: Unlike CSS
  • Transform origin: transform-origin has three shortcut values that can be set and animated individually:
  • CSS variables: Motion for Vue can animate the value of CSS variables
  • Animating CSS variables: Sometimes it's convenient to be able to animate a CSS variable to animate many children:
  • CSS variables as animation targets: HTML motion components accept animation targets with CSS variables:
  • SVG line drawing: Line drawing animations can be created with many different SVG elements using three specia

Code Examples

import { motion } from "motion-v"
  • What it demonstrates: Core usage pattern for Vue animations with Motion for Vue.

Key Takeaways

  1. Numbers: 0, 100 etc.
  2. Strings containing numbers: "0vh", "10px" etc.
  3. Colors: Hex, RGBA, HSLA.
  4. Complex strings containing multiple numbers and/or colors (like box-shadow).
  5. display: "none"/"block" and visibility: "hidden"/"visible".

Connects To

  • Vue <motion /> component: related Motion doc page.
  • Motion values: related Motion doc page.
  • Vue transitions: related Motion doc page.
  • AnimatePresence: related Motion doc page.
  • useAnimate: related Motion doc page.