fixing-motion-performance

Audit and fix CSS and JavaScript animation performance issues including layout thrashing and scroll-linked motion.

Updated Aug 13, 2026
One-click install
npx skills add https://github.com/Mjlike123/ui-prototype-workbench --skill fixing-motion-performance-mjlike123
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: fixing-motion-performance
Source: https://github.com/Mjlike123/ui-prototype-workbench/tree/main/.agents/skills/fixing-motion-performance
Command: npx skills add https://github.com/Mjlike123/ui-prototype-workbench --skill fixing-motion-performance-mjlike123

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? UI animations often stutter or jank because they trigger expensive layout and paint work, interleave DOM reads and writes, or poll scroll position. This Skill provides a prioritized rule set to audit animation code and apply concrete fixes without rewriting the existing animation stack. ## Core Features & Use Cases - Prioritized Rule Audit: Reviews files against nine ranked rule categories, from critical never-patterns (layout thrashing, scroll-event-driven animation) to lower-priority view transition guidance. - Concrete Fix Patterns: Supplies before/after code examples such as animating transform instead of width, using scroll-timeline instead of scroll listeners, and FLIP-style batched measurement. - Stack-Agnostic Constraints: Applies rules within the existing animation system (CSS, WAAPI, Motion, rAF, GSAP) without migrating libraries unless explicitly requested. - Use Case: A developer notices a dropdown transition janks on mobile. They run the Skill on the component file and receive violations with quoted lines, one-sentence impact explanations, and code-level fixes such as replacing width transitions with transform. ## Quick Start Ask the assistant to review your animation file with the fixing-motion-performance rules, for example by saying: review components/Menu.tsx for animation performance issues and suggest fixes.

Frequently Asked Questions about fixing-motion-performance

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

FAQPage Schema
How do I fix janky CSS animations in my web app?

Animate only compositor-friendly properties like transform and opacity instead of layout properties like width or position. Batch DOM reads before writes, avoid scroll-event-driven animation, and use will-change temporarily only where layer promotion is needed.

What causes layout thrashing in JavaScript animations?

Layout thrashing happens when code interleaves layout reads (like getBoundingClientRect) and writes (like style changes) in the same frame, forcing repeated reflows. Fix it by measuring once, then animating via transform, or by using FLIP-style transitions.

How to implement scroll-linked animations without scroll event listeners?

Use CSS Scroll or View Timelines (animation-timeline: view()) for scroll-linked motion when available, and IntersectionObserver for visibility detection and pausing. Polling scrollTop or scrollY in event handlers triggers continuous layout work and should be avoided.

Does this approach work with GSAP or Motion animation libraries?

Yes, the rules apply within any existing animation system including CSS, WAAPI, Motion, rAF, and GSAP. The Skill explicitly avoids migrating or rewriting animation libraries and never mixes multiple animation systems within the same component.

When is it acceptable to animate blur or filter effects?

Blur animation is acceptable only for small surfaces at 8px or less and for short, one-time effects. Never animate blur continuously or on large surfaces; prefer opacity and translate transitions before reaching for blur.

Why should will-change be used only temporarily?

will-change promotes elements to compositor layers, which consumes memory and can hurt performance when overused. Apply it surgically and temporarily, avoid many or large promoted layers, and validate layer behavior with browser tooling.