Skip to content
animorio
IT
Back to the library

Stretching word

Text, ScrollGSAP, CSS onlyMediumCompressed weight: Demo 5.0 KBGSAP 28 KBLenis 5.3 KBFreeDownload the zip

Scroll inside the preview

A minimal scroll text animation with one gesture: the faster the page runs, the wider the word. A single word stays still in the middle while the page runs under it; scroll fast and the letters stretch on the width axis of the type and get thinner, the middle ones first, and when you stop they spring back, a hair too narrow and then right, like a rubber band. The thin rule underneath measures it and turns orange at full speed; press and hold and the word squeezes and gets heavier.

The code

A folder that runs on its own: index.html, style.css, script.js and the libraries from a CDN. The React and Vue tabs hold the same demo as a ready component, which switches its animations off when it leaves the page.

<!doctype html>
<!--
  "Stretching word" from Animorio · https://animorio.com
  License: free on your own sites and your clients’ sites, paid work included.
  Not for resale, redistribution, templates or code collections · https://animorio.com/en/license/
-->
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>The word that stretches when you scroll fast</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/mona-sans@5.3.0/wdth.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <!-- a long page: the stage stays put while the page runs under it, and the word takes its width from how fast it runs -->
  <main class="corsa" data-run>
    <section class="palco" data-stage>
      <!-- the hairline ruler at the edge: it is the page going by -->
      <div class="righello" data-ruler aria-hidden="true"></div>
      <div class="gruppo">
        <h1 class="parola" data-word aria-label="Momentum"></h1>
        <!-- the thin rule that measures the word, with a tick at each end -->
        <div class="misura" data-rule aria-hidden="true">
          <span class="linea" data-line></span>
          <span class="tacca" data-tick-a></span>
          <span class="tacca" data-tick-b></span>
        </div>
      </div>
      <p class="nota" data-note>Scroll fast, then let go</p>
    </section>
  </main>

  <script src="https://cdn.jsdelivr.net/npm/gsap@3.15.0/dist/gsap.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/lenis@1.3.26/dist/lenis.min.js"></script>
  <script src="script.js"></script>
</body>
</html>

Playground

Change values, colours and text with the controls and watch the animation respond live. Or write in the code yourself. Then download the folder with your changes.

16 values to change

Or ask your AI assistant for it

With the Animorio connector, Claude Code, ChatGPT, Cursor or VS Code take it from here, guide included, and fit it into your project. Paste this request:

Take “Stretching word” from Animorio and fit it into my site
Platform licenseFree on your sites and your clients’ sites. Want it inside a website builder, a template platform or a client dashboard? There’s a license for agencies and platforms.

What it does

On empty warm white a single word rises from below, ‘Momentum’, letter by letter from the middle: it arrives very wide and thin and at once snaps closed to its size on a spring, the middle letters first and the outer ones after, a hair too narrow and then right. Under it a thin grey rule draws itself from the middle, with a small vertical tick at each end; at the right edge a ruler of very fine ticks appears, short ones with a longer one every so often, fading out at the top and the bottom. The word stays still in the middle while the page scrolls: the ruler moves with the page and shows it running. The faster you scroll, the more the word stretches on the width axis of the type and gets thinner, like a pulled rubber band; the middle letters answer first, the outer ones arrive later, and they all trail a few pixels behind the scroll, the outer ones more, so the word bends very slightly. The rule underneath follows the width at every moment, goes from grey to orange with the speed and its two ticks grow longer. When you stop, the word springs back narrow, goes a little past and settles, the rule turns grey again and the small line ‘Scroll fast, then let go’ comes back at the bottom. Press and hold the word, with the mouse or a finger, and it squeezes to the narrowest the type allows and gets heavier; let go and it bounces back to its size.

How it works

Speed, measured by hand

Every frame of GSAP’s ticker reads scrollY and divides the change by the screen height and the time passed: screens per second. The number is smoothed with a 70 millisecond filter and turned into a stretch between 0 and 1 with one minus an exponential, so a slow scroll widens a little and a fling gets close to the top without going past it.

A spring for every letter

Every letter has its own spring chasing the stretch, in a few small steps per frame. The middle letters are 40 per cent stiffer than the outer ones: they answer first and stop first, so the word opens and closes from the middle without any delay written by hand.

Width and weight together

The stretch becomes two axes of the variable font, written in font-variation-settings on the inner span: the width goes from 82 to 125 and the weight drops from 640 to 380, because a pulled rubber band gets thinner. Pressed, the word goes below zero: width 75 and weight 820.

The trail

With speed every letter moves a few pixels against the scroll on a second, softer spring, the outer ones more: the word bends very slightly. That move is a GSAP y on the outer span, so it never touches the axes on the inner one.

The measure and the ruler

The rule underneath takes the real width of the word every frame and its colour mixes grey and orange by the stretch of the widest letter. The ruler at the edge is a background of two repeating gradients, every 12 and every 60 pixels, moved by as much as the page scrolls.

Values to change

NameFileDefaultWhat it changes
WORDscript.jsMomentumThe word.
REST_WIDTHscript.js82The width of the letters at rest, from 75 to 125.
FAST_WIDTHscript.js125The width at full speed, from 75 to 125.
REST_WEIGHTscript.js640The weight at rest.
FAST_WEIGHTscript.js380The weight at full speed: stretched letters get thinner.
PRESS_WEIGHTscript.js820The weight while you hold the word down.
FULL_SPEEDscript.js0.9How many screens per second stretch the word most of the way: lower, it stretches sooner.
BOUNCEscript.js0.5How springy the letters are: 0.2 calm, 0.8 jelly.
DRAGscript.js5How many pixels the letters trail behind the scroll.
SMOOTHscript.js1Seconds of the smooth scroll; 0 for the browser’s own.

Try them in the Playground

When to use it

For a long page that wants you to feel the motion: the opening of a motion design studio, a type foundry, a sports brand or a running app, or a single word between two sections of a portfolio.

On phones

The same animation with adapted sizes: the word is sized to fit the box even fully stretched, in width and height, and it stretches the same way under the finger; press and hold and it squeezes.

With reduced motion

The word is already at its size, the rule is grey and everything appears in a fade; scrolling does not stretch the word and nothing moves, and the scroll is the browser’s own.

Pitfalls

  • Speed has to be read from scrollY every frame, not from scroll events: with smooth scrolling the events come in bursts and the word would jitter.
  • The word must be sized fully stretched, not at rest: sized narrow, at full speed it leaves the box.
  • The font axes go on the inner span and GSAP’s move on the outer one: on the same element GSAP’s transform and the hand-written style step on each other.

Libraries

GSAP 3.15.0, Lenis 1.3.26, Mona Sans (font variabile) 5.3.0.

Compressed with gzip, the three demo files weigh 5.0 KB; the libraries: GSAP 28 KB, Lenis 5.3 KB.

Testing

Tested on 31 October 2026

  • Desktop: Done
  • Phone: Done
  • Reduced motion: Done
  • Safari on iPhone: To do

License

Use it in your own projects and in your clients’ projects. Do not resell it or redistribute it as is. GSAP stays under its own Standard license. Full license.

All animations