Skip to content
animorio
IT
All components

Announcement bar

Notifications, Hover, TransitionsGSAP, CSS onlyEasyCompressed weight: Demo 5.6 KBGSAP 28 KBFreeDownload the zip

The thin bar on top of the site of Marlow Supply, a made-up clothing shop: three messages taking turns on a vertical spring, free shipping, the sale countdown with rolling digits and the new arrival with Shop now. Hovering pauses the loop together with its time line; the X folds the bar away and the header rises, and a small Show offers brings it back. A component on white, one saffron accent.

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>
<!--
  "Announcement bar" 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>Announcement bar</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/mona-sans@5.3.0/wdth.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <main class="stage">
    <!-- the announcement bar on top of a made-up shop, Marlow Supply: three messages take turns on a spring,
         the sale countdown rolls, hovering pauses the loop, and the X folds the bar away while the header rises -->
    <div class="site" data-site>
      <div class="bar" data-bar role="region" aria-label="Offers">
        <div class="bar__in" data-bar-in>
          <button class="bar__arrow" type="button" data-prev aria-label="Previous offer">
            <svg viewBox="0 0 12 12" aria-hidden="true"><path d="M7.4 2.6 4 6l3.4 3.4"/></svg>
          </button>
          <div class="bar__view" data-view aria-live="polite">
            <p class="msg" data-msg>
              <svg class="msg__icon" viewBox="0 0 16 16" aria-hidden="true"><path d="M1.8 4.5h7.4v6.3H1.8zM9.2 6.6h2.6l2.4 2.3v1.9H9.2"/><circle cx="4.4" cy="11.4" r="1.3"/><circle cx="11.6" cy="11.4" r="1.3"/></svg>
              <span>Free shipping on orders over <b data-threshold>$80</b></span>
            </p>
            <p class="msg" data-msg>
              <span>Sale ends in</span>
              <span class="clock" data-clock aria-label="2 hours 14 minutes 9 seconds"></span>
            </p>
            <p class="msg" data-msg>
              <span class="msg__new">New</span>
              <span>The wool overshirt is back</span>
              <a class="msg__link" href="#" data-link>Shop now<svg viewBox="0 0 12 12" aria-hidden="true" data-link-arrow><path d="M2.4 6h7M6.6 3.2 9.4 6 6.6 8.8"/></svg></a>
            </p>
          </div>
          <button class="bar__arrow" type="button" data-next aria-label="Next offer">
            <svg viewBox="0 0 12 12" aria-hidden="true"><path d="M4.6 2.6 8 6 4.6 9.4"/></svg>
          </button>
          <button class="bar__close" type="button" data-close aria-label="Close the offers">
            <svg viewBox="0 0 12 12" aria-hidden="true"><path d="M3 3l6 6M9 3 3 9"/></svg>
          </button>
        </div>
        <span class="bar__time" aria-hidden="true"><span class="bar__fill" data-fill></span></span>
      </div>

      <header class="head" data-head>
        <span class="logo">Marlow<span class="logo__light"> Supply</span></span>
        <nav class="head__nav" aria-label="Shop">
          <a href="#" class="head__link">Shop</a>
          <a href="#" class="head__link">Journal</a>
          <button class="reopen" type="button" data-reopen aria-label="Show the offers" hidden>
            <svg viewBox="0 0 14 14" aria-hidden="true"><path d="M2.2 5.6 9.8 2.8v8.4L2.2 8.4zM9.8 5.2c1.3.3 1.9 1 1.9 1.8s-.6 1.5-1.9 1.8M4 8.9l.7 2.5"/></svg>
            <span>Show offers</span>
          </button>
          <span class="bag" aria-label="Bag, 2 items">
            <svg viewBox="0 0 18 18" aria-hidden="true"><path d="M3.6 6.2h10.8l-.9 9H4.5zM6.4 6.2V5a2.6 2.6 0 0 1 5.2 0v1.2"/></svg>
            <span class="bag__n">2</span>
          </span>
        </nav>
      </header>
      <div class="hero" data-hero>
        <p class="hero__kicker">Winter edit</p>
        <p class="hero__title">Layers for the long cold.</p>
      </div>
    </div>
  </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.

28 values to change

Works with Claude, Claude Code, ChatGPT, Cursor, VS Code, Windsurf, Codex, Gemini CLI

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 “Announcement bar” 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 top of the Marlow Supply site a black bar one line tall: «Free shipping on orders over $80», then «Sale ends in 02:14:09» with its six digits rolling every second, then «New The wool overshirt is back · Shop now». Each message stays a few seconds while a thin saffron line fills underneath; then it rises and fades and the next one comes in from below with a small bounce. The two arrows step back and forth by hand, the mouse over the bar pauses the loop and the line. The X folds the bar in height, the header with the logo and the bag rises, and next to the menu the Show offers pill appears and opens it again on a spring.

How it works

Stacked messages

The three messages sit on top of each other in the same cell, position: absolute, all hidden but the first.

The spring swap

The old one rises 70 percent and fades in 0.32 s; the new one comes from yPercent 90 with back.out, so it goes a hair past and settles.

The time line

A 2 px line runs scaleX from 0 to 1, linear, over ROTATE seconds; at the end it calls the swap. Hovering pauses it and leaving resumes it.

Rolling digits

Each digit is a column of 0 to 9 inside a one-line window: the GSAP ticker takes off a second and moves the column to yPercent −digit×10 with a small bounce.

The folding bar

The X animates the bar height from its size to 0 with back.in: the header below rises by itself. Show offers does the reverse up to height auto.

Values to change

NameFileDefaultWhat it changes
ROTATEscript.js3.4Seconds each message stays before the next.
SPRINGscript.js1.6How far the new message overshoots as it arrives (0 = no bounce).
COUNTDOWNscript.js02:14:09Where the sale countdown starts, hours:minutes:seconds.
THRESHOLDscript.js80The free shipping threshold, in dollars.
FOLDscript.js0.6Seconds the bar takes to fold away when you close it.
REOPEN_AFTERscript.js2.2In the demo loop, seconds before the closed bar opens again.
--barrastyle.css#17181cThe bar colour.
--accentostyle.css#e9b44cThe single accent: the price, the countdown, Shop now and the time line.

Try them in the Playground

When to use it

On top of an online shop or a landing page to say two or three short things (shipping, sale, new arrivals) without covering the page.

On phones

The Shop and Journal links hide under 520 px; the messages stay on one line, with smaller arrows and X.

With reduced motion

Messages swap with a fade, digits change without rolling and the bar fades out instead of folding.

Pitfalls

  • Close the bar by animating its height from its pixel size to 0, and reopen it to its size and then height auto: GSAP does not tween to and from auto well in every case.
  • Messages must fit on one line even at 341 px: short copy and white-space: nowrap.
  • Hover pauses the time line only with a real mouse (pointerType mouse), not on touch.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

Tested on 25 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