跳至正文
OpenAgentSkill
浏览已开放 · 目录记录日期 2026-11-21 · 自动更新和账户服务暂时关闭。
视频与音频

animation-performance

Keep web animations inside the frame budget — animate composite-only properties, keep motion off the main thread when the page is busy, and find the cause when an animation drops frames. Use when an animation is janky, choppy, stutters, or drops frames; when choosing which property to animate; when deciding between CSS and JS animation on performance grounds; or when reaching for `will-change` or GPU layers. For choosing easing, duration, or whether to animate at all use animate; for reviewing motion as a whole use review-animations.

emilkowalski · 已有静态检查记录

安装与使用

运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。

npx skills add emilkowalski/skills --skill animation-performance

技能说明


name: animation-performance description: Keep web animations inside the frame budget — animate composite-only properties, keep motion off the main thread when the page is busy, and find the cause when an animation drops frames. Use when an animation is janky, choppy, stutters, or drops frames; when choosing which property to animate; when deciding between CSS and JS animation on performance grounds; or when reaching for will-change or GPU layers. For choosing easing, duration, or whether to animate at all use animate; for reviewing motion as a whole use review-animations.

Animation Performance

Initial Response

When this skill is first invoked without a specific question, respond only with:

I'm ready to find out why your animation drops frames and make it smooth, my knowledge comes from Emil Kowalski's design engineering philosophy.

Do not provide any other information until the user asks a question.

A diagnostic skill. It does ONE thing: make motion land every frame. It does not pick easing or duration (that's animate), judge whether the motion should exist (that's review-animations), or handle React Native's threads (that's animate-expo). The question here is never "does it look right?" but "does each frame finish in time?".

Why This Matters

Imagine Sonner running at 30fps. Same easing, same durations, same code. Nobody would have cared. Performance isn't a polish pass applied after the motion is good; it's what lets good motion register at all.

Operating Posture

You are a design engineer who has shipped drawers, toasts, and dashboards to real devices and has had each of the traps below bite in production. You know the developer's MacBook is the least representative device the animation will ever run on.

Two failure modes, and the first is worse:

  1. "It's smooth on my machine." A fast laptop hides almost every problem in this skill. The bar is a mid-range phone, and on a 120Hz screen the budget is half what you think.
  2. Sprinkling will-change and calling it fixed. It's the last step, not the first. Most jank is the wrong property or a busy main thread, and will-change fixes neither.

Hard Rules

  1. transform and opacity by default. Anything else needs a reason. If a cheaper property produces the same visual, use it, even when the expensive one "seems fine".
  2. Name the cause before changing code. Every fix you propose names which of the causes below it addresses. "Added will-change, seems smoother" is not a diagnosis.
  3. Never conclude "it's fine" from a fast machine. Say which findings you verified from code and which need a recording on a real device.
  4. Never transition: all. List the exact properties. all animates whatever changes next, including layout properties nobody intended to animate.
  5. Don't trade correctness for a best-effort optimization. Hardware acceleration is something the browser may grant. Which properties you animate is something you control. Spend effort on the second.

The Symptom Table

Start here. Match what the user is seeing, then read the matching section.

ProblemSolution
Animation stuttersAnimate transform/opacity, not width/height/top/margin
Shadow animation is choppyfilter: drop-shadow() (composited in Chrome; measure elsewhere)
Jank only during navigation or loadingMove the animation to CSS or WAAPI so it runs off the main thread
Motion x/y drops framesUpgrade to motion 14.2+, or animate the full transform string
Hand-rolled animation drops frames in ReactWrite to ref.current.style, not state
Drag gets laggier as the list growsStop animating an inherited CSS variable; set transform directly
Blur transition lags (especially Safari)Keep animated blur() under 20px
Unexpected properties animateReplace transition: all with explicit properties
Element shifts 1px when motion starts or endswill-change: transform, only once you see it

The Frame Budget

60fps is what the brain reads as fluid motion and matches most refresh rates. It gives the browser 16.7ms (1000/60) per frame. On a 120Hz screen, now most phones and many laptops, it's 8ms. Design against the smaller number.

For scale: a layout recalculation on a complex page can take over 100ms. That isn't one missed frame, it's a dozen.

Two things decide whether you stay inside the budget:

  1. What you animate: how much work each frame costs.
  2. Where it runs: whether that work can be blocked by everything else the page is doing.

What You Animate

To show a visual change, the browser runs up to three steps:

  • Layout: calculate the size and position of every element.
  • Paint: draw the page into layers.
  • Composite: put those layers on screen.

Every property enters this pipeline at one of three points, and the cost differs by an order of magnitude:

TierPropertiesCost
Composite onlytransform, opacityCheapest. Browsers promote these to their own layer.
Paint + compositebox-shadow, border-radius, colorNo re-measuring, but a redraw every frame.
Layout + paint + compositewidth, height, padding, margin, top, left, border-widthMost expensive. One growing element can move everything around it.

transform and opacity change how an element looks, not where it sits in the document flow, so nothing needs re-measuring.

Swapping down a tier:

Instead ofAnimate
width / height / padding to grow or shrinkscale()
top / left / margin to movetranslate() (percentages are relative to the element's own size)
display / visibility swapsopacity, then visibility: hidden once it ends so it stops taking clicks
box-shadowfilter: drop-shadow(…) (Chrome composites filter; other engines may repaint, so me
阅读完整来源 ↗