Communitygithub.com

David-Li0406/meta-skill-evloving

使用 Motion 库实现动画效果。适用于为组件添加动效、过渡、手势、滚动效果或交互式动画。由实现请求触发,而非概念讨论。

meta-skill-evloving 是什么?

该技能专为开发者和 AI 代理设计,旨在利用 Motion 库(https://motion.dev)在 React 应用中实现高性能动画。它涵盖了核心动画模式,如弹簧物理、手势交互、布局动画、滚动联动效果、子元素交错动画以及进入/退出动画。技能文档提供了完整的代码示例、动画属性说明(包括 GPU 加速的变换属性、视觉属性和 SVG 属性)、无障碍支持(自动适配 prefers-reduced-motion)以及性能优化建议。此外,还包括动画设计原则(何时该动画、何时不该动画、时长指南)和常见模式(如加载状态、提示通知、抽屉、手风琴)的详细说明。支持的技术栈以 React 为主,Motion 库是 MIT 许可、生产就绪、支持 TypeScript 且可 tree-shaking 的。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/David-Li0406/meta-skill-evloving/tree/HEAD/skill-flow/data/skills-refined-36k/skillsmp/animation

在你喜欢的 AI 中提问

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

文档

使用 Motion 实现动画

所有动画工作均使用 Motion 库 (https://motion.dev)。

快速开始

React(主要):

import { motion } from "motion/react"

// 基础动画
<motion.div animate={{ opacity: 1, y: 0 }} />

// 带过渡配置
<motion.div
  animate={{ x: 100 }}
  transition={{ type: "spring", stiffness: 100 }}
/>

核心模式

1. 弹簧物理(推荐)

<motion.div
  animate={{ scale: 1 }}
  transition={{
    type: 'spring',
    stiffness: 260,
    damping: 20,
  }}
/>

弹簧预设:

  • 柔和:stiffness: 120, damping: 14
  • 弹跳:stiffness: 180, damping: 12
  • 坚硬:stiffness: 300, damping: 20

2. 手势交互

<motion.div
  whileHover={{ scale: 1.05 }}
  whileTap={{ scale: 0.95 }}
  drag="x"
  dragConstraints={{ left: -100, right: 100 }}
/>

3. 布局动画

<motion.div layout>{/* 内容位置或大小会变化 */}</motion.div>

4. 滚动联动效果

import { useScroll, useTransform } from "motion/react"

const { scrollYProgress } = useScroll()
const opacity = useTransform(scrollYProgress, [0, 1], [1, 0])

<motion.div style={{ opacity }} />

5. 子元素交错动画

<motion.ul
  variants={{
    visible: { transition: { staggerChildren: 0.07 } },
  }}
>
  {items.map((item) => (
    <motion.li
      key={item}
      variants={{
        hidden: { opacity: 0, y: 20 },
        visible: { opacity: 1, y: 0 },
      }}
    />
  ))}
</motion.ul>

6. 进入/退出动画

import { AnimatePresence } from 'motion/react';

<AnimatePresence>
  {show && <motion.div initial={{ opacity: 0 }} animate={{ opacity: 1 }} exit={{ opacity: 0 }} />}
</AnimatePresence>;

动画属性

变换属性(GPU 加速,性能高效):

  • x, y, z - 平移
  • scale, scaleX, scaleY - 缩放
  • rotate, rotateX, rotateY, rotateZ - 旋转
  • skew, skewX, skewY - 倾斜

视觉属性(谨慎使用,可能影响性能):

  • opacity
  • background, backgroundColor
  • color
  • borderRadius

SVG 特定属性:

  • pathLength - 用于路径绘制动画
  • pathOffset - 偏移路径
  • pathSpacing - 虚线间的间距

无障碍支持

始终尊重用户偏好:

<motion.div
  animate={{ x: 100 }}
  transition={{
    type: 'spring',
    // 如果用户偏好减少动画,则禁用动画
    duration: 0,
  }}
/>

Motion 会自动处理 prefers-reduced-motion。弹簧效果会变为即时过渡。

性能提示

  1. 尽量仅对变换属性和透明度进行动画(GPU 加速)
  2. 使用 layout 属性,而非手动对宽度/高度进行动画
  3. 避免在滚动期间进行动画
  4. 对复杂动画使用 will-change: transform(Motion 会自动处理)
  5. 限制同时进行的动画数量 - 使用交错动画而非同时进行

设计原则(简要)

何时使用动画

  • 状态切换(加载 → 成功)
  • 空间变化(进入/退出视图)
  • 吸引注意力(谨慎使用)
  • 确认用户操作

何时不使用动画

  • 重复操作(首次之后)
  • 性能关键路径
  • 用户控制的滚动
  • 每一次交互(克制很重要)

时间指南

  • 微交互:150-250毫秒
  • 面板/模态框过渡:200-300毫秒
  • 页面过渡:300-500毫秒
  • 弹簧效果:让物理引擎决定时长

弹簧 vs 时长

  • 交互元素、手势、布局变化使用弹簧
  • 有意序列、编排、加载器使用时长的过渡

详细动画理念请参阅 principles.md。

常见模式

加载状态:

<motion.div
  animate={{ rotate: 360 }}
  transition={{
    repeat: Infinity,
    duration: 1,
    ease: 'linear',
  }}
/>

提示通知:

<motion.div
  initial={{ x: 400, opacity: 0 }}
  animate={{ x: 0, opacity: 1 }}
  exit={{ x: 400, opacity: 0 }}
  transition={{ type: 'spring', stiffness: 300, damping: 30 }}
/>

抽屉:

<motion.div
  initial={{ x: '-100%' }}
  animate={{ x: 0 }}
  exit={{ x: '-100%' }}
  transition={{ type: 'spring', damping: 25 }}
/>

手风琴:

<motion.div
  animate={{ height: isOpen ? 'auto' : 0 }}
  transition={{ type: 'spring', bounce: 0 }}
  style={{ overflow: 'hidden' }}
/>

资源

快速故障排除

动画未运行?

  • 检查元素是否为条件渲染(使用 AnimatePresence)
  • 确认目标值与初始值不同
  • 检查是否存在可能覆盖的 CSS(例如 !important)

性能问题?

  • 坚持使用变换属性和透明度
  • 使用 layout 属性替代对尺寸的动画
  • 检查浏览器开发者工具的 Performance 面板

布局动画闪烁?

  • 确保父元素有 position: relative
  • 必要时同时为父元素和子元素添加 layout
  • 检查是否存在冲突的 CSS 过渡

说明

  • Motion 是 MIT 许可的,可投入生产使用
  • 混合引擎:120fps,GPU 加速
  • 内置 TypeScript 支持
  • 支持 tree-shaking,优化打包体积
  • 兼容 React 18+(包括 Suspense)

Individual skills in this repo

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

David-Li0406/meta-skill-evloving

Browser automation with persistent page state. Use when users ask to navigate websites, fill forms, take screenshots, extract web data, test web apps, or automate browser workflows. Trigger phrases include "go to [url]", "click on", "fill out the form", "take a screenshot", "scrape", "automate", "test the website", "log into", or any browser interaction request.

David-Li0406/meta-skill-evloving

Create technical diagrams using Mermaid syntax for architecture, sequences, ERDs, flowcharts, and state machines. Use for visualizing system design, data flows, and processes. Triggers: diagram, mermaid, architecture diagram, sequence diagram, flowchart, ERD, entity relationship, state diagram, C4 model, component diagram, visualize, draw.

David-Li0406/meta-skill-evloving

Comprehensive document creation, editing, and analysis with support for tracked changes, comments, formatting preservation, and text extraction. When Claude needs to work with professional documents (.docx files) for: (1) Creating new documents, (2) Modifying or editing content, (3) Working with tracked changes, (4) Adding comments, or any other document tasks

David-Li0406/meta-skill-evloving

Complete color manipulation and green screen effects system. PROACTIVELY activate for: (1) Green screen/chromakey removal, (2) Color grading with LUTs, (3) Color correction (levels, curves, white balance), (4) Colorkey/color removal effects, (5) Hue/saturation manipulation, (6) Color space conversions (BT.709, BT.2020, HDR), (7) Color isolation effects, (8) Teal and orange look, (9) Vintage/film looks, (10) Color keying for transparency. Provides: chromakey and colorkey filters, LUT application (lut3d), curves and levels adjustment, color balance, selective color manipulation, color space handling, HDR tone mapping, professional color grading chains.

David-Li0406/meta-skill-evloving

Convert files and office documents to Markdown. Supports PDF, DOCX, PPTX, XLSX, images (with OCR), audio (with transcription), HTML, CSV, JSON, XML, ZIP, YouTube URLs, EPubs and more.

David-Li0406/meta-skill-evloving

Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).

David-Li0406/meta-skill-evloving

Build with OpenAI's stateless APIs - Chat Completions (GPT-5, GPT-4o), Embeddings, Images (DALL-E 3), Audio (Whisper + TTS), and Moderation. Includes Node.js SDK and fetch-based approaches for Cloudflare Workers. Use when: implementing chat completions with GPT-5/GPT-4o, streaming responses with SSE, using function calling/tools, creating structured outputs with JSON schemas, generating embeddings for RAG (text-embedding-3-small/large), generating images with DALL-E 3, editing images with GPT-Image-1, transcribing audio with Whisper, synthesizing speech with TTS (11 voices), moderating content (11 safety categories), or troubleshooting rate limits (429), invalid API keys (401), function calling failures, streaming parse errors, embeddings dimension mismatches, or token limit exceeded.

David-Li0406/meta-skill-evloving

Comprehensive PDF manipulation toolkit for extracting text and tables, creating new PDFs, merging/splitting documents, and handling forms. When Claude needs to fill in a PDF form or programmatically process, generate, or analyze PDF documents at scale.

David-Li0406/meta-skill-evloving

Presentation creation, editing, and analysis. When Claude needs to work with presentations (.pptx files) for: (1) Creating new presentations, (2) Modifying or editing content, (3) Working with layouts, (4) Adding comments or speaker notes, or any other presentation tasks

David-Li0406/meta-skill-evloving

Comprehensive spreadsheet creation, editing, and analysis with support for formulas, formatting, data analysis, and visualization. When Claude needs to work with spreadsheets (.xlsx, .xlsm, .csv, .tsv, etc) for: (1) Creating new spreadsheets with formulas and formatting, (2) Reading or analyzing data, (3) Modify existing spreadsheets while preserving formulas, (4) Data analysis and visualization in spreadsheets, or (5) Recalculating formulas

David-Li0406/meta-skill-evloving

Download YouTube videos with customizable quality and format options. Use this skill when the user asks to download, save, or grab YouTube videos. Supports various quality settings (best, 1080p, 720p, 480p, 360p), multiple formats (mp4, webm, mkv), and audio-only downloads as MP3.

David-Li0406/meta-skill-evloving

Best practices for Remotion - Video creation in React

David-Li0406/meta-skill-evloving

Provides bidirectional translation (Chinese/English), grammar checking, and sentence polishing. Supports specific tense constraints, context-aware tone adjustment, and natural expression optimization. Outputs direct text without formatting.

David-Li0406/meta-skill-evloving

指导如何通过自定义注解(如@Unicom)标识Dubbo接口,利用BeanDefinitionRegistryPostProcessor在启动时扫描并动态注册ReferenceBean,实现RPC调用的封装。

David-Li0406/meta-skill-evloving

生成Python脚本,利用FFmpeg将图片序列按3x3布局合并,或将合并图拆分。要求使用subprocess模块执行命令,并支持用户交互式输入路径。

David-Li0406/meta-skill-evloving

SOP for extracting and analyzing promotional activity details, handling time formatting, location mapping, payment logic, and step-by-step process validation.

David-Li0406/meta-skill-evloving

Specializes in creating TikTok short video scripts using an anthropomorphic 'Chef' perspective to explain wildlife food chains and survival environments, utilizing real field footage.

David-Li0406/meta-skill-evloving

针对TikTok平台,以拟人化视角(如动物作为厨师)创作系列短视频脚本。重点介绍野生动物、食物链及生态环境,要求使用野外实拍素材,风格幽默且具有教育意义。

David-Li0406/meta-skill-evloving

Generates KWL (Know, Want to know, Learned) charts for educational videos, specifically BrainPOP, using simple 7th-grade language and short, concise bullet points.

David-Li0406/meta-skill-evloving

Tracks complex, multi-session work using the Beads issue tracker and dependency graphs, and provides persistent memory that survives conversation compaction. Use when work spans multiple sessions, has complex dependencies, or needs persistent context across compaction cycles. Trigger with phrases like "create task for", "what's ready to work on", "show task", "track this work", "what's blocking", or "update status".

相关技能