Skip to content
animorio
IT
Back to the library

Card-driven headline word

Text, HoverGSAP, CSS onlyMediumCompressed weight: Demo 5.9 KBGSAP 28 KBFreeDownload the zip

The “built for” section of the landing page of a workspace app, on warm white: under the headline One workspace, built for teams sits a row of cards for the different kinds of user, and passing over a card turns the last word of the headline into that card’s word, designers, agencies, students, founders: the old letters rise away getting lighter, the new ones come up from below from thin to full weight, in the card’s colour, while the card lifts, takes a tint and draws its icon.

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>
<!--
  "Card-driven headline 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 headline whose word changes as you pass over the cards</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>
  <main class="stage" data-stage>
    <!-- the "built for" section of a made-up workspace app: passing over a card changes the last word of the headline -->
    <section class="sezione" data-sezione aria-label="Brightdesk">
      <p class="occhiello" data-occhiello>
        <svg class="occhiello__segno" viewBox="0 0 16 16" aria-hidden="true"><rect x="2.5" y="2.5" width="11" height="11" rx="3.2"></rect><path d="M5.5 8h5M8 5.5v5"></path></svg>
        Brightdesk
      </p>
      <h1 class="titolo" data-titolo>
        <span class="riga" data-riga>One workspace,</span>
        <span class="riga" data-riga>built for <span class="parola" data-parola aria-live="polite"><span class="parola__dentro" data-dentro></span></span><span class="punto">.</span></span>
      </h1>
      <span class="titolo misura" data-misura aria-hidden="true"></span>

      <ul class="card" data-cards>
        <li class="c" data-card data-word="designers" data-color="#7c3aed" tabindex="0">
          <svg class="c__icona" viewBox="0 0 24 24" aria-hidden="true"><path d="M4 20l3.2-.8L18.6 7.8a2 2 0 0 0-2.8-2.8L4.4 16.4z"></path><path d="M14.5 6.5l3 3"></path></svg>
          <span class="c__nome">Design teams</span>
          <span class="c__riga">Files, specs and reviews</span>
          <svg class="c__freccia" viewBox="0 0 16 16" aria-hidden="true"><path d="M3.5 8h9M8.5 4l4 4-4 4"></path></svg>
        </li>
        <li class="c" data-card data-word="agencies" data-color="#ea580c" tabindex="0">
          <svg class="c__icona" viewBox="0 0 24 24" aria-hidden="true"><rect x="3.5" y="7.5" width="17" height="12" rx="2.5"></rect><path d="M9 7.5V5.5a1.5 1.5 0 0 1 1.5-1.5h3A1.5 1.5 0 0 1 15 5.5v2"></path><path d="M3.5 12.5h17"></path></svg>
          <span class="c__nome">Agencies</span>
          <span class="c__riga">Every client, one board</span>
          <svg class="c__freccia" viewBox="0 0 16 16" aria-hidden="true"><path d="M3.5 8h9M8.5 4l4 4-4 4"></path></svg>
        </li>
        <li class="c" data-card data-word="students" data-color="#0d9488" tabindex="0">
          <svg class="c__icona" viewBox="0 0 24 24" aria-hidden="true"><path d="M2.5 9.5L12 5l9.5 4.5L12 14z"></path><path d="M6.5 11.5v4.5c0 1.2 2.5 2.5 5.5 2.5s5.5-1.3 5.5-2.5v-4.5"></path></svg>
          <span class="c__nome">Students</span>
          <span class="c__riga">Notes that stay together</span>
          <svg class="c__freccia" viewBox="0 0 16 16" aria-hidden="true"><path d="M3.5 8h9M8.5 4l4 4-4 4"></path></svg>
        </li>
        <li class="c" data-card data-word="founders" data-color="#2563eb" tabindex="0">
          <svg class="c__icona" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3.5c3 2 4.5 5 4.5 9l-2 3h-5l-2-3c0-4 1.5-7 4.5-9z"></path><path d="M9.5 15.5l-2 4 3-1M14.5 15.5l2 4-3-1"></path><circle cx="12" cy="10" r="1.6"></circle></svg>
          <span class="c__nome">Startups</span>
          <span class="c__riga">Plans, docs and launches</span>
          <svg class="c__freccia" viewBox="0 0 16 16" aria-hidden="true"><path d="M3.5 8h9M8.5 4l4 4-4 4"></path></svg>
        </li>
      </ul>
      <p class="nota" data-nota>One price for the whole team. Free for students.</p>
    </section>
    <svg class="ghost" data-ghost viewBox="0 0 20 20" aria-hidden="true"><path d="M4 2.5v13.2l3.5-3.3 2.4 5.3 2.3-1-2.4-5.2 4.8-.2z"></path></svg>
  </main>
  <script src="https://cdn.jsdelivr.net/npm/gsap@3.15.0/dist/gsap.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.

28 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 “Card-driven headline 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 a warm white background, with a barely visible glow of the chosen colour behind the headline, sits the landing section of Brightdesk, a made-up app for working together. At the top the pill with its name, then the big headline on two lines, One workspace, built for teams, and below four white cards with thin borders: Design teams, Agencies, Students and Startups, each with its line icon and a line of text. Passing over a card changes the last word of the headline: the letters of the old one rise away one after the other, get thinner and disappear, and only when they are gone do the new letters come up from below, go slightly above the line and settle, starting thin and reaching full weight, in the card’s colour: violet for designers, orange for agencies, teal for students, blue for founders. Meanwhile the word stretches or shrinks on a spring and the full stop, with the whole line, slides to make room. The chosen card lifts a few pixels, takes on its colour, its icon redraws itself with a small turn and an arrow arrives at the top right. Leaving the row brings the headline back to teams. A click gives the card a small press. If nobody touches the page, a drawn pointer passes over every card one after the other.

How it works

One word, a row of letters

The word is a span with overflow hidden holding one absolutely positioned span per letter: GSAP decides the width and the leaving letters vanish at its edge.

The old one leaves, then the new one arrives

The old letters go to yPercent minus 112, fade and lose weight, LETTER_STAGGER seconds apart; the new ones start only once the last old letter is gone: never two words readable together.

The weight that rises

Every letter has font-variation-settings with the weight in a CSS variable, --w; GSAP takes it from WEIGHT_FROM to WEIGHT_TO while the letter rises through the keyframes 112, minus 8, 2, 0: the word arrives thin and fills up as it settles.

The width on a spring

The new word’s width is measured on a hidden twin of the headline, with the same typeface and the final weight; the word reaches it with back.out(SPRING), and the centred headline slides the rest of the line along.

The cards and the colour

Each card carries its word and colour in data-word and data-color; the script computes fill, border and glow (no color-mix, it does not survive the video), the card lifts LIFT pixels and its icon redraws itself with stroke-dashoffset.

Values to change

NameFileDefaultWhat it changes
REST_WORDscript.js'teams'The headline’s word when no card is chosen.
REST_COLORscript.js'#141414'The colour of the word at rest.
LETTER_STAGGERscript.js0.026The seconds between one letter and the next as they roll.
WEIGHT_FROMscript.js260The weight the new letters arrive with.
WEIGHT_TOscript.js680The weight the letters settle at.
SPRINGscript.js1.6How much the word’s width bounces (0 means no bounce).
LIFTscript.js5How many pixels the chosen card lifts.
AUTO_PILOTscript.js1.4After how many seconds the drawn pointer starts (0 means never).

Try them in the Playground

When to use it

For the section of a landing page that says who a product is for: an app, a piece of software, a service with different kinds of people (designers, agencies, students, founders). One headline that adapts to the card you pass over, instead of four blocks of text.

On phones

The same animation with adapted sizes: the cards go onto two rows of two, the headline is measured on the width and height of the screen and a tap on a card changes the word.

With reduced motion

No rolling letters, no spring and the card does not lift: the word changes with a fade and takes its width at once, the card takes on its tint.

Pitfalls

  • The width must be measured with the letters’ final weight: measured halfway through the change, at the thin weight, the word comes out too narrow and then jumps.
  • The old letters keep their colour while they leave (the script writes it on them): otherwise they take the new one and for a moment the old word changes colour.
  • The weight lives in a CSS variable inside font-variation-settings: GSAP animates the variable, not the whole property.
  • CSS color-mix does not survive the video rendering: the cards’ fill, border and glow are computed by the script.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

Tested on 28 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