Skip to content
animorio
IT
Back to the library

Bubble wrap pop

Physics, HoverCanvas, GSAPMediumCompressed weight: Demo 6.9 KBGSAP 28 KBFreeDownload the zip

Parcel & Pine, a made-up shop that ships with care: a sheet of bubble wrap to pop. Hover a bubble and it swells a hair, press it and it squashes and goes flat with creases, its highlight breaks and the neighbours jump on a spring with a wave that travels slowly outwards. Drag to pop a whole row, the tally rolls and New sheet inflates everything again. Hand-written physics on canvas, minimal style, GSAP.

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>
<!--
  "Bubble wrap pop" 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>Bubble wrap</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/jetbrains-mono@5.3.0/index.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <!-- Parcel & Pine, a made-up shop that ships with care: a sheet of bubble wrap to pop. Hover a bubble and it swells
       a hair, press it and it squashes and goes flat with creases, the neighbours jump on a spring, the tally rolls.
       Drag to pop a whole row; New sheet inflates everything again in a wave -->
  <main class="stage">
    <section class="pack" aria-label="A sheet of bubble wrap to pop">
      <header class="head">
        <p class="brand">Parcel <span class="brand__amp">&amp;</span> Pine</p>
        <h1 class="title">Packed with care</h1>
      </header>

      <div class="sheet" data-sheet>
        <canvas class="sheet__canvas" data-canvas aria-hidden="true"></canvas>
        <svg class="cursor" data-cursor viewBox="0 0 24 24" aria-hidden="true">
          <path d="M5 3 L5 19 L9.2 15.2 L12 21.2 L14.6 20 L11.9 14.2 L17.6 14.2 Z" fill="#1f1c18" stroke="#fff" stroke-width="1.4" stroke-linejoin="round"/>
        </svg>
      </div>

      <footer class="foot">
        <p class="tally" aria-live="polite"><span class="tally__num" data-tally><span class="tally__n">0</span></span><span class="tally__word">popped</span></p>
        <button class="pill" type="button" data-reset><span class="pill__bg" aria-hidden="true"></span><span class="pill__label">New sheet</span></button>
      </footer>
    </section>
  </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.

20 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 “Bubble wrap pop” 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 the site of Parcel & Pine, a made-up shop that ships with care, under «Packed with care» there is a sheet of bubble wrap: a staggered grid of clear bubbles, each with its highlight, a soft shadow underneath and the thin film between them, with the dashed tear line at the top and bottom. The bubbles barely breathe. Hover one and it swells a hair; press it and it squashes, goes flat in a quarter of a second with creases on its edge and its highlight broken in two, and a green ring widens and fades. The neighbours jump, each on its own spring, with a wave that starts from the bubble and reaches the closest first. Hold and drag to pop a whole row. The «popped» tally rolls with every bubble; New sheet presses with a bounce and inflates everything again in a wave from the right. On its own, the demo moves a pointer that presses a bubble, pops a row, presses another and takes a new sheet.

How it works

The staggered grid

The bubbles are drawn on a canvas: rows at 0.88 of the step, every other one shifted by half a step. The diameter is measured on the box (never more than BUBBLE, never less than 22 pixels) and the grid is rebuilt on resize, keeping the bubbles already popped.

One spring per bubble

Each bubble has an offset z and a velocity: every frame z gets −SPRING·z − DAMPING·v. Hover adds a 5% swell, pressing squashes it.

The pop

Deflating is a tween from 0 to 1 over POP_TIME seconds: the edge takes its creases from sixteen fixed random numbers per bubble, the shadow and highlight fade, two highlight fragments and three creases appear, and the accent ring widens.

The wave

A pop queues a kick for every bubble within seven radii, delayed by the distance divided by WAVE_SPEED and weakened with the square of the distance: the neighbours jump first, the far ones later and less.

The tally and the new sheet

The new number rises from below on a back.out while the old one leaves at the top; New sheet reinflates the bubbles with a delay by distance and an upward kick on the spring.

Values to change

NameFileDefaultWhat it changes
BUBBLEscript.js44Bubble diameter in pixels.
GAPscript.js0.2Gap between bubbles, as a share of the diameter.
SPRINGscript.js260Stiffness of each bubble’s spring.
DAMPINGscript.js11Damping of the spring.
WAVEscript.js0.55Strength of the neighbours’ jump.
WAVE_SPEEDscript.js520Wave speed in pixels per second.
POP_TIMEscript.js0.26Seconds to deflate.
ACCENTscript.js#2f6b4fThe colour of the tally and the flash.

Try them in the Playground

When to use it

For a shop that ships, the shipping or packaging page, an order just confirmed, a 404 page or a stress-relief moment inside a product.

On phones

The same sheet, with bubbles sized on the box height; pop them with a finger and by dragging.

With reduced motion

No springs, no waves and no self-moving pointer: a pressed bubble is flat at once, the tally changes without rolling and New sheet makes them full again.

Pitfalls

  • The canvas must be sized with devicePixelRatio and redrawn on resize, or the bubbles look grainy.
  • The creases must come from fixed random numbers per bubble: drawn every frame, the edge jitters.
  • The real pointer must stop the fake one, or the two fight over the bubbles.

Libraries

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

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

Testing

Tested on 2 December 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