Skip to content
animorio
IT
Back to the library

Tracked changes headline

TextGSAP, CSS onlyMediumCompressed weight: Demo 7.8 KBGSAP 28 KBFreeDownload the zip

The headline of a home page inside Penwick, a made-up writing app, in the clean style of today’s apps: you pick a tone, Plain, Warm or Bold, and the sentence rewrites itself with tracked changes. The words leaving are struck through by an orange line and narrow, the new ones type themselves letter by letter on an orange wash, each arriving a little heavier and settling; with Accept the struck words fold away and the whole sentence takes the weight and width of its tone.

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>
<!--
  "Tracked changes headline" 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 headline that changes its tone with tracked changes</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>
    <!-- a made-up writing app, Penwick: pick a tone and the headline rewrites itself with tracked changes,
         struck words going out, new words typing in, then Accept merges them -->
    <section class="doc" aria-label="Penwick headline editor" data-doc>
      <header class="doc__top">
        <span class="brand">
          <svg class="brand__mark" viewBox="0 0 20 20" aria-hidden="true"><path d="M4 16.2 13.8 6.4l-0.2-2.2 2.2 0.2L16 6.6 6.2 16.4Z"/><path d="M3.2 17 4 16.2l2.2 0.2-0.8 0.8Z"/><path d="M12.4 7.8l1.8 1.8"/></svg>
          <span>Penwick</span>
        </span>
        <span class="doc__file">Homepage / Headline</span>
      </header>

      <div class="tones" role="radiogroup" aria-label="Tone" data-tones>
        <span class="tones__pill" data-pill aria-hidden="true"></span>
        <button class="tone" type="button" role="radio" data-tone="0" aria-checked="true">Plain</button>
        <button class="tone" type="button" role="radio" data-tone="1" aria-checked="false">Warm</button>
        <button class="tone" type="button" role="radio" data-tone="2" aria-checked="false">Bold</button>
      </div>

      <div class="sheet" data-sheet>
        <h1 class="line" data-line aria-live="polite"></h1>
        <span class="caret" data-caret aria-hidden="true"></span>
      </div>

      <footer class="doc__bottom">
        <span class="meta">
          <span class="meta__diff" data-diff aria-live="polite"><span class="roll" data-plus>+0</span><span class="roll roll--minus" data-minus>&minus;0</span><span class="meta__words">words</span></span>
          <span class="meta__draft">Draft <span class="roll" data-draft>1</span> of 3</span>
        </span>
        <button class="accept" type="button" data-accept disabled>
          <span class="accept__face" data-face>
            <svg class="accept__check" viewBox="0 0 16 16" aria-hidden="true"><path data-checkpath d="M3.4 8.4 6.6 11.4 12.6 4.8"/></svg>
            <span class="accept__label" data-label>Accept</span>
          </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.

25 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 “Tracked changes headline” 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 a sheet with round corners and a soft shadow: at the top the Penwick mark, a drawn pen with its name, and on the right Homepage / Headline; below, a pill switch with three tones, Plain, Warm and Bold, and the big home page headline, Write your notes in one place and find them later., which at first types itself letter by letter with its orange caret. At the bottom, behind a thin line, the count of changes, plus in green and minus in orange, Draft 1 of 3 and the Accept button, switched off. A drawn pointer picks Warm: the white pill slides under the word with a small bounce, the draft number rolls and the sentence rewrites itself with tracked changes. The words leaving are struck through by an orange line crossing them from the left and narrow on the width axis; right after, in their place, the new words type themselves letter by letter on a light orange wash, each letter arriving heavier and settling, with the caret following them. The sheet grows as much as needed, the count says how many words come in and go out, and Accept lights up with a bounce. Pressed, a check draws itself on the button and the label becomes Accepted; the struck words fold into themselves, the wash behind the new ones fades, the words rise a pixel and come back down, and the whole headline changes its type along with the tone: lighter and wider for Warm, heavier and narrower for Bold. Then the pointer moves on to Bold, and after Bold back to Plain.

How it works

The words that change

The previous sentence and the new one are compared word by word with the longest common subsequence: equal words stay where they are, the others become an exit and an entry, in reading order. The words leaving stay in the headline, struck through, and the new ones are inserted right after, still empty and hidden, so the line does not move until they type.

The striking line

Each word leaving gets an absolute orange bar at mid height with its transform-origin on the left: GSAP takes it from scaleX 0 to 1 in three tenths with power2.inOut, while the word turns grey and its --wd variable drops to minus 12, taking twelve points off the wdth axis of Mona Sans.

The letters that type

The new words are already split into letters with display none: a timeline shows them one at a time, each with a tween taking --lw from 240 to 0 and --ld from minus 10 to 0 with back.out, an extra weight that settles. The caret moves to the right edge of the last letter, read with getBoundingClientRect, and only blinks when it stops.

The tone in the type

The headline has two CSS variables, --w and --d, used in font-variation-settings by every word and every letter. Each tone has its own values, 540 and 100, 460 and 108, 720 and 88: with Accept GSAP takes them to the new ones in nine tenths with power3.inOut, and all the letters change weight and width together.

The sheet that grows

The height of the headline changes with the struck and the new words: the container follows it with a tween on the height read from offsetHeight, recomputed at every word typed and on resize, so the sheet does not jump.

Values to change

NameFileDefaultWhat it changes
TYPEscript.js0.034The seconds between one letter and the next as the new word types itself.
STRIKEscript.js0.3The seconds of the orange line striking through a word that leaves.
SETTLEscript.js240The extra weight each letter arrives with before it settles.
HOLDscript.js1.5The seconds the changes stay marked before the pointer presses Accept.
PAUSEscript.js1.6The seconds between one accepted tone and the next.
ACCENTscript.js#ff5b1fThe colour of the striking line, the caret and the wash behind the new words.

Try them in the Playground

When to use it

For the opening of a writing app, an assistant that rewrites text or a copywriting tool: it shows in one gesture what the product does, changing the tone of a sentence and showing what changed before you accept it.

On phones

The same animation with adapted sizes: the headline is sized on the width and the height, the sheet takes almost the whole box, under 420 pixels the file name and the word words disappear, and the tones are picked with a finger.

With reduced motion

No typing letters and no folding words: the struck words appear already struck, the new ones fade in, with Accept the old ones fade out and the headline takes the weight of the tone at once; there is no drawn pointer and the tones change by themselves.

Pitfalls

  • The new words are inserted empty and with display none, and their wash starts at zero too: an empty word with its margin and shadow would leave a double space and an orange sliver before typing.
  • In Mona Sans the tabular figures (tabular-nums) draw a slashed zero: the change count uses normal figures.
  • The struck words fold by taking their width from the one read with offsetWidth to zero, together with the right margin: without the margin an extra space would remain for every word removed.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

Compressed with gzip, the three demo files weigh 7.8 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