Skip to content
animorio
IT
All components

Shipping radio buttons

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

The radio buttons of the shipping choice in a made-up shop’s checkout, on black: Standard, Express, Pick up in store and Same day, which cannot be chosen. The filled dot does not jump from circle to circle: it slides between the rows like a drop that stretches and closes up, the circle it reaches tightens and takes it in, the chosen card’s edge lights up and the total rolls digit by digit.

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>
<!--
  "Shipping radio buttons" 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>Shipping radio buttons with the dot that slides between the options</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 shipping step of a made-up shop's checkout: native radio buttons, one dot that flows from circle to circle
         like a drop that stretches and closes up, the chosen card lights its edge and the total rolls -->
    <form class="ship" data-wrap onsubmit="return false">
      <fieldset class="ship__set">
        <legend class="ship__head">
          <span class="ship__title">Shipping method</span>
          <span class="ship__shop">Tallis Supply</span>
        </legend>

        <div class="list" data-list>
          <label class="opt" data-opt>
            <input type="radio" name="ship" value="standard" data-price="0" checked>
            <span class="opt__ring" data-ring aria-hidden="true"></span>
            <span class="opt__text"><b class="opt__name">Standard</b><span class="opt__meta">3–5 days</span></span>
            <svg class="opt__ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M4.5 8 12 4l7.5 4v8L12 20l-7.5-4Z"></path><path d="M4.5 8 12 12l7.5-4M12 12v8M8.2 6 15.8 10"></path></svg>
            <span class="opt__price">Free</span>
            <span class="opt__edge" aria-hidden="true"></span>
          </label>

          <label class="opt" data-opt>
            <input type="radio" name="ship" value="express" data-price="9">
            <span class="opt__ring" data-ring aria-hidden="true"></span>
            <span class="opt__text"><b class="opt__name">Express</b><span class="opt__meta">Tomorrow</span></span>
            <svg class="opt__ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M3 7.5h10.5v8.5H3ZM13.5 10.5h4l3 3v2.5h-7"></path><circle cx="7" cy="17" r="1.7"></circle><circle cx="17" cy="17" r="1.7"></circle></svg>
            <span class="opt__price">$9</span>
            <span class="opt__edge" aria-hidden="true"></span>
          </label>

          <label class="opt" data-opt>
            <input type="radio" name="ship" value="pickup" data-price="0">
            <span class="opt__ring" data-ring aria-hidden="true"></span>
            <span class="opt__text"><b class="opt__name">Pick up in store</b><span class="opt__meta">Today</span></span>
            <svg class="opt__ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M4 9.5 5.5 5h13L20 9.5M4 9.5v10h16v-10M4 9.5c0 1.4 1.1 2.3 2.7 2.3S9.3 10.9 9.3 9.5c0 1.4 1.1 2.3 2.7 2.3s2.7-.9 2.7-2.3c0 1.4 1 2.3 2.6 2.3S20 10.9 20 9.5"></path><path d="M10 19.5v-4.5h4v4.5"></path></svg>
            <span class="opt__price">Free</span>
            <span class="opt__edge" aria-hidden="true"></span>
          </label>

          <label class="opt is-off" data-opt>
            <input type="radio" name="ship" value="sameday" data-price="15" disabled>
            <span class="opt__ring" data-ring aria-hidden="true"></span>
            <span class="opt__text"><b class="opt__name"><s>Same day</s></b><span class="opt__meta">Unavailable</span></span>
            <svg class="opt__ic" viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="8"></circle><path d="M12 7.5V12l3 2"></path></svg>
            <span class="opt__price"><s>$15</s></span>
          </label>

          <svg class="drop" data-drop aria-hidden="true">
            <defs>
              <radialGradient id="dropShine" cx="38%" cy="30%" r="75%">
                <stop offset="0" stop-color="#ffffff" stop-opacity="0.55"></stop>
                <stop offset="0.45" stop-color="#ffffff" stop-opacity="0"></stop>
              </radialGradient>
            </defs>
            <path class="drop__body" data-dropbody></path>
            <path class="drop__shine" data-dropshine fill="url(#dropShine)"></path>
          </svg>
        </div>
      </fieldset>

      <div class="sum">
        <div class="sum__row">
          <span>Subtotal</span><span class="sum__val">$84.00</span>
        </div>
        <div class="sum__row">
          <span>Shipping</span><span class="sum__val sum__flip"><span class="sum__flipin" data-shipline>Free</span></span>
        </div>
        <div class="sum__row sum__total">
          <span>Total</span><span class="odo" data-odo aria-hidden="true"></span>
          <span class="sr" data-live aria-live="polite"></span>
        </div>
      </div>
    </form>

    <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>

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.

38 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 “Shipping radio buttons” 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 black background there is just the shipping panel of a checkout for the made-up shop Tallis Supply: a dark box with a one pixel edge catching the light along the top and soft shadows, the Shipping method title and four cards in a column. Each has its radio circle, the name, the days, an icon drawn in line and the price: Standard in 3–5 days for free, Express tomorrow for $9, Pick up in store today for free, and Same day, struck through, grey, with a hatched circle and the word Unavailable, which cannot be chosen (tapped, it only gives a little sideways no). When another option is chosen the blue dot does not jump: it draws back by a pixel and then pours towards the new circle, the head running ahead and the tail leaving later, so between the rows it becomes a stretched drop with a thin neck, which closes up as it arrives; the head passes the centre by a pixel and settles on a spring. The circle it leaves loosens for a moment, the one it reaches tightens and takes it in, coming back with a bounce. The chosen card’s edge lights up in blue, brighter at the top, a soft light settles over it, the name widens a touch on the wdth axis and the icon brightens. Below, the Shipping line changes upwards and the total rolls digit by digit, from the right, from $84.00 to $93.00 and back, with a one pixel jolt. With the mouse over another option the dot leans two pixels towards it; pressed, a card squeezes and springs back. They are real radios: you choose with a click, a finger or the keyboard arrows, which skip Same day, and the focus has its blue ring. Left alone, a drawn pointer picks Express, then Pick up in store, then Standard, and starts again.

How it works

Real radios under the cards

Each card is a label holding a native radio input, transparent and as big as the card: click, touch, keyboard arrows and screen readers work by themselves, and the change event says which option is chosen. The Same day option is disabled, so the arrows skip it. The keyboard focus adds a class to the card, which draws the ring with outline.

One dot for every circle

The dot does not live inside the circles: it is an SVG path over the list. The circles’ positions are measured with offsetTop and offsetLeft, which ignore the cards’ squeeze, and measured again by a ResizeObserver, even mid-travel.

The drop: head, tail and neck

The dot’s state is an object with a head, a tail and their radii. GSAP moves the head towards the new circle with power3.inOut and the tail later (STRETCH), and on every frame the path is redrawn: two arcs for the ends and four Bézier curves with vertical tangents that narrow into a neck, thinner the longer the drop. When head and tail meet, it is a circle again.

The settling

Before leaving the head draws back a pixel, it arrives a pixel past the centre and comes back with elastic.out; the circle it leaves loosens in scale and the one it reaches tightens to 0.82 and bounces back, right as the head gets there.

The rolling total

Each digit of the total is a column from zero to nine inside a window one line tall: only yPercent changes, with back.out and a stagger from the right. The Shipping line leaves upwards and comes back from below with the new price.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#9db4ffThe colour of the dot, the lit edge and the focus.
DOTscript.js5The radius of the filled dot, in pixels.
TRAVELscript.js0.62How many seconds the dot takes to go from one row to the next.
STRETCHscript.js0.26How long the tail waits before leaving: higher means a longer drop.
ROLLscript.js0.7How many seconds the total’s digits roll for.
SUBTOTALscript.js84The order subtotal, before shipping.
CURRENCYscript.js$The currency symbol.

Try them in the Playground

When to use it

In the shipping step of a checkout, in the pickup or delivery choice of a restaurant, in a subscription’s options, in any form where you pick one thing out of a few and want the choice to be felt.

On phones

The panel narrows to the screen width minus thirty-two pixels, under 380 pixels the icons go to leave room for the names, and the cards get shorter with the screen height. A finger chooses like the mouse; without hover the dot does not lean.

With reduced motion

The dot does not slide: it fades out on the old circle and in on the new one. No springs, bounces or squeezes; the edge lights up with a fade and the total changes with a fade, without rolling.

Pitfalls

  • Measured with getBoundingClientRect, the circles moved when a pressed card squeezed and the drop left crooked: with offsetTop and offsetLeft the measure ignores transforms.
  • With straight tangents between the two ends the drop looked like a stiff pill: the curves leave each circle’s equator vertically, so the outline has no corners, and the neck narrows with the length.
  • Setting checked from code does not fire the change event: the autopilot ticks the radio and then calls the same function as a real choice.
  • Changing every digit of the total at once made a flash: only the digits that change roll, from the right, and if the number’s length changes the columns are rebuilt.

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 13 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