Skip to content
animorio
IT
Back to the library

Interest bubbles

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

The welcome step of Mossby, a made-up app, in the Morphin and Bencho style: eleven interests in white bubbles of different sizes, held together by a soft pull to the centre, pushing each other with hand-written physics and making way for the pointer. Tapped, a bubble swells on a spring, fills with coral as its check draws itself and shoulders its neighbours aside; the count rolls and at the third pick Continue lights up. The bubbles can be dragged and thrown.

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>
<!--
  "Interest bubbles" 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>Interest bubbles that push each other</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 welcome step of a made-up app, Mossby: a cluster of interests in bubbles held together by a soft pull to
         the centre. They push each other, make way for the pointer, can be dragged and thrown; a tapped bubble swells,
         fills with colour and shoulders the others aside, and Continue wakes up at the third pick -->
    <header class="head">
      <div class="brand">
        <svg class="brand__mark" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3.2c3.6 2.2 5.6 5.1 5.6 8.6a5.6 5.6 0 0 1-11.2 0c0-3.5 2-6.4 5.6-8.6Z"/><path d="M12 20.8V10.6"/><path d="m12 14.6 2.6-2.4"/></svg>
        <span data-app>Mossby</span>
      </div>
      <button class="skip" type="button" data-skip>Skip</button>
    </header>
    <section class="intro">
      <h1 class="title">Pick 3 things you like</h1>
      <p class="sub">We’ll shape your feed around them. <span class="count" aria-live="polite"><span class="count__roll" data-roll><span data-digit>0</span></span> of <span data-need>3</span> picked</span></p>
    </section>
    <div class="field" data-field aria-label="Interests" role="group"></div>
    <footer class="foot">
      <button class="go" type="button" disabled data-go>
        <span class="go__fill" data-go-fill></span>
        <span class="go__label" data-go-label>Continue</span>
        <svg class="go__check" viewBox="0 0 24 24" aria-hidden="true"><path data-go-check d="m6.5 12.4 3.6 3.6 7.4-7.6"/></svg>
      </button>
    </footer>
    <svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.2 19.2 11l-6.3 1.6-3.3 5.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.

22 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 “Interest bubbles” 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 background there is the welcome step of Mossby, a made-up app: at the top its sprout-shaped mark and Skip, then the headline Pick 3 things you like and the line with the count, 0 of 3 picked. In the middle eleven white bubbles, each with an interest written on it, Design, Running, Jazz, Cooking, Film, Travel, Plants, Coffee, Books, Climbing and Yoga, of different sizes and with a soft light at the top left and a light shadow. On arrival they grow out of nothing one after another and gather from a wide ring into a tight cluster, held together by a soft pull to the centre: they bump, push and settle. Passing over them with the pointer, the bubbles make way and then come back. Tapped, a bubble swells on an elastic spring, turns coral with white lettering and a check drawing itself above the word, and gives its neighbours a little push, so they move aside to make room; tapped again it shrinks and turns white. With every pick the number of the count rolls up or down. At the third pick the Continue button, grey and off before, fills with black from the centre with a small bounce and its label widens. The bubbles can be grabbed, dragged and thrown: they leave with the speed of the hand and the cluster takes them back. When Continue is pressed the button squashes and returns, the label rises away and a check draws itself, and the bubbles not chosen fade. A drawn pointer runs through the cluster, picks three interests, throws a bubble into the middle and presses Continue, then it all starts again.

How it works

The bubbles and their size

Each bubble is a button with a body inside: GSAP moves the button with x and y, the body carries the size, the colour and the press through its scale. The base radius comes from the free area, so that all of them together, already swollen, cover a little over half of the field; it is recomputed on resize.

The hand-written physics

A single gsap.ticker takes one step per frame: each bubble is pulled towards the centre with a force proportional to the distance, a little stronger along the short side so the cluster fills the field, and slowed by a damping that does not depend on the frame rate. Then three rounds of contacts: two overlapping bubbles are pushed apart along the line between their centres, half each; a bubble held by the finger does not move and pushes the others. Soft walls keep them inside the field.

The pointer that clears the way

Near the pointer, within the bubble’s radius plus REPEL, each bubble gets a push that grows the closer it is; the cluster opens in front of the hand and closes behind it. On the phone this part stays off: there the finger taps and drags.

The pick and the push

A press without movement is a pick: the bubble takes its scale to GROW with elastic.out, takes its colour through a CSS transition, the check draws itself with stroke-dashoffset, and the neighbours get a velocity that moves them away. The count is a small window where the old number leaves and the new one comes in from the right side; at the third pick the button’s fill grows from the centre with back.out and the label goes from wdth 84 to 100.

Drag and throw

With pointer capture the bubble follows the finger; the last six positions, with their time, give the speed it leaves with when released, kept within a limit. From there it is physics again: the pull to the centre brings it back into the cluster and the contacts make room.

Values to change

NameFileDefaultWhat it changes
APPscript.js'Mossby'The name of the made-up app, written at the top left.
PICKscript.js3How many bubbles must be picked for Continue to light up.
ACCENTscript.js#ff5a36The colour of the picked bubbles and of the mark.
PULLscript.js5The force that keeps the cluster towards the centre.
PUSHscript.js0.55How much the bubbles push each other away when they touch.
GROWscript.js1.28How much a picked bubble swells.
REPELscript.js70The pixels around the pointer from which the bubbles move away.
HOLDscript.js2.2The seconds the finished pick stays before the drawn pointer starts again.

Try them in the Playground

When to use it

For the first run of an app, a magazine or a shop that wants to know what newcomers like: picking three interests becomes something to play with instead of a form with checkboxes.

On phones

The same animation with adapted sizes: the bubbles’ radius comes from the field left between the headline and the button, the cluster stretches vertically, and the finger taps, drags and throws; the push of the passing pointer stays on the computer only.

With reduced motion

No motion: the cluster appears already settled, a pick only changes the bubble’s colour and size without a spring, the count changes without rolling and there is no drawn pointer.

Pitfalls

  • The damping has to be written with Math.pow(base, dt), not as a fixed factor per frame: with a fixed factor, at 30 frames per second the bubbles slide twice as far.
  • A bubble held by the finger must count as a wall in the contacts (zero weight), otherwise the others push it out from under the finger.
  • The check sits in absolute position above the word: inside the grid, even hidden, it pushed the word down.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

Tested on 27 October 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