Skip to content
animorio
IT
All components

Edited message history

Chat, Transitions, Text, HoverGSAP, CSS onlyMediumCompressed weight: Demo 9.5 KBGSAP 28 KBFreeDownload the zip

A message in the team chat of Juniper, an invented work app, on a white card with soft shadows. Under the bubble the edges of its earlier versions peek out like a small stack of paper. Ana edits the message: the changed words leave upwards and the new ones roll in letter by letter, the bubble grows on a spring and a band of light crosses it, the edit time and the number of versions roll forward and a new edge slides out from under it. Tapping Edited, the stack springs open into the version history, with the added words highlighted and the removed ones struck through; choosing a version, a violet frame jumps onto it and in the bubble a marker sweeps over the words that changed since then.

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>
<!--
  "Edited message history" 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 edited message with the version history</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">
    <!-- a message in the team chat of Juniper, an invented work app. Under the bubble the edges of its earlier
         versions peek out like a small stack of paper. When the message is edited the changed words roll in, the
         edit time rolls forward and a new edge slides out; tapping Edited unfolds the stack into the version
         history, and choosing a version marks in the bubble the words that changed since then -->
    <section class="chat" data-chat aria-label="Message in launch-room">
      <header class="chat__head">
        <svg class="chat__hash" viewBox="0 0 16 16" aria-hidden="true"><path d="M6.2 2.5 5 13.5M11 2.5 9.8 13.5M2.8 6h11M2.2 10h11"/></svg>
        <span class="chat__room">launch-room</span>
        <span class="chat__members">12 members</span>
      </header>

      <article class="msg">
        <span class="msg__avatar" aria-hidden="true"><span>AK</span></span>
        <div class="msg__main">
          <p class="msg__who"><span class="msg__name">Ana Kovac</span><span class="msg__role">Design lead</span><span class="msg__time">10:31</span></p>

          <div class="bubble-wrap" data-wrap>
            <span class="peek" data-peek aria-hidden="true"></span>
            <span class="peek" data-peek aria-hidden="true"></span>
            <div class="bubble" data-bubble>
              <p class="bubble__text" data-text></p>
              <span class="bubble__glint" data-glint aria-hidden="true"></span>
            </div>
          </div>

          <div class="msg__meta">
            <button class="edited" type="button" data-edited data-autoclic aria-expanded="false" aria-controls="history">
              <svg class="edited__pen" viewBox="0 0 16 16" aria-hidden="true">
                <path data-pen pathLength="1" d="M10.6 2.9l2.5 2.5-7.4 7.4-3.1.6.6-3.1z M9.2 4.3l2.5 2.5"/>
              </svg>
              <span class="edited__word">Edited</span>
              <span class="edited__at roll" data-at></span>
              <svg class="edited__caret" viewBox="0 0 16 16" aria-hidden="true"><path d="M4.5 6.5 8 10l3.5-3.5"/></svg>
            </button>
            <span class="msg__count"><span class="roll" data-count></span> <span data-count-word>earlier version</span></span>
          </div>

          <div class="hist" id="history" data-hist inert>
            <div class="hist__list" data-list role="listbox" aria-label="Earlier versions">
              <span class="hist__sel" data-sel aria-hidden="true"></span>
            </div>
            <p class="hist__note" data-note>Choose a version to compare</p>
          </div>
        </div>
      </article>
    </section>
    <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.

27 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 “Edited message history” 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 white page there is the card of a channel, launch-room, with a message from Ana Kovac: the avatar is a violet and pink rounded square with her initials, the grey bubble says ‘Launch review moves to Thursday at 3 pm.’ and under it peeks the edge of a sheet, the version before. Beside it there is the violet Edited chip with the pencil and the time, 10:36, and ‘1 earlier version’. Then Ana corrects it: ‘3 pm.’ rises and disappears, ‘4 pm, room B.’ rolls in letter by letter, the bubble grows on a spring, a band of light crosses it, the pencil redraws itself, the time rolls to 10:42 and the count to 2, and a second edge slides out from under the bubble. The new words stay highlighted for a moment and the marker leaves towards the right. Tapping Edited, the caret turns and the two edges spring open into two rows: 10:36, with ‘is on Wednesday’ struck through in red and ‘moves to Thursday’ highlighted, and 10:31, the original. Choosing a row, a thin violet frame jumps onto it with a small settle, and in the bubble the marker sweeps, one word after another, over the ones that changed since then; underneath it reads ‘4 words changed since 10:36’, then ‘7 words changed since 10:31’. Tapped again, the rows rise and shrink under the bubble until they are edges again.

How it works

Differences word by word

The versions are three sentences. A longest common subsequence (LCS) function on the words says which stay, which leave and which come in: the same function builds the history rows (span for additions, s for removed words) and picks the words to highlight in the bubble when a version is compared.

The edit that rolls

The removed words rise with a little blur; then the words are rebuilt keeping the ones that stay, and the new ones are split into letters that come in from below with a rotation on the X axis and a 50 ms stagger. The bubble's height is measured before and after and the spring takes it from one to the other, then it goes back to auto.

From edges to rows

The edges under the bubble are two absolute spans. On opening each history row starts from the position and width of its edge (translateY and scaleX measured with getBoundingClientRect, scaleY 0.4) and reaches its place on a spring, while the container grows from zero to its measured height; the text fades in after. Closing takes the path backwards.

One frame and the marker

The violet frame is a single element that springs from row to row (y and height from offsetTop and offsetHeight). The marker is a flat background-image on each word: GSAP animates background-size from 0% to 100%, and to remove it moves the origin to the right, so it leaves in the direction of reading.

Numbers on drums

Each digit of the time and the count is a column of twenty figures in a drum 1.2 em tall with a faded mask; GSAP takes it with yPercent to the right digit, always forwards, on the spring and with a small stagger between drums. A hand written damped spring is the ease of everything.

Values to change

NameFileDefaultWhat it changes
BOUNCEscript.js0.72The springs: lower bounces more (0.5), higher settles without passing the mark (1).
HOLDscript.js1.7The seconds the pilot stays on each version it compares.
ROLLscript.js0.05The seconds between one letter and the next when the new words roll in.
GLINTscript.js1How bright the band of light that crosses the edited bubble is.
SPEEDscript.js1The pilot's speed: 2 twice as fast, 0.5 half.
LOOPscript.jstrueThe edit and the history start again.

Try them in the Playground

When to use it

For the chat of a work app, a back office, a project tool or a messaging app: it shows that a message was changed and lets you check what it said before, without opening another window. It also fits the comments of a shared document or a CMS, or as a feature showcase on a landing page.

On phones

The same animation with adapted sizes: the card is 92% of the screen wide, the bubble's text is sized on the height too, and the history rows are tapped with a finger; on a short screen the channel header hides, so the open history stays inside.

With reduced motion

Nothing moves: the new text fades in, the numbers are already in place, the history opens and closes with a fade, the frame appears on the chosen row and the marker is already full.

Pitfalls

  • The digit drums, inline-block with overflow hidden, aligned to their bottom edge instead of the baseline: the time sat two pixels above Edited and the colon stayed low. The drums' container is a centred inline-flex, one drum tall.
  • With the marker in 2 pixels of padding and negative margin, two neighbouring words overlapped and the seam got darker: one pixel per side is enough.
  • The history rows, closed, could still be reached with Tab: the container is inert until the history is open.
  • An edit while the history is open makes the rows wrong: before the text changes the history closes quickly, and the rows are rebuilt at the next opening.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

Tested on 6 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 components