Skip to content
animorio
IT
Back to the library

Notification pile

Physics, HoverGSAP, CSS onlyMediumCompressed weight: Demo 9.8 KBGSAP 28 KBFreeDownload the zip

The notification centre of a made-up team app, Ondine, on warm paper: notifications drop from the top one after another into a glass tray and pile up with real physics, gravity, card against card collisions, friction and a small bounce, each settling with a slight tilt of its own. Grab a card with a finger or the mouse and it lifts with a growing shadow; fling it hard and it spins out, fades and the unread counter at the top rolls down by one. Let it go gently and it falls back on the pile. When only a few are left, a new batch drops in.

The code

A folder that runs on its own: index.html, style.css, script.js and the libraries from a CDN. The React tab holds the same demo as a ready component, which switches its animations off when it leaves the page.

<!doctype html>
<!--
  "Notification pile" 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 notifications that fall into a pile and get flung away</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" data-stage>
    <!-- the notification tray of a made-up workspace app, Ondine. The notifications fall from the top and pile up with
         real physics: gravity, collisions, friction and a small bounce. Grab one and fling it: out of the tray it is
         cleared and the unread counter rolls down. When the pile runs low a new batch drops in -->
    <header class="head">
      <span class="brand">
        <svg class="brand__mark" viewBox="0 0 22 22" aria-hidden="true">
          <path class="brand__wave" d="M3 12.5c2.2-2.6 4.4-2.6 6.6 0s4.4 2.6 6.6 0 3.3-1.9 2.8-1.2" />
          <path class="brand__wave brand__wave--2" d="M3 16.5c2.2-2.6 4.4-2.6 6.6 0s4.4 2.6 6.6 0" />
          <circle cx="15.6" cy="6.4" r="2.2" />
        </svg>
        <span class="brand__name">Ondine</span>
      </span>
      <span class="count" data-count aria-label="unread notifications">
        <span class="count__roll" data-roll></span>
        <span class="count__word">unread</span>
      </span>
    </header>

    <section class="tray" data-tray aria-label="Notifications">
      <span class="tray__sheen" aria-hidden="true"></span>
      <span class="tray__floor" aria-hidden="true"></span>
      <p class="tray__empty" data-empty>All caught up</p>
    </section>

    <p class="hint" data-hint>Grab a notification and fling it away</p>

    <template data-card>
      <article class="card">
        <span class="card__shadow" aria-hidden="true"></span>
        <div class="card__body">
          <span class="card__icon"><svg viewBox="0 0 24 24" aria-hidden="true"></svg></span>
          <span class="card__text">
            <span class="card__top"><b class="card__title"></b><time class="card__time"></time></span>
            <span class="card__line"></span>
          </span>
        </div>
        <span class="card__edge" aria-hidden="true"></span>
      </article>
    </template>

    <svg class="pointer" data-pointer viewBox="0 0 20 20" aria-hidden="true">
      <path d="M4.5 2.8l10.6 8.1-4.6.6 2.6 5.1-2.1 1-2.6-5.1-3.4 3.2z" />
    </svg>
    <p class="sr" aria-live="polite" data-live></p>
  </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.

23 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 “Notification pile” 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 warm paper with a little grain sits a recessed tray with 26 pixel corners and a soft inner shadow. At the top, the Ondine mark, two thin waves and a blue dot, and a glass pill with the blue unread counter. Notifications come in from the top edge one every 0.18 seconds and fall: light glass cards with a drawn gradient icon, the title, a line and the time (Maya Ortiz replying, an invoice paid, the standup in ten minutes, a new sign-in, an export finished, a post trending, a mention, a task closed). They hit the floor and the other cards, bounce a little, slide with friction and stop a degree or two askew, while the counter goes up by one at each arrival. Grabbed with the pointer they lift by 4.5% with a wider shadow and follow the finger, tilting with the speed; the cards below move aside. Flung faster than 850 pixels per second, a card flies out spinning, fades and the counter rolls down with a small bounce; let go gently, it falls back. When two are left another batch drops in; when none is left, ‘All caught up’ appears. Left alone, a drawn pointer grabs the top card and flings it.

How it works

Cards as boxes

Each notification is a body with position, velocity and size: the physics treats it as an upright box, the rotation is only in the drawing. Gravity of 2600 pixels per second squared, three small steps per frame on the GSAP ticker.

Box against box

Two overlapping cards separate along the axis where they overlap least: almost always vertically, the upper one rises and the lower one drops just enough. If they are closing in, an impulse with a bounce only above 160 pixels per second, so the pile comes to rest; friction removes part of the sideways speed. Four solver passes per step keep the pile still.

Grab and fling

The held card has infinite mass and chases the finger: the others move, it doesn't. The throw speed is measured over the last 90 milliseconds of the gesture; above the threshold the card becomes a projectile with no collisions, with a spin depending on its sideways speed, and fades in half a second.

The rolling counter

The number is a column of two digits in an 18 pixel window: it comes up from below when a notification arrives and drops from above when one leaves, with back.out and a little beat of the pill.

The tilt

Every card has a resting angle of its own, up to 1.3 degrees; in flight and while held the angle follows the sideways speed, on a spring. The highlight on the edge turns with the angle.

Values to change

NameFileDefaultWhat it changes
GRAVITYscript.js2600Pixels per second squared pulling the cards down.
BOUNCEscript.js0.22How much a card bounces when it lands: 0 dead, 0.6 lively.
FRICTIONscript.js0.5How much a card sliding on another slows down, 0 to 1.
FLINGscript.js850Release speed, in pixels per second, above which a card flies out and is cleared.
CARDSscript.js6Notifications in a full batch (fewer if the tray is short).
DROP_GAPscript.js0.18Seconds between two notifications dropping in.
TILTscript.js1How much the cards tilt while flying and resting, 0 for none.
REFILL_ATscript.js2When this many cards are left, a new batch drops in.
LOOPscript.jstrueLeft alone, a drawn pointer flings the cards.

Try them in the Playground

When to use it

For the notification centre of an app or a dashboard, for an inbox you clear with a gesture, for an onboarding screen showing the alerts, or as a playful opening piece on the landing page of a product that sends notifications: anywhere clearing an alert should feel like a physical, satisfying gesture.

On phones

The same animation with adapted sizes: the tray takes almost the whole width and gets shorter with the screen's height, the cards get lower and a batch holds fewer notifications when space is tight. You fling them with your finger.

With reduced motion

No physics and no movement: the notifications fade in already stacked at the bottom of the tray, and a tap on a card fades it away; the counter changes without rolling.

Pitfalls

  • With a bounce on every contact the pile never settles and jitters: the bounce only applies above an impact speed (160 pixels per second here), below it is zero.
  • Cards almost as wide as the tray, separated along the horizontal axis, slip sideways and wedge into the walls: they separate along the axis with the smallest overlap, which for cards like these is almost always the vertical one.
  • A pile taller than the tray stays above the edge, out of sight: the batch is sized on the real height (how many cards fit) and recomputed on resize.
  • The throw speed taken from the last movement alone is noisy: it is measured over a 90 millisecond window.
  • Rotation in the collision maths makes the pile dance: the physics stays on upright boxes, the angle is only in the drawing.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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