Communitygithub.com

ux-animation-principles

Apply 20 UX and animation principles (12 animation principles adapted to UI, plus Fitts's, Hick's, Miller's, Postel's and Jakob's laws, the Doherty threshold, bigger hit areas and frequency of use) when designing, reviewing or implementing UI motion, micro-interactions, transitions, feedback, target sizing, menus, forms or layouts. Use when a user asks to animate an interface, make UI feel better or snappier, review motion or interaction design, choose durations and easing, size touch targets, simplify choices, write a motion spec, or add a specific principle to a specific element (e.g. add squash & stretch to this button).

ux-animation-principles 是什麼?

ux-animation-principles is a Claude Code agent skill that apply 20 UX and animation principles (12 animation principles adapted to UI, plus Fitts's, Hick's, Miller's, Postel's and Jakob's laws, the Doherty threshold, bigger hit areas and frequency of use) when designing, reviewing or implementing UI motion, micro-interactions, transitions, feedback, target sizing, menus, forms or layouts. Use when a user asks to animate an interface, make UI feel better or snappier, review motion or interaction design, choose durations and easing, size touch targets, simplify choices, write a motion spec, or add a specific principle to a specific element (e.g. add squash & stretch to this button).

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/kweeyo09/ux-animation-kit/tree/HEAD/skill/ux-animation-principles

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

UX & Animation Principles

A working method for turning 20 principles into concrete, testable UI and motion decisions. The full per-principle reference (what it does, when to use it, how to implement it, one common pitfall) is in references/principles.md. Accessibility, reduced-motion and performance rules are in references/accessibility-performance.md. How to put any principle on any element, with recipes for common elements and rules for combining principles, is in references/element-recipes.md. Read the reference sections for the principles you select; do not load all 20 when only three apply.

The 20 principles (fixed order, stable IDs)

IDPrincipleFamily
ux-01Squash & stretchMotion
ux-02Anticipation wind-upMotion
ux-03Staging the focusMotion
ux-04Pose to poseMotion
ux-05Follow throughMotion
ux-06Ease in & ease outMotion
ux-07ArcsMotion
ux-08Secondary actionMotion
ux-09Snappy timingMotion
ux-10Exaggerated feedbackMotion
ux-11Solid 3D modelsMotion
ux-12ConsistencyMotion
ux-13Fitts's lawUX law
ux-14Bigger hit areasUX law
ux-15Hick's lawUX law
ux-16Miller's lawUX law
ux-17Doherty thresholdUX law
ux-18Postel's lawUX law
ux-19Jakob's lawUX law
ux-20Frequency of useUX law (label unverified; see reference)

Workflow

Follow these five steps in order. Keep the answer proportional: a one-button question gets a few lines, a full screen review gets the full spec.

1. Assess the task and constraints

Before choosing anything, establish (from the request, the code, or by asking one short question if a wrong guess would be costly):

  • What is being built or reviewed: component, flow, screen, or whole product.
  • Platform and input: touch, mouse, keyboard, TV remote, mixed. Viewport sizes.
  • Stack: CSS, Web Animations API, Framer Motion/Motion, GSAP, SwiftUI, Compose, Lottie, native. Use what the project already uses.
  • Frequency: how often a user sees this interaction (once at onboarding, or 200 times a day). Frequent interactions need shorter, subtler motion.
  • Brand and tone: playful, neutral, premium, utilitarian.
  • Hard constraints: accessibility level (WCAG 2.2 AA is the default target), low-end devices, performance budget, existing design tokens.

2. Select the relevant principles

Pick the smallest set that solves the problem (usually 2–5). Use this map:

SituationStart with
Element enters, exits or changes stateux-06, ux-09, ux-03
Something feels stiff or lifelessux-01, ux-05, ux-07, ux-08
Action is easy to miss or misreadux-02, ux-10, ux-03
Multi-step or multi-element transitionux-04, ux-05, ux-03
Spatial / card / flip / depth effectsux-11, ux-07
UI feels inconsistent or "cheap"ux-12, ux-09, ux-06
Hard to tap or clickux-13, ux-14, ux-20
Too many options, slow decisionsux-15, ux-16, ux-20
Feels slow, laggy, unresponsiveux-17, ux-09
Forms reject reasonable inputux-18
Users get lost, "where is X?"ux-19, ux-20, ux-03

Name the principles you chose and the ones you rejected when a rejection is not obvious (for example: "No squash & stretch: this is a banking app and the tone is neutral").

3. Translate into concrete decisions

Never stop at "add some easing". Every recommendation must be specific enough to implement without guessing. Express motion as a spec:

Element:     <what moves>
Trigger:     <user action / state change>
Principle:   <ux-NN name>
Properties:  transform: translateY(8px → 0), opacity 0 → 1   (transform/opacity only where possible)
Duration:    180ms            Easing: cubic-bezier(0.2, 0, 0, 1)
Delay/stagger: 0 / 30ms per item, max 5 items
Reduced motion: opacity only, 120ms   (or: no animation, instant state change)
Interruptible: yes — retargets from current value

Express UX-law decisions as measurable rules, for example:

  • "Primary action button 48px tall, placed in the thumb zone, within 120px of the last input" (ux-13).
  • "Icon stays 20px; hit area 44×44px via padding; 8px minimum gap" (ux-14).
  • "Show 4 grouped options with a recommended default; move 11 rarer items behind 'More'" (ux-15, ux-20).
  • "Acknowledge the tap within 100ms; show skeleton if the result exceeds 400ms" (ux-17).

Default timing tokens (adjust to brand, then keep them consistent):

TokenDurationUse
instant0–80msHover/press colour, focus ring
fast120–180msSmall elements, toggles, tooltips
base200–280msMenus, cards, dialogs entering
slow300–450msLarge surfaces, page-level transitions
exit~70–80% of the matching enterLeaving should be quicker than arriving

Default easings: enter cubic-bezier(0, 0, 0.2, 1) (ease-out), exit cubic-bezier(0.4, 0, 1, 1) (ease-in), move on-screen cubic-bezier(0.4, 0, 0.2, 1) (ease-in-out). Use springs for direct manipulation and interruptible motion.

4. Implement

  • Prefer the project's existing animation layer. If none, use CSS transitions for simple state changes and the Web Animations API for sequenced or replayable motion.
  • Animate transform and opacity; avoid animating layout properties (width, height, top, left, margin) on large or frequent elements.
  • Wrap motion in a reduced-motion branch from the start, not as an afterthought (see references/accessibility-performance.md).
  • Keep motion interruptible: a second click mid-animation must retarget, never queue.
  • Put durations and easings in shared tokens or CSS custom properties.

5. Verify

Run through this checklist and report what you actually checked (do not claim a check you did not perform):

  • Each chosen principle maps to a visible, specific change (name the ux-ID).
  • Durations fall inside the token ranges; frequent interactions are at the short end.
  • prefers-reduced-motion: reduce removes or replaces non-essential motion, and no information is conveyed only by motion.
  • Nothing auto-plays for more than 5 seconds without a pause/stop control.
  • No flashing more than 3 times per second.
  • Interactive targets are at least 24×24 CSS px (WCAG 2.2 AA), 44×44 for primary touch targets.
  • Focus is visible and keyboard order follows the visual order after motion.
  • Only compositor-friendly properties animate on hot paths; no layout thrash.
  • Interaction feedback appears within 100ms; results or progress within 400ms.
  • Tested at least once at 0.25× speed (DevTools Animations panel or a slowed clock) to inspect easing and overlap.

Apply any principle to any element

Any of the 20 principles can be added to any element in a design: a button, card, dialog, toast, toggle, input, list row, menu, or a whole screen. When the user asks to add a principle to an element ("give this card follow through", "make the toast snappy", "apply Fitts's law to the checkout button"), or asks which principles could improve an element:

  1. Name the element and its parts. Container, children, actions, inputs, and where it sits.
  2. Find the hook. Each principle attaches to one of six hooks: enter/exit, press, feedback, content, actions, or placement & size. Look up the principle's row and the element's recipe in references/element-recipes.md.
  3. If the element has no obvious place for the principle, go one level up and say so. A toast has no input, so Postel's law applies to the field its "Reply" action opens.
  4. Check how it stacks with principles the element already uses. See the stacking rules in the same file. Pick one hero principle per element and keep the rest subtle.
  5. Give the spec and code for that element only. Then verify it with the checklist above, including reduced motion.

Never refuse a principle because the element seems too small or too plain. A one-pixel shift, a 120ms ease-out or a 44px hit area is still the principle applied.

Output format

For a review: list findings as ux-ID · issue · concrete fix, ranked by user impact. For a build: give the spec block(s), then the code, then the verification results. For a quick question: answer in a few lines and cite the ux-ID.

Guardrails

  • Motion must serve a purpose: orientation, feedback, focus, continuity or personality. If you cannot name the purpose, remove the motion.
  • Personality principles (ux-01, ux-08, ux-10) scale with brand tone. Turn them down for serious, high-stakes or high-frequency contexts.
  • UX laws are heuristics with empirical backing, not physics. State them as trade-offs, and prefer testing with users over citing a law.

相關技能