Communitygithub.com

Anhvu1107/all-agent-skill

始终在请求涉及 Makepad 动画系统时使用此技能。

all-agent-skill 是什么?

该技能专门用于处理 Makepad 动画系统,为开发者提供生成动画代码、解释状态与过渡以及处理时间线的专家级帮助。它支持在 Makepad 中创建悬停、按下、聚焦、禁用等多种交互状态的平滑动画。该技能依赖于本地文档文件(如 `references/animation-system.md`),并在文档不完整时提示用户更新。通过 Rust 的 `AnimatorImpl` trait,开发者可以直接在事件处理中调用动画播放和切换方法,实现高度定制化的 UI 反馈。支持的平台包括基于 Makepad 框架的 Rust 应用开发。

兼容平台✓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(dev 分支) | 最后更新: 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_* 着色器 uniform 都可动画化:

  • 颜色:color, border_color, shadow_color
  • 大小:border_size, border_radius, shadow_radius
  • 变换:scale, rotation, offset
  • 不透明度:opacity

编写代码时

  1. 始终设置 default: 作为初始状态
  2. 使用 Forward 实现平滑过渡
  3. 使用 Snap 实现即时状态变化(如禁用)
  4. 保持持续时间短(0.1-0.3s)以获得响应感
  5. 在 draw_bg, draw_text 等中动画化着色器 uniform

Rust API(AnimatorImpl 特质)

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.

相关技能