Rotate - Vue-motion Typing CST Test
Loading…
Rotate — Vue-motion Code
Rotates a div from 0 to 360 degrees
# vue_motion/demo/App6.vue
<template>
<motion-div :initial="{ rotate: 0 }" :animate="{ rotate: 360 }" style="width:100px;height:100px;background:cyan;"></motion-div>
</template>
<script>
import { MotionDiv } from 'vue-motion'
export default {
components: { MotionDiv }
}
</script>
Vue-motion Language Guide
Vue Motion is a physics-based animation library for Vue.js that provides smooth, natural transitions using spring dynamics. It enables reactive, declarative motion tied directly to Vue’s reactivity system.
Primary Use Cases
- ▸Animating Vue component transitions
- ▸Interactive UI motions (hover, drag, scroll-based)
- ▸Animating lists, state changes, and conditional rendering
- ▸SVG and canvas-style motion in Vue
- ▸Page transitions for SPA navigation
Notable Features
- ▸Spring-based physics animations
- ▸Composable motion APIs for Vue 3
- ▸Component-based animation wrappers for Vue templates
- ▸Value interpolation for complex motions
- ▸Gesture-responsive animations
Origin & Creator
Vue Motion emerged from the Vue ecosystem around 2019-2020, inspired by libraries like React Spring and Framer Motion, and maintained by independent Vue animation contributors.
Industrial Note
Vue Motion is popular in Vue-based dashboards, admin panels, SaaS apps, and interactive UI components where physics-based, smooth animations improve usability and polish.
Quick Explain
- ▸Vue Motion uses spring physics to animate component states with realistic, natural motion.
- ▸Animations are reactive - changes in Vue state automatically trigger updated springs.
- ▸Supports transitions for entering, leaving, and list reordering.
- ▸Works with Vue 2 and Vue 3 using components and composable APIs.
- ▸Suitable for gestures, dynamic UI interactions, and fluid micro-interactions.
Core Features
- ▸useSpring for reactive animated values
- ▸Motion and MotionGroup components
- ▸Transition-based enter/exit animations
- ▸Interpolation utilities for dynamic motion
- ▸Reactive transforms, opacity, and SVG attributes
Learning Path
- ▸Learn basics of useSpring
- ▸Animate components with Motion
- ▸Master list animations with MotionGroup
- ▸Explore gesture-driven motion
- ▸Build advanced choreographed UI sequences
Practical Examples
- ▸Button hover springs
- ▸Card fade/slide on mount
- ▸Page transitions for SPA routing
- ▸Drag-and-drop elements
- ▸Animated navigation menus
Comparisons
- ▸Vue Motion vs React Spring: Similar physics engine but Vue-native.
- ▸Vue Motion vs GSAP: GSAP is timeline-based; Motion is reactive.
- ▸Vue Motion vs Framer Motion: Motion is Vue-focused, simpler.
- ▸Vue Motion vs Anime.js: Anime is DOM/SVG-focused; Motion is reactive.
- ▸Vue Motion vs Vue Transitions: Motion adds physics, interpolation, and complex motion.
Strengths
- ▸Deeply integrated with Vue reactivity
- ▸Smooth and natural physics-based motion
- ▸Template-friendly components for animations
- ▸Great for micro-interactions
- ▸Lightweight and easy to integrate
Limitations
- ▸Vue-only library
- ▸Not suitable for timeline-heavy animations
- ▸Complex 3D or WebGL animations require other tools
- ▸Less flexible than GSAP for sequenced choreography
- ▸Gesture integration varies across ecosystems
When NOT to Use
- ▸Projects requiring timeline-based animation
- ▸Heavy 3D or WebGL motion
- ▸Very simple transitions (CSS is enough)
- ▸Apps without Vue
- ▸Non-reactive animations outside Vue lifecycle
Cheat Sheet
- ▸const x = useSpring(0);
- ▸<Motion :style="{ transform: `translateX(${x.value}px)` }">
- ▸x.value = 100; // triggers spring
- ▸<MotionGroup> handles list transitions
- ▸Interpolation maps spring values to transforms/colors
FAQ
- ▸Does Vue Motion work with Vue 3? -> Yes.
- ▸Does it support gestures? -> Yes, with VueUse.
- ▸Can it animate SVG? -> Yes.
- ▸Is it lightweight? -> Very.
- ▸Does it support SSR? -> Yes, with constraints.
30-Day Skill Plan
- ▸Week 1: Spring basics
- ▸Week 2: Interpolation & binding
- ▸Week 3: Page transitions
- ▸Week 4: Gestures
- ▸Week 5: Complex interactive UI motion
Final Summary
- ▸Vue Motion brings physics-based animation to Vue.
- ▸Reactive springs animate UI components naturally.
- ▸Ideal for transitions, gestures, and interactive UX.
- ▸Lightweight and Vue-native.
- ▸A powerful alternative to GSAP and CSS transitions.
Project Structure
- ▸App.vue - main application entry
- ▸components/ - animated Vue components
- ▸motion/ - custom spring configs and helpers
- ▸views/ - page transitions
- ▸composables/ - reusable motion logic
Monetization
- ▸Animated Vue component libraries
- ▸SaaS dashboards with polished UX
- ▸Landing pages with interactive motion
- ▸Premium UI kits using Motion
- ▸Client UI animation work
Productivity Tips
- ▸Create reusable spring presets
- ▸Use MotionGroup for batch lists
- ▸Profile heavy components
- ▸Keep transforms GPU-accelerated
- ▸Integrate gestures early
Basic Concepts
- ▸useSpring - basic reactive spring animation
- ▸Motion - animated wrapper for any element
- ▸MotionGroup - staggered list transitions
- ▸Value interpolation for chained animations
- ▸Reactivity-driven animation updates