Skip to content
motionprompts motionprompts

Offset Scrub Headline Lines

GSAP animation component · Published 2026-11-21 · by vanguardia.dev

Open live demo ↗ Raw prompt (.md)

What it does

Giant three-line uppercase headline whose lines rise out of their masks tied to scroll (scrub). Each line starts at a different depth (yPercent 70, 110, 90) and all reach rest over the same scroll range, so they travel at different speeds and the middle one surfaces last. Scrolling back rewinds them.

How it's built

Categorytext
Techgsap
GSAP pluginsScrollTrigger
Complexitysection
Performance costlight
Mobile-safeyes

scroll scrub headline mask-reveal lines typography uppercase condensed

Rebuild it with AI

To reproduce this animation in your own project, copy the prompt below into Claude Code, Cursor or any AI coding agent. The prompt is validated, it describes the exact structure, timing and easing, so the agent rebuilds the effect faithfully and you can then adapt colors, copy and layout to your design.

The full prompt

Offset Scrub Headline Lines: Three Masked Lines That Rise With Scroll at Different Speeds

Goal

Build a white page with an empty stretch of scroll, then a giant three-line uppercase headline centred in a full-height section, then another empty stretch. As the section scrolls in, each line rises out of its own mask tied to scroll (scrub). The lines start at different depths (yPercent 70, 110 and 90) and all reach rest over the same scroll range, so they move at different speeds and the middle line surfaces last. Scrolling back up rewinds them into their masks. The only other text is a discreet "Scroll" hint at the bottom of the first screen. GSAP + ScrollTrigger.

Tech

Vanilla HTML/CSS/JS with ES module imports. gsap (npm) and gsap/ScrollTrigger. Fonts: Sofia Sans Extra Condensed 800 (headline) and Hanken Grotesk (hint).

Layout / HTML

<div class="os">
  <div class="os-spacer"><span class="os-hint">Scroll</span></div>
  <section class="os-stage" data-os>
    <h2 class="os-title">
      <span class="os-mask"><span data-os-line>Ready</span></span>
      <span class="os-mask"><span data-os-line>to start</span></span>
      <span class="os-mask"><span data-os-line>something?</span></span>
    </h2>
  </section>
  <div class="os-spacer" aria-hidden="true"></div>
</div>

Styling

:root: --os-bg:#fff, --os-ink:#0d0a10, --os-size:clamp(5rem,14vw,13rem).

  • .os-spacer: position:relative; height:90svh. .os-hint: absolute, centred at the bottom, 0.75rem uppercase, letter-spacing:.08em; opacity:.5.
  • .os-stage: min-height:100svh; display:flex; align-items:center; justify-content:center.
  • .os-title: Sofia Sans Extra Condensed 800, font-size:var(--os-size); line-height:.86; letter-spacing:-.01em; text-transform:uppercase; text-align:center.
  • .os-mask: display:block; overflow:hidden; padding-bottom:.06em; margin-bottom:-.06em. .os-mask > span: display:block.
  • Under 767px: --os-size:clamp(3.4rem,18vw,6rem).

GSAP effect (be exact)

Build in mount(config) → destroy().

const DEFAULTS = { offsets: [70, 110, 90], start: "top 90%", end: "top 25%", scrub: 0.6 };

One tween for the three lines:

gsap.fromTo(lines, { yPercent: (i) => offsets[i] }, {
  yPercent: 0, ease: "none",
  scrollTrigger: { trigger: section, start: "top 90%", end: "top 25%", scrub: 0.6 },
});

No stagger: the difference in rhythm comes only from the different starting offsets over a shared range. A line at 110% is fully hidden at the start, so the middle one appears noticeably later. scrub: 0.6 smooths the catch-up; reversing is automatic.

If prefers-reduced-motion: reduce matches, skip the tween (lines stay at rest).

destroy(): kill the trigger and the tween, clearProps:"transform" on the lines.

Assets / images

None.

Behavior notes

  • The spacers exist only to give the trigger room before and after; inside a real page the surrounding sections do that job.
  • Change the rhythm by editing offsets; values above 100 keep a line fully hidden for part of the range.
  • Only the prefixed variables are global.

Using this outside its demo page

This component is written as a complete page: that is how the demo is meant to look. If you are dropping it into an existing project, or combining it with other components, these are the things it declares at document level and that you need to move or reconcile first.

  • Palette on :root: --os-bg, --os-ink, --os-size. Generic names like --ink, --paper or --muted are defined by many components in this catalogue with different values, and they will also collide with whatever your own project defines. Move them onto the component's wrapper (.my-section { --ink: … }) or keep the prefix.
  • **Rules on *, *::before, *::after, html, body**: the demo owns the whole document, so these set the box model and resets. Dropped into an existing project they restyle the entire page, not just this section. Re-target them at the component's wrapper before using it.

New components in your inbox

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