Skip to content
animorio
IT
Back to the library

Springy chat

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

The conversation of Murmur, a made-up messaging app, on warm white, in the style of real product interface pieces: every bubble sits on its own spring, so as you drag the chat the messages under your finger move first and the others catch up one after another. Flicked, the conversation runs, stretches like rubber at both ends and comes back; a new message pushes the others up in a wave, from the bottom up.

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>
<!--
  "Springy chat" 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 chat whose messages follow each other on springs as you drag</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 conversation of a made-up messaging app, Murmur: every bubble hangs on its own spring, so dragging the
         thread moves the bubbles under the finger first and the others catch up one after another; at the ends the
         thread stretches like rubber and comes back, and a new message pushes the others up in a wave -->
    <section class="chat" data-chat aria-label="Conversation with Juno Park">
      <header class="head">
        <span class="avatar" aria-hidden="true"><span class="avatar__in">JP</span></span>
        <div class="who">
          <span class="who__name" data-name>Juno Park</span>
          <span class="who__state">Active now</span>
        </div>
        <svg class="head__ico" viewBox="0 0 24 24" aria-hidden="true"><path d="M4.5 6.8c0-1.2 1-2.2 2.2-2.2h6.6c1.2 0 2.2 1 2.2 2.2v10.4c0 1.2-1 2.2-2.2 2.2H6.7c-1.2 0-2.2-1-2.2-2.2Z"/><path d="m15.5 10.2 4-2.4v8.4l-4-2.4"/></svg>
      </header>

      <div class="thread" data-thread>
        <div class="list" data-list>
          <p class="day" data-day>Today 9:30</p>
        </div>
      </div>

      <footer class="composer">
        <div class="field" data-field>
          <span class="field__txt" data-field-txt></span><span class="field__caret" data-caret></span>
          <span class="field__ph" data-ph>Message</span>
        </div>
        <button class="send" type="button" data-send aria-label="Send">
          <span class="send__in"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 18.5V6.2M6.8 11.2 12 6l5.2 5.2"/></svg></span>
        </button>
      </footer>
    </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.

21 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 “Springy chat” 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 sits the white card of a conversation in Murmur, a made-up messaging app: at the top the avatar with the initials JP, the name Juno Park, Active now and the video call icon; in the middle the conversation, with the date Today 9:30 and her bubbles, grey on the left, and mine, blue on the right, about Sunday’s photos and a table for four on Friday night; at the bottom the Message field and the round blue button with the arrow to send. The drawn pointer grabs the conversation and pulls it down slowly: the messages under the finger follow it at once, the farther ones stay behind and catch up later, one after another, so the gaps between the bubbles widen and close like a spring. Then it flicks it: the chat runs up to the first messages, past the date it stretches like rubber, wobbles and settles back. The same gesture the other way takes it back to the bottom, where it stretches again and settles. A message from Juno arrives, Saving you a seat by the window: it comes in at the bottom with a little hop and pushes the conversation up, first the messages at the bottom and then, one by one, those at the top, in a wave. The pointer goes into the field, which lights up blue, and types Be there in 5; it presses the button, which squashes and springs back, and my blue bubble joins the conversation with the same wave. Underneath Delivered appears, and soon after, once Delivered has gone, Read 9:43. With a real mouse, hovering a bubble shows its time beside it and the bubble shifts by two pixels; the conversation can be dragged and flicked with a finger or the mouse, and it scrolls with the wheel too, always on springs.

How it works

One spring per bubble

The conversation has a single position, the one the finger controls; each bubble has its own, which chases the conversation’s on a spring. The spring’s strength is STIFFNESS divided by one plus LAG times the distance from the bubble under the finger: nearby bubbles are tied tight, distant ones loosely, so they arrive later. The damping is DAMPING, measured against each spring’s strength.

The finger and the flick

While dragging, the conversation’s position follows the finger with no delay; the bubble closest to the touched point becomes the centre of the wave. On release the speed is worked out from the last ninety milliseconds of movement and the conversation carries on by itself, slowing down with FRICTION.

Rubber at the ends

Past the first and the last message the conversation gives only a fraction of the gesture, RUBBER, like rubber; let go there or reached at speed, a fully damped spring brings it back to the edge, while the bubbles, on their own springs, arrive wobbling.

The incoming message

A new message is added at the end of the list and becomes the centre of the wave; the conversation moves towards the new end on a spring, so the bubbles at the bottom rise first and those at the top follow one at a time. The new bubble comes in from sixteen pixels lower with back.out.

Time

The physics runs in GSAP’s ticker in fixed steps of a hundred-and-twentieth of a second, so the autopilot, the video and the tests always give the same movement. The drawn pointer is a GSAP timeline calling the same handlers as a real finger; when it is really touched the autopilot stops and starts again after seven quiet seconds.

Values to change

NameFileDefaultWhat it changes
NAMEscript.js'Juno Park'The name of the person writing, at the top of the conversation.
STIFFNESSscript.js260The spring strength of the messages near the finger: higher and they stick closer to it.
LAGscript.js0.42How far behind the messages far from the finger stay (0: they all move together).
DAMPINGscript.js0.6The springs’ damping: low and they wobble more, 1 and they arrive without bouncing.
RUBBERscript.js0.36How far the conversation stretches past the first and the last message (0 for not at all).
FRICTIONscript.js3.4How quickly a flick stops: higher and it stops sooner.
HOLDscript.js1.2The drawn pointer’s pause in seconds between one gesture and the next.

Try them in the Playground

When to use it

For an app’s chat, the support chat inside a site, the inbox of a marketplace or a booking platform: wherever a conversation is scrolled with a finger, the springs make it feel alive and show where it was touched.

On phones

The same animation with adapted sizes: the card is almost as wide as the screen and at most as tall, and the bubbles and the field shrink on short screens; the conversation is dragged and flicked with a finger.

With reduced motion

No springs, flicks or rubber: the conversation scrolls rigidly and stops where it is left, there is no pointer; new messages and the status fade in and the conversation jumps to the bottom.

Pitfalls

  • The conversation and the bubbles have two different positions: if the finger moved the bubbles instead of the conversation, on release there would be nothing to chase and the wave would vanish.
  • The bubble has a CSS transition on its transform for hover: the spring goes on the row that holds it, and GSAP’s entrance clears its transform at the end (clearProps), otherwise the transition slows it down.
  • On every loop the autopilot works out the pointer’s positions again (invalidate on repeat), because the demo window can change height while it is being watched.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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