Skip to content
animorio
IT
Back to the library

The accordion wordmark

The monogram «Q.» opens like an accordion into the full word: the gap widens pushing the full stop along, and the middle letters rise from below the line in random order.

Text, HoverGSAPMediumFree

The code

A folder that runs on its own: index.html, style.css, script.js and the libraries from a CDN.

<!doctype html>
<html lang="it">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Il marchio a fisarmonica</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/mona-sans@5.3.0/standard.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <header class="testa">
    <!-- il marchio piccolo della testata: la sigla si apre nella parola intera -->
    <button class="marchio marchio--piccolo" type="button" data-marchio="Quasi.">Quasi.</button>
    <p class="testa__nota">Studio di grafica</p>
  </header>

  <main class="eroe">
    <!-- lo stesso marchio alla misura di un titolo -->
    <button class="marchio marchio--grande" type="button" data-marchio="Quasi." data-autoclic>Quasi.</button>
    <p class="eroe__nota">Passa sopra il marchio, o toccalo.</p>
  </main>

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

What it does

At rest the wordmark is just the monogram, the first letter and the full stop. Hover it and the gap between them widens to the full word, pushing the full stop to the right; meanwhile the middle letters rise from below the line, each in its own mask, in a different order every time. On leaving, the letters drop, still in random order, and the gap closes. If you change your mind halfway, the gesture restarts from where it got to.

How it works

Three pieces

The script splits the word into monogram, middle letters and full stop. The middle letters sit in a flex container with overflow: clip, zero wide at rest: the full stop sits right after the monogram and follows the widening gap by itself.

The gap

The container’s width goes from zero to the sum of the letter masks in 0.7 seconds on power4.inOut. At the end it goes back to «auto», so if the window changes size the open word adapts; before closing it is set back to pixels so it can animate.

The letters

Each letter sits in a mask that clips only vertically and rises from yPercent 110 to 0 in 0.6 seconds, 60 milliseconds after the previous one, starting at 0.35 seconds. The order is reshuffled every time with gsap.utils.shuffle: the wordmark never opens the same way twice.

Interruptions

Every gesture kills the running sequence and builds a new one from where things are: if the gap is already open only the letters rise, without waiting; a letter already up does not start again. With a mouse hovering drives it, with a finger or the keyboard a click does.

Values to change

NameFileDefaultWhat it changes
APREscript.js0.7Seconds for the gap to widen or close.
SALEscript.js0.6Seconds for each letter to rise or drop.
SFASA_SUscript.js0.06Seconds between letters when they rise (when they drop it is SFASA_GIU, 0.08).
RITARDOscript.js0.35How many seconds into the opening the letters start.

When to use it

For the header wordmark of a site with a strong monogram: at rest it takes little room, on hover it introduces itself in full. It also works large, as the title of the first screen.

On phones

Without hover the wordmark opens and closes on tap. The first time it comes into view it opens by itself and closes after a couple of seconds, to show it is there.

With reduced motion

No rising letters and no accordion: the word appears and disappears with a two-tenths-of-a-second fade, and it does not open by itself.

Pitfalls

  • With tight letter spacing the side of a letter leaves its box: the mask must clip only vertically (overflow-x: visible, overflow-y: clip), or the letters lose their right edge.
  • Measure the open word by adding up the masks, not with the closed container’s scrollWidth: with overflow: clip it is not a scroll area and the measure is unreliable.
  • Letters inside a zero-wide flex container would shrink: flex: none.
  • With a mouse, a click must not repeat what hovering already did: check the type of the last pointerdown.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

Weight: 8.2 KB of our own files.

Testing

Tested on 27 September 2026

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

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