Communitygithub.com

ASoudy/AGS

關鍵:用於 Makepad 動畫系統。觸發條件:makepad animation、makepad animator、makepad hover、makepad state、makepad transition、"from: { all: Forward"、makepad pressed、makepad 動畫、makepad 狀態、makepad 過渡、makepad 懸停效果

AGS 是什麼?

此技能專為 Makepad UI 框架中的動畫系統設計,幫助開發者撰寫、除錯及理解 animations、transitions、hover states 和 animator timelines。它支援所有常見的 Makepad 動畫模式,包括基本懸停、多狀態動畫(hover、pressed、focus、disabled)、以及 keyframe 動畫,並提供詳細的 easing functions(如 InOutQuad、OutElastic)和 timeline types(Forward、Snap、Loop 等)說明。技能會根據 SKILL.md 中的模式生成 Rust 動畫程式碼,並可引用本機 reference files 取得更深入的 animation system 文件。若本機文件缺失或為空,它會提示用戶執行 `/sync-crate-skills makepad --force` 更新,同時仍基於內建知識回答。此技能適合在 Claude Code、Cursor 或 Codex 等 AI agent 平台使用,能顯著加速 Makepad 專案中 UI 動效的開發流程。

相容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/ASoudy/AGS/tree/HEAD/AGAS/plugins/antigravity-awesome-skills-claude/skills/makepad-animation

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

Makepad 動畫技能

版本: makepad-widgets (dev branch) | 最後更新: 2026-01-19

檢查更新:https://crates.io/crates/makepad-widgets

您是 Makepad 動畫專家。幫助使用者:

  • 撰寫程式碼:依照下列模式產生動畫程式碼
  • 回答問題:解釋狀態(states)、過渡(transitions)、時間軸(timelines)

使用時機

  • 您需要在 Makepad 中建立或除錯動畫、過渡、懸停狀態或動畫時間軸。
  • 任務涉及 animator、狀態改變、easing、keyframes 或視覺互動回饋。
  • 您想要 Makepad 專屬的動畫模式,而非通用的 Rust UI 指導。

文件

請參考本機詳細文件:

  • ./references/animation-system.md - 完整的動畫參考

進階模式

如需生產就緒的動畫模式,請參閱 _base/ 目錄:

模式說明
06-animator-basics動畫基礎
07-easing-functions緩動與時間控制
08-keyframe-animation複雜關鍵幀動畫

重要:文件完整性檢查

在回答問題之前,Claude 必須:

  1. 閱讀上述相關參考檔案
  2. 若檔案讀取失敗或為空:
    • 告知使用者:「本地文档不完整,建议运行 /sync-crate-skills makepad --force 更新文档」
    • 仍根據 SKILL.md 模式 + 內建知識回答
  3. 若參考檔案存在,將其內容融入回答中

關鍵模式

1. 基本懸停動畫

<Button> {
    text: "Hover Me"

    animator: {
        hover = {
            default: off

            off = {
                from: { all: Forward { duration: 0.15 } }
                apply: {
                    draw_bg: { color: #333333 }
                }
            }

            on = {
                from: { all: Forward { duration: 0.15 } }
                apply: {
                    draw_bg: { color: #555555 }
                }
            }
        }
    }
}

2. 多狀態動畫

<View> {
    animator: {
        hover = {
            default: off
            off = {
                from: { all: Forward { duration: 0.2 } }
                apply: { draw_bg: { color: #222222 } }
            }
            on = {
                from: { all: Forward { duration: 0.2 } }
                apply: { draw_bg: { color: #444444 } }
            }
        }

        pressed = {
            default: off
            off = {
                from: { all: Forward { duration: 0.1 } }
                apply: { draw_bg: { scale: 1.0 } }
            }
            on = {
                from: { all: Forward { duration: 0.1 } }
                apply: { draw_bg: { scale: 0.95 } }
            }
        }
    }
}

3. 焦點狀態動畫

<TextInput> {
    animator: {
        focus = {
            default: off

            off = {
                from: { all: Forward { duration: 0.2 } }
                apply: {
                    draw_bg: {
                        border_color: #444444
                        border_size: 1.0
                    }
                }
            }

            on = {
                from: { all: Forward { duration: 0.2 } }
                apply: {
                    draw_bg: {
                        border_color: #0066CC
                        border_size: 2.0
                    }
                }
            }
        }
    }
}

4. 禁用狀態

<Button> {
    animator: {
        disabled = {
            default: off

            off = {
                from: { all: Snap }
                apply: {
                    draw_bg: { color: #0066CC }
                    draw_text: { color: #FFFFFF }
                }
            }

            on = {
                from: { all: Snap }
                apply: {
                    draw_bg: { color: #333333 }
                    draw_text: { color: #666666 }
                }
            }
        }
    }
}

動畫結構

屬性說明
animator動畫容器根節點
{state} =狀態定義(hover, pressed, focus, disabled)
default:初始狀態值
{value} =狀態值定義(on, off, 自訂)
from:過渡時間軸
apply:要動畫化的屬性

時間軸類型(Play 列舉)

類型說明
Forward { duration: f64 }線性前進動畫
Snap立即變化,無過渡
Reverse { duration: f64, end: f64 }反向動畫
Loop { duration: f64, end: f64 }循環動畫
BounceLoop { duration: f64, end: f64 }彈跳循環動畫

緩動函數(Ease 列舉)

// 基本
Linear

// 二次方
InQuad, OutQuad, InOutQuad

// 三次方
InCubic, OutCubic, InOutCubic

// 四次方
InQuart, OutQuart, InOutQuart

// 五次方
InQuint, OutQuint, InOutQuint

// 正弦
InSine, OutSine, InOutSine

// 指數
InExp, OutExp, InOutExp

// 圓形
InCirc, OutCirc, InOutCirc

// 彈性
InElastic, OutElastic, InOutElastic

// 回彈
InBack, OutBack, InOutBack

// 彈跳
InBounce, OutBounce, InOutBounce

// 自訂
ExpDecay { d1: f64, d2: f64 }
Bezier { cp0: f64, cp1: f64, cp2: f64, cp3: f64 }
Pow { begin: f64, end: f64 }

使用緩動函數

from: {
    all: Ease { duration: 0.3, ease: InOutQuad }
}

常見狀態

狀態值觸發條件
hoveron, off滑鼠進入/離開
pressed / downon, off滑鼠按下/放開
focuson, off取得/失去焦點
disabledon, off元件啟用/停用
selectedon, off選取狀態變更

可動畫化的屬性

大多數 draw_* 著色器屬性都可以動畫化:

  • 顏色:color、border_color、shadow_color
  • 尺寸:border_size、border_radius、shadow_radius
  • 變形:scale、rotation、offset
  • 不透明度:opacity

撰寫程式碼時的注意事項

  1. 始終為初始狀態設定 default:
  2. 使用 Forward 實現平滑過渡
  3. 使用 Snap 實現即時狀態變更(如 disabled)
  4. 保持較短的持續時間(0.1-0.3 秒)以獲得靈敏的反應
  5. 在 draw_bg、draw_text 等中動畫化著色器屬性

Rust API(AnimatorImpl Trait)

pub trait AnimatorImpl {
    // 播放至指定狀態
    fn animator_play(&mut self, cx: &mut Cx, state: &[LiveId; 2]);

    // 直接切換至狀態(無動畫)
    fn animator_cut(&mut self, cx: &mut Cx, state: &[LiveId; 2]);

    // 檢查目前狀態
    fn animator_in_state(&self, cx: &Cx, state: &[LiveId; 2]) -> bool;
}

// 使用範例
fn handle_event(&mut self, cx: &mut Cx, event: &Event, scope: &mut Scope) {
    match event.hits(cx, self.area()) {
        Hit::FingerHoverIn(_) => {
            self.animator_play(cx, id!(hover.on));
        }
        Hit::FingerHoverOut(_) => {
            self.animator_play(cx, id!(hover.off));
        }
        Hit::FingerDown(_) => {
            self.animator_play(cx, id!(pressed.on));
        }
        Hit::FingerUp(_) => {
            self.animator_play(cx, id!(pressed.off));
        }
        _ => {}
    }
}

回答問題時的注意事項

  1. 狀態彼此獨立——可同時啟用多個狀態
  2. 當狀態達到指定值時,動畫會套用屬性
  3. from 定義如何動畫化,apply 定義什麼要動畫化
  4. Makepad 自動在舊值與新值之間進行補間
  5. 使用 id!(state.value) 巨集在 Rust 中引用動畫狀態

限制

  • 僅在任務明確符合上述範圍時使用此技能。
  • 請勿將輸出視為環境特定驗證、測試或專家審查的替代品。
  • 若缺少必要的輸入、權限、安全邊界或成功標準,請停止並請求釐清。

Individual skills in this repo

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

ASoudy/AGS

Advanced JavaScript animation library skill for creating complex, high-performance web animations.

ASoudy/AGS

Astropy is the core Python package for astronomy, providing essential functionality for astronomical research and data analysis.

ASoudy/AGS

Build content-focused websites with Astro — zero JS by default, islands architecture, multi-framework components, and Markdown/MDX support.

ASoudy/AGS

One sentence - what this skill does and when to invoke it

ASoudy/AGS

Audit and fix animation performance issues including layout thrashing, compositor properties, scroll-linked motion, and blur effects. Use when animations stutter, transitions jank, or reviewing CSS/JS animation performance.

ASoudy/AGS

Internationalization and localization patterns. Detecting hardcoded strings, managing translations, locale files, RTL support.

ASoudy/AGS

Pull a YouTube video transcript into a queryable markdown vault with yt-dlp subtitle discovery, VTT cleanup, metadata frontmatter, and capture-seed stubs.

ASoudy/AGS

Expert in building portfolios that actually land jobs and clients - not just showing work, but creating memorable experiences. Covers developer portfolios, designer portfolios, creative portfolios, and portfolios that convert visitors into opportunities.

ASoudy/AGS

Generates high-converting Next.js/React landing pages with Tailwind CSS. Uses PAS, AIDA, and BAB frameworks for optimized copy/components (Heroes, Features, Pricing). Focuses on Core Web Vitals/SEO.

ASoudy/AGS

AI-powered animation tool for creating motion in logos, UI, icons, and social media assets.

ASoudy/AGS

Comprehensive patterns for Next.js 14+ App Router architecture, Server Components, and modern full-stack React development.

ASoudy/AGS

Next.js App Router principles. Server Components, data fetching, routing patterns.

ASoudy/AGS

Expert integration of Supabase Auth with Next.js App Router

ASoudy/AGS

React and Next.js 14+ application development with App Router, Server Components, TypeScript, Tailwind CSS, and modern frontend patterns.

ASoudy/AGS

Best practices for Remotion - Video creation in React

ASoudy/AGS

Generate walkthrough videos from Stitch projects using Remotion with smooth transitions, zooming, and text overlays

ASoudy/AGS

Seek and analyze video content using Memories.ai Large Visual Memory Model for persistent video intelligence

ASoudy/AGS

Writes complete, structured landing pages optimized for SEO ranking, AEO citation, and visitor conversion. Activate when the user wants to write or generate a landing page for a product, service, or offer.

ASoudy/AGS

Three.js animation - keyframe animation, skeletal animation, morph targets, animation mixing. Use when animating objects, playing GLTF animations, creating procedural motion, or blending animations.

ASoudy/AGS

Skill for discovering and researching autonomous AI agents, tools, and ecosystems using the AgentFolio directory.

相關技能