mcpField
M
motion

motion

github.com/onmax设计与 UI7232.3k 次安装今天更新
代码仓库

关于 motion

Motion Vue 是面向 Vue 3 和 Nuxt 的动画库,本技能为开发者提供组件、组合式函数、手势及动画模式的专项参考。

主要功能

  1. 01Motion 组件指南
  2. 02手势与布局动画参考
  3. 03组合式函数用法指南
  4. 04按任务选择参考资料

适用场景

  1. 01添加淡入、滑动或缩放效果
  2. 02构建悬停、点击或拖动交互
  3. 03创建滚动联动或布局动画

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/onmax/nuxt-skills --skill motion

安装后在 Claude Code 中输入/motion确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

references/
components.md
composables.md
examples.md

详细介绍

Motion Vue (motion-v)

适用于 Vue 3 和 Nuxt 的动画库。可用于生产环境的硬件加速动画,且打包体积极小。

当前稳定版本: motion-v 1.x - Motion(前身为 Framer Motion)的 Vue 移植版

概述

Motion Vue 动画的渐进式参考。仅加载与当前任务相关的文件(基础内容约 200 个 token,每个子文件约 500–1500 个 token)。

适用场景

适合使用 Motion Vue 的场景:

  • 简单的声明式动画(淡入、滑动、缩放)
  • 基于手势的交互(悬停、轻触、拖动)
  • 与滚动关联的动画
  • 布局动画和共享元素过渡
  • 弹簧物理动画

可考虑的替代方案:

  • GSAP - 复杂时间轴、SVG 变形、滚动触发的动画序列
  • @vueuse/motion - API 更简单、功能较少、打包体积更小
  • CSS animations - 无需 JS 的简单过渡效果

安装

# Vue 3
pnpm add motion-v

# Nuxt 3
pnpm add motion-v @vueuse/nuxt
// nuxt.config.ts - Nuxt 3 setup
export default defineNuxtConfig({
  modules: ['motion-v/nuxt'],
})

快速参考

开发内容加载文件
Motion 组件、手势references/components.md
useMotionValue、useScrollreferences/composables.md
动画示例、模式references/examples.md

加载文件

请根据任务考虑加载以下参考文件:

请勿一次性加载所有文件。 仅加载与当前任务相关的文件。

核心概念

Motion 组件

渲染具备动画功能的任意 HTML/SVG 元素:

<script setup lang="ts">
import { motion } from 'motion-v'
</script>

<template>
  <motion.div
    :initial="{ opacity: 0, y: 20 }"
    :animate="{ opacity: 1, y: 0 }"
    :exit="{ opacity: 0, y: -20 }"
    :transition="{ duration: 0.3 }"
  >
    Animated content
  </motion.div>
</template>
手势动画
<motion.button
  :whileHover="{ scale: 1.05 }"
  :whilePress="{ scale: 0.95 }"
  :transition="{ type: 'spring', stiffness: 400 }"
>
  Click me
</motion.button>
滚动动画
<motion.div
  :initial="{ opacity: 0 }"
  :whileInView="{ opacity: 1 }"
  :viewport="{ once: true, margin: '-100px' }"
>
  Appears on scroll
</motion.div>

可用指南

references/components.md - Motion 组件变体、动画属性、手势属性、布局动画、过渡配置

references/composables.md - useMotionValue、useSpring、useTransform、useScroll、useInView、animate()

references/examples.md - 外部资源、组件库、动画模式和灵感

评论

支持 Markdown