Skip to content
animorio
IT
Back to the library

A/B test results

Hover, SVGGSAP, CSS onlyMediumCompressed weight: Demo 6.1 KBGSAP 28 KBFreeDownload the zip

The results of an A/B test in a dashboard, to read day by day. Drag the day and the two variants’ conversion rates change while their uncertainty ranges narrow: at first they overlap (and B is even behind), then they pull apart. When the confidence passes 95% the test turns “Significant” and B gets the “Winner” tag.

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>
<!--
  "A/B test results" 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>A/B test results</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 of an A/B test, day by day: drag the day and the two likely ranges narrow, cross, pull apart;
         when they stop touching the confidence passes the line and the winner is called -->
    <section class="ab" data-ab aria-label="A/B test results">
      <header class="ab__head">
        <h2 class="ab__title">Checkout button</h2>
        <span class="ab__chip" data-chip><span class="ab__roll"><span data-status>Collecting data</span></span></span>
      </header>
      <p class="ab__meta"><span data-day>Day 1 of 14</span> · <span data-visitors>1,000</span> visitors</p>

      <div class="ab__row" data-row="a">
        <div class="ab__line">
          <span class="ab__key">A</span>
          <span class="ab__name">Buy now</span>
          <span class="ab__range" data-range="a"></span>
          <span class="ab__rate" data-rate="a"></span>
        </div>
        <div class="ab__track"><span class="ab__band" data-band="a"></span><span class="ab__tick" data-tick="a"></span></div>
      </div>

      <div class="ab__row ab__row--b" data-row="b">
        <div class="ab__line">
          <span class="ab__key">B</span>
          <span class="ab__name">Get it today</span>
          <span class="ab__win" data-win>Winner</span>
          <span class="ab__range" data-range="b"></span>
          <span class="ab__rate" data-rate="b"></span>
        </div>
        <div class="ab__track"><span class="ab__band" data-band="b"></span><span class="ab__tick" data-tick="b"></span></div>
      </div>

      <dl class="ab__stats">
        <div><dt>Uplift</dt><dd data-uplift></dd></div>
        <div>
          <dt>Confidence</dt><dd data-conf></dd>
          <span class="ab__meter" aria-hidden="true"><span class="ab__meterfill" data-meter></span><span class="ab__level" data-level></span></span>
        </div>
      </dl>

      <label class="ab__days">
        <span class="ab__sr">Day of the test</span>
        <input type="range" min="1" max="14" step="1" value="1" data-days>
        <span class="ab__ends" aria-hidden="true"><span>Day 1</span><span>Day 14</span></span>
      </label>
    </section>

    <svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.200 19.200 11l-6.300 1.600-3.300 5.900Z"></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>

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.

26 values to change

Works with Claude, Claude Code, ChatGPT, Cursor, VS Code, Windsurf, Codex, Gemini CLI

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 “A/B test results” 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 light ground, a white card: “Checkout button”, a status chip and the line “Day 1 of 14 · 1,000 visitors”. Below, the two variants, A “Buy now” and B “Get it today”, each with its conversion rate large on the right and a track holding the range the true rate probably lies in, with a mark on the measured value. Then two tiles, B’s uplift over A and the confidence with its little bar and the threshold notch, and at the bottom the day slider. Drag it and the numbers glide to that day’s values, visitors climb, the ranges shift and narrow. In the first days B is behind and the ranges overlap almost entirely; around day ten they stop touching, the confidence passes 95%, the chip rolls to “Significant” and turns green, B’s range takes the colour and “Winner” pops in beside its name with a small bounce. Go back and it all withdraws.

How it works

The statistics are real

From the day’s rates and visitors come each variant’s standard error, the z-score of the difference and the confidence (with an approximation of the error function). Change the traffic and the answer arrives sooner or later.

Ranges that pull apart

Each range is 1.39 standard errors either side: at that width, two ranges that stop touching correspond, roughly, to 95% confidence. So the eye sees what the number says.

Everything glides together

A single object holds the values being drawn; on a new day a GSAP tween takes it to the new values and every step rewrites figures, ranges, marks and the little bar.

The verdict

Only when the confidence crosses the line, either way, do the chip, the range colour and the “Winner” change: not on every day.

A real slider

The days are a range input restyled in CSS: arrows, Home and End work, and aria-valuetext says day, rates and confidence.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#1e9e62The colour of the winning variant.
TRAFFICscript.js500How many visitors a day each variant gets: with more traffic the answer arrives sooner.
LEVELscript.js95The confidence, in percent, past which the test is called.
STARTscript.js1The day shown at the start, from 1 to 14.
LOOPscript.jstrueLeft alone, the demo’s pointer drags the days forward, goes back and runs to the end.

Try them in the Playground

When to use it

In the dashboard of an analytics or experimentation tool, in the back office of an online shop trying two buttons, on the site of a marketing product that wants to show how a test works.

On phones

The same card, as wide as the screen: the day slider has a 22-pixel thumb with a 24-pixel touch area and does not scroll the page while dragged.

With reduced motion

On a new day the numbers, ranges and chip jump straight to the new values, with no gliding or bouncing. The demo does not move by itself.

Pitfalls

  • The fourteen days of rates are made up; the maths is not. With real data you need visitors and conversions per variant, and checking the confidence daily to stop the moment it crosses the line skews the test: decide the duration first.
  • Two 95% intervals can overlap even when the difference is significant: that is why the ranges are narrower (1.39 standard errors).
  • The tracks run from 2 to 6.5 percent: with very different rates change the scale, or the ranges leave the edge.
  • The filled part of the slider track is a CSS variable updated by the script: Chromium and Safari have no “progress” part of the track as Firefox does.
  • The ranges are placed in pixels on the track’s width: redraw them on resize.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

Tested on 21 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 animations