Mastering 60FPS Web Animation: GSAP, ScrollTrigger & Hardware Acceleration
A masterclass on building silky-smooth, GPU-accelerated motion systems in React, avoiding layout thrashing, and respecting prefers-reduced-motion.
Nothing breaks the immersion of a digital portfolio faster than stuttering scroll animations, frame drops, or janky element reflows. To craft an experience that feels fluid and tactile, animations must run at a consistent 60 or 120 FPS by delegating transformation matrices directly to the GPU.
In this guide, we break down the physics and engineering behind our custom motion engine built with GSAP, ScrollTrigger, and Lenis smooth scrolling.
1. Avoiding Layout Thrashing: Composite-Only Properties
The browser rendering pipeline comprises four phases: JavaScript → Style Calculation → Layout (Reflow) → Paint → Compositing.
Animating properties like top, left, height, or margin forces the browser to recalculate the layout geometry of the entire DOM tree on every single frame:
/* ❌ AVOIDS: Forces CPU layout recalculations */
.card-bad {
transition: top 0.3s ease, width 0.3s ease;
}
/* ✅ PREFERRED: Promoted to GPU composite layer */
.card-good {
will-change: transform, opacity;
transform: translate3d(0, var(--y), 0) scale(var(--scale));
transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
By restricting animations strictly to transform (translation, rotation, scale) and opacity, elements are rasterized into isolated GPU layers, completely bypassing the layout and paint stages.
2. Choreographing Timelines with GSAP & ScrollTrigger
For complex section reveals, declarative CSS keyframes become unmaintainable. GSAP's timeline sequencer provides granular control over easing curves, stagger offsets, and scroll velocity pinning.
import gsap from 'gsap';
import { ScrollTrigger } from 'gsap/ScrollTrigger';
gsap.registerPlugin(ScrollTrigger);
export function animateFeatureGrid(container: HTMLElement) {
const cards = container.querySelectorAll('.project-card');
return gsap.timeline({
scrollTrigger: {
trigger: container,
start: 'top 80%',
end: 'bottom 20%',
toggleActions: 'play none none reverse',
},
}).fromTo(
cards,
{ y: 60, opacity: 0 },
{
y: 0,
opacity: 1,
duration: 0.85,
stagger: 0.12,
ease: 'power3.out',
clearProps: 'transform',
}
);
}
3. Accessibility & prefers-reduced-motion
Delivering motion design responsibly means providing effortless opt-outs for visitors with vestibular disorders or motion sensitivities.
Our application inspects the system media query and exposes a user-toggleable motion mode:
- Full: Full dynamic physics, parallax depth, and cursor magnetic effects.
- Calm: Instant opacity reveals, zero parallax drift, and standard cursor tracking.
export function isReducedMotion(): boolean {
if (typeof window === 'undefined') return false;
return (
window.matchMedia('(prefers-reduced-motion: reduce)').matches ||
document.documentElement.dataset.flow === 'calm'
);
}
Motion is not decorative garnish; when applied with restraint and mechanical precision, it guides user attention and builds lasting digital delight.


