Skip to content
animorio
IT
All components

Blog nav with caret

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

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.

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>
<!--
  "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>

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.

24 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 “Blog nav with caret” 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 near black page, with a soft blue light behind and a fine grain, a capsule of smoked glass 60 pixels tall and 600 wide: a one pixel edge catching the light at the top, a layered shadow lifting it off the page. On the left the name Wren Hale in italic; on the right four links in Newsreader: Essays, Notes, Letters and About. On arrival the capsule rises into focus, the name and the links rise a few pixels one after the other, and after About, the page you are on, white and fuller than the others, a blue text caret 2 pixels wide grows from the bottom with a small bounce, and under it a pool of blue light comes up on the glass, with a thread of light on the bottom edge. Half a second later it starts blinking like in an editor, on and off, with soft edges. Click another link and the caret stops blinking and glides to the end of the new word: it leans the way it goes and gets a little wider with the speed, like a smear; the light on the glass follows it, wider and brighter with the speed, and the words it passes over darken for a moment, as if read on the way. Once there it goes a pixel too far and back, squashes a touch at the foot and straightens; half a second later it blinks again. Meanwhile the old link loses weight and the new one takes it letter by letter, from the side the caret comes from, without the other links moving. With the mouse on a link, a faint grey caret appears after its last letter, where the real one would go; pressing, the real caret crouches a little before it leaves. From the keyboard every link has a thin blue frame and the arrow keys move from link to link.

How it works

The caret on a real spring

The 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.

Bent by the speed

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.

An editor's blink

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.

Weight letter by letter, without moving the line

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.

Words read on the way

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 glass and the light

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.

Values to change

NameFileDefaultWhat it changes
CARET_SPRINGscript.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).
LEANscript.js0.016How far the caret leans the way it goes, in degrees for every pixel a second.
STRETCHscript.js0.0022How much wider the caret gets with the speed, like a smear.
BLINKscript.js1.06How long one blink of the caret lasts, on and off, in seconds.
BLINK_RESUMEscript.js0.5How long the caret stays lit once it stops, before it blinks, in seconds.
CURRENT_WEIGHTscript.js580The weight of the page you are on (200 to 800).
REST_WEIGHTscript.js400The weight of the other links.
LETTER_STAGGERscript.js0.035The wait between one letter and the next as the new link takes weight, in seconds.
CARET_GAPscript.js2The room between the last letter and the caret, in pixels.

Try them in the Playground

When to use it

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.

On phones

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.

With reduced motion

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.

Pitfalls

  • With the links free to widen, the link taking weight pushed the others by three pixels and the line shook at every choice: now every link keeps the width of its heaviest self, measured at start and on every resize.
  • The caret's target worked out once at the click fell short: the new word, taking weight, grows a few pixels longer while the caret travels. Now the end of the word is measured every frame until the caret stops.
  • Lean, smear, blink and squash on one element wiped each other out (GSAP's transform covers the one written by the script): they are three elements one inside the other.
  • A caret as tall as the line went too far below the letters' tails: it is 21 pixels tall and one higher, from the top of the capitals to just under the descenders.
  • The pool of light and the thread took their opacity from two places (the entrance timeline and the per-frame drawing) and flickered: now the entrance only brings a level from 0 to 1, and the drawing multiplies it by the speed.

Libraries

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.

Testing

Tested on 1 November 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 components