跳到正文
Skillpedia
网站与界面(前端)48k · #5144

makepad-animation

它能做什么

这个工具可以帮你为 Makepad 框架中的用户界面创建动画效果。你可以定义元素在用户交互(比如鼠标悬停或点击)时如何改变颜色、大小或其他属性。

适用场景

  • ✓制作鼠标悬停时会改变颜色的按钮。
  • ✓制作点击时会放大的元素。
  • ✓设定文本输入框获得焦点时的颜色变化。

技能链接

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/makepad-animation/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/makepad-animation/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“为一个按钮创建动画:鼠标悬停时变成绿色,鼠标移开后恢复正常。”

每周 5 个新技能,1 分钟读完。

工作原理

你需要定义“状态”(比如“normal”和“hover”),再设定 Makepad 如何在这些状态之间做动画过渡,包括持续时间,以及哪些属性(颜色、大小)需要变化。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Supporting material availability

This catalog copy contains the inline guidance below, but does not include the following supporting paths. They are external prerequisites, not bundled files:

  • ./references/animation-system.md

Ask for the original supporting material or an existing installation before using a step that depends on these paths; this catalog does not identify a verified download source for them. Resolve each path relative to that installation, inspect its contents, and verify any applicable license and execution prerequisites. Do not run a command or claim a referenced procedure was followed until its required file exists. Do not fabricate the missing scripts or treat an unrelated file with the same name as equivalent. Independent steps fully documented here can proceed within the user’s authorized scope; report any dependent step as unavailable.

Makepad Animation Skill

Version: makepad-widgets (dev branch) | Last Updated: 2026-01-19

Check for updates: https://crates.io/crates/makepad-widgets

You are an expert at Makepad animations. Help users by:

  • Writing code: Generate animation code following the patterns below
  • Answering questions: Explain states, transitions, timelines

When to Use

  • You need to build or debug animations, transitions, hover states, or animator timelines in Makepad.
  • The task involves animator, state changes, easing, keyframes, or visual interaction feedback.
  • You want Makepad-specific animation patterns instead of generic Rust UI guidance.

Documentation

Refer to the local files for detailed documentation:

  • ./references/animation-system.md - Complete animation reference

Advanced Patterns

For production-ready animation patterns, see the _base/ directory:

Pattern Description
06-animator-basics Animator fundamentals
07-easing-functions Easing and timing
08-keyframe-animation Complex keyframes

IMPORTANT: Documentation Completeness Check

Before answering questions, Claude MUST:

  1. Read the relevant reference file(s) listed above
  2. If file read fails or file is empty:
    • Inform user: "本地文档不完整,建议运行 /sync-crate-skills makepad --force 更新文档"
    • Still answer based on SKILL.md patterns + built-in knowledge
  3. If reference file exists, incorporate its content into the answer

Key Patterns

1. Basic Hover Animation

<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. Multi-State Animation

<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. Focus State Animation

<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. Disabled State

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

            off = {

…
常见问题

动画中的“状态”是什么?

状态是元素可以呈现的不同外观,比如“normal”(正常)、“hover”(鼠标悬停)、“pressed”(按下)或“disabled”(禁用)。

“duration”是什么意思?

duration 指的是从一个状态过渡到另一个状态所需的时间。数值越小,动画就越快。

什么是“Snap”?

“Snap”表示从一个状态切换到另一个状态时是瞬间完成的,没有动画效果。

详情

作者的原始描述

CRITICAL: Use for Makepad animation system. Triggers on: makepad animation, makepad animator, makepad hover, makepad state, makepad transition, "from: { all: Forward", makepad pressed, makepad 动画, makepad 状态, makepad 过渡, makepad 悬停效果

repo: sickn33/agentic-awesome-skills

热度

GitHub 星标
48k
排名
#5144
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能