Skip to content
motionprompts motionprompts

Line-by-Line Text Reveal

GSAP animation component · Published 2026-07-27 · by vanguardia.dev

Open live demo ↗ Download source

What it does

A scroll-driven line-by-line text reveal. GSAP SplitText breaks each heading and paragraph into masked lines, gsap.set pushes them to y:100%, and a ScrollTrigger fired once at 'top 75%' tweens them back to y:0% (duration 1, stagger 0.1, power4.out); the hero headline runs on load with a 0.5s delay. Lenis provides smooth scrolling.

How it's built

Categorytext
Techgsap, lenis
GSAP pluginsSplitText, ScrollTrigger
Complexitypage
Performance costmedium
Mobile-safeyes
Scrollhijacks scrolling

text-reveal split-text line-mask scroll stagger lenis editorial minimal

How it works

A quiet, editorial one-page site where every piece of text arrives the same way: line by line, rising out of an invisible slot. The hero headline lifts in a moment after the page loads; after that, each label, headline and paragraph waits until it has scrolled most of the way into view, then its lines slide up one after another and stay put.

It is built with GSAP, its SplitText and ScrollTrigger plugins, and Lenis for smooth scrolling. The point of the component is less the animation itself than the small system around it, which makes the reveal reusable on any block of text.

An attribute-driven reveal system

Instead of writing an animation per element, any element on the page can opt in with a data attribute. Other attributes adjust it: a delay for the hero, a switch to play on load rather than on scroll, and a wrapper mode for containers whose children should be split individually but animated as one sequence. That last mode is what lets three paragraphs, or a column of footer links, cascade as a single continuous column instead of starting three separate animations at once. Adding the effect to new copy is a matter of markup, with no new JavaScript.

What happens to each block

When a block is set up, SplitText breaks it into visual lines and wraps each line in a clipping mask. Every line is moved down by its own height, so it sits just below its mask and cannot be seen. A ScrollTrigger watches the block, and when its top reaches a point well inside the viewport, a single tween moves all its lines back up with a short stagger and a strong ease-out: a fast start and a long, soft landing. The trigger fires once, so scrolling back up never hides the text again.

Where it gets hard

Line splitting is only correct once the real font has loaded, because a fallback font breaks lines in different places. The whole system therefore waits for the fonts before splitting anything, while a CSS rule keeps the lines hidden in the meantime so there is no flash of text that then disappears.

The other subtlety is indentation. Two of the large headlines use a first-line indent, a classic editorial detail. Once the text is split into lines, every line would inherit that indent, so the system reads the indent before splitting, applies it only to the first line as padding and removes it from the block.

Performance, mobile and accessibility

Only transforms are animated, and each block animates once, so it is light on any device. The layout adapts below tablet width with smaller type and stacked columns, and the reveal itself runs unchanged on phones. Because the text is hidden until it is revealed, it is worth adding a reduced-motion branch that skips the movement and shows the copy immediately, and making sure screen readers receive whole sentences rather than fragments.

Rebuild it with AI

This component's prompt is part of the paid library. Below you can read how it starts; the full prompt, the exact structure, timing and easing an AI agent needs to rebuild the effect, unlocks with any paid plan, yearly or lifetime.

# Text Reveal Animation (Masked Line-by-Line Scroll Reveal)
## Goal
Build a minimal, editorial one-page site for a fictional design studio ("Greyloom") where **every headline, label and paragraph reveals itself line by line**: GSAP **SplitText** breaks each text block into lines, each line is wrapped in an overflow-clipping mask, pushed down to `y: 100%`, and slid up to `y: 0%` with a `power4.out` ease and a 0.1s stagger — triggered **once per block when it scrolls to 75% of the viewport** (the hero headline plays on load with a 0.5s delay). Scrolling is smoothed with Lenis. The reveal system is generic and attribute-driven (`data-copy`, `data-copy-wrapper`, `data-copy-delay`, `data-copy-scroll`).
## Tech
Vanilla HTML/CSS/JS with ES module imports. Use **`gsap` (npm)** with the **`SplitText`** and **`ScrollTrigger`** plugins, plus **`lenis`** for smooth scrolling:
```js
import gsap from "gsap";
import { SplitText } from "gsap/SplitText";
import { ScrollTrigger } from "gsap/ScrollTrigger";
import Lenis from "lenis";
gsap.registerPlugin(SplitText, ScrollTrigger);
```
…

Premium prompt

Unlock this prompt, and every other one

From $99/year, or $139 once for lifetime access. Commercial license included.

See pricing Or start with the free set Already bought? Sign in

New components in your inbox

One email a week, only when new components ship, each with its live demo and prompt.