fixing-motion-performance

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

Updated Mar 12, 2026
One-click install
npx skills add https://github.com/RavitejaKarra24/dotfiles --skill fixing-motion-performance-ravitejakarra24
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: fixing-motion-performance
Source: https://github.com/RavitejaKarra24/dotfiles/tree/main/agents/.agents/skills/fixing-motion-performance
Command: npx skills add https://github.com/RavitejaKarra24/dotfiles --skill fixing-motion-performance-ravitejakarra24

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 for diagnosing and fixing those animation performance problems in CSS, WAAPI, Motion, rAF, and GSAP code. ## Core Features & Use Cases - Prioritized rule categories: Nine ranked categories from critical never-patterns (layout thrashing, scroll-driven animation) down to view transition guidance, each with concrete do/don't rules. - File review mode: Point it at a file to get violations quoted line-by-line, a one-sentence explanation of why each matters, and a concrete code-level fix. - Common fix patterns: Ready-made before/after snippets for transform-based motion, FLIP measurement batching, and scroll-timeline replacements. - Use Case: A React component animates a panel by transitioning width and the UI janks on every toggle. Run the review to get the violation flagged and a transform-based replacement that stays on the compositor. ## Quick Start Ask the assistant to review your animation file with the fixing-motion-performance rules, for example by saying: review animations.js for animation performance violations 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 that stutter?

Janky CSS animations usually animate layout or paint properties like width, height, or top. Switch to compositor-only properties, transform and opacity, so the browser skips layout and paint during the animation.

How to animate on scroll without using scroll event listeners?

Use CSS scroll-timeline or view-timeline for scroll-linked motion instead of listening to scroll events and reading scrollY. For visibility-based triggering, use IntersectionObserver, which avoids polling scroll position every frame.

What is layout thrashing and how do I avoid it?

Layout thrashing happens when code interleaves DOM reads and writes in the same frame, forcing repeated layout recalculation. Batch all reads first, then all writes, or use a FLIP pattern: measure once, apply the change, measure again, then animate via transform.

When should I use will-change in CSS?

Use will-change temporarily and surgically, only on elements about to animate, and remove it afterward. Overusing it creates too many promoted layers, which consumes memory and can hurt performance instead of helping.

Does this skill migrate my GSAP or Motion code to another library?

No. The rules apply within your existing animation stack, whether CSS, WAAPI, Motion, rAF, or GSAP. Library migration or rewriting is explicitly out of scope unless you request it.

Why is animating blur or filters bad for performance?

Blur and filter animations trigger expensive paint work on every frame, especially on large surfaces. Keep blur under 8px, use it only for short one-time effects, and prefer opacity and translate for continuous motion.