
Button menu
Menus, Transitions, Text
The code block of a suggested change in Tessel, a made-up developer app, on black: a TypeScript file in a diff view, with the removed lines in red and struck through by a thin line and the added ones in green. Pressing Apply suggestion folds the removed lines away one after another like an accordion, the added ones slide up into their place and lose their colour, the line numbers roll to their new values while a thread of light runs down the margin, the +3 −2 count goes to zero and the button draws the Applied tick. Undo brings it all back as it was.
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>
<!--
"Code block with diff" 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 code block with the diff that applies line by line</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>
<main class="stage">
<!-- a suggested change in a code review of Tessel, a made-up tool for developers: the diff with the removed lines
(red, struck through with a thin line) and the added ones (green). Apply suggestion folds the removed lines
away one after another, the added ones slide into their place and lose their colour, the line numbers roll
to their new values, a thread of light runs down the margin and the +3 -2 count goes to zero. Undo brings
it all back. -->
<section class="sug" aria-label="Tessel code review: suggested change in src/cart/price.ts" data-sug>
<span class="sug__glow" aria-hidden="true" data-glow></span>
<header class="sug__head">
<span class="sug__avatar" aria-hidden="true">MK</span>
<p class="sug__who"><b>Mira Kovac</b> <span>suggested a change</span></p>
<span class="sug__count" data-count aria-label="3 lines added, 2 removed">
<span class="sug__plus">+<span class="roll" data-roll="add">3</span></span>
<span class="sug__minus"><svg viewBox="0 0 8 8" aria-hidden="true"><path d="M1.2 4h5.6"/></svg><span class="roll" data-roll="del">2</span></span>
</span>
</header>
<div class="sug__file">
<svg class="sug__file-icon" viewBox="0 0 16 16" aria-hidden="true"><path d="M4 1.8h5.2L12.6 5.2v9H4z"/><path d="M9 1.8v3.6h3.6"/></svg>
<span class="sug__path"><span>src/cart/</span>price.ts</span>
<span class="sug__state roll" data-state><span>Suggestion</span></span>
</div>
<div class="code" data-code>
<span class="code__thread" aria-hidden="true"><span class="code__beam" data-beam></span></span>
<div class="code__rows" data-rows></div>
</div>
<footer class="sug__foot">
<button class="btn btn--ghost" type="button" data-undo aria-hidden="true" tabindex="-1">
<svg class="btn__icon" viewBox="0 0 16 16" aria-hidden="true"><path d="M5.6 3.4L2.6 6.4l3 3"/><path d="M2.8 6.4h6.4a3.8 3.8 0 0 1 0 7.6H6.6"/></svg>
<span>Undo</span>
</button>
<button class="btn btn--main" type="button" data-apply>
<span class="btn__shine" aria-hidden="true" data-shine></span>
<span class="btn__face">
<svg class="btn__icon btn__tick" viewBox="0 0 16 16" aria-hidden="true"><path data-tick pathLength="1" d="M3.2 8.4l3.1 3.1 6.5-6.8"/></svg>
<span class="btn__words"><span data-words>Apply suggestion</span></span>
</span>
</button>
</footer>
</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>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.
64 values to change
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 “Code block with diff” from Animorio and fit it into my siteThe code is the CODE list: each entry is the kind of the line (ctx stays, del removed, add added) and its text. The script builds every row with its number column, its SVG sign, its text and its wash, and works out two numberings: the one before (kept and removed lines) and the one after (kept and added lines). Only the numbers that change roll.
A small tokenizer with a single regular expression splits the line into comments, strings, numbers, words, spaces and signs. A word is a keyword if it is in the list, a function if a bracket follows, a property if a dot comes before it, a type if it starts with a capital; each becomes a span with its class, and the colours live in :root.
Each row's height is calc(1.78em * var(--o)): GSAP takes --o from 1 to 0 with power3.inOut while the content turns -82 degrees on rotateX from its top edge, inside a 300 pixel perspective, and fades. The lines below rise by themselves, and since everything is in em the size stays right when the window changes. Undo does the same backwards with back.out, the last line first.
Every number is a window one line tall with hidden overflow: when it changes, the old figure leaves upwards (downwards going back) and the new one comes in with back.out. The same drum serves the line numbers, the +3 −2 count, Suggestion turning into Applied and the button's label, which meanwhile changes width on a spring by measuring the new word.
The line between the numbers and the code holds a segment with a pale green and white gradient, clipped with clip-path so its glow spills sideways but not above or below: GSAP runs it down in BEAM seconds. A pilot made of gsap.delayedCall applies and undoes again and again and stops for good at the first real touch.
| Name | File | Default | What it changes |
|---|---|---|---|
CODE | script.js | [['ctx', "import { cents, dollars } from './money';"], …] | The file: each row is [kind, text], with kind ctx (stays), del (removed) or add (added). |
START | script.js | 12 | The number of the first line shown. |
FOLD | script.js | 0.5 | The seconds a removed line takes to fold away. |
STAGGER | script.js | 0.15 | The seconds between one removed line and the next. |
ROLL | script.js | 0.42 | The seconds a number takes to roll to its new value. |
BEAM | script.js | 1.15 | The seconds the thread of light takes to run down the margin. |
HOLD | script.js | 2.6 | The pilot's pause between Apply and Undo. |
LOOP | script.js | true | The pilot applies and undoes again and again until someone touches the block. |
For the code review of a developer app, an online editor or an AI coding assistant that suggests changes: it shows what changes in the file and makes clear, without a message, that the change went in and that it can be taken back. It also works on the landing page of a developer tool, as a live demonstration, or in documentation to show a migration from one version to the next.
The same animation with adapted sizes: the panel is 94% of the screen wide, the code is sized on the height too (min of vw and vh) and goes down to 9.4 pixels so the longest line fits without wrapping, the words suggested a change hide and the buttons drop to 32 pixels. A finger presses like the mouse.
Nothing moves: the panel fades in, the removed lines fade out and leave the others already in their place, the washes and signs fade, the numbers, the count and the labels change with a fade, the tick appears without the button squashing, and there is no thread of light and no glow.
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 10 KB; the libraries: GSAP 28 KB.
Tested on 7 November 2026
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.
Support Animorio
Animorio stays free thanks to the people who support it. If you like, buy us a coffee: it helps us make the next animations.
You asked for
We made it for you: it’s in the library, with the preview, the Playground and the code to copy.
An animation you can’t find, or a site to take apart in the journal: tell us which. We pick the next ones from here.
With your account’s email and password.
or with your email
You’re signed in as .
With your account, you can download the zip of every animation and every pack, for free.