Anim

From Asymmetric-al/core · View interactive version

Anim is an AI agent skill from the GitHub repository Asymmetric-al/core. Core's motion contract: shared easing, duration, stagger, and scale tokens; press/hover utilities; motion/react import rules; route view transitions; tooltip timing; and the reduced-motion baseline. Use when adding or reviewing interface motion in Core — hover and press feedback, entrances and exits

How to use this skill

Skill file

Core motion contract

Use this skill for the repository's operative motion rules. For animation

craft (timing, easing, choreography, when not to animate), load

docs/ai/skills/emil-design-engineering/SKILL.md first. For motion/react

API details, use the motion skill.

Workflow

  1. Decide what the motion communicates (feedback, hierarchy, spatial continuity). If it is decoration, leave it out.
  2. Use the shared tokens, utilities, and presets below instead of raw durations, curves, or scales.
  3. Animate transform and opacity; entrances ease out, exits ease in and run faster than entrances.
  4. Define reduced-motion behavior and check the route view-transition rules when the element sits inside an app shell.
  5. Run node scripts/check-motion-patterns.mjs <files> on changed files; tests/unit/motion-contract.test.ts guards the banned class patterns.

Two synchronized halves

  1. CSS tokens in packages/ui/styles/globals.css (:root) — the baseline for Tailwind, Base UI surfaces, and global CSS.
  2. TS constants in packages/lib/motion-presets.ts (@asym/lib/motion-presets) — the pair for motion/react and shared helpers. Prefer these over raw literals.

When updating one half, update the other.

CSS tokens (`packages/ui/styles/globals.css :root`)

/* Easing */
--ease-out-soft: cubic-bezier(0.22, 1, 0.36, 1);
--ease-in-soft: cubic-bezier(0.4, 0, 1, 1);
--ease-in-out-soft: cubic-bezier(0.77, 0, 0.175, 1);
--ease-drawer: cubic-bezier(0.32, 0.72, 0, 1); /* iOS curve */

/* Duration tiers — product UI stays under 300ms unless ceremonial */
--duration-press: 120ms; /* button/tile press feedback */
--duration-micro: 150ms; /* hover, color change */
--duration-standard: 220ms; /* tooltip, popover, dropdown, select */
--duration-modal: 220ms; /* dialog open/close */
--duration-drawer: 320ms; /* sheet / vaul drawer */
--duration-route: 240ms; /* matches asym-vt-route-* */
--duration-shared: 280ms; /* matches asym-vt-share-* */

/* Stagger */
--stagger-tight: 45ms;
--stagger-medium: 60ms;

/* Transform — never below 0.95 */
--scale-press: 0.98;
--scale-hover-subtle: 1.02;
--scale-entrance: 0.96;

The values in globals.css are authoritative; keep this copy in sync when tokens change.

CSS utilities (same file)

| Utility | What it does | Touch-safe? | Pair with |

| --------------------- | ----------------------------------------------------------------------------- | ------------------------------------------------- | --------------------------------- |

| .press-feedback | :active scale to var(--scale-press) | Yes (:active fires on tap) | Already on every <Button> |

| .hover-lift | :hover translateY(-2px) | Yes (@media (hover: hover) and (pointer: fine)) | Cards, tiles, list rows |

| .hover-scale-subtle | :hover scale(var(--scale-hover-subtle)) | Yes (@media (hover: hover) and (pointer: fine)) | Buttons, badges, marketing CTAs |

| .spinner-essential | infinite spin exempt from the reduced-motion kill (essential status feedback) | Yes | Loader2 loading indicators only |

The first three share one transition-property declaration, so they can be stacked on one element without overriding each other's transition list.

TS constants (`@asym/lib/motion-presets`)

EASE_OUT_SOFT, EASE_IN_SOFT, EASE_IN_OUT_SOFT, EASE_DRAWER, DURATION_PRESS, DURATION_MICRO, DURATION_STANDARD, DURATION_ROUTE, DURATION_SHARED, DURATION_DRAWER, DURATION_SLOW, STAGGER_TIGHT, STAGGER_MEDIUM, SCALE_HOVER_SUBTLE, SCALE_TAP_SUBTLE, SCALE_ENTRANCE. They match the CSS tokens in numeric intent, not always in name (DURATION_SLOW is a TS-only marketing/hero tier; SCALE_TAP_SUBTLE matches --scale-press).

Pre-built Transition objects: transitionStandard, transitionSlow, transitionExitQuick, springTap (gestures only).

Reduced-motion-aware helpers:

`@asym/lib/motion` and `@asym/lib/motion-provider`

ESLint (tooling/eslint-config/restricted-imports.mjs) bans importing motion/react or framer-motion directly. Import from @asym/lib/motion, which exports motion (the lazy m component), AnimatePresence, LayoutGroup, LazyMotion, domAnimation, useInView, useReducedMotion, and the common types.

Because motion is the lazy m component, it needs the MotionProvider from @asym/lib/motion-provider above it (LazyMotion features={domAnimation} plus MotionConfig reducedMotion="user"). Each app's root layout.tsx already mounts it.

Repo motion standard (operative rules)

packages/ui/styles/globals.css and packages/lib/motion-presets.ts are the runtime contract. This file and the Motion section of docs/ai/rules/frontend.md describe how to apply it; keep them in sync when policy changes.

When not to animate

Hover on touch

Transitions and press feedback

Popover, tooltip, and dropdown origin

Route transitions

CSS transitions, tweens, and springs

Tooltip timing

Reduced motion

Repo examples

Checklist

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.