Communitygithub.com

YepAPI/动画技能

使用 Framer Motion 实现过渡、滚动动画和布局动画的 React 动画技能。

动画技能 是什么?

该技能专注于在 React 应用中利用 Framer Motion 库创建流畅、可访问的动画效果。它提供了清晰的规则来指导开发者使用 motion.div 组件进行基础的进入、离开和布局动画,并通过 AnimatePresence 处理组件挂载/卸载时的过渡。技能还涵盖了滚动驱动的动画(如视差效果)和布局动画的自动处理,同时强调性能优化,建议仅动画化 transform 和 opacity 属性以确保 60fps 流畅度。此外,技能强制要求使用 useReducedMotion() 钩子尊重用户的减少动效偏好,并给出了合理的动画时长范围(UI 过渡 200-400ms,页面过渡 400-800ms)。该技能适用于任何基于 React 的前端项目,特别是需要复杂交互动画或页面过渡的场景。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/YepAPI/skills/tree/HEAD/skills/animations

在你喜欢的 AI 中提问

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

文档

动画

规则

  • 使用 Framer Motion 实现 React 动画 — 使用 motion.div 并设置 initial、animate、exit 属性
  • 使用 AnimatePresence 处理挂载/卸载动画 — 包裹条件渲染内容
  • 使用 layout 属性实现自动布局动画(重排序、调整大小)
  • 滚动动画:使用 useScroll() + useTransform() 实现视差和滚动触发的揭示效果
  • 尊重减少动效偏好:使用 useReducedMotion() 钩子 — 关闭非必要的动画
  • 子元素交错:使用 variants 并设置 staggerChildren 实现列表动画
  • 性能优化:仅动画化 transform 和 opacity —— 切勿动画化 width、height、margin
  • 保持动画时长简短:UI 过渡 200-400ms,页面过渡 400-800ms

避免

  • 动画化布局属性(width, height, top, left)—— 应使用 transform: translate/scale
  • UI 交互动画超过 1 秒 —— 感觉迟钝
  • 未经用户触发自动播放动画 —— 造成混乱
  • 忽略 prefers-reduced-motion —— 可访问性要求

Individual skills in this repo

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

YepAPI/skills

WCAG 2.1 AA — semantic HTML, keyboard navigation, screen readers.

YepAPI/skills

Experiment setup, variant splitting, statistical significance, and feature flag integration.

YepAPI/skills

CRUD generators, data tables, user management, role-based access, and bulk operations.

YepAPI/skills

Monitor what ChatGPT and Gemini say about your brand using YepAPI.

YepAPI/skills

Queue workers with BullMQ/Inngest/Trigger.dev, job retries, dead letter queues, concurrency.

YepAPI/skills

Commander.js, interactive prompts with Clack, spinners, colors, config files, exit codes, and npm publishing.

YepAPI/skills

cmdk integration, Cmd+K trigger, fuzzy search, grouped actions, keyboard navigation, and dynamic action registration.

YepAPI/skills

Content planning with trend and sentiment data from YepAPI.

YepAPI/skills

Content calendar, keyword-driven planning, and content briefs.

YepAPI/skills

Theme switching with CSS variables, system preference detection, next-themes, and persistence.

YepAPI/skills

Threaded comments, @mentions, reactions, moderation queue, optimistic UI, and cursor pagination.

YepAPI/skills

Competitive analysis between domains using YepAPI.

YepAPI/skills

Layout grids, KPI cards, data tables with sorting/filtering, sidebar navigation, and responsive breakpoints.

YepAPI/skills

Data encryption — TLS everywhere, AES-256-GCM for PII, bcrypt passwords, encrypted backups.

YepAPI/skills

Chart patterns with Recharts/Nivo/D3, responsive containers, color scales, and accessibility.

YepAPI/skills

Drizzle schema definition, push vs migrate, type-safe queries, relations, transactions, and prepared statements.

YepAPI/skills

Upload handling, resize/compress, CDN delivery, blur placeholders, and next/image patterns.

YepAPI/skills

Local business and Google Maps research using YepAPI.

YepAPI/skills

Cursor-based pagination, IntersectionObserver, virtualized lists with @tanstack/react-virtual, and scroll position restoration.

YepAPI/skills

Chat UI components, streaming responses with AI SDK, context window management, and RAG patterns.

相关技能