Animate

From aladicf/better-web-ui · View interactive version

Animate is an AI agent skill from the GitHub repository aladicf/better-web-ui. Improve or implement purposeful motion systems, micro-interactions, gestures, and transition behavior for production-grade UI. Use when the user mentions animation, motion, transitions, micro-interactions, hover states, drawers, toasts, gestures, or making the UI feel more alive.

How to use this skill

Skill file

Analyze a feature and add motion that improves clarity, feedback, perceived performance, and polish without making the interface feel slow, noisy, or theatrical.

MANDATORY PREPARATION

Users start this workflow with /animate. Once this skill is active, load $frontend-design — it contains design principles, anti-patterns, and the Context Gathering Protocol. Follow that protocol before proceeding — if no design context exists yet, you MUST load $setup first. Additionally gather: performance constraints.

Consult the motion reference for timing, easing, choreography, and reduced-motion handling.

Consult the animate reference index when you need to browse the deeper motion library by use case instead of guessing filenames.

Consult the elevation system when motion should reinforce raised, pressed, inset, dragged, or layered depth.

Consult the interaction reference when animation decisions overlap with focus, loading, transitions, or feedback states.

Consult the component anatomy reference when motion affects custom primitives such as buttons, tabs, tooltips, toasts, toggles, drawers, or submit actions.

Consult the responsive design reference when motion needs to adapt across small screens, touch contexts, or reduced viewport space.

Consult the framework official docs reference before making framework-specific animation decisions.

Consult the React shadcn accelerators reference when the request overlaps with React toasts, drawers, text motion, or other UI patterns that already have strong accelerators.

Consult the CSS, Tailwind, and WAAPI motion reference to decide when modern CSS, Tailwind, or WAAPI can solve the motion cleanly without reaching for a framework animation library.

Consult the scroll-driven animations reference when motion should progress with scroll position rather than time.

Consult the view transitions reference when animating between page states or DOM changes with shared-element continuity.

Consult attribution and sources for the source lineage behind this skill's Emil-inspired motion guidance.

Consult entrance animations, exit animations, gesture interactions, and micro-interactions for consolidated thematic guidance by motion type.

Consult ease-out defaults, easing by context, and custom easing curves when choosing motion curves.

Consult UI under 300ms, asymmetric press and release timing, 500ms drawer timing, faster perceived performance, and tooltip timing escalation when the main question is duration rather than easing.

Consult on-screen movement easing, sheet and drawer easing, and spring motion when the motion pattern needs more specific guidance.

Consult damped drag boundaries, upward drag friction, interruptible animations, momentum dismissal, pointer capture, scroll and drag conflicts, and velocity-aware snap points when implementing gesture-heavy surfaces.

Consult blur-bridged transitions, clip-path tabs, respect reduced motion, opacity fallback, reduced motion alternatives, Motion's CODE0, hover gap fill, scroll reveal thresholds, child orchestration, and toast stack depth for polish and accessibility refinement.

Consult transform and opacity only, avoid CSS variables in drag loops, clip-path reveals, hardware-accelerated motion under load, and surgical CODE0 for performance-sensitive property choices.

Consult immediate action feedback, interaction frequency, no keyboard animation, marketing exceptions, and animation purpose for strategy-heavy motion decisions.

Consult preserve-3d effects, never scale from zero, origin-aware animations, and percentage translateY when the question is really about transform technique and spatial feel.

Consult button press scale 0.97, scale affecting children, and SVG path morph disclosure icons for finer transform polish details.

If the interface already feels laggy under frequent use, also load optimize.

If the interface needs stronger resilience around reduced motion, errors, overflow, edge cases, or mixed input modes, also load harden.


Attribution and Inspiration

This skill's motion guidance is informed in part by Emil Kowalski's animations.dev course, especially the emphasis on easing choice, timing, tasteful restraint, springs, and motion that "feels right" in production UI.

It is also informed by Emil's animation-heavy open-source work on Sonner and Vaul, which are already relevant elsewhere in this library for React toast and drawer guidance.

This repository rewrites those lessons into original, repository-specific guidance rather than reproducing the course materials directly.


Motion Operating Model

Use this decision order before adding any animation:

  1. Fix structure first — motion should reinforce hierarchy and state, not rescue a confusing layout.
  2. Animate only with a job to do — every animation should improve feedback, orientation, relationship, or delight.
  3. Bias toward speed — product UI should feel responsive first and impressive second.
  4. Keep motion interruptible — new user intent beats finishing the old animation.
  5. Match the input method — mouse, touch, and keyboard interactions do not all deserve the same motion treatment.
  6. Plan reduced motion up front — accessibility is part of the system, not a cleanup pass.
  7. Prefer the lightest implementation that fits — modern CSS and Tailwind first, WAAPI when imperative timing matters, Motion when the interaction genuinely needs it.

Use motion for one or more of these jobs:

If the animation cannot justify itself with one of those jobs, cut it.

Assess Motion Opportunities

Analyze where motion would improve the experience:

  1. Identify static areas:
  1. Understand the context:

If any of these are unclear from the codebase, ask the user directly to clarify what you cannot infer.

CRITICAL: Respect prefers-reduced-motion. Always provide non-animated alternatives for users who need them.

Motion should reinforce hierarchy, not compensate for weak hierarchy. If the layout only becomes understandable once it moves, fix the layout first.

Plan Animation Strategy

Create a purposeful animation plan:

IMPORTANT: One well-orchestrated experience beats scattered animations everywhere. Focus on high-impact moments.

Default Motion Rules

Use these as the default guidelines for animation work unless the product context gives a strong reason to deviate.

1. Strategy and Purpose

2. Easing Defaults

3. Timing and Duration

4. Property Selection and Performance

5. Transform and Scale Techniques

6. Gesture and Interaction Patterns

7. Accessibility and Polish

Implement Animations

Add motion systematically across these categories:

Entrance Animations

Micro-interactions

State Transitions

Navigation & Flow

Feedback & Guidance

Depth & Elevation Motion

Delight Moments

Technical Implementation

Use appropriate techniques for each animation:

Timing & Easing

Durations by purpose:

Easing curves (use these, not CSS defaults):

/* Recommended - natural deceleration */
--ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);    /* Smooth, refined */
--ease-out-quint: cubic-bezier(0.22, 1, 0.36, 1);   /* Slightly snappier */
--ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);     /* Confident, decisive */
--ease-in-out-standard: cubic-bezier(0.65, 0, 0.35, 1); /* Reversible movement */
--ease-sheet-standard: cubic-bezier(0.32, 0.72, 0, 1);   /* Sheets / drawers */

/* AVOID - feel dated and tacky */
/* bounce: cubic-bezier(0.34, 1.56, 0.64, 1); */
/* elastic: cubic-bezier(0.68, -0.6, 0.32, 1.6); */

Exit animations are faster than entrances. Use ~75% of enter duration.

CSS Animations

/* Prefer for simple, declarative animations */
- transitions for state changes
- @keyframes for complex sequences
- transform + opacity first (GPU-friendly)
- Tailwind utilities when the project already uses Tailwind

JavaScript Animation

/* Use for complex, interactive animations */
- Web Animations API for programmatic control
- Framer Motion / Motion for React
- GSAP for complex sequences

Default rule: if a hover, press, reveal, or reduced-motion fallback can be expressed cleanly with modern CSS or Tailwind utilities, prefer that path before escalating to Motion.

Performance

Accessibility

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

Prefer replacing large movement with short fades, highlights, blur transitions, or instant state changes instead of deleting every form of feedback.

Useful Default Values

Use these as starting points, then tune for context:

| Value | Good default use |

| --- | --- |

| scale(0.97) | Button and chip press feedback |

| scale(0.95) | Minimum believable enter scale |

| 200ms | Standard UI transition |

| 300ms | Soft cap for common UI motion |

| 500ms | Large sheet / drawer transition upper bound |

| cubic-bezier(0.32, 0.72, 0, 1) | Drawer / bottom-sheet easing |

| 10-16px | Toast-stack offset starting range |

| ~100px from viewport edge | Scroll-reveal trigger starting point |

NEVER:

Verify Quality

Test animations thoroughly:

Remember: the best UI animation usually feels inevitable, not attention-seeking. Animate with purpose, tune for responsiveness, respect accessibility, and let motion support the product instead of starring in it.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.