gsap-performance

Optimize GSAP animations by batching reads and writes to minimize reflows.

Updated Oct 2, 2024
One-click install
npx skills add https://github.com/James-Gamboa/portfolio-james --skill gsap-performance-james-gamboa
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gsap-performance
Source: https://github.com/James-Gamboa/portfolio-james/tree/main/.agents/skills/gsap-performance
Command: npx skills add https://github.com/James-Gamboa/portfolio-james --skill gsap-performance-james-gamboa

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill helps you optimize GSAP-driven animations by avoiding layout-thrashing and promoting GPU-accelerated properties, delivering smoother frame rates.

Core Features & Use Cases

  • Prefer transforms (x, y, scale, rotation) and opacity to keep work on the compositor.
  • Use will-change strategically to hint the browser for animated elements.
  • Batch reads and writes to minimize layout thrashing and improve performance on large lists and complex scenes.

Quick Start

Start by auditing your current GSAP timeline to replace layout-affecting properties with transforms and opacity for the major animation flows.

Frequently Asked Questions about gsap-performance

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

FAQPage Schema
How do I optimize GSAP animations to run at 60fps?

Optimize GSAP animations to run at 60fps by replacing layout-affecting properties with transforms and opacity, keeping animation work on the compositor. This approach significantly reduces layout thrashing and unnecessary paints across complex timelines and scroll-driven effects.

Why does my GSAP animation cause layout thrashing?

GSAP animation causes layout thrashing when interleaving DOM read and write operations forces the browser into synchronous reflows. Fix this by batching reads and writes, and prefer compositor-friendly properties like transforms and opacity to minimize reflows.

What is the best way to use will-change for GSAP UI animations?

The best way to use will-change for GSAP UI animations is strategically, applying it only to elements that will be animated. This hints the browser to prepare for compositor layer promotion, preventing unnecessary paints while avoiding excessive memory consumption.

Can I use GSAP transforms and opacity for scroll-driven effects?

Yes, you can use GSAP transforms and opacity for scroll-driven effects to ensure smooth 60fps performance. Relying on these compositor-friendly properties avoids main thread bottlenecks, keeping complex scroll scenes running smoothly across web apps.

How do I fix GSAP performance issues on large lists?

Fix GSAP performance issues on large lists by batching read and write operations to minimize layout thrashing. Additionally, enforce best practices like using transforms and opacity to move rendering work off the main thread.