
The colour columns
Hover, SVG
The results block in a portfolio case study: three numbers, each with its bar, and a Before / After control. Switching to after the bars go to the new value on a spring and leave a thin mark where they were, the numbers count, a chip with the change springs in next to each and everything takes the lime green. Hovering a row brings back what it was before.
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>
<!--
"Before and after bars" 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>Case study results with before and after bars</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">
<!-- the results block of a portfolio case study: three numbers, each with a bar; switching from before to after
the bars move on a spring to the new value and leave a thin mark where they were, the numbers count, and a
small chip with the change springs in next to each; hovering a row brings back what it was before -->
<section class="card" data-card data-view="before" aria-label="Case study results">
<span class="card__glow" aria-hidden="true"></span>
<header class="head">
<div>
<p class="head__kicker">Case study, Harbor & Pine</p>
<h1 class="head__title">Checkout, redesigned</h1>
</div>
<div class="seg" data-seg role="group" aria-label="Show">
<span class="seg__pill" data-pill aria-hidden="true"></span>
<button type="button" data-view-btn="before" aria-pressed="true">Before</button>
<button type="button" data-view-btn="after" aria-pressed="false">After</button>
</div>
</header>
<ul class="rows">
<li class="row" data-row data-before="2.1" data-after="2.9" data-max="3.4" data-kind="percent" data-delta="+38%">
<div class="row__top"><span class="row__name">Conversion rate</span><span class="row__chip" data-chip><span>+38%</span></span><span class="row__value"><span data-value>2.1%</span></span></div>
<div class="row__bar"><span class="row__fill" data-fill></span><span class="row__mark" data-mark></span></div>
<p class="row__was" data-was>was 2.1%</p>
</li>
<li class="row" data-row data-before="220" data-after="125" data-max="240" data-kind="time" data-delta="−43%">
<div class="row__top"><span class="row__name">Time to check out</span><span class="row__chip" data-chip><span>−43%</span></span><span class="row__value"><span data-value>3:40</span></span></div>
<div class="row__bar"><span class="row__fill" data-fill></span><span class="row__mark" data-mark></span></div>
<p class="row__was" data-was>was 3:40</p>
</li>
<li class="row" data-row data-before="71" data-after="56" data-max="100" data-kind="whole" data-delta="−15 pts">
<div class="row__top"><span class="row__name">Cart abandonment</span><span class="row__chip" data-chip><span>−15 pts</span></span><span class="row__value"><span data-value>71%</span></span></div>
<div class="row__bar"><span class="row__fill" data-fill></span><span class="row__mark" data-mark></span></div>
<p class="row__was" data-was>was 71%</p>
</li>
</ul>
</section>
<p class="sr" data-live aria-live="polite"></p>
<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"></path></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>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
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 “Before and after bars” from Animorio and fit it into my siteEach row has in the HTML the before value, the after value, the maximum of its scale and the kind (percentage with one decimal, time in minutes and seconds, whole percentage). The script reads everything from there.
For each row an object holds the value and the bar’s fraction. The bar gets there with elastic.out, which overshoots and returns; the number with power2.out, which never overshoots: a number going past and coming back would look like a mistake.
A dash 14 pixels tall sits at the percentage of the before value: it shows only in the after, so you see how far the bar has travelled.
The grey bar has a lime layer on top with zero opacity: the card takes data-view="after" and the CSS brings it to one in half a second, together with the control’s pill and the halo.
Each chip comes in from 14 pixels lower and scale 0.7 with elastic.out, three tenths after its bar; it leaves upwards when going back to before.
| Name | File | Default | What it changes |
|---|---|---|---|
START | script.js | before | What is shown at the start: before or after. |
SPRING | script.js | 0.9 | How long the bars’ spring lasts, in seconds. |
COUNT | script.js | 0.9 | In how many seconds the numbers reach the new value. |
STAGGER | script.js | 0.09 | The delay between one row and the next, in seconds. |
ACCENT | script.js | #b9f06c | The colour of after. |
PAUSE | script.js | 2.6 | By itself: how many seconds it stays on after before looking at the rows. |
LOOP | script.js | true | Left alone, a pointer switches from before to after. |
At the end of a case study in the portfolio of a designer, a developer or an agency, where you say what changed after the work. Also good on a landing page to show clients’ results, or in a report.
The same card, as wide as the screen: title and control tighten a little and on a short screen the rows sit closer. A tap on a row shows the before value.
No springs and no counting: bars and numbers go straight to the new value, the chips appear already in place and the colours change with a fade.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 5.4 KB; the libraries: GSAP 28 KB.
Tested on 14 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.