Skip to content
animorio
IT
Back to the library

Stretching nav panel

Hover, SVGGSAP, CSS onlyMediumCompressed weight: Demo 8.2 KBGSAP 28 KBFreeDownload the zip

The menu of a made-up film distributor, minimal: the white bar drops in from the top over the film still, a real photo of a wooden boardwalk running down to the sea at sunset, and pressing its two lines makes the same bar stretch down into the menu panel, on a spring. The two lines cross into an X on eight springs, one for each end, the page behind darkens and blurs, the links arrive out of a one-pixel blur and, on hover, an arrow slides in and pushes the word aside.

Rebuilt from scratch studying neonrated.com by 27b: the idea is theirs; code, copy and images are ours. Read how it’s made

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>
<!--
  "Stretching nav panel" 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>Kestrel Pictures, the menu bar that stretches open</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/archivo@5.3.0/wdth.css">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/instrument-sans@5.3.0/wdth.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <!-- the page of a made-up film distributor, over a still of its film: a real photo of a wooden walkway running down to the sea at sunset. The white bar drops in from the top; press the two lines and the same bar
       stretches down into the menu panel, the lines cross into an X on eight separate springs, the links come in out of a
       one-pixel blur and an arrow slides in on hover, pushing the word aside. -->
  <svg width="0" height="0" class="nascosto" aria-hidden="true" focusable="false">
    <defs>
      <filter id="grana" x="0" y="0" width="100%" height="100%">
        <feTurbulence type="fractalNoise" baseFrequency="0.9" numOctaves="2" seed="4" stitchTiles="stitch" data-seme />
        <feColorMatrix type="saturate" values="0" />
        <feComponentTransfer><feFuncA type="table" tableValues="0 0.22" /></feComponentTransfer>
      </filter>
      <symbol id="freccia" viewBox="0 0 13 11"><path d="M0.37 5.08H10.73L6.29 0.63L6.85 0L12.35 5.5L6.85 11L6.29 10.37L10.73 5.92H0.37Z" fill="currentColor" /></symbol>
    </defs>
  </svg>

  <main class="palco" data-palco>
    <div class="pagina" data-pagina aria-hidden="true">
      <img class="pagina__foto" data-foto src="low-tide.webp" alt="" width="960" height="720" decoding="async">
      <i class="pagina__ombra"></i>
      <svg class="pagina__grana"><rect width="100%" height="100%" filter="url(#grana)" /></svg>
      <div class="pagina__testo">
        <span class="etichetta">In theaters</span>
        <p class="film">Low Tide</p>
        <p class="film__riga">A Kestrel Pictures release. Now showing.</p>
      </div>
      <svg class="play" viewBox="0 0 40 46"><path d="M1 1 L39 23 L1 45 Z" /></svg>
    </div>

    <div class="velo" data-velo></div>

    <header class="testata" data-testata>
      <div class="barra" data-barra>
        <div class="barra__riga">
          <div class="gruppo gruppo--sx" data-gruppo-sx>
            <button class="ham" type="button" aria-label="Open menu" aria-expanded="false" aria-controls="voci" data-ham data-autoclic>
              <svg viewBox="0 0 24 19" width="24" height="19"><line data-l="0" /><line data-l="1" /></svg>
            </button>
            <a class="marchio" href="#" aria-label="Kestrel Pictures, home" data-marchio>KESTREL</a>
          </div>
          <div class="gruppo gruppo--dx" data-gruppo-dx>
            <a class="icona" href="#" aria-label="Search" data-icona><svg viewBox="0 0 24 24"><circle cx="10.5" cy="10.5" r="6.2" /><path d="M15.2 15.2 L20 20" /></svg></a>
            <a class="icona" href="#" aria-label="Wishlist" data-icona><svg viewBox="0 0 24 24"><path d="M12 19.4 L5.3 12.9 A4.2 4.2 0 0 1 12 7.6 A4.2 4.2 0 0 1 18.7 12.9 Z" /></svg></a>
            <a class="icona" href="#" aria-label="Account" data-icona><svg viewBox="0 0 24 24"><circle cx="12" cy="8.6" r="3.6" /><path d="M5.2 20 C5.8 15.6 8.6 13.6 12 13.6 C15.4 13.6 18.2 15.6 18.8 20" /></svg></a>
            <a class="icona" href="#" aria-label="Cart" data-icona><svg viewBox="0 0 24 24"><path d="M5.4 8.4 H18.6 L17.6 19.6 H6.4 Z" /><path d="M9 10.4 V7.4 A3 3 0 0 1 15 7.4 V10.4" /></svg></a>
          </div>
        </div>
        <nav class="voci" id="voci" data-voci aria-label="Main">
          <ul>
            <li><a href="#" data-voce><span class="voce__freccia" data-freccia><svg width="13" height="11"><use href="#freccia" /></svg></span><span class="voce__testo" data-testo>Home</span></a></li>
            <li><a href="#" data-voce><span class="voce__freccia" data-freccia><svg width="13" height="11"><use href="#freccia" /></svg></span><span class="voce__testo" data-testo>Shop</span></a></li>
            <li><a href="#" data-voce><span class="voce__freccia" data-freccia><svg width="13" height="11"><use href="#freccia" /></svg></span><span class="voce__testo" data-testo>In Theaters</span></a></li>
            <li><a href="#" data-voce><span class="voce__freccia" data-freccia><svg width="13" height="11"><use href="#freccia" /></svg></span><span class="voce__testo" data-testo>Watch Now</span></a></li>
            <li><a href="#" data-voce><span class="voce__freccia" data-freccia><svg width="13" height="11"><use href="#freccia" /></svg></span><span class="voce__testo" data-testo>All Films</span></a></li>
          </ul>
          <div class="piede" data-piede>
            <span>Screenings and news, once a month</span>
            <span class="piede__icone">
              <svg viewBox="0 0 24 24" aria-hidden="true"><rect x="3.5" y="6" width="17" height="12" rx="1.5" /><path d="M4 7 L12 13 L20 7" /></svg>
              <svg viewBox="0 0 24 24" aria-hidden="true"><path d="M3.5 8 H20.5 V10.4 A1.8 1.8 0 0 0 20.5 13.6 V16 H3.5 V13.6 A1.8 1.8 0 0 0 3.5 10.4 Z" /><path d="M14.5 8 V16" stroke-dasharray="1.4 1.6" /></svg>
              <svg viewBox="0 0 24 24" aria-hidden="true"><rect x="3.5" y="5.5" width="17" height="13" rx="2.5" /><path d="M10.4 9.4 L14.8 12 L10.4 14.6 Z" /></svg>
            </span>
          </div>
        </nav>
      </div>
      <a class="biglietti" href="#" data-biglietti>
        <span class="biglietti__foto" aria-hidden="true"><img src="low-tide.webp" alt="" width="960" height="720" decoding="async"></span>
        <span>Get tickets</span>
        <svg class="biglietti__freccia" width="13" height="11" aria-hidden="true"><use href="#freccia" /></svg>
      </a>
    </header>

    <svg class="puntatore" data-puntatore viewBox="0 0 20 24" aria-hidden="true"><path d="M2 1.5 L2 19 L6.6 14.8 L9.6 21.6 L12.6 20.3 L9.7 13.6 L16 13.4 Z" /></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.

29 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 “Stretching nav panel” 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

Over the still of a made-up film, Low Tide, which is a real photo (a wooden boardwalk between the dunes running down to the sea, with the sun low on the horizon and its trail on the water) breathing slowly like a held shot, with a soft shade at the bottom so the big title reads, the white bar of Kestrel Pictures drops in from the top and settles at the top in the middle: the letters of the logo rise one after the other, the four icons (search, wishlist, account, cart) drop a few pixels, go one past their mark and come back, and the two menu lines open out from the centre. Under the bar the black Get tickets strip slides out with the film thumbnail. Then a drawn pointer shows the menu: it presses the two lines, which sink a little and come back, and the same bar stretches down on a spring until it becomes the menu panel; the two lines cross into an X, every end on its own spring, the two groups of icons move in towards the centre, the page behind darkens and blurs. The five links, Home, Shop, In Theaters, Watch Now and All Films, arrive out of a one-pixel blur one after the other, while the thin rules between them draw from the left. Hover a link and a blue arrow slides in, goes one pixel too far and comes back, pushing the word aside; the rule above it gets darker. Leave the link and the arrow fades while the word waits a tenth of a second before coming back. Press the X and the menu folds back into the bar. As soon as you touch it the pointer steps aside and the menu is yours: it opens and closes with the button, with a click on the dark page or with Esc, and the links can be reached with the keyboard too.

How it works

One single bar

The menu is not a separate panel: it is the bar itself, which holds both the top row and the links, hidden below its edge. Opening only changes its height, from 50 pixels to the height of the row plus the links, measured every time, on a spring of stiffness 550 and damping 30 on mass 1; the bar clips what spills out, so the panel is revealed as it stretches.

Eight springs for two lines

The two lines of the button are two lines in a 24 by 19 SVG. Each of the eight numbers, x1, y1, x2 and y2 of both lines, has its own spring (stiffness 500, damping 30, mass 0.5) computed on the GSAP ticker: on opening every number runs towards the X on its own, and the ends of the second line swap sides, so the X twists as it forms.

The links and the arrow

The links come in from opacity 0, scale 0.975 and a one-pixel blur in three tenths of a second, 0.02 seconds apart. On hover the word moves 23 pixels in three tenths with the curve (0.19, 1, 0.22, 1), and the arrow appears 75 thousandths later, from six pixels back to one too far and then into place. On the way out the word comes back a tenth of a second late.

The curves, solved by hand

The bar comes in from -85 pixels in 0.8 seconds with the curve (0.77, 0, 0.175, 1). GSAP without CustomEase does not read Bézier curves, so the demo solves the four it uses with a small Newton step and hands GSAP the function.

Values to change

NameFileDefaultWhat it changes
DROPscript.js0.8The seconds the bar takes to drop in from the top.
STIFFNESSscript.js500The stiffness of the eight springs of the two lines.
DAMPINGscript.js30The damping of the eight springs: lower and the X wobbles more.
MASSscript.js0.5The mass of the eight springs.
PANELscript.js550The stiffness of the spring of the bar stretching into the panel.
VEILscript.js0.4How dark the page behind the open menu gets.
STAGGERscript.js0.02The seconds between one link and the next as they come in.
PUSHscript.js23How many pixels the arrow pushes the word.
BLURscript.js5How much the page behind the open menu blurs, in pixels.

Try them in the Playground

When to use it

For the header of a cinema site, a festival, a shop or a brand: a small tidy bar that does not cover the page and becomes the menu without opening anything new.

On phones

The same animation with adapted sizes: the bar is as wide as the screen minus the margins, the links and their rows are sized on the height too, so the open panel always fits the screen; the arrow appears on focus just as on hover.

With reduced motion

No drops and no springs: the bar fades in, the panel opens already full height with the links fading in, the X is an X straight away, the arrow fades in without moving the word, the photo stays put and there is no drawn pointer.

Pitfalls

  • The springs run on the GSAP ticker and not on a separate requestAnimationFrame: whoever pauses GSAP pauses them too, and the step is cut into pieces of a four hundred and eightieth of a second so the spring does not explode when a frame comes late.
  • The open height is measured each time from the height of the links: with sizes in vh it changes with the screen, and on resize the bar snaps straight to the right size.
  • The links stay in the page even when closed, with hidden visibility: that way they can be measured, and the keyboard cannot get in while the menu is closed.
  • The arrow sits on top of the word, not in its flow: moving the word with a transform does not shift the rows or make the page reflow.
  • The thumbnail in the Get tickets strip is the same photo as the background, in a box with hidden overflow: the entrance spring scales the image inside, not the box, so the edges stay still and the browser downloads the photo only once.

Libraries

GSAP 3.15.0, Archivo (font variabile) 5.3.0, Instrument Sans (font variabile) 5.3.0.

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

Testing

Tested on 5 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 animations