Makepad Graphics & Effects
GPU-accelerated shaders, SDF drawing, and animations in Makepad.
Quick Navigation
| Category | Description |
|---|---|
| Shader Basics | Structure, variables, math functions |
| SDF Drawing | Circle, box, capsule, path drawing |
| Animation | Animator, easing, keyframes, loops |
| Visual Effects | Hover, gradients, shadow, glow |
Shader Structure
live_design! {
MyShader = {{MyShader}} {
fn pixel(self) -> vec4 {
let sdf = Sdf2d::viewport(self.pos * self.rect_size);
// Draw shapes
sdf.circle(50.0, 50.0, 20.0);
sdf.fill(#FF0000);
return sdf.result;
}
}
}
SDF Operations
// Basic shapes
sdf.circle(x, y, radius)
sdf.box(x, y, width, height, border_radius)
sdf.capsule(x1, y1, x2, y2, width)
// Fill and stroke
sdf.fill(color) // Fill shape
sdf.stroke(color, width) // Stroke outline
sdf.fill_keep(color) // Fill, keep shape for more ops
Animator System
live_design! {
<Button> {
animator: {
hover = {
default: off
off = { from: {all: Forward {duration: 0.15}} }
on = { from: {all: Snap} }
}
}
draw_bg: {
color: #2196F3
color_hover: #42A5F5
}
}
}
Easing Functions
| Easing | Use Case |
|---|---|
OutQuad | Enter animations |
InQuad | Exit animations |
InOutQuad | Smooth transitions |
ExpDecay {d1: 0.8, d2: 0.97} | Physics-like motion |
Animation Example
live_design! {
LoadingSpinner = {{LoadingSpinner}} {
animator: {
spin = {
default: on
on = {
from: {all: Loop {duration: 1.0}}
apply: { draw_bg: { rotation: 360.0 } }
}
}
}
draw_bg: {
fn pixel(self) -> vec4 {
// Rotating arc shader
let sdf = Sdf2d::viewport(self.pos * self.rect_size);
let angle = self.rotation * PI / 180.0;
// Draw rotating arc
return sdf.result;
}
}
}
}
Gradient Effects
draw_bg: {
fn pixel(self) -> vec4 {
// Linear gradient
let grad = self.pos.y;
let color = mix(#FF0000, #0000FF, grad);
return vec4(color, 1.0);
}
}
Resources
Comments
No comments yet. Be the first to comment!
Related Tools
Makepad Core Concepts
makepad.nl
Fundamental building blocks of Makepad UI development including layout systems, widgets, event handling, and styling with live_design! macro.
Makepad Getting Started
makepad.nl
Entry point for Makepad development with Claude. Learn project setup, structure, and available skills for building cross-platform UI applications with Rust.
Makepad Components Gallery
makepad.nl
Quick reference for all Makepad built-in widgets with usage examples. Covers buttons, inputs, sliders, checkboxes, dropdowns, labels, icons, and virtual lists.
Related Insights

Anthropic Subagent: The Multi-Agent Architecture Revolution
Deep dive into Anthropic multi-agent architecture design. Learn how Subagents break through context window limitations, achieve 90% performance improvements, and real-world applications in Claude Code.
Complete Guide to Claude Skills - 10 Essential Skills Explained
Deep dive into Claude Skills extension mechanism, detailed introduction to ten core skills and Obsidian integration to help you build an efficient AI workflow
Skills + Hooks + Plugins: How Anthropic Redefined AI Coding Tool Extensibility
An in-depth analysis of Claude Code's trinity architecture of Skills, Hooks, and Plugins. Explore why this design is more advanced than GitHub Copilot and Cursor, and how it redefines AI coding tool extensibility through open standards.