animation-performance

Diagnose and fix dropped frames in web animations by targeting composite-only properties and optimizing thread execution.

53.1k|3.1k|Updated Mar 16, 2026
Ready to run
npx skills add https://github.com/emilkowalski/skills --skill animation-performance-emilkowalski
šŸ’¬ Prompt for ChatGPT / Claude Chatā–¼
Please help me install this Agent Skill.
Skill: animation-performance
Source: https://github.com/emilkowalski/skills/tree/main/skills/animation-performance
Command: npx skills add https://github.com/emilkowalski/skills --skill animation-performance-emilkowalski

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? You've built an animation that looks smooth on your laptop but stutters on phones, or it drops frames mysteriously during page navigation. This Skill identifies which part of the rendering pipeline is the bottleneck—whether it's the wrong CSS property, the main thread being blocked, or React re-rendering every frame—and gives you the exact fix. ## Core Features & Use Cases - Property Analysis: Categorizes animations by rendering cost (layout, paint, composite) and recommends cheaper alternatives like transform and opacity. - Thread Diagnosis: Detects when animations run on the main thread during busy periods and moves them to CSS or Web Animations API for hardware acceleration. - React Trap Detection: Catches state-driven animations that re-render the component every frame and suggests direct DOM writes instead. - Use Case: Your toast notification drawer animates smoothly in development but jank during real-world interactions. This Skill walks through whether you're animating height instead of scaleY, or if the animation conflicts with a data fetch happening simultaneously. ## Quick Start Describe what you're seeing—stuttering on a specific device, jank during navigation, or a shadow animation that seems expensive—and whether it's CSS, JavaScript, or React-driven motion.

Frequently Asked Questions about animation-performance

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix animations that drop frames on mobile devices?ā–¼

Profile with DevTools Performance panel to identify dropped frames, then check which properties animate. Replace layout properties (`width`, `height`, `top`) with `transform`/`opacity` equivalents: use `scale()` instead of `height`, `translateX()` instead of `left`. If jank coincides with page navigation, move to CSS or WAAPI for hardware acceleration.

Should I animate with CSS, JavaScript, or Framer Motion?ā–¼

Use CSS for simple motion and anything playing during heavy page work (navigation, data fetching). Use Framer Motion for complex, interruptible, or gesture-driven animations. Motion 14.2+ accelerates `x`, `y`, `scale` shorthands on HTML; older versions require the full `transform` string for smooth motion during busy main threads.

Why does my animated shadow cause frame drops?ā–¼

`box-shadow` repaints the element every frame. Replace it with `filter: drop-shadow()`, which is composited instead of painted. Keep animated blur values under 20px; 2–5px is sufficient for crossfades and costs less in Safari.

How does a CSS variable animation kill performance?ā–¼

Animating inherited CSS variables triggers style recalculation for every descendant element, every frame. For draggable drawers or lists, write `transform` directly to the element instead of updating `--swipe-amount` on a parent. Performance degrades as content grows with CSS variables but stays constant with direct property animation.

When should I add `will-change` to an element?ā–¼

Only after you see visual glitches (1px shifts at animation start/end) or measured dropped frames from expensive paint operations. Browsers already promote `transform` and `opacity` animations; `will-change` earns its place on large filtered or blurred elements to prevent mid-flight GPU hand-offs. Never use it on `*` or large containers—promoted layers cost GPU memory.

Can I animate a React state value every frame?ā–¼

No; calling `setState` in `requestAnimationFrame`, `pointermove`, or drag handlers causes a re-render every 16.7ms and blows the frame budget. Write directly to `ref.current.style` or use a motion value instead to keep animation off React's render cycle.