fixing-motion-performance

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

1|Updated Dec 29, 2025
One-click install
npx skills add https://github.com/ratnesh-maurya/tracker.ratnesh-maurya.com --skill fixing-motion-performance-ratnesh-maurya
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: fixing-motion-performance
Source: https://github.com/ratnesh-maurya/tracker.ratnesh-maurya.com/tree/main/.claude/skills/fixing-motion-performance
Command: npx skills add https://github.com/ratnesh-maurya/tracker.ratnesh-maurya.com --skill fixing-motion-performance-ratnesh-maurya

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? UI animations often stutter or jank because they trigger expensive layout and paint work instead of cheap compositor updates. This Skill provides a prioritized rule set to audit animation code and apply concrete fixes for layout thrashing, scroll-driven motion, blur effects, and layer management. ## Core Features & Use Cases - Prioritized Rule Categories: Nine ranked categories from critical never-patterns (layout thrashing, scroll-event-driven animation) to lower-priority concerns like view transitions. - File Review Mode: Review a specific file against all rules and report violations with quoted snippets, impact explanations, and code-level fixes. - Concrete Fix Patterns: Includes before/after examples for common issues such as animating width instead of transform, polling scroll position instead of using scroll-timeline, and unbatched DOM reads. - Use Case: A developer notices a dropdown transition janks on mobile. They run the review on the component file and learn the animation mutates width on a large container, then apply the suggested transform-based FLIP fix. ## Quick Start Ask the assistant to review your animation file with the fixing-motion-performance rules, for example by invoking /fixing-motion-performance on the component that contains the janky transition.

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?▼

Janky CSS animations usually animate layout or paint properties like width, height, or top instead of compositor properties. Switch to transform and opacity, which skip layout and paint, and avoid interleaving DOM reads and writes in the same frame.

How to animate on scroll without using scroll events?▼

Use CSS scroll-timeline or view-timeline for scroll-linked motion instead of listening to scroll events or polling scrollTop. For visibility-based pausing, use IntersectionObserver so off-screen animations stop consuming frames.

What is layout thrashing and how do I avoid it?▼

Layout thrashing happens when code interleaves layout reads (like getBoundingClientRect) and writes in the same frame, forcing repeated reflows. Batch all DOM reads before writes, measure once, and animate via transform using a FLIP-style approach.

When should I use will-change in CSS?▼

Use will-change temporarily and surgically to promote an element to its own compositor layer before an animation. Avoid applying it broadly or permanently, since many or large promoted layers consume memory and can hurt performance.

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 animation at or below 8px, use it only for short one-time effects, and prefer opacity and translate instead.

Does this approach require migrating my animation library?▼

No. The rules apply within your existing animation stack, whether CSS, WAAPI, Motion, GSAP, or rAF. Library migrations or rewrites are only done when explicitly requested, and mixing animation systems in one component is discouraged.