Skip to content
animorio
IT
Back to the library

Shopping list basket

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

The shopping list of Fennow, a made-up app, on warm white with a single basil green: seven items with a small drawn icon. Checking one fills the box, draws the tick, and the row comes loose as a pill that falls with real gravity, spins, bounces and lands in the basket drawn in lines at the bottom of the card, where the checked rows pile up knocking into each other. The rows left close up on a spring, the «4 of 7» counter rolls, and a row can also be dragged and thrown into the basket.

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>
<!--
  "Shopping list basket" 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 shopping list with the checked rows that drop into the basket</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/mona-sans@5.3.0/wdth.css">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/geist-mono@5.3.0/index.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <main class="stage" data-stage>
    <!-- the shopping list of a made-up grocery app, Fennow. Checking an item draws the tick, the row comes loose and
         falls with real gravity into the basket drawn at the bottom of the card, where the checked rows pile up,
         knocking into each other and settling. The rows left close up on a spring and the counter rolls. A row can
         also be dragged and thrown into the basket. Put back empties the basket into the list again -->
    <section class="card" data-card aria-label="Fennow shopping list">
      <span class="card__rim" aria-hidden="true"></span>
      <span class="card__shine" aria-hidden="true"></span>

      <header class="head">
        <div class="head__left">
          <span class="brand">
            <svg class="brand__mark" viewBox="0 0 22 22" aria-hidden="true">
              <rect x="0.75" y="0.75" width="20.5" height="20.5" rx="6"/>
              <path d="M7.6 15.6V6.6h6.6M7.6 11h5"/>
            </svg>
            <span class="brand__name">Fennow</span>
          </span>
          <h1 class="title">Saturday shop</h1>
        </div>
        <div class="count" aria-live="polite">
          <span class="count__num"><span class="count__win" data-count-win><span class="count__d" data-count>0</span></span><span class="count__of">of <span data-total>7</span></span></span>
          <span class="count__cap">in the basket</span>
        </div>
      </header>

      <div class="list" data-list>
        <ul class="rows" data-rows></ul>
        <p class="empty" data-empty aria-hidden="true">Everything is in the basket</p>
        <button class="back" type="button" data-back>
          <svg viewBox="0 0 16 16" aria-hidden="true"><path d="M5.2 3.6 2.4 6.4l2.8 2.8M2.6 6.4h6.6a4 4 0 0 1 0 8H6.6"/></svg>
          <span>Put back</span>
        </button>
      </div>

      <div class="basket" data-basket>
        <svg class="basket__back" viewBox="0 0 100 100" preserveAspectRatio="none" aria-hidden="true">
          <path class="basket__fill" d="M1 9 L99 9 L93 98 L7 98 Z"/>
          <g class="basket__slats" data-slats></g>
        </svg>
        <svg class="basket__front" data-basket-front viewBox="0 0 100 100" preserveAspectRatio="none" aria-hidden="true">
          <path class="basket__line" d="M1 9 L99 9 L93 98 L7 98 Z"/>
          <path class="basket__line basket__line--soft" d="M1.5 16 L98.5 16"/>
          <path class="basket__line basket__line--soft" d="M5.4 66 L94.6 66"/>
        </svg>
        <span class="basket__handle basket__handle--l" aria-hidden="true"></span>
        <span class="basket__handle basket__handle--r" aria-hidden="true"></span>
      </div>

      <div class="world" data-world aria-hidden="true"></div>
    </section>

    <svg class="cursor" data-cursor viewBox="0 0 24 24" aria-hidden="true"><path d="M5 2.8v16.4l4.2-4 2.8 6.2 2.9-1.3-2.8-6.1h5.9Z"/></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.

49 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 “Shopping list basket” 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 warm white page sits the Fennow card: the mark, the title «Saturday shop» and on the right the counter «0 of 7» with «In the basket» under it. Below, seven rows: the rounded box, a small line icon (apple, milk carton, loaf, egg, leaf, lemon, coffee bean), the name and the quantity in mono. At the bottom a basket drawn in a green stroke, with slanted sides, thin slats and two handles. Tapping a row fills the box with a small bounce and draws the white tick; the quantity slides away, the row comes loose and turns into a white pill with a shadow, hops up a little, falls with real gravity while it spins, bounces on the basket floor and lands on the others, tipping and sliding until it finds its place. The basket gives by a pixel at every hard landing. The rows below rise to close the gap on a spring, the counter digit rolls up, and «Put back» appears in the room left free. A row can be picked up and dragged: it hangs from where it is held and, let go, flies off with the speed of the gesture. With everything in the basket «Everything is in the basket» appears; «Put back» sends the pills home on an arc, one after the other, and the ticks are erased. Left alone, a pointer checks the items one by one, throws one into the basket and then empties it.

How it works

The tick

The box is an SVG with three parts: the border, a green fill at scale 0 and the tick, a path with a stroke-dasharray as long as itself. On a tap the fill goes to scale 1 in 0.26 s on back.out(2.4) and the tick draws itself as stroke-dashoffset goes to 0, 0.06 s later.

The row coming loose

After DROP_DELAY the pill (the chip) moves from its place in the list into the world layer of the card, at the same spot measured with offsetLeft and offsetTop, takes a white fill and a shadow, and its child shrinks to PILL_SCALE. The row is left empty and is hidden.

The physics by hand

Each pill is a row of circles as wide as half its height, held by stiff sticks (between neighbours, two apart and between the two ends): a Verlet integration at 240 steps a second, four rounds of constraints per step. So the pill falls, spins, rests at an angle and rolls over the others with no library. The first push is POP upwards, a little sideways towards the middle and a spin up to SPIN.

The basket and the knocks

The floor and slanted sides of the basket come from its size: below the rim the side narrows linearly. At every hit the speed flips and BOUNCE of it stays, on the floor FRICTION slows the sliding; circles of different pills push each other apart by half each. A hard landing makes the basket give by a couple of pixels with an elastic.out.

The rows on a spring and the counter

The rows below the loose one are measured before and after hiding it and start from where they were with a FLIP: y goes back to 0 in 0.62 s on back.out(SPRING), 0.03 s apart. The counter digit leaves upwards and the new one comes in from below on back.out(2.2) inside a window with a soft mask.

The throw and the way home

Dragging past 6 px pulls the row loose and the circle nearest the finger is pinned to the pointer: the others follow through the constraints and the pill dangles. Let go, its last speed stays in the Verlet and it flies. Put back takes the pills out of the physics and brings them home with a tween along an arc that straightens the rotation; then the tick is erased.

Values to change

NameFileDefaultWhat it changes
ITEMSscript.jsRed apples, Oat milk, Sourdough, Free-range eggs, Fresh basil, Lemons, Coffee beansThe items: name, quantity and icon.
GRAVITYscript.js2600Gravity, in pixels per second squared.
BOUNCEscript.js0.32How much speed a pill keeps when it hits the basket.
FRICTIONscript.js0.2How much a pill sliding on the floor slows down.
PILL_SCALEscript.js0.8The size of the row once it is a pill in the basket.
DROP_DELAYscript.js0.3Seconds between the tick and the fall.
POPscript.js240The little hop upwards when the row comes loose, in pixels per second.
SPINscript.js2.4The strongest spin of a falling row, in radians per second.
SPRINGscript.js1.7How far past their place the closing rows go.
LOOPscript.jstrueLeft alone, check everything, empty the basket and start again.

Try them in the Playground

When to use it

For the shopping list or cart of a grocery or delivery app, for a to-do list, for the checklist of a travel or events app (what to pack), or on a landing page that wants to show a product that is fun to use.

On phones

The same animation with adapted sizes: rows, text and basket are measured on width and height with clamp and min(vw, vh), the basket and the pills are measured again at every resize. A finger taps a row to check it or drags it to throw it.

With reduced motion

No fall and no springs: the tick appears, the row fades out and the pill appears already resting in the basket, two per layer. Put back fades them home. No pointer on its own.

Pitfalls

  • A pill made of one circle rolls like a ball and never rests at an angle; with only two circles at the ends, the others slip into the gap in the middle. Here the circles are at most 1.1 radii apart.
  • The Verlet bounce works on the previous position: put the pill back on the floor and move the previous position by BOUNCE times the speed. Doing it at every constraint round multiplies the energy: only on the first.
  • Sizes come from offsetLeft and offsetTop, not getBoundingClientRect: the demo on the page can be scaled down and the card's world must stay in its own pixels; the pointer is brought back to those sizes by dividing by the scale.
  • Dragging hands the finger position to the physics once per frame: inside the four steps it is spread in slices, or the throw would have the speed of a single step and snap.
  • The step is fixed (1/240 s) and the gathered time is capped: coming back from another tab the physics must not catch up whole seconds in one frame.
  • GSAP writes its transform inline: the physics position sits on the chip and the GSAP scale on its child, so they do not wipe each other out.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0, Geist Mono (font variabile) 5.3.0.

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

Testing

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