Communitygithub.com

NeverSight/learn-skills.dev

使用 Motion.dev(Framer Motion 继承者)为 React、Next.js、Svelte 和 Astro 项目创建 120fps GPU 加速动画。用于需求动画、动效、滚动效果、视差、Hero 动画、手势、拖拽交互、弹簧物理、whileHover 效果、whileInView 动画、动画 UI、微交互、页面过渡或布局动画时。生成生产级 TypeScript/JSX 代码,包含无障碍(prefers-reduced-motion)和性能验证(≥60fps)。支持入场动画、手势交互(悬停/点击/拖拽)、基于滚动的揭示和布局过渡,使用弹簧物理和自然时序。不要用于纯 CSS 过渡(使用原生 CSS)、无 JavaScript 的静态网站、Vue 动画(应使用 motion-v 变体)或 SVG/Canvas 复杂动画(GSAP 更适合)。

learn-skills.dev 是什么?

这是一个面向 React 19+/Next.js 15+/Svelte 5+/Astro 4+ 等现代前端框架的动画技能,基于 Motion.dev(Framer Motion 的继承者,月下载量超 1000 万)构建。该技能能够生成 120fps GPU 加速的动画效果,涵盖入场动画、手势交互(悬停、点击、拖拽)、基于滚动的视差揭示以及布局过渡等多种类型。它遵循 Apple/Jon Ive 设计理念,强调动画的有目的性、流畅性、无障碍和性能优化。技能提供清晰的四步工作流(需求澄清→策略规划→分阶段实施→质量验证),并附有动画模式决策树、API 快速参考、框架集成指南、常见模式(如淡入上升、悬停卡片、滚动揭示)以及完整的示例库和参考文档。最终代码会内置 prefers-reduced-motion 降级方案,并通过 Chrome DevTools 和 Lighthouse 进行性能(≥60fps)和无障碍(CLS=0)验证。

兼容平台✓Claude Code~Codex CLI✓Cursor
npx skills add https://github.com/NeverSight/learn-skills.dev/tree/HEAD/data/skills-md/199-biotechnologies/motion-dev-animations-skill/motion-dev-animations

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

Motion Dev 动画

Motion.dev - 月下载量超 1000 万,Framer Motion 的继承者 为 React、Next.js、Svelte、Astro、Vue 提供 120fps GPU 加速动画

目的

使用 Motion.dev 生成符合 Apple/Jon Ive 原则的生产级动画: 有目的性(服务于功能)| 流畅(120fps)| 无障碍(减少动效)| 高性能(仅 GPU)| 优雅(微妙)| 一致(统一时序)

何时使用

✅ 适用场景:

  • React 19+/Next.js 15+/Svelte 5+/Astro 4+ 动画实现
  • 滚动效果(视差、揭示)、手势(悬停、拖拽、点击)、布局动画
  • 需要 60fps+ 性能的 Hero 区块、卡片、微交互
  • 需要弹簧物理、自然动效、无障碍性的项目

❌ 不适用场景:

  • 纯 CSS 过渡(使用原生 transition 属性)
  • 无 JavaScript 框架的静态网站
  • Vue 项目(使用 motion-v 包 - 不同 API)
  • SVG/Canvas 复杂动画(GSAP 更适合)
  • 纯表单 CRUD 应用(过度使用)

工作流:澄清 → 规划 → 实现 → 验证

步骤 1:澄清需求

确定项目上下文和动画目标:

  • 框架(React 19+、Next.js 15+、Svelte 5+、Astro 4+)
  • 动画类型(入场、手势、滚动、布局)
  • 设计目标(微妙、突出、趣味、专业)
  • 性能约束(目标设备、包大小限制、无障碍要求)
  • 触发机制(挂载、视口、用户交互)

步骤 2:规划动画策略

定义实现方法:

  • 要动画化的组件(标题、卡片、按钮、区块)
  • 动效模式(淡入、滑动、缩放、弹簧、视差)
  • 时序规格(持续时间、延迟、交错间隔)
  • 物理参数(刚度:300-400、阻尼:20、质量:1)
  • 无障碍降级(prefers-reduced-motion 替代方案)

步骤 3:分阶段实现

逐步构建动画:

  • 设置:安装 Motion.dev,配置导入,准备组件结构
  • 核心动画:应用动效属性(initial、animate、transition)
  • 细化:调整时序、缓动曲线、弹簧物理以达到自然效果
  • 无障碍:添加减少动效检测、键盘导航支持
  • 优化:验证 GPU 加速、减少包大小、测试性能

步骤 4:验证质量标准

根据要求检查:

  • 性能:≥60fps(Chrome DevTools → Performance 选项卡)
  • 布局稳定性:CLS = 0(Lighthouse 审计)
  • 无障碍:遵循 prefers-reduced-motion(系统设置测试)
  • 键盘导航:所有交互元素可通过键盘访问
  • 移动端响应:触摸友好手势,已在 iOS/Android 上测试

动画模式决策树

INPUT: 哪些元素需要动画?

├─ 入场(页面加载、挂载)
│   → 模式:initial={{opacity: 0, y: 20}} animate={{opacity: 1, y: 0}}
│   → 时序:0.6-0.8s, ease: [0.22, 1, 0.36, 1]
│   → 交错:元素之间 0.1-0.2s
│   → 示例:./examples/hero-fade-up.md
│
├─ 手势(悬停、点击、拖拽)
│   → 模式:whileHover={{scale: 1.05}}, whileTap={{scale: 0.95}}
│   → 物理:Spring(刚度:300-400、阻尼:20)
│   → 时序:即时响应(无持续时间)
│   → 示例:./examples/card-hover.md、./examples/magnetic-button.md
│
├─ 滚动(揭示、视差)
│   → 模式:whileInView + viewport 或 useScroll + useTransform
│   → 触发:viewport={{once: true, amount: 0.3}}
│   → 性能:仅 transform/opacity
│   → 示例:./examples/scroll-reveal.md、./examples/parallax-layers.md
│
└─ 布局(重排序、展开)
    → 模式:layout 属性(自动 FLIP)
    → 共享:layoutId="id" 用于变形
    → 注意事项:仅动画化 transforms

API 快速参考

组件/钩子用法何时使用
motion.div<motion.div animate={{x: 100}}>基础动画
whileHoverwhileHover={{scale: 1.05}}悬停状态(0.2-0.3s)
whileTapwhileTap={{scale: 0.95}}点击反馈
whileInViewwhileInView={{opacity: 1}}滚动揭示
dragdrag="x" dragConstraints可拖拽元素
layout<motion.div layout />自动 FLIP 动画
useScroll跟踪滚动进度视差、进度条
useTransform映射值滚动联动效果
useSpring弹簧物理平滑值变化
useInView视口检测触发动画

完整 API:详见 完整 API 参考

框架集成

框架导入组件退出动画
React/Next.js"motion/react"<motion.div><AnimatePresence>
Svelte"motion"原生 API不适用
Astro"motion"客户端脚本不适用
Vue"motion-v"<motion.div>与 React 类似

质量标准

类别要求验证方式
性能≥60fpsChrome DevTools → Performance
GPU 加速仅 transform/opacity无 width/height/left/top
包大小<50KBwebpack-bundle-analyzer
无障碍prefers-reduced-motion系统设置测试
移动端触摸友好iOS/Android 测试
布局偏移CLS = 0Lighthouse 审计

示例库(渐进式加载)

根据动画类型按需加载:

Hero 区块

  • Hero 淡入上升 - 经典 Apple 风格入场
  • Hero 交错 - 编排元素
  • Hero 文字分割 - 字符揭示

滚动效果

手势与交互

布局动画

  • 列表重排序 - 拖拽重排序 FLIP
  • 手风琴 - 展开/折叠
  • 标签切换 - 共享布局

完整示例:./examples/ 目录下所有文件

参考文档(按需加载)

  • 完整 API 参考 - 所有组件、钩子、属性
  • 弹簧物理指南 - 调整刚度、阻尼、质量
  • 性能优化 - GPU、will-change、懒加载
  • 无障碍指南 - 减少动效、键盘、屏幕阅读器
  • 故障排查 - 常见问题与解决方案
  • Framer Motion 迁移 - 升级指南

模板(生产就绪)

  • Next.js 页面模板 - Hero + 特性 + 推荐
  • 组件库 - 10 个以上可复用组件
  • 滚动模板 - 视差 + 揭示模式
  • 仪表板模板 - 交互式卡片、图表

安装

# React/Next.js/Svelte/Astro
npm install motion

# Vue
npm install motion-v

常用模式(可直接复制使用)

模式 1:淡入上升入场

<motion.div
  initial={{ opacity: 0, y: 20 }}
  animate={{ opacity: 1, y: 0 }}
  transition={{ duration: 0.6, ease: [0.22, 1, 0.36, 1] }}
/>

模式 2:悬停卡片

<motion.div
  whileHover={{ y: -8, boxShadow: "0 20px 40px rgba(0,0,0,0.12)" }}
  transition={{ type: "spring", stiffness: 300, damping: 20 }}
/>

模式 3:滚动揭示

<motion.div
  initial={{ opacity: 0, y: 50 }}
  whileInView={{ opacity: 1, y: 0 }}
  viewport={{ once: true, amount: 0.3 }}
/>

更多模式:交错列表、退出动画、布局过渡 → ./examples/ 目录

错误处理

问题解决方案
动画未触发检查 initial ≠ animate 值
性能差仅使用 transform/opacity + will-change CSS
布局偏移设置显式尺寸,使用 layout 属性
退出动画不工作包裹 <AnimatePresence>,添加 key 属性

实现最佳实践

  1. 从简开始 → 从淡入 + 滑动构建,逐步增加复杂性
  2. 提取变体 → 将动画状态定义为命名的变体以便维护
  3. 优先使用弹簧物理 → 默认使用弹簧过渡(比 tweens 更自然)
  4. 列表项交错 → 使用 staggerChildren(0.1-0.2s)来实现节奏和层次
  5. 充分测试移动端 → 在 iOS/Android 设备上验证触摸手势和性能
  6. 包含减少动效 → 始终提供 prefers-reduced-motion 降级动画
  7. 分析性能 → 使用 Chrome DevTools Performance 选项卡,目标 ≥60fps

设计理念(Apple/Jon Ive 原则)

将这些设计原则应用于所有动画:

  • 简洁:使用 200-400ms 持续时间,最小化并发动效,优先使用 transform 属性
  • 自然物理:实现基于弹簧的过渡,避免线性缓动,应用基于质量的运动
  • 有目的的动作:引导用户注意力,提供交互反馈,建立视觉层次
  • 优雅克制:应用“少即是多”原则,保持一致的时序,尊重用户动效偏好

验证

关于结构化输出验证,请参见:

元数据

版本:3.0.0(研究驱动优化) 优化:命令式语言、少样本模式(3 个示例)、层次复杂性、渐进式加载 Token 效率:核心缩减 87%(15K → 2K)+ 自动缓存 Motion.dev:v11+ 框架:React 19+、Next.js 15+、Svelte 5+、Astro 4+、Vue 3+ 研究:arXiv 2402.07927v1、2211.01910、2310.14735v5、PubMed 40334089 许可证:MIT

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

NeverSight/learn-skills.dev

Use when generating or modifying Remotion video code, creating demo videos, or working with the demo-video/ directory

NeverSight/learn-skills.dev

Create AI avatar and talking head videos via inference.sh CLI. Recommended: P-Video-Avatar (fastest, cheapest, built-in TTS). Also: OmniHuman, Fabric, PixVerse. Audio: Inworld TTS-2 (100+ languages, emotion steering for characters), ElevenLabs, Kokoro. Capabilities: audio-driven avatars, text-to-avatar, lipsync videos, talking head generation, virtual presenters, UGC content. Use for: AI presenters, explainer videos, virtual influencers, dubbing, marketing videos, UGC ads, gaming avatars, NPC dialogue. Triggers: ai avatar, talking head, lipsync, avatar video, virtual presenter, ai spokesperson, audio driven video, heygen alternative, synthesia alternative, talking avatar, lip sync, video avatar, ai presenter, digital human, ugc, ugc video, ugc ad, avatar ugc

NeverSight/learn-skills.dev

Create AI marketing videos for ads, promos, product launches, and brand content. Models: Veo, Seedance, Wan, FLUX for visuals, Kokoro for voiceover. Types: product demos, testimonials, explainers, social ads, brand videos. Use for: Facebook ads, YouTube ads, product launches, brand awareness. Triggers: marketing video, ad video, promo video, commercial, brand video, product video, explainer video, ad creative, video ad, facebook ad video, youtube ad, instagram ad, tiktok ad, promotional video, launch video

NeverSight/learn-skills.dev

Generate AI videos with Google Veo, Seedance 2.0, HappyHorse, Wan, Grok and 40+ models via inference.sh CLI. Models: Veo 3.1, Veo 3, Seedance 2.0, HappyHorse 1.0, Wan 2.5, Grok Imagine Video, OmniHuman, Fabric, HunyuanVideo. Capabilities: text-to-video, image-to-video, reference-to-video, video editing, lipsync, avatar animation, video upscaling, foley sound. Use for: social media videos, marketing content, explainer videos, product demos, AI avatars. Triggers: video generation, ai video, text to video, image to video, veo, animate image, video from image, ai animation, video generator, generate video, t2v, i2v, ai video maker, create video with ai, runway alternative, pika alternative, sora alternative, kling alternative, seedance, happyhorse

NeverSight/learn-skills.dev

ElevenLabs automatic dubbing - translate and dub audio/video into 29 languages while preserving speaker voice via inference.sh CLI. Capabilities: auto speaker detection, voice-preserving translation, video dubbing, audio localization. Use for: content localization, video translation, multilingual content, international distribution. Triggers: dubbing, dub video, translate audio, video translation, audio translation, localize content, elevenlabs dubbing, eleven labs dub, multilingual dub, voice translation, auto dub, language dub, content localization

NeverSight/learn-skills.dev

Explainer video production guide: scripting, voiceover, visuals, and assembly. Covers script formulas, pacing rules, scene planning, and multi-tool pipelines. Use for: product demos, how-it-works videos, onboarding videos, social explainers. Triggers: explainer video, how to make explainer, product video, demo video, video production, video script, animated explainer, product demo video, tutorial video, onboarding video, walkthrough video, video pipeline

NeverSight/learn-skills.dev

Still-to-video conversion guide: model selection, motion prompting, and camera movement. Covers Wan 2.5 i2v, Seedance, Fabric, Grok Video with when to use each. Use for: animating images, creating video from stills, adding motion, product animations. Triggers: image to video, i2v, animate image, still to video, add motion to image, image animation, photo to video, animate still, wan i2v, image2video, bring image to life, animate photo, motion from image

NeverSight/learn-skills.dev

Generate talking head avatar videos with Pruna P-Video-Avatar via inference.sh CLI. Turn a portrait image into a realistic speaking video with built-in TTS. 18x faster and 6x cheaper than competitors. Models: P-Video-Avatar, P-Image (for portrait generation). Capabilities: text-to-avatar, audio-driven avatars, 30 voices, 10 languages, 720p/1080p, built-in TTS, dynamic backgrounds, full-body control. Use for: AI presenters, product demos, explainer videos, virtual influencers, marketing, education, multilingual content, UGC, gaming avatars. Triggers: avatar video, talking head, ai avatar, p-video-avatar, pruna avatar, video avatar, ai presenter, digital human, virtual presenter, lipsync, talking avatar, ai spokesperson, heygen alternative, synthesia alternative, veed alternative, fabric alternative, omnihuman alternative

NeverSight/learn-skills.dev

Generate videos with Pruna P-Video and WAN models via inference.sh CLI. Models: P-Video, WAN-T2V, WAN-I2V. Capabilities: text-to-video, image-to-video, audio support, 720p/1080p, fast inference. Pruna optimizes models for speed without quality loss. Triggers: pruna video, p-video, pruna ai video, fast video generation, optimized video, wan t2v, wan i2v, economic video generation, cheap video generation, pruna text to video, pruna image to video

NeverSight/learn-skills.dev

Render videos from React/Remotion component code via inference.sh. Pass TSX code, get MP4. Supports all Remotion APIs: useCurrentFrame, useVideoConfig, spring, interpolate, AbsoluteFill, Sequence. Configurable resolution, FPS, duration, codec. Use for: programmatic video generation, animated graphics, motion design, data-driven videos, React animations to video. Triggers: remotion, render video from code, tsx to video, react video, programmatic video, remotion render, code to video, animated video, motion graphics code, react animation video

NeverSight/learn-skills.dev

Video ad creation with exact platform-specific specs for TikTok, Instagram, YouTube, Facebook, LinkedIn. Covers dimensions, duration limits, AIDA framework, and caption requirements. Use for: video ads, social media ads, paid media creative, video marketing, ad production. Triggers: video ad, social media ad, tiktok ad, instagram ad, youtube ad, facebook ad, linkedin ad, video creative, ad specs, paid media, video marketing, ad production, reels ad, stories ad, pre roll, bumper ad

NeverSight/learn-skills.dev

Best practices and techniques for writing effective AI video generation prompts. Covers: Veo, Seedance, Wan, Grok, Kling, Runway, Pika, Sora prompting strategies. Learn: shot types, camera movements, lighting, pacing, style keywords, negative prompts. Use for: improving video quality, getting consistent results, professional video prompts. Triggers: video prompt, how to prompt video, veo prompts, video generation tips, better ai video, video prompt engineering, video prompt guide, video prompt template, ai video tips, video prompt best practices, video prompt examples, cinematography prompts

NeverSight/learn-skills.dev

YouTube thumbnail design with specific dimensions, contrast rules, and mobile preview optimization. Covers safe zones, text placement, face expression psychology, and A/B testing. Use for: YouTube thumbnails, video cover images, click-through optimization. Triggers: youtube thumbnail, thumbnail design, video thumbnail, click through rate, ctr optimization, youtube cover, video cover image, thumbnail maker, thumbnail tips, youtube design, video preview image

NeverSight/learn-skills.dev

Landing page conversion optimization with layout rules, hero section design, and CTA psychology. Covers above-the-fold formula, social proof placement, mobile design, and F-pattern reading. Use for: startup landing pages, product pages, SaaS marketing, conversion optimization. Triggers: landing page, hero section, above the fold, conversion optimization, landing page design, cta button, hero image, landing page layout, saas landing page, product page design, conversion rate, landing page best practices

NeverSight/learn-skills.dev

Configure and use the hosted YouTube Data MCP end-to-end with minimal user input. Use when users want the agent to verify Node.js and `npx`, configure MCP server config (Windows/macOS, Cursor/Codex/OpenClaw/OpenCode), request API key at setup time, run post-install capability discovery (`tools/list` and `get_patch_notes`), and then strongly recommend helper skill and Python setup for full local document and spreadsheet workflows.

NeverSight/learn-skills.dev

Static artifact craft skill for self-contained HTML/CSS/JS documents: docs, sheets, dashboards, explainers, slides, tools, and landing pages. Use when the user asks for a durable, openable, shareable web deliverable they'll keep or hand off — a report, a dashboard, a slide deck, a data table, a page. Local folder first, temporary public link via tunnel (localhost.run), optional durable publish to Surge, GitHub Pages, or Cloudflare. Not for quick look renders, inline snippets, or throwaway scratch. Not for SPA frameworks, backend APIs, database apps, or production product UI.

NeverSight/learn-skills.dev

FFmpeg commands for video/audio conversion, trimming, compression, and processing. Use when user mentions "ffmpeg", "convert video", "compress video", "extract audio", "trim video", "gif from video", "video codec", "transcode", "screen recording", "merge videos", "video to mp4", "reduce file size", or any media processing task.

NeverSight/learn-skills.dev

Vim keybindings, motions, text objects, and operators for efficient text editing. Use when user asks about "vim commands", "vim motions", "text objects", "vim keybindings", "vim cheat sheet", "learn vim", "vim in VS Code", or any Vim editing tasks.

NeverSight/learn-skills.dev

Download YouTube videos, extract/proofread/translate subtitles, and render them onto video. Use whenever the user asks to download a YouTube video with subtitles, translate video subtitles to Chinese, add subtitles/burn subtitles to a video, or do ASR transcription on video audio. Covers the full pipeline: video download → subtitle extraction → proofreading → translation → SRT generation → subtitle rendering. Also use for "下载视频加字幕", "视频翻译字幕", "把字幕烧录到视频中". For pure subtitle file creation without rendering (just SRT output), this skill handles that too — stop before Phase 5.

NeverSight/learn-skills.dev

Grok Build ONLY. Turn a 2D character still into smooth animation sprites via image_gen/image_edit base → image_to_video (6s/10s run-in-place) → ffmpeg frames → magenta chroma-key → dense sampled sprites (strip/grid/GIF). Use when the user wants video-to-sprite, motion capture from generated video, smoother run/walk cycles from dense frames, or runs /video2dsprite. Do NOT use on Codex/Claude — only Grok Build has image_to_video. Prefer generate2dsprite for crisp pixel sheets without video.

相关技能