Communitygithub.com

astudio · UI 動畫

為 UI 元件與流程打造介面動畫:按鈕、下拉選單、彈出視窗、工具提示、模態框、抽屜、提示訊息、手風琴、標籤頁、列表、骨架、路由/頁面轉換、共享元素變形、拖曳與手勢。支援 React、Vue、Svelte 或純 HTML,使用 CSS、WAAPI、View Transitions 及 Motion (motion.dev / framer-motion)。

astudio · UI 動畫 是什麼?

此技能專注於為產品級 UI 建立高品質動畫,由資深動畫設計師 (15 年以上經驗) 指導。它首先判斷某個元件「是否該有動畫」(如鍵盤操作或高頻率操作則不應動畫),再選擇最簡單可行的技術(CSS 過渡、@starting-style、WAAPI、View Transitions 或 Motion),並嚴格遵循屬性使用規則(僅 transform 和 opacity 為首選,避免 scale(0))。對於需要可訪問元件的任務(如對話框、下拉選單),它要求使用 Radix、React Aria 等庫來進行動畫化,而非手寫 `<div>`。技能還定義了完整的動畫系統流程:從頻率分級、目的判斷、工具選擇、曲線/彈簧參數、中斷與退出行為,到減少動作偏好和指標門控,最後透過腳本進行視覺與 lint 檢查。支援 Figma MCP 整合,可從設計稿直接取得動畫上下文。

相容平台✓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.55 秒,選單 0.8 秒)。 兩種失敗模式,第一種更糟:(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
    彈簧、退出動畫、佈局 (FLIP) 動畫、React 手勢Motion (motion/react)
    時間軸、滾動故事、文字分割、SVGGSAP -> astudio-motion:gsap
    如果任務需要一個元件(下拉選單、對話框、提示訊息、命令選單),請使用可訪問的函式庫(Radix/Base UI、React Aria、Sonner、Vaul)並為其加入動畫——絕不手寫 <div> 下拉選單。
  4. 屬性 - transform 和 opacity(clip-path 和 filter 為下一層級);accordion 僅使用 height;絕不使用 scale(0)(從 0.9-0.97 加 opacity 0 開始);彈出視窗/選單/工具提示在觸發點設定 transform-origin(模態框保持居中);未知尺寸使用 translate 百分比。
  5. 曲線與持續時間,或彈簧 - 來自 <root>/reference/easing-timing.md 和專案的 tokens: 進入/退出 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 低於 300 毫秒。彈簧(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。說明無法從影格判斷的內容(彈簧感覺、低於 150 毫秒的快照)以及如何檢查(使用 DevTools 動畫面板設為 10% 速度、實際裝置)。

配方

從 references/recipes.md 開始,用於:按鈕按壓、下拉選單/彈出視窗、工具提示群組、模態框、抽屜/面板、提示訊息堆疊、手風琴(grid-rows)、階梯群組、按住確認、標籤頁指示器、圖示切換、數字滾動、骨架 -> 內容、滾動揭示、拖曳關閉、共享元素(layoutId / View Transitions)、Next.js 路由轉換(template + AnimatePresence + FrozenRouter,或 View Transitions)、列表新增/移除(AnimatePresence + layout)、成功勾選、載入按鈕。每個元件的預設值:search.py -d ui "<component>"。

動畫系統

對於產品,先定義 tokens(easing.py tokens)、角色對應表和永不動畫清單,然後元件參照角色(<root>/reference/motion-system.md)。從 Figma 實作:references/figma-motion.md。

絕不發佈

transition: all · scale(0) 入場 · UI 上的 ease-in · 刻意動畫上的內建 ease-out · 鍵盤/100+ 次/天操作上的動畫 · 無理由超過 300 毫秒的 UI · 觸發錨定彈出視窗上的中心原點 · toast/切換開關的關鍵影格 · 對 width/height/margin/padding/top/left 做動畫 · Motion v14.2 之前的 x/y 縮寫在負載下使用 · 未門控的 :hover 動畫 · 缺少減少動作偏好 · 所有內容同時進入(30-80 毫秒階梯)或每個列表都做階梯 · 每個影格設定 React state。

輸出

撰寫程式碼。然後最多幾行:門控結果(分級 + 目的;拒絕了什麼及原因),成分(工具、屬性、曲線、持續時間/彈簧)各一行,需要手感檢查的內容及檢查方式。程式碼即交付成果。

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.

相關技能