
The elastic button
Buttons, Hover, Text
The navigation bar of a writer's blog: a capsule of smoked glass on a near black page, with a name in italic, four links in a serif and, instead of an underline, the text caret of an editor, a thin glowing blue line blinking after the last letter of the page you are on and lighting the glass under it. Choose another link and the caret stops blinking, glides there leaning into the move, sets down a pixel too far, comes back and starts blinking again; meanwhile the new link takes weight one letter at a time.
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>
<!--
"Blog nav with caret" 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 blog nav with the text caret</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/newsreader@5.3.0/opsz.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/newsreader@5.3.0/opsz-italic.css">
<link rel="stylesheet" href="style.css">
</head>
<body>
<main class="stage">
<!-- the top bar of a writer's blog. The page you are on is marked by a text caret, the thin blinking line of a
text editor, standing after its last letter. Choose another link and the caret stops blinking, glides there
leaning into the move, sets itself down a pixel too far and comes back, then starts blinking again -->
<header class="bar" data-bar>
<span class="bar__glow" aria-hidden="true"><span class="bar__glow-spot" data-glow-spot></span><span class="bar__glow-line" data-glow-line></span></span>
<a class="brand" href="#" aria-label="Wren Hale, home" data-brand>Wren Hale</a>
<nav class="nav" aria-label="Main" data-nav>
<ul class="list">
<li><a class="link" href="#" data-link data-autoclic><span class="word" data-word>Essays</span></a></li>
<li><a class="link" href="#" data-link data-autoclic><span class="word" data-word>Notes</span></a></li>
<li><a class="link" href="#" data-link data-autoclic><span class="word" data-word>Letters</span></a></li>
<li><a class="link" href="#" aria-current="page" data-link data-autoclic><span class="word" data-word>About</span></a></li>
</ul>
<!-- the ghost caret: where the caret would go, under the mouse -->
<span class="ghost" aria-hidden="true" data-ghost><span class="ghost__bar" data-ghost-bar></span></span>
<!-- the caret: one element for the place, one for the lean and the stretch, one for the blink -->
<span class="caret" aria-hidden="true" data-caret><span class="caret__body" data-caret-body><span class="caret__bar" data-caret-bar></span></span></span>
</nav>
</header>
</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.
24 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 “Blog nav with caret” from Animorio and fit it into my siteThe caret's position is not a tween: it is a damped spring (CARET_SPRING, stiffness 260 and friction 26) stepped in GSAP's ticker at most 1/120 of a second at a time and never more than 1/30 a frame. With those values the damping is about 0.8: over 150 pixels of travel the caret goes a pixel or two too far and back. The target is the end of the word measured every frame, so the caret follows the word even while it widens taking weight.
The caret has three elements: the first for the place (translate3d, written by the script), the second for the lean and the smear (skewX in proportion to the speed with LEAN, up to 14 degrees, and a scaleX growing with STRETCH), the third, the line itself, for the blink and for the squash at the foot made by GSAP. That way none of them wipes out the transform of another.
Standing still, the caret stays lit for BLINK_RESUME seconds and then blinks with a period of BLINK (1.06 s, like macOS): lit for half, dark for the other half, with 80 millisecond edges. The opacity comes from the ticker's time and is only written when it changes; while the caret moves it stays lit, as editors do while you type.
Every word is split into letters and GSAP takes font-weight from REST_WEIGHT to CURRENT_WEIGHT with a LETTER_STAGGER stagger, starting from the side the caret comes from; the old one empties from the side the caret leaves. At start and on every resize each link is measured at its heaviest and keeps that minimum width: the links beside it never move.
While the caret runs faster than 60 pixels a second, every word it crosses gets --t = 1, which then falls away exponentially; the colour is a color-mix between the grey and the black at that percentage. The ghost caret under the mouse is a second element that slides from link to link on a power3.
The capsule is a white gradient from 7.5 to 2.5% with backdrop-filter, a one pixel inner edge, a lighter thread on top and a darker one below, and three outer shadows of different sizes. Behind, on the #09090b page, a radial blue ellipse and an SVG grain (feTurbulence) in overlay at 7%. Inside the capsule, under the caret, a radial pool and a thread on the bottom edge follow its x and grow with the speed.
| Name | File | Default | What it changes |
|---|---|---|---|
CARET_SPRING | script.js | [260, 26] | The caret's spring: how stiff, and how much it is held back (with 26 it goes a pixel too far and back). |
LEAN | script.js | 0.016 | How far the caret leans the way it goes, in degrees for every pixel a second. |
STRETCH | script.js | 0.0022 | How much wider the caret gets with the speed, like a smear. |
BLINK | script.js | 1.06 | How long one blink of the caret lasts, on and off, in seconds. |
BLINK_RESUME | script.js | 0.5 | How long the caret stays lit once it stops, before it blinks, in seconds. |
CURRENT_WEIGHT | script.js | 580 | The weight of the page you are on (200 to 800). |
REST_WEIGHT | script.js | 400 | The weight of the other links. |
LETTER_STAGGER | script.js | 0.035 | The wait between one letter and the next as the new link takes weight, in seconds. |
CARET_GAP | script.js | 2 | The room between the last letter and the caret, in pixels. |
For the header of a writer's blog: a journal, a newsletter, the site of a novelist, a freelance journalist or a small magazine, a product's docs. It suits three, four or five short links. Colours and weights change in the variables; with a sans serif it becomes the bar of a writing app.
Below 560 pixels the name goes and the four links stay in the middle, with spaces narrowing down to 18 pixels: at 341 the line is about 260 wide. A tap on a link sends the caret off like a click; the ghost caret, which is for the mouse, does not appear on touch.
No spring, no lean and no blink: the caret stays lit and still. Choosing another link it fades out where it was and fades back in after the new word, which is already full. The light on the glass stays still under the caret. When the page opens the capsule, the name and the links fade in.
GSAP 3.15.0, Newsreader (font variabile, con gli assi del peso e della dimensione ottica) 5.3.0.
Compressed with gzip, the three demo files weigh 6.5 KB; the libraries: GSAP 28 KB.
Tested on 1 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.