DEV Community

Cover image for I Stopped Using CSS for Animations. GSAP Changed Everything.
Hashir Khan
Hashir Khan

Posted on

I Stopped Using CSS for Animations. GSAP Changed Everything.

I wasted 8 months fighting CSS animations.

Keyframes, transition, animation-delay hacks, browser inconsistencies — it felt like building a house with tape.
Then I tried GSAP for a one-weekend project. I never went back.
Here's exactly what changed — and the **3 animations
that would have taken me 3 days in CSS, but took 3 hours in GSAP:**

🎯 Animation 1: Staggered text reveal on page load
Every portfolio wants this. CSS version? 20 lines, fragile. GSAP version:

javascriptgsap.from(".hero-text span", {
  opacity: 0,
  y: 60,
  stagger: 0.08,
  duration: 0.9,
  ease: "power3.out"
});
Enter fullscreen mode Exit fullscreen mode

Done. Each word staggers in smoothly. Zero browser quirks.

🎯 Animation 2: Scroll-triggered section reveal
, JavaScript GSAP.registerPlugin(ScrollTrigger);

gsap.from(".section", {
  scrollTrigger: ".section",
  opacity: 0,
  x: -80,
  duration: 1,
  ease: "power2.out"
});
Enter fullscreen mode Exit fullscreen mode

No Intersection Observer boilerplate. No manual cleanup. It just works.

🎯 Animation 3: Magnetic button hover effect
javascriptconst btn = document.querySelector(".magnetic-btn");

btn.addEventListener("mousemove", (e) => {
  const rect = btn.getBoundingClientRect();
  const x = e.clientX - rect.left - rect.width / 2;
  const y = e.clientY - rect.top - rect.height / 2;
  gsap.to(btn, { x: x * 0.3, y: y * 0.3, duration: 0.4, ease: "power2.out" });
});

btn.addEventListener("mouseleave", () => {
  gsap.to(btn, { x: 0, y: 0, duration: 0.6, ease: "elastic.out(1.2, 0.4)" });
});

Enter fullscreen mode Exit fullscreen mode

This one thing made my portfolio feel like a $50K agency site.

The truth nobody tells you: CSS animations are fine for simple things. But the moment you need sequencing, scroll-linking, or interactive motion — GSAP wins by a mile.
I now use GSAP on every single project: portfolios, real estate demos, agency sites, and Chrome extensions.

What's the animation YOU've been trying to build but couldn't figure out? Drop it in the comments — I'll write a GSAP solution for the best one. 👇

Top comments (0)