Communitygithub.com

Anhvu1107/all-agent-skill

一律在請求與 Makepad 動畫相關時使用:當任務涉及 Makepad 動畫系統時,此技能為必用。

all-agent-skill 是什麼?

此技能專為 Makepad 動畫系統設計,是開發者在處理 Makepad UI 框架中任何動畫、轉場、懸停狀態或時間軸任務時的核心指南。它提供了一套結構化的文件參考與程式碼範例,涵蓋從基本的懸停動畫到複雜的多狀態與關鍵幀動畫,並說明了動畫器 (animator) 的結構、時間軸類型、緩動函式以及可動畫化的屬性。此技能支援 Claude Code 等 AI 代理,透過指示代理先讀取特定的參考文件(如 `references/animation-system.md`)來確保回答的完整性,並在文件缺失時提供更新指令。其核心價值在於將 Makepad 特有的動畫模式標準化,幫助開發者快速生成一致且高品質的動畫程式碼,避免依賴通用的 Rust UI 開發知識。

相容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/Anhvu1107/all-agent-skill/tree/HEAD/.agent/skills/makepad-animation

在你喜歡的 AI 中提問

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

說明文件

Makepad 動畫技能

選擇性閱讀規則

從以下檔案開始:

  • references/senior-master-standard.md
  • references/usage-routing.md
  • references/quality-checklist.md

然後僅載入與使用者實際任務相符的繼承文件、腳本、資產或範例。

版本: makepad-widgets (開發分支) | 最後更新: 2026-01-19

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

您是 Makepad 動畫的專家。透過以下方式幫助使用者:

  • 撰寫程式碼:依照下列模式產生動畫程式碼
  • 回答問題:解釋狀態、轉場、時間軸

使用時機

  • 您需要在 Makepad 中建立或除錯動畫、轉場、懸停狀態或動畫器時間軸。
  • 任務涉及 animator、狀態變更、緩動、關鍵幀或視覺互動回饋。
  • 您想要 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, custom)
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. 在 Rust 中使用 id!(state.value) 巨集來引用動畫狀態

限制

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

Individual skills in this repo

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

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches 007: Security audit, hardening, threat modeling (STRIDE/PASTA), Red/Blue Team, OWASP checks, code review, incident response, and infrastructure security for any project.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Agentfolio: Skill for discovering and researching autonomous AI agents, tools, and ecosystems using the AgentFolio directory.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Animejs Animation: Advanced JavaScript animation library skill for creating complex, high-performance web animations.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Astropy: Astropy is the core Python package for astronomy, providing essential functionality for astronomical research and data analysis.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Astro: Build content-focused websites with Astro — zero JS by default, islands architecture, multi-framework components, and Markdown/MDX support.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Emotional ARC Designer: One sentence - what this skill does and when to invoke it

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Fixing Motion Performance: Audit and fix animation performance issues including layout thrashing, compositor properties, scroll-linked motion, and blur effects.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches I18n Localization: Internationalization and localization patterns.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Interactive Portfolio: Expert in building portfolios that actually land jobs and clients - not just showing work, but creating memorable experiences.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches JQ: Expert jq usage for JSON querying, filtering, transformation, and pipeline integration.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Landing Page Generator: Generates high-converting Next.js/React landing pages with Tailwind CSS.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches LEX: Centralized ''Truth Engine'' for cross-jurisdictional legal context (US, EU, CA) and contract scaffolding.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Magic Animator: AI-powered animation tool for creating motion in logos, UI, icons, and social media assets.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Nextjs APP Router Patterns: Comprehensive patterns for Next.js 14+ App Router architecture, Server Components, and modern full-stack React development.

Anhvu1107/all-agent-skill

ALWAYS use this when the user mentions Nextjs Best Practices, asks to build, debug, review, document, automate, test, configure, migrate, or make decisions in this domain, or the task clearly depends on Nextjs Best Practices; scope: Next.js App Router principles. Apply the bundled workflow, references, scripts, Senior Master standard, and Codex strict review gate before final output.

Anhvu1107/all-agent-skill

description: ALWAYS use this when the work is specifically about modern Next.js or React architecture, data flow, rendering strategy, routing, or performance-sensitive frontend behavior.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Nextjs Supabase Auth: Expert integration of Supabase Auth with Next.js App Router

Anhvu1107/all-agent-skill

ALWAYS use this when the task involves reading, extracting, splitting, merging, rotating, creating, validating, OCR-ing, form-filling, or otherwise producing or modifying PDF files.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches React Nextjs Development: React and Next.js 14+ application development with App Router, Server Components, TypeScript, Tailwind CSS, and modern frontend patterns.

Anhvu1107/all-agent-skill

ALWAYS use this when working with Remotion code, video compositions, rendering logic, timing, media assets, or React-based motion workflows.

相關技能