Agent skill

Web Animation Perf

by swyxio in swyxio/skills

Prevent layout/transition/reflow thrash in JS-driven CSS animations.

MITAuto-check passedFrontend & Design

Install Web Animation Perf

skills CLI
$ npx skills add swyxio/skills --skill web-animation-perf -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install swyxio/skills web-animation-perf --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/swyxio/skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/web-animation-perf .claude/skills/web-animation-perf && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
web-animation-perf
GitHub stars
176
Token cost
~2.3k tokens
SKILL.md length
949 words
Files
1
Skills in repo
89
Repo updated
First seen
Licence
MIT

At a glance

Prevent layout/transition/reflow thrash in JS-driven CSS animations.

  • Works in 3 steps: Never combine transition: all with JS… → Use requestAnimationFrame, never… → Animate transform and opacity. Avoid…
  • Debugging continuous motion (rotation
  • SKILL.md covers The Three Cardinal Rules, Supporting practices, Diagnostic Workflow and Quick Reference Anti-Pattern →…, plus 1 more section
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Web Animation Perf is an agent skill from swyxio/skills. Prevent layout/transition/reflow thrash in JS-driven CSS animations. Use when building or debugging continuous motion (rotation, orbit, parallax, scroll-linked effects, marquee, carousels) and when symptoms appear like jank, stutter, lag, animation drift, ghosting, "elements collapsing toward center", "going slow", "should we use canvas?", or when mixing setInterval/React state with CSS transition.

Its SKILL.md is about 2.3k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Frontend & Design, covering Web animation and motion, Mobile performance and State management. The repository describes itself as: Agent skills for Claude Code and other AI agents. The licence is MIT.

When your agent uses it

  • Debugging continuous motion (rotation
  • Scroll-linked effects
  • Carousels) and when symptoms appear like jank
  • Animation drift

Example prompts

  • “elements collapsing toward center”
  • “going slow”
  • “should we use canvas?”
  • “/web-animation-perf”

Workflow steps

3 steps, taken from the step headings in SKILL.md.

  1. Never combine transition: all with JS that updates the same property every frame
  2. Use requestAnimationFrame, never setInterval, for continuous motion
  3. Animate transform and opacity. Avoid left/top/width/height/margin/padding

What it can do on your machine

Read from SKILL.md and the folder at commit 038ef34. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are javascript).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Web Animation Perf loads about 2.3k tokens when it runs. Until then it costs about 106 tokens; SKILL.md has 949 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~106
When it runs · the whole SKILL.md, loaded when a task matches
~2.3k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from swyxio/skills at commit 038ef34, republished under its MIT licence (© swyxio). 949 words, ~2,336 tokens.

Download SKILL.mdSave it as .claude/skills/web-animation-perf/SKILL.md (or your agent's skills folder).
name
web-animation-perf
description
Prevent layout/transition/reflow thrash in JS-driven CSS animations. Use when building or debugging continuous motion (rotation, orbit, parallax, scroll-linked effects, marquee, carousels) and when symptoms appear like jank, stutter, lag, animation drift, ghosting, "elements collapsing toward center", "going slow", "should we use canvas?", or when mixing `setInterval`/React state with CSS `transition`.

Web Animation Performance

Guidance for writing smooth, GPU-accelerated animations on the web. Most jank comes from three avoidable mistakes; the rest is diagnostic technique.

The Three Cardinal Rules

1. Never combine transition: all <duration> with JS that updates the same property every frame

This is the single most common animation bug. If JS updates left/top/transform on every tick AND the element has transition-all duration-700 (or similar), CSS will linearly interpolate between every pair of successive JS values over the transition duration. For non-linear motion (orbit, arc, easing curve) the linear chord cuts across the intended path — e.g., rotating nodes appear to drift inward toward the center, parallax elements ghost-trail, scroll-linked effects lag noticeably behind the scroll.

Pick exactly one driver:

  • Pure CSS: @keyframes + animation: spin 8s linear infinite and let the browser handle it.
  • Pure JS: set the final position every frame; no transition on that property. Use a separate, narrower transition only for state changes (e.g., active/inactive scale and color).

If you want a transition on hover/active states but JS-driven continuous motion on position, scope the transition to the specific properties (transition: transform 300ms, background-color 300ms) and exclude the JS-driven property.

2. Use requestAnimationFrame, never setInterval, for continuous motion
ConcernsetInterval(fn, 16)requestAnimationFrame(fn)
Frame syncDrifts; may fire 2× per frame or miss framesPinned to vsync
Backgrounded tabKeeps running, wasting CPU/batteryBrowser pauses
Timing precisionWall clock, ±browser timer resolutionHigh-res performance.now() arg passed to callback
Jitter under loadCompoundsSkips frames cleanly

Always integrate by elapsed time, not by fixed step-per-tick. Motion stays correct under dropped frames:

js
useEffect(() => {
  let lastFrame = performance.now();
  let id = 0;
  const tick = (now) => {
    const dt = Math.min(now - lastFrame, 100); // clamp to handle tab-switch gaps
    lastFrame = now;
    const degrees = SPEED_DEG_PER_SEC * (dt / 1000);
    setRotation((prev) => (prev + degrees) % 360);
    id = requestAnimationFrame(tick);
  };
  id = requestAnimationFrame(tick);
  return () => cancelAnimationFrame(id);
}, []);
3. Animate transform and opacity. Avoid left/top/width/height/margin/padding

Only transform and opacity skip layout & paint and run entirely on the GPU compositor. Anything else triggers reflow on every change — fine once on hover, catastrophic at 60Hz.

Want to change…Do thisNot this
Positiontransform: translate3d(x, y, 0)left, top, margin
Sizetransform: scale(s)width, height
Rotatetransform: rotate(a)(no left/top equivalent — but use transform for compositor promotion)
Fadeopacityvisibility, display, color alpha

For static positioning (rendered once and not animated), left/top is fine. The rule applies to continuously animated properties.

Supporting practices

Promote to a compositor layer with will-change
jsx
style={{ willChange: 'transform, opacity' }}

Only on elements that actually animate continuously. Overusing will-change consumes GPU memory.

Drive DOM directly via refs when state-driven re-renders dominate

If profiling shows React reconciliation is the bottleneck (rare for <50 elements), bypass React for the per-frame update:

jsx
const nodeRefs = useRef([]);
// in rAF tick:
nodeRefs.current[idx].style.transform = `translate3d(${x}px, ${y}px, 0)`;

Re-render via React state only when a meaningful semantic change occurs (e.g., the highlighted node changes), not for every frame.

When in doubt about animation-state correctness, sample DOM positions

Use Playwright or DevTools to actually measure rendered geometry. For circular motion you can verify positions land on the orbit ring:

js
// In Playwright page.evaluate, sample every 200ms for ~1s
const nodes = Array.from(document.querySelectorAll('.orbital-node'));
const ratios = nodes.map((n) => {
  const r = n.getBoundingClientRect();
  const dx = r.left + r.width / 2 - centerX;
  const dy = r.top + r.height / 2 - centerY;
  return Math.hypot(dx, dy) / expectedOrbitRadius; // should be 1.00
});

If ratios drift below 1.00 (toward center), rule 1 is broken: a CSS transition is fighting JS updates. If ratios are correct but the animation looks janky, suspect rule 2 (timer/rAF) or rule 3 (left/top reflow).

Canvas? Almost never the right answer for UI

For ≤ ~100 DOM elements, GPU-composited transform animation is faster than canvas redraw and keeps accessibility, click targets, hover states, and inspectability for free. Reach for canvas only when (a) element count is in the thousands, (b) you need pixel-level rendering control (particles, fluid sim), or (c) the layout doesn't map to a DOM tree.

Show full SKILL.md (401 more words)Show less

Diagnostic Workflow

When the user reports "the animation is slow/janky/broken":

Reflect on the 5–7 typical causes, then narrow to the most likely 1–2 before changing code. Common culprits, in rough order:

  1. transition-all racing JS updates (rule 1) — characteristic symptom: motion looks like an interpolated short-cut of the intended path (inward drift on circles, lag on parallax, ghost trails).
  2. left/top/width/height instead of transform (rule 3) — characteristic symptom: jank scales with element count or viewport size, DevTools Performance shows layout/paint columns.
  3. setInterval instead of rAF (rule 2) — characteristic symptom: stutter that gets worse when the tab is busy or backgrounded.
  4. React state update per frame — characteristic symptom: profiler shows reconciliation dominating; OK for small element counts.
  5. Animations on display/visibility/height: auto — characteristic symptom: animation doesn't run at all or snaps instead of tweens.
  6. Excessive will-change — characteristic symptom: scrolling jank elsewhere on the page, GPU memory pressure.
  7. Layout thrash in tight loops: reading layout (offsetWidth, getBoundingClientRect) interleaved with writes inside the same frame.

Validate with logs/measurements before changing more than one thing at a time.

Quick Reference Anti-Pattern → Fix

jsx
// ❌ ANTI-PATTERN
<div
  className="absolute transition-all duration-700"
  style={{ left: `${x}%`, top: `${y}%` }}
/>
useEffect(() => {
  const id = setInterval(() => setAngle((a) => a + 0.6), 50);
  return () => clearInterval(id);
}, []);

// ✅ FIX
<div
  className="absolute"
  style={{
    left: `${x}%`, top: `${y}%`,
    willChange: 'left, top',
  }}
/>
useEffect(() => {
  let last = performance.now(); let id = 0;
  const tick = (now) => {
    const dt = Math.min(now - last, 100); last = now;
    setAngle((a) => (a + DEG_PER_SEC * dt / 1000) % 360);
    id = requestAnimationFrame(tick);
  };
  id = requestAnimationFrame(tick);
  return () => cancelAnimationFrame(id);
}, []);

(For maximum perf, swap left/top for transform: translate3d(...) as well.)

In-repo case study: OrbitalDiagram (AIE conference sites)

apps/main/src/pages/worldsfair/index.jsx — a rotating orbital diagram with 11 role nodes. The original implementation hit all three cardinal anti-patterns:

  1. Each node had transition-all duration-700 while a setInterval(50ms) updated left/top every tick. The CSS transition linearly interpolated between successive JS-set positions, cutting straight-line chords across the orbit. Visible symptom: under the post-release boost, nodes appeared to collapse inward toward the center logo instead of orbiting the ring. (rule 1)
  2. setInterval instead of requestAnimationFrame → stutter and unsynced timing. (rule 2)
  3. Animating left/top instead of transform → reflow on every tick. (rule 3)

The fix:

  • Removed transition-all duration-700 from the rotating wrapper (kept transition-all duration-300 only on the inner circle for active-state scale/color, which is event-driven, not per-frame).
  • Switched to requestAnimationFrame with delta-time integration (degPerSec × dt), so speed reads in degrees-per-second and motion stays correct under dropped frames.
  • Added willChange: 'left, top, opacity'.
  • Validated by sampling node positions via Playwright (getBoundingClientRect) and checking that distance-from-center ÷ expected orbit radius = 1.00 for every node across multiple frames.

When verifying PRs that touch animation code in this repo, use Playwright to sample geometry over time and assert the expected invariant — don't rely on screenshots alone, since the artifact may be subtle (chord-vs-arc) or only appear during boost/peak motion.

© swyxio, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in web-animation-perf of swyxio/skills.

Open the folder on GitHubat commit 038ef34

Compare with similar skills

Web Animation Perf next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Web Animation Perf compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Web Animation Perf this skillswyxio/skills176—~2.3kAutomated safety check: PassMIT
Motionsoftmaple/softmaple161—~1.1kAutomated safety check: PassApache-2.0
Oil Frontend Rulesoil-oil/oil-frontend131—~1.4kAutomated safety check: PassMIT
Cue AnimationsMilad-Akarie/cue1191 repos~6.6kAutomated safety check: PassMIT
Impeccablebestofjs/bestofjs3.1k26 repos~2.6kAutomated safety check: PassMIT
GSAP ScrollTriggergreensock/gsap-skills16k4 repos~4.6kAutomated safety check: PassMIT

Similar skills

  • Motion

    softmaple/softmaple

    Animation skill for Motion (prev Framer Motion) and CSS animation.

    161 GitHub stars~1.1k tokensUpdated 2 days ago
    Frontend & DesignAuto-check passed
  • Oil Frontend Rules

    oil-oil/oil-frontend

    Chinese-language rules for building, changing and reviewing product front ends, covering interface, interaction, state and data flow and component organization.

    131 GitHub stars~1.4k tokensUpdated 6 days ago
    Frontend & DesignAuto-check passed
  • Cue Animations

    Milad-Akarie/cue

    Flutter animation using the Cue package. An agent skill from Milad-Akarie/cue.

    119 GitHub starsUsed in 1 repo~6.6k tokens
    MobileAuto-check passed
  • Impeccable

    bestofjs/bestofjs

    A skill your agent uses when the user wants to design, redesign, shape, critique, audit, polish, clarify, distill, harden, optimize, adapt, animate, colorize, extract, or otherwise improve a…

    3.1k GitHub starsUsed in 26 repos~2.6k tokens
    Frontend & DesignAuto-check passed
  • GSAP ScrollTrigger

    greensock/gsap-skills

    Teaches an agent how to wire up GSAP's ScrollTrigger plugin for scroll-linked animation, pinned sections and scrub, including the start and end position syntax.

    16k GitHub starsUsed in 4 repos~4.6k tokens
    Frontend & DesignAuto-check passed
  • GSAP Core Animation

    greensock/gsap-skills

    Covers the GSAP core API for tweens, easing, staggers, defaults and matchMedia, and when to choose GSAP over CSS animations or other JavaScript animation libraries.

    16k GitHub starsUsed in 3 repos~3.7k tokens
    Frontend & DesignAuto-check passed

More from swyxio/skills

All 89 skills in this repo
  • Programmatic Agents

    swyxio/skills

    Run a selected coding-agent CLI programmatically, with latency, error, usage, cost, and trace logging.

    176 GitHub stars~2.2k tokensUpdated 5 days ago
    Auto-check passed
  • Design, implement, audit, or refresh protected username and handle namespaces for public products.

    176 GitHub stars~1.1k tokensUpdated 5 days ago
    Auto-check passed
  • New Mac Setup

    swyxio/skills

    Fully automated new Mac setup for fullstack web developers and AI engineers.

    176 GitHub stars~4.3k tokensUpdated 5 days ago
    Auto-check passed
  • Youtube API

    swyxio/skills

    Manage YouTube videos programmatically via the YouTube Data API v3 — upload video files, upload custom thumbnails, update video metadata (titles, descriptions, tags), and query video/channel info…

    176 GitHub stars~2.2k tokensUpdated 5 days ago
    Auto-check passed
  • Batch YouTube Studio upload workflow for videos sourced from Airtable, Google Drive, Loom, YouTube, or local files.

    176 GitHub stars~1.5k tokensUpdated 5 days ago
    Auto-check: warnings
  • Reconstruct and visually analyze paired agent, game, or policy trajectories to determine whether changed actions produced their intended effects.

    176 GitHub stars~1.8k tokensUpdated 5 days ago
    Auto-check passed

Questions about Web Animation Perf

What does Web Animation Perf do?

Prevent layout/transition/reflow thrash in JS-driven CSS animations. Web Animation Perf is an agent skill from swyxio/skills. Prevent layout/transition/reflow thrash in JS-driven CSS animations.

When should I use Web Animation Perf?

Web Animation Perf fits situations like: debugging continuous motion (rotation; scroll-linked effects; carousels) and when symptoms appear like jank; animation drift.

How do I install Web Animation Perf in Claude Code?

Run `npx skills add swyxio/skills --skill web-animation-perf -a claude-code`. Or copy the skill folder (web-animation-perf in swyxio/skills) into .claude/skills/web-animation-perf in your project. Claude Code loads it when a task matches its description.

How do I install Web Animation Perf in Codex?

Run `npx skills add swyxio/skills --skill web-animation-perf -a codex`. Or copy the skill folder (web-animation-perf in swyxio/skills) into .agents/skills/web-animation-perf in your project. Codex loads it when a task matches its description.

Can I use Web Animation Perf in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add swyxio/skills --skill web-animation-perf -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/web-animation-perf, .gemini/skills/web-animation-perf, .github/skills/web-animation-perf and .opencode/skills/web-animation-perf in your project.

What does Web Animation Perf need to run?

SKILL.md names no scripts, command-line tools or credentials: Web Animation Perf is instructions for the agent only.

Does Web Animation Perf access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Web Animation Perf safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Web Animation Perf use?

Web Animation Perf is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Web Animation Perf use?

About 2.3k tokens (SKILL.md is roughly 9.3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Web Animation Perf?

Skills that share tags, products or a category with Web Animation Perf: Motion (softmaple/softmaple, 161 stars), Oil Frontend Rules (oil-oil/oil-frontend, 131 stars), Cue Animations (Milad-Akarie/cue, 119 stars) and Impeccable (bestofjs/bestofjs, 3.1k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Web Animation Perf?

swyxio (a GitHub user) maintains it in swyxio/skills, which has 176 GitHub stars. The repository holds 89 skills in this directory. The repository was last updated on October 5, 2026.

Source: swyxio/skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.