When to Use
User needs motion designed or implemented inside a product UI. Agent turns vague requests into motion contracts, stack-specific implementation choices, and testable acceptance criteria across Flutter, React, Next.js, SwiftUI, Compose, React Native, and broader web stacks.
Use this for micro-interactions, navigation transitions, shared-element flows, loading states, gesture feedback, and motion system design. Do not use it for video editing, GIF rendering, or media encoding.
Architecture
Memory lives in ~/animate/. If ~/animate/ does not exist, run setup.md. See memory-template.md for structure and status fields.
CODEBLOCK0
Quick Reference
Use the smallest relevant file for the current task.
| Topic | File |
|---|
| Setup flow | INLINECODE4 |
| Memory template |
memory-template.md |
| Motion system and spec contract |
motion-system.md |
| Platform routing by stack |
platform-routing.md |
| Starter snippets by stack |
implementation-snippets.md |
| Common app animation patterns |
pattern-catalog.md |
| Performance and accessibility guardrails |
performance-accessibility.md |
| QA and regression checks |
qa-playbook.md |
Core Rules
1. Start from Product Intent and State Change
- - Define the trigger, user goal, and state transition before choosing an effect.
- Map motion to one of five jobs: orientation, feedback, continuity, emphasis, or delight.
- If the intent is unclear, do not animate yet.
2. Write a Motion Contract Before Code
Every proposal must specify:
- - Trigger and affected surfaces
- Initial state, end state, and reduced-motion fallback
- Duration, easing or spring, delay or stagger, and cancellation behavior
- Acceptance criteria: responsiveness, accessibility, parity, and performance
No vague wording like "smooth" or "premium" without values.
3. Route to the Safest Native Abstraction
Use the highest-level API that solves the job:
- - Flutter: implicit animation widgets,
AnimatedSwitcher, TweenAnimationBuilder, INLINECODE14 - React and Next.js: CSS-first transitions, Motion presence/layout APIs, and router-safe transitions before bespoke choreography
- SwiftUI:
withAnimation, content transitions, INLINECODE16 - Compose:
animate*AsState, AnimatedVisibility, INLINECODE19 - React Native: native-thread or worklet-safe animation paths before JS-thread choreography
- Web: CSS
transform and opacity, View Transitions, or framework-native transitions before GSAP-level complexity
Avoid low-level animation code when a higher-level primitive already handles interruption and lifecycle.
4. Optimize for Compositor-Safe Motion and Interruption
- - Prefer transform, opacity, color, and scale patterns that keep layout stable.
- Avoid width, height, top, left, and layout-driven loops unless the stack provides a dedicated layout animation primitive.
- Define behavior for rapid taps, back gestures, dismiss, re-render, offscreen, and navigation cancel.
- Users should never get stuck behind an animation.
5. Ship Accessible Variants by Default
- - Respect reduced-motion and system animation-scale settings.
- Replace large travel, parallax, bounce, blur-heavy flourishes, and infinite loops with calmer equivalents.
- Never rely on movement alone to communicate status.
- Keep focus order, screen reader output, and hit targets stable during motion.
6. Cover Real Product States, Not Only the Happy Path
- - Animate loading, success, error, empty, disabled, retry, and optimistic-update states when relevant.
- Coordinate navigation, overlays, lists, forms, and async data so motion still works with latency and content changes.
- Deliver a sober V1 first, then a more expressive V2 only when constraints allow.
7. Verify with Previews, Tests, and Device Reality
- - Leave deterministic previews, stories, or demo toggles for the motion states you touched.
- Add or update behavior, E2E, or visual tests when the app stack supports them.
- Validate reduced motion, mid-tier performance, and interrupted flows before calling it done.
Common Traps
- - Pretty animation without a user-facing reason -> extra motion, less clarity.
- Hardcoded timings per screen -> inconsistent product feel and painful iteration.
- JS or main-thread choreography for critical mobile motion -> dropped frames under load.
- Animating only happy-path states -> broken UX on loading, error, or rapid retries.
- Missing cancellation rules -> stuck overlays, ghost states, or navigation glitches.
- Shipping only one variant -> accessibility regressions and poor low-end performance.
Security & Privacy
Data that leaves your machine:
- - None by default from this skill itself.
Data that stays local:
- - Motion preferences, approved tokens, platform notes, and QA learnings under
~/animate/.
This skill does NOT:
- - Upload builds, videos, or telemetry automatically.
- Modify files outside
~/animate/ for memory. - Disable accessibility settings.
- Modify its own
SKILL.md.
Related Skills
Install with
clawhub install <slug> if user confirms:
- -
flutter - Widget lifecycles and performance rules useful for Flutter motion. - INLINECODE27 - Component and rendering patterns that shape animation behavior in React apps.
- INLINECODE28 - Mobile lifecycle and animation-thread constraints for React Native.
- INLINECODE29 - Swift and SwiftUI implementation patterns for Apple platforms.
- INLINECODE30 - Android and Compose implementation details for native motion.
Feedback
- - If useful: INLINECODE31
- Stay updated: INLINECODE32
何时使用
用户需要在产品UI中设计或实现动效。智能体将模糊的需求转化为动效契约、特定技术栈的实现方案,以及跨Flutter、React、Next.js、SwiftUI、Compose、React Native及更广泛Web技术栈的可测试验收标准。
适用于微交互、导航过渡、共享元素动效、加载状态、手势反馈和动效系统设计。不适用于视频编辑、GIF渲染或媒体编码。
架构
记忆文件存储在~/animate/目录下。如果~/animate/不存在,请运行setup.md。结构和状态字段请参考memory-template.md。
text
~/animate/
|- memory.md # 持久的动效偏好和平台上下文
|- tokens.md # 已批准的时长、缓动和弹簧参数阶梯
|- patterns.md # 经过验证的交互和过渡模式
|- platform-notes.md # 特定技术栈的实现决策
- - qa.md # 回归问题、低端设备发现和可访问性说明
快速参考
为当前任务使用最相关的最小文件。
memory-template.md |
| 动效系统和规范契约 | motion-system.md |
| 按技术栈的平台路由 | platform-routing.md |
| 按技术栈的入门代码片段 | implementation-snippets.md |
| 常见应用动画模式 | pattern-catalog.md |
| 性能和可访问性护栏 | performance-accessibility.md |
| QA和回归检查 | qa-playbook.md |
核心规则
1. 从产品意图和状态变化出发
- - 在选择效果之前,先定义触发条件、用户目标和状态转换。
- 将动效映射到五个功能之一:导向、反馈、连续性、强调或愉悦。
- 如果意图不明确,暂时不要添加动效。
2. 在编写代码前制定动效契约
每个提案必须指定:
- - 触发条件和受影响的界面元素
- 初始状态、结束状态和减少动效的降级方案
- 时长、缓动或弹簧参数、延迟或交错效果,以及取消行为
- 验收标准:响应性、可访问性、一致性和性能
不允许使用流畅或高级等没有具体数值的模糊措辞。
3. 选择最安全的原生抽象层
使用能解决问题的最上层API:
- - Flutter:隐式动画组件、AnimatedSwitcher、TweenAnimationBuilder、Hero
- React和Next.js:优先使用CSS过渡、Motion presence/layout API、以及路由安全的过渡效果,再考虑自定义编排
- SwiftUI:withAnimation、内容过渡、matchedGeometryEffect
- Compose:animate*AsState、AnimatedVisibility、updateTransition
- React Native:优先使用原生线程或worklet安全的动画路径,再考虑JS线程编排
- Web:优先使用CSS transform和opacity、View Transitions或框架原生过渡,再考虑GSAP级别的复杂度
当更高级的原生组件已能处理中断和生命周期时,避免使用低级的动画代码。
4. 优化合成器安全的动效和中断处理
- - 优先使用保持布局稳定的transform、opacity、color和scale模式。
- 除非技术栈提供专门的布局动画原语,否则避免使用width、height、top、left和布局驱动的循环。
- 定义快速点击、返回手势、关闭、重新渲染、离屏和导航取消时的行为。
- 用户绝不应被动画卡住。
5. 默认提供可访问的变体
- - 尊重减少动效和系统动画缩放设置。
- 用更温和的替代方案替换大幅移动、视差、弹跳、重度模糊效果和无限循环。
- 绝不要仅依靠移动来传达状态信息。
- 在动效期间保持焦点顺序、屏幕阅读器输出和点击目标的稳定。
6. 覆盖真实的产品状态,而不仅仅是理想路径
- - 在相关情况下为加载、成功、错误、空状态、禁用、重试和乐观更新状态添加动效。
- 协调导航、覆盖层、列表、表单和异步数据,使动效在延迟和内容变化时仍能正常工作。
- 先交付一个克制的V1版本,只有在条件允许时再开发更具表现力的V2版本。
7. 通过预览、测试和真实设备验证
- - 为你处理的动效状态留下确定性的预览、故事或演示开关。
- 当应用技术栈支持时,添加或更新行为测试、端到端测试或视觉测试。
- 在宣布完成之前,验证减少动效、中端设备性能和中断流程。
常见陷阱
- - 没有用户可见理由的漂亮动画 -> 多余的动效,更低的清晰度。
- 每个屏幕硬编码时间 -> 不一致的产品感受和痛苦的迭代。
- 关键移动端动效使用JS或主线程编排 -> 负载下掉帧。
- 仅为理想路径状态添加动效 -> 加载、错误或快速重试时用户体验崩溃。
- 缺少取消规则 -> 覆盖层卡住、幽灵状态或导航故障。
- 仅提供一个变体 -> 可访问性退化和低端设备性能差。
安全与隐私
离开你机器的数据:
保留在本地的数据:
- - 动效偏好、已批准的参数、平台说明和QA学习记录,存储在~/animate/下。
此技能不会:
- - 自动上传构建包、视频或遥测数据。
- 修改~/animate/以外的文件用于记忆存储。
- 禁用可访问性设置。
- 修改自身的SKILL.md文件。
相关技能
如果用户确认,使用clawhub install 安装:
- - flutter - Flutter动效相关的组件生命周期和性能规则。
- react - 影响React应用中动画行为的组件和渲染模式。
- react-native - React Native的移动端生命周期和动画线程约束。
- swift - Apple平台的Swift和SwiftUI实现模式。
- android - Android和Compose原生动效的实现细节。
反馈
- - 如果觉得有用:clawhub star animate
- 保持更新:clawhub sync