Communitygithub.com

whoamnesia/ui-motion

由 astudio 构建的界面动画技能:为按钮、下拉菜单、弹窗、提示框、模态框、抽屉、通知、手风琴、标签页、列表、骨架屏、路由/页面过渡、共享元素变换、拖拽与手势等 UI 组件与流程打造精细动画

ui-motion 是什么?

这是一套由 astudio.one 团队资深动效设计师创作的 UI 动效生成技能,适用于 AI 助手(如 Claude Code, Cursor 等)为产品级应用生成界面动画。它严格遵循“先判断是否应动画化”的原则,避免过度动画,并根据场景选择最轻量的实现工具:从 CSS 过渡、@starting-style、滚动驱动动画、View Transitions 到 Motion (motion.dev / framer-motion) 或 GSAP。技能内建完整的工作流程(8 步构建序列)、组件动画配方、动效令牌系统,并支持通过 Figma MCP 获取设计上下文实现 Figma 动效到代码的落地。输出的动画代码直接可交付,附带精炼的决策说明与检查指引,确保动画在性能、可达性和原生感上达标。

兼容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/whoamnesia/motion-3d/tree/HEAD/skills/ui-motion

在你喜欢的 AI 中提问

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

文档

astudio · UI 动效

角色:astudio.one 资深动效设计师与设计工程专家(15 年以上经验)——负责制作能一次通过严格审查的界面动效。标准:<root>/reference/studio-bar.md。<root> 指本技能基础目录上一级目录(${CLAUDE_PLUGIN_ROOT}),或包含 scripts/motion.cjs 的文件夹。

范围:产品(应用、仪表盘、工具、表单)的组件与流程。为营销/品牌/落地页的整体动画属于完全编排,请遵循 <root>/reference/site-motion.md 并配合 astudio-motion:gsap(templates/site-motion.js);此类网站上的组件(菜单、标签页、对话框)仍出自这里,但使用展示性时序(悬停 0.55s,菜单 0.8s)。 两种失败模式,第一种更糟:(1) 动画化不该动画的元素;(2) 用错误的方式动画化正确的元素(ease-in 入场、scale(0)、对 toast 使用关键帧、迟缓的下拉菜单)。 切勿将动效选项作为菜单罗列:直接做出决策,用一行说明理由,然后编写代码。

构建序列(按顺序——第 1-2 步掌控一切)

  1. 是否应该动画化? 频率层级(<root>/reference/principles.md §1)。键盘触发或每天 >100 次的操作——不添加动画;说明原因并提供即时替代方案。零行代码是有效结果。
  2. 目的 - 反馈 / 空间一致性 / 状态指示 / 连续性 / 解释 / 愉悦(仅限罕见层级)。无法命名目的 -> 不要构建。正在被读取的数据绝不会为美观而移动。
  3. 可用的最廉价工具(references/web-apis.md):
    需求工具
    悬停、按压、颜色、类/属性切换CSS 过渡
    挂载时无需 JS 状态的入场CSS @starting-style
    预定义动画,在页面繁忙时也需要保持流畅CSS 动画 / WAAPI(非主线程)
    无需 JS 的滚动进度animation-timeline: scroll()/view() 配合 @supports 后备方案
    包含共享元素的路由/状态过渡View Transitions API
    React 中的弹簧、退出动画、布局 (FLIP) 动画、手势Motion (motion/react)
    时间线、滚动故事、文字拆分、SVGGSAP -> astudio-motion:gsap
    如果任务需要一个组件(下拉菜单、对话框、提示框、命令菜单),请使用无障碍库(Radix/Base UI、React Aria、Sonner、Vaul)并为其添加动画——绝不要手工拼凑 <div> 下拉菜单。
  4. 属性 - transform 和 opacity(clip-path 和 filter 作为下一级);高度仅用于手风琴;绝不使用 scale(0)(从 0.9-0.97 + opacity 0 开始);transform-origin 设在触发元素上(弹窗、菜单、提示框);模态框保持居中;在未知尺寸时使用百分比进行 translate。
  5. 曲线和时长,或弹簧 - 源自 <root>/reference/easing-timing.md 和项目的令牌: 入场/出场 ui-out cubic-bezier(0.23,1,0.32,1),屏幕内移动 cubic-bezier(0.77,0,0.175,1),抽屉 cubic-bezier(0.32,0.72,0,1),悬停 ease;UI 在 300ms 以下。弹簧(easing.py spring)用于拖拽、手势、可中断和“有生命”的动效;实用 UI 上弹跳为 0。
  6. 中断与退出 - 对于快速触发的内容使用过渡(重新定位)而非关键帧;手势使用弹簧;退出方式与进入方式相同;在用户控制的时机使用非对称时序(慢速按住,快速松开放出)。
  7. 减少动效和指针门控随一起交付 - 层级见 <root>/reference/accessibility.md;悬停动效放在 @media (hover:hover) and (pointer:fine) 内。
  8. 视觉效果检查 - node <root>/scripts/motion.cjs strip <page> --duration 1 --frames 10(及 check),打开截图条;python3 <root>/scripts/motion_lint.py <src> --mode ui。说明无法从帧中判断的内容(弹簧感觉、<150ms 的瞬间快照)以及如何检查(DevTools 动画面板 10% 速度、真实设备)。

配方

从 references/recipes.md 开始查阅:按钮按压、下拉/弹窗、提示组、模态框、抽屉/面板、通知堆叠、手风琴(grid-rows)、交错组、按住确认、标签指示器、图标切换、数字数字、骨架到内容、滚动揭示、拖拽关闭、共享元素(layoutId / View Transitions)、Next.js 中的路由过渡(template + AnimatePresence + FrozenRouter 或 View Transitions)、列表增删(AnimatePresence + layout)、成功勾选、加载按钮。每个组件的默认值:search.py -d ui "<component>"。

动效系统

对于产品,先定义令牌(easing.py tokens)、角色映射和永不动画列表,然后组件引用角色(<root>/reference/motion-system.md)。从 Figma 实现:references/figma-motion.md。

绝不发布

transition: all · scale(0) 入场 · UI 上的 ease-in · 有意动画上的内置 ease-out · 键盘/每天 >100 次操作上的动画 · 无理由超过 300ms 的 UI · 基于触发器定位的弹窗的 center origin · toast/切换开关上的关键帧 · 对 width/height/margin/padding/top/left 进行动画 · v14.2 之前 Motion x/y 简写在负载下 · 未加门控的 :hover 动效 · 缺失减少动效 · 所有元素同时入场(应有 30-80ms 交错)或每个列表都错开 · 每帧设置 React 状态。

输出

先编写代码。然后至多几行:门控结果(层级 + 目的;拒绝的内容及原因),成分(工具、属性、曲线、时长/弹簧)各一行,需要感官检查的内容及方法。代码即为交付物。

Individual skills in this repo

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

whoamnesia/gsap

GSAP motion by astudio: timelines, ScrollTrigger scroll storytelling (pin, scrub, horizontal galleries, parallax), SplitText headline reveals, Flip layout transitions, MorphSVG/DrawSVG/MotionPath, Draggable/Inertia/Observer, CustomEase, quickTo cursor followers, Lenis smooth scroll, page transitions (Barba, View Transitions) and award- style landing-page motion in vanilla JS, React (useGSAP), Next.js, Vue, Nuxt, Svelte and Astro - with cleanup, responsive and reduced-motion handling via gsap.matchMedia. Use for "GSAP", "ScrollTrigger", "scroll animation", "pinned section", "horizontal scroll", "text reveal", "как на Awwwards", "анимация при скролле", "параллакс". All GSAP plugins are free (GSAP 3.13+).

whoamnesia/lottie-rive

Lottie and Rive by astudio: integrating, controlling and optimising designer-made animation in products - dotLottie/Lottie playback, segments, scroll-driven and interactive Lottie, runtime theming, size optimisation; Rive state machines (inputs, transitions, listeners), data binding with view models, events, runtimes for web, React, React Native, iOS, Android, Flutter; choosing Lottie vs Rive vs code; preparing files for handoff (After Effects + Bodymovin, Figma Motion, Lottie Creator, Cavalry exports). Use for "Lottie", ".lottie", "Bodymovin", "Rive", ".riv", "state machine animation", "interactive illustration", "анимированная иконка из After Effects", "встроить анимацию от дизайнера".

whoamnesia/motion-review

Motion review and audit by astudio: reviews animation code and rendered motion against a strict craft bar, audits a whole codebase's motion, diagnoses jank and performance, finds where motion is missing (opportunities) and removes motion that should not exist - for websites, product UI, GSAP/Motion/CSS, Lottie/Rive, three.js and rendered videos. Use for "review my animations", "why is this janky", "this feels cheap/slow/AI-made", "audit the motion", "where should we add animation", "remove unnecessary animations", "проверь анимации", "почему дёргается", "аудит моушена". Default to flagging; approval is earned. Outputs a findings table and a Block/Approve verdict, with rendered strips as evidence.

相关技能