makepad-animation
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 悬停效果
About this skill
This skill transforms an AI agent into an expert on the Makepad UI animation system. It empowers the agent to generate Rust code snippets for various animation states, transitions, hover effects, and interaction-driven animations within the Makepad framework. Leveraging internal documentation, it can also answer complex questions regarding Makepad's animation architecture, timelines, state management, and best practices, providing accurate and context-rich explanations to streamline the development process for Makepad developers.
Best use case
Rapidly prototype Makepad UI animations; Understand intricate Makepad animation behaviors and underlying principles; Debug animation logic within Makepad applications; Learn best practices for Makepad state and transition management in Rust.
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 悬停效果
Well-structured Makepad animation code snippets in Rust, clear and comprehensive explanations of Makepad animation concepts, or precise troubleshooting guidance for animation-related issues. The user will receive accurate, actionable information directly applicable to their Makepad project, improving development efficiency.
Practical example
Example input
How do I create a smooth hover animation for a button in Makepad that changes its background color from a dark gray to a light gray over 300ms when hovered, and smoothly reverts when the mouse leaves? Provide the Rust code for both states and the transition.
Example output
// Example Makepad animation code for a button hover effect
use makepad_widgets::*; // Assuming necessary imports
live_design!{
// Define your colors (or use existing ones)
COLOR_DARK_GRAY = #404040
COLOR_LIGHT_GRAY = #A0A0A0
// Define the animation states within your component's LiveDesign block
ButtonHoverAnimator = {{Animator}} {
state default {
from: { all: Forward { duration: 0.3 } }
apply: { background_color: (COLOR_DARK_GRAY) }
}
state hover {
from: { all: Forward { duration: 0.3 } }
apply: { background_color: (COLOR_LIGHT_GRAY) }
}
}
}
#[derive(Live, LiveHook, Widget)]
pub struct MyAnimatedButton {
#[animator] animator: Animator,
#[walk] walk: Walk,
#[redraw] #[live] redraw: Redraw,
#[live] background_color: Vec4,
// Other button properties...
}
impl LiveHook for MyAnimatedButton {
fn before_apply(&mut self, _cx: &mut Cx) {
self.animator_init();
}
}
impl Widget for MyAnimatedButton {
fn handle_event(&mut self, cx: &mut Cx, event: &Event, scope: &mut Scope) {
// Handle mouse events to trigger animation states
if let Event::MouseHover(me) = event {
if self.rect_for_instance(cx, self.instance()).contains(me.abs) {
// Mouse entered the button area
self.animator.play_anim(cx, id!(hover));
} else {
// Mouse left the button area
self.animator.play_anim(cx, id!(default));
}
}
// ... other event handling for the button
}
fn draw_walk(&mut self, cx: &mut Cx2d, scope: &mut Scope, walk: Walk) -> DrawStep {
// Get the current animated color
let current_bg_color = self.animator.construct_at(cx, id!(background_color)).eval(cx, self.background_color);
// Draw your button, applying the animated color
// This is a simplified example, actual drawing might use `draw_text`, `draw_quad` etc.
cx.draw_quad(walk, current_bg_color);
// ... rest of your drawing logic
DrawStep::done()
}
}When to use this skill
- When needing to implement new UI animations in Makepad (e.g., hover effects, state transitions, pressed states); When encountering issues with existing Makepad animations and seeking troubleshooting guidance; When seeking detailed explanations on how Makepad handles animation states or timelines; When generating Rust code for Makepad's `animation`, `animator`, `state`, `transition`, `hover`, or `pressed` properties.
When not to use this skill
- For animation systems or UI frameworks other than Makepad; For general Rust programming help unrelated to Makepad UI development; For front-end development tasks outside of the Makepad ecosystem; When the request is purely about visual design without involving code generation or technical explanation.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/makepad-animation/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How makepad-animation Compares
| Feature / Agent | makepad-animation | Standard Approach |
|---|---|---|
| Platform Support | Claude | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | easy | N/A |
Frequently Asked Questions
What does this skill do?
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 悬停效果
Which AI agents support this skill?
This skill is designed for Claude.
How difficult is it to install?
The installation complexity is rated as easy. You can find the installation instructions above.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
Best AI Skills for Claude
Explore the best AI skills for Claude and Claude Code across coding, research, workflow automation, documentation, and agent operations.
AI Agents for Coding
Browse AI agent skills for coding, debugging, testing, refactoring, code review, and developer workflows across Claude, Cursor, and Codex.
ChatGPT vs Claude for Agent Skills
Compare ChatGPT and Claude for AI agent skills across coding, writing, research, and reusable workflow execution.
SKILL.md Source
# 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
```rust
<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
```rust
<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
```rust
<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
```rust
<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 Structure
| Property | Description |
|----------|-------------|
| `animator` | Root animation container |
| `{state} =` | State definition (hover, pressed, focus, disabled) |
| `default:` | Initial state value |
| `{value} =` | State value definition (on, off, custom) |
| `from:` | Transition timeline |
| `apply:` | Properties to animate |
## Timeline Types (Play Enum)
| Type | Description |
|------|-------------|
| `Forward { duration: f64 }` | Linear forward animation |
| `Snap` | Instant change, no transition |
| `Reverse { duration: f64, end: f64 }` | Reverse animation |
| `Loop { duration: f64, end: f64 }` | Looping animation |
| `BounceLoop { duration: f64, end: f64 }` | Bounce loop animation |
## Easing Functions (Ease Enum)
```rust
// Basic
Linear
// Quadratic
InQuad, OutQuad, InOutQuad
// Cubic
InCubic, OutCubic, InOutCubic
// Quartic
InQuart, OutQuart, InOutQuart
// Quintic
InQuint, OutQuint, InOutQuint
// Sinusoidal
InSine, OutSine, InOutSine
// Exponential
InExp, OutExp, InOutExp
// Circular
InCirc, OutCirc, InOutCirc
// Elastic
InElastic, OutElastic, InOutElastic
// Back
InBack, OutBack, InOutBack
// Bounce
InBounce, OutBounce, InOutBounce
// Custom
ExpDecay { d1: f64, d2: f64 }
Bezier { cp0: f64, cp1: f64, cp2: f64, cp3: f64 }
Pow { begin: f64, end: f64 }
```
### Using Easing
```rust
from: {
all: Ease { duration: 0.3, ease: InOutQuad }
}
```
## Common States
| State | Values | Trigger |
|-------|--------|---------|
| `hover` | on, off | Mouse enter/leave |
| `pressed` / `down` | on, off | Mouse press/release |
| `focus` | on, off | Focus gain/lose |
| `disabled` | on, off | Widget enabled/disabled |
| `selected` | on, off | Selection change |
## Animatable Properties
Most `draw_*` shader uniforms can be animated:
- Colors: `color`, `border_color`, `shadow_color`
- Sizes: `border_size`, `border_radius`, `shadow_radius`
- Transforms: `scale`, `rotation`, `offset`
- Opacity: `opacity`
## When Writing Code
1. Always set `default:` for initial state
2. Use `Forward` for smooth transitions
3. Use `Snap` for instant state changes (like disabled)
4. Keep durations short (0.1-0.3s) for responsive feel
5. Animate shader uniforms in `draw_bg`, `draw_text`, etc.
## Rust API (AnimatorImpl Trait)
```rust
pub trait AnimatorImpl {
// Animate to state
fn animator_play(&mut self, cx: &mut Cx, state: &[LiveId; 2]);
// Cut to state (no animation)
fn animator_cut(&mut self, cx: &mut Cx, state: &[LiveId; 2]);
// Check current state
fn animator_in_state(&self, cx: &Cx, state: &[LiveId; 2]) -> bool;
}
// Usage example
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));
}
_ => {}
}
}
```
## When Answering Questions
1. States are independent - multiple can be active simultaneously
2. Animation applies properties when state reaches that value
3. `from` defines HOW to animate, `apply` defines WHAT to animate
4. Makepad tweens between old and new values automatically
5. Use `id!(state.value)` macro to reference animation states in RustRelated Skills
makepad-platform
CRITICAL: Use for Makepad cross-platform support. Triggers on: makepad platform, makepad os, makepad macos, makepad windows, makepad linux, makepad android, makepad ios, makepad web, makepad wasm, makepad metal, makepad d3d11, makepad opengl, makepad webgl, OsType, CxOs, makepad 跨平台, makepad 平台支持
makepad-layout
CRITICAL: Use for Makepad layout system. Triggers on: makepad layout, makepad width, makepad height, makepad flex, makepad padding, makepad margin, makepad flow, makepad align, Fit, Fill, Size, Walk, "how to center in makepad", makepad 布局, makepad 宽度, makepad 对齐, makepad 居中
makepad-font
CRITICAL: Use for Makepad font and text rendering. Triggers on: makepad font, makepad text, makepad glyph, makepad typography, font atlas, text layout, font family, font size, text shaping, makepad 字体, makepad 文字, makepad 排版, makepad 字形
moodle-external-api-development
This skill guides you through creating custom external web service APIs for Moodle LMS, following Moodle's external API framework and coding standards.
mobile-developer
Develop React Native, Flutter, or native mobile apps with modern architecture patterns. Masters cross-platform development, native integrations, offline sync, and app store optimization.
graphql-architect
Master modern GraphQL with federation, performance optimization, and enterprise security. Build scalable schemas, implement advanced caching, and design real-time systems.
git-pr-workflows-pr-enhance
You are a PR optimization expert specializing in creating high-quality pull requests that facilitate efficient code reviews. Generate comprehensive PR descriptions, automate review processes, and ensu
git-advanced-workflows
Master advanced Git techniques to maintain clean history, collaborate effectively, and recover from any situation with confidence.
debugging-toolkit-smart-debug
Use when working with debugging toolkit smart debug
debugger
Debugging specialist for errors, test failures, and unexpected behavior. Use proactively when encountering any issues.
conductor-setup
Configure a Rails project to work with Conductor (parallel coding agents)
comprehensive-review-pr-enhance
Generate structured PR descriptions from diffs, add review checklists, risk assessments, and test coverage summaries. Use when the user says "write a PR description", "improve this PR", "summarize my changes", "PR review", "pull request", or asks to document a diff for reviewers.