Skip to content
Yasitha Kasthuri 5.0 · 78 reviews Hire on Upwork

· 2 min read

GSAP animations in WordPress: a practical guide

GSAP is the animation library behind many of the smooth scroll effects, text reveals and page transitions you see on modern websites. It works well with WordPress, as long as it is added with care. Here is how I use it without slowing a site down.

What GSAP is good for

CSS handles simple hover effects and fades well. GSAP is the better tool when animations need to run in sequence, follow the scroll position or be controlled precisely, such as a headline that reveals word by word or a section that pins while content moves through it. If your designer has already prototyped the motion in Figma, those interactions can be rebuilt with GSAP as part of a Figma to WordPress build.

Load it the WordPress way

Add GSAP with wp_enqueue_script() in your theme, loaded in the footer, and only on the pages that use it. Avoid pasting script tags into a page builder or loading it site-wide “just in case”. On a page with no animation, GSAP should not load at all.

Animate the right properties

Stick to transform (move, scale, rotate) and opacity. Browsers can animate these smoothly. Animating width, height, margins or top and left positions forces the browser to recalculate the layout on every frame, which makes pages stutter on phones.

Don’t hide your main content

If the main heading or hero image starts invisible and fades in, Google measures your page as slower, because Largest Contentful Paint waits for that element to appear. Let the most important content show straight away, and save the animation for elements further down the page. More on that in Core Web Vitals explained.

Use ScrollTrigger sparingly

ScrollTrigger is GSAP’s plugin for scroll-based animation. It is powerful, and easy to overuse. A few well-placed reveals feel polished; an effect on every section makes a page tiring to scroll. Start animations when the element enters the screen, and avoid long pinned sections on mobile.

Respect “reduce motion”

Some visitors turn on the reduce-motion setting on their device because movement makes them unwell. GSAP’s matchMedia() lets you run animations only for visitors who have not asked for less motion, and show the finished state to everyone else.

Keep the page usable without it

If the script fails to load, the content should still be readable. Set the starting state of an animation with GSAP itself, not in your CSS, so nothing stays hidden when JavaScript is blocked.

Test on a real phone

Animations that are smooth on a laptop can struggle on a mid-range phone. Test on one, then run a speed test to make sure the scores have not dropped.

The short version

Load GSAP only where it is used, animate transform and opacity, keep the main content visible from the start and respect reduce-motion. Built this way, animation adds polish without costing speed. If you want motion built into a custom WordPress theme, tell me about your project.

Start a project

Ready to start your website?

Tell me about your project, even if it's just an idea. I'll reply with questions, a fixed quote and next steps.

Not ready to hire yet? Run a free speed test on your site

Top Rated · 5.0 ★ 120 jobs · 100% job success

Hire on Upwork