Skip to content
TASIMA HAPAZARI
WritingLearning

Learning GSAP by rebuilding my homepage

Timelines, ScrollTrigger and SplitText, learned in the order I needed them. The mental model that finally made motion feel like layout.

4 min read

This post's shape: Lead 119 words, 01 106 words, 02 130 words, 03 97 words, 04 97 words, 05 111 words.

My homepage had been the same static page for two years: a name, a list of links, and a paragraph I rewrote every few months without ever changing what it said. I knew what I wanted instead, something that moved when you arrived and kept moving as you read, and I had never written a line of animation code that was not a CSS transition.

So I gave myself a rule. Rebuild the homepage, and learn only the parts of GSAP the rebuild actually needed. No tutorials watched end to end, no demos cloned. If a feature did not solve a problem the page had, I did not read its documentation.

That constraint turned out to be the lesson.

01

Starting from a static page

The first version of the rebuild had no animation in it at all. I laid the page out as I wanted it to end, with final positions, final type sizes, final spacing, and only then asked what should have arrived late.

That sounds obvious written down. It is not how I had been thinking. My instinct was to design the entrance first, because the entrance is the part that looks like animation. Doing it the other way round meant every motion had a destination before it had a beginning, and I never had to invent a resting state to animate towards.

02

The timeline owns the clock

Almost everything I found confusing about GSAP stopped being confusing once I stopped writing individual tweens. A tween is a single property change over time. A timeline is a container that owns the clock.

Once the timeline owns the clock, after the heading and two tenths into the tween before it become positions I can name rather than delays I have to compute by hand. Nothing needs to know what came before it.

1const intro = gsap.timeline({
2 defaults: { ease: 'power3.out', duration: 0.6 }
3});
4
5intro
6 .from('[data-name] .char', { yPercent: 60, stagger: 0.02 })
7 .from('[data-links] a', { opacity: 0, y: 12, stagger: 0.06 }, '-=0.3');

I rewrote the entrance three times. The third version was half the length of the first, and the only structural difference was that the timings had become relative.

Motion is layout that happens over time. Once I stopped treating it as decoration applied to a finished page, the API stopped feeling arbitrary.
03

Everything has to be legible in reverse

ScrollTrigger looks like an add-on and behaves like a second way of thinking. A normal tween runs on time. A scrubbed tween runs on position, which means the reader can run it backwards, stop it halfway, and sit there.

Every animation I wrote for scroll had to look correct at every frame, not only at the end, including the frames a reader reaches by scrolling up. That killed about half my ideas, which was useful. Anything that only reads correctly in one direction is a transition, not a scroll effect.

04

SplitText, and knowing when to stop

Splitting a heading into characters is the cheapest way to make a page feel considered, and the fastest way to make it feel like a template.

I split exactly two things: the name in the masthead, and the section headings. Body text stays whole. Words that animate individually are harder to read, and the page is for reading.

I also learned to revert splits. A split heading is a pile of spans. Leaving it split breaks text selection, confuses screen readers on some combinations, and ruins any re-measure that happens later.

05

What I would tell myself in week one

  • Build the finished state first. You cannot animate towards a layout you have not committed to.
  • Learn timelines before anything else. Every other part of the library assumes you have one.
  • Every scroll-linked effect must be legible in reverse. If it is not, it belongs on a click.

The homepage has been live for two months. The animation I am most pleased with is one nobody has mentioned: the navigation label for the section you are in stays lit while the others sit at thirty-five percent. It took nine lines. The rest of what I learned went into knowing not to add more.