
Speeding marquee
Scroll, Text, Hover
A large headline with three pills between its words, each holding a photo: they open one after the other pushing the text apart, and passing over them they widen further, lighten and show where they lead.
Rebuilt from scratch studying marimba.design by Myranda Wicks: the idea is theirs; code, copy and images are ours. Read how it’s made
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>
<!--
"Pills in the headline" 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="it">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Le pillole nel titolo</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/mona-sans@5.3.0/standard.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource/instrument-serif@5.3.0/index.css">
<link rel="stylesheet" href="style.css">
</head>
<body>
<main class="pagina">
<p class="nota" data-nota>Nel titolo si aprono tre pillole con dentro una foto; passandoci sopra si allargano, si schiariscono e dicono dove portano.</p>
<h1 class="titolo" data-titolo>
Disegniamo <a class="pillola" href="#" data-pillola style="--velo: #DCEFF8"><span class="pillola__quadro"><img src="orto.webp" alt="" width="900" height="600" decoding="async"></span><span class="pillola__nome">Chi siamo</span></a> orti e giardini che si guardano <a class="pillola" href="#" data-pillola style="--velo: #FBE3EC"><span class="pillola__quadro"><img src="tulipani.webp" alt="" width="900" height="600" decoding="async"></span><span class="pillola__nome">Lavori</span></a> anche dalla finestra <a class="pillola" href="#" data-pillola style="--velo: #E9F4D8"><span class="pillola__quadro"><img src="davanzale.webp" alt="" width="900" height="574" decoding="async"></span><span class="pillola__nome">Scrivici</span></a> di casa.
</h1>
</main>
<script src="https://cdn.jsdelivr.net/npm/gsap@3.15.0/dist/gsap.min.js"></script>
<script src="script.js"></script>
</body>
</html>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
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 “Pills in the headline” from Animorio and fit it into my siteEach pill is an inline-block link inside the headline, 0.8em tall with a full border-radius: it is measured on the headline’s size, so it follows the text at any size. It starts with width 0 and zero margins: the line is set as if it were not there.
Once the font has loaded, the headline gets a class and the pills go to width 1.45em with a 1.2-second transition, each 180 milliseconds after the other. Animating width means reflowing every frame, but these are three elements in one line: the text reflowing is exactly what makes the effect.
On mouse over the width goes to 2.3em, an ::after with a pastel in mix-blend-mode: lighten, at 84%, brightens the photo while letting it show through, and the name, in another typeface, rises from scale 0.92. A single pointermove listener decides what is under the pointer; keyboard focus does the same.
The staggered delay is only for the opening: once it is over, the script resets each pill’s --i variable, so the response to the mouse is immediate. The photo inside, an img with object-fit: cover enlarged by 12%, drifts with a 5-second yoyo tween, slightly longer for each pill: the enlargement’s margin covers the drift, so the edges never show.
| Name | File | Default | What it changes |
|---|---|---|---|
--largo | style.css | 1.45em, 2.3em | The pill’s width when open and on mouse over, in the headline’s em. |
--velo | index.html | per pillola | The pastel that lightens the photo on mouse over. |
APRE | script.js | 400 | The milliseconds before the pills start opening. |
For the headline of a home page or a portfolio that wants to lead somewhere at once: the pills are links, and they can hold photos, videos or drawings.
The pills are measured on the headline, so they shrink with it; with a finger they light up on touch and stay lit for just over a second, long enough to widen, then return as they were.
The pills are already open and do not widen: on mouse over only the veil and the name change, with a short fade, and the photo inside stays still.
GSAP 3.15.0, Instrument Serif 5.3.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 3.1 KB; the libraries: GSAP 28 KB.
Tested on 6 November 2026
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.
Support Animorio
Animorio stays free thanks to the people who support it. If you like, buy us a coffee: it helps us make the next animations.
You asked for
We made it for you: it’s in the library, with the preview, the Playground and the code to copy.
An animation you can’t find, or a site to take apart in the journal: tell us which. We pick the next ones from here.
With your account’s email and password.
or with your email
You’re signed in as .
With your account, you can download the zip of every animation and every pack, for free.