fixing-motion-performance
When to Use
Use this skill when you need audit and fix animation performance issues including layout thrashing, compositor properties, scroll-linked motion, and blur effects. Use when animations stutter, transitions jank, or reviewing CSS/JS animation performance.
Fix animation performance issues.
how to use
Do not migrate animation libraries unless explicitly requested. Apply rules within the existing stack.
when to apply
Reference these guidelines when:
- adding or changing UI animations (CSS, WAAPI, Motion, rAF, GSAP)
- refactoring janky interactions or transitions
- implementing scroll-linked motion or reveal-on-scroll
- animating layout, filters, masks, gradients, or CSS variables
- reviewing components that use will-change, transforms, or measurement
rendering steps glossary
- composite: transform, opacity
- paint: color, borders, gradients, masks, images, filters
- layout: size, position, flow, grid, flex
rule categories by priority
| priority |
category |
impact |
| 1 |
never patterns |
critical |
| 2 |
choose the mechanism |
critical |
| 3 |
measurement |
high |
| 4 |
scroll |
high |
| 5 |
paint |
medium-high |
| 6 |
layers |
medium |
| 7 |
blur and filters |
medium |
| 8 |
view transitions |
low |
| 9 |
tool boundaries |
critical |
quick reference
1. never patterns (critical)
- do not interleave layout reads and writes in the same frame
- do not animate layout continuously on large or meaningful surfaces
- do not drive animation from scrollTop, scrollY, or scroll events
- no requestAnimationFrame loops without a stop condition
- do not mix multiple animation systems that each measure or mutate layout
2. choose the mechanism (critical)
- default to transform and opacity for motion
- use JS-driven animation only when interaction requires it
- paint or layout animation is acceptable only on small, isolated surfaces
- one-shot effects are acceptable more often than continuous motion
- prefer downgrading technique over removing motion entirely
3. measurement (high)
- measure once, then animate via transform or opacity
- batch all DOM reads before writes
- do not read layout repeatedly during an animation
- prefer FLIP-style transitions for layout-like effects
- prefer approaches that batch measurement and writes
4. scroll (high)
- prefer Scroll or View Timelines for scroll-linked motion when available
- use IntersectionObserver for visibility and pausing
- do not poll scroll position for animation
- pause or stop animations when off-screen
- scroll-linked motion must not trigger continuous layout or paint on large surfaces
5. paint (medium-high)
- paint-triggering animation is allowed only on small, isolated elements
- do not animate paint-heavy properties on large containers
- do not animate CSS variables for transform, opacity, or position
- do not animate inherited CSS variables
- scope animated CSS variables locally and avoid inheritance
6. layers (medium)
- compositor motion requires layer promotion, never assume it
- use will-change temporarily and surgically
- avoid many or large promoted layers
- validate layer behavior with tooling when performance matters
7. blur and filters (medium)
- keep blur animation small (<=8px)
- use blur only for short, one-time effects
- never animate blur continuously
- never animate blur on large surfaces
- prefer opacity and translate before blur
8. view transitions (low)
- use view transitions only for navigation-level changes
- avoid view transitions for interaction-heavy UI
- avoid view transitions when interruption or cancellation is required
- treat size changes as potentially layout-triggering
9. tool boundaries (critical)
- do not migrate or rewrite animation libraries unless explicitly requested
- apply these rules within the existing animation system
- never partially migrate APIs or mix styles within the same component
common fixes
/* layout thrashing: animate transform instead of width */
/* before */ .panel { transition: width 0.3s; }
/* after */ .panel { transition: transform 0.3s; }
/* scroll-linked: use scroll-timeline instead of JS */
/* before */ window.addEventListener('scroll', () => el.style.opacity = scrollY / 500)
/* after */ .reveal { animation: fade-in linear; animation-timeline: view(); }
// measurement: batch reads before writes (FLIP)
// before — layout thrash
el.style.left = el.getBoundingClientRect().left + 10 + 'px';
// after — measure once, animate via transform
const first = el.getBoundingClientRect();
el.classList.add('moved');
const last
1---2name: fixing-motion-performance3description: Audit and fix animation performance issues including layout thrashing, compositor properties, scroll-linked motion, and blur effects. Use when animations stutter, transitions jank, or reviewing CSS/JS4category: AI & Agents5source: antigravity6tags: [api, ai, image, security, cro]7url: https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/fixing-motion-performance8metadata:9 source: https://skillmd.com/skills/sickn33/fixing-motion-performance10---111213# fixing-motion-performance14## When to Use1516Use this skill when you need audit and fix animation performance issues including layout thrashing, compositor properties, scroll-linked motion, and blur effects. Use when animations stutter, transitions jank, or reviewing CSS/JS animation performance.171819Fix animation performance issues.2021## how to use2223- `/fixing-motion-performance`24 Apply these constraints to any UI animation work in this conversation.2526- `/fixing-motion-performance <file>`27 Review the file against all rules below and report:28 - violations (quote the exact line or snippet)29 - why it matters (one short sentence)30 - a concrete fix (code-level suggestion)3132Do not migrate animation libraries unless explicitly requested. Apply rules within the existing stack.3334## when to apply3536Reference these guidelines when:37- adding or changing UI animations (CSS, WAAPI, Motion, rAF, GSAP)38- refactoring janky interactions or transitions39- implementing scroll-linked motion or reveal-on-scroll40- animating layout, filters, masks, gradients, or CSS variables41- reviewing components that use will-change, transforms, or measurement4243## rendering steps glossary4445- composite: transform, opacity46- paint: color, borders, gradients, masks, images, filters47- layout: size, position, flow, grid, flex4849## rule categories by priority5051| priority | category | impact |52|----------|----------|--------|53| 1 | never patterns | critical |54| 2 | choose the mechanism | critical |55| 3 | measurement | high |56| 4 | scroll | high |57| 5 | paint | medium-high |58| 6 | layers | medium |59| 7 | blur and filters | medium |60| 8 | view transitions | low |61| 9 | tool boundaries | critical |6263## quick reference6465### 1. never patterns (critical)6667- do not interleave layout reads and writes in the same frame68- do not animate layout continuously on large or meaningful surfaces69- do not drive animation from scrollTop, scrollY, or scroll events70- no requestAnimationFrame loops without a stop condition71- do not mix multiple animation systems that each measure or mutate layout7273### 2. choose the mechanism (critical)7475- default to transform and opacity for motion76- use JS-driven animation only when interaction requires it77- paint or layout animation is acceptable only on small, isolated surfaces78- one-shot effects are acceptable more often than continuous motion79- prefer downgrading technique over removing motion entirely8081### 3. measurement (high)8283- measure once, then animate via transform or opacity84- batch all DOM reads before writes85- do not read layout repeatedly during an animation86- prefer FLIP-style transitions for layout-like effects87- prefer approaches that batch measurement and writes8889### 4. scroll (high)9091- prefer Scroll or View Timelines for scroll-linked motion when available92- use IntersectionObserver for visibility and pausing93- do not poll scroll position for animation94- pause or stop animations when off-screen95- scroll-linked motion must not trigger continuous layout or paint on large surfaces9697### 5. paint (medium-high)9899- paint-triggering animation is allowed only on small, isolated elements100- do not animate paint-heavy properties on large containers101- do not animate CSS variables for transform, opacity, or position102- do not animate inherited CSS variables103- scope animated CSS variables locally and avoid inheritance104105### 6. layers (medium)106107- compositor motion requires layer promotion, never assume it108- use will-change temporarily and surgically109- avoid many or large promoted layers110- validate layer behavior with tooling when performance matters111112### 7. blur and filters (medium)113114- keep blur animation small (<=8px)115- use blur only for short, one-time effects116- never animate blur continuously117- never animate blur on large surfaces118- prefer opacity and translate before blur119120### 8. view transitions (low)121122- use view transitions only for navigation-level changes123- avoid view transitions for interaction-heavy UI124- avoid view transitions when interruption or cancellation is required125- treat size changes as potentially layout-triggering126127### 9. tool boundaries (critical)128129- do not migrate or rewrite animation libraries unless explicitly requested130- apply these rules within the existing animation system131- never partially migrate APIs or mix styles within the same component132133## common fixes134135```css136/* layout thrashing: animate transform instead of width */137/* before */ .panel { transition: width 0.3s; }138/* after */ .panel { transition: transform 0.3s; }139140/* scroll-linked: use scroll-timeline instead of JS */141/* before */ window.addEventListener('scroll', () => el.style.opacity = scrollY / 500)142/* after */ .reveal { animation: fade-in linear; animation-timeline: view(); }143```144145```js146// measurement: batch reads before writes (FLIP)147// before — layout thrash148el.style.left = el.getBoundingClientRect().left + 10 + 'px';149// after — measure once, animate via transform150const first = el.getBoundingClientRect();151el.classList.add('moved');152const last