Skip to content
animorio
IT
All components

Member price button

Buttons, Hover, TransitionsGSAP, CSS onlyMediumCompressed weight: Demo 6.6 KBGSAP 28 KBFreeDownload the zip

The small card of a linen throw from Loam & Lane, a made-up home goods shop, with the full price and a «Show member price» pill. On tap the pill tightens into a circle with a spinning ring, the veil with the lock lifts and the member price comes into focus digit by digit, rolling; the full price is struck through by a line that draws itself, a «Save 20%» lozenge lands on a spring and the pill opens again into «Add to cart · $118.40», which in turn says Added with a tick and comes back. On white, with a single blue accent.

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>
<!--
  "Member price button" 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>Member price button</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">
    <!-- a small product card of Loam & Lane, a made-up home goods shop: the full price, and a pill that reveals
         the member price. On press the pill tightens into a spinning ring, the member price comes into focus digit
         by digit, the old price is struck through, the saving shows in a lozenge and the pill becomes Add to cart -->
    <section class="card" data-card aria-label="Waffle linen throw, Loam and Lane">
      <span class="card__edge" aria-hidden="true"></span>

      <div class="prod">
        <span class="thumb" aria-hidden="true">
          <svg viewBox="0 0 40 40" data-thumb>
            <rect class="throw throw--back" x="7" y="12.5" width="26" height="18" rx="3"/>
            <rect class="throw" x="5.5" y="15" width="29" height="17.5" rx="3.2"/>
            <path class="weave" d="M9 19.5h22M9 23h22M9 26.5h22"/>
            <path class="fringe" d="M8.5 32.5v2.4M12 32.5v2.4M15.5 32.5v2.4M19 32.5v2.4M22.5 32.5v2.4M26 32.5v2.4M29.5 32.5v2.4"/>
          </svg>
        </span>
        <div class="prod__txt">
          <p class="brand">Loam &amp; Lane</p>
          <h1 class="name">Waffle linen throw</h1>
          <p class="meta">Oat · 130 × 170 cm</p>
        </div>
      </div>

      <div class="prices">
        <div class="row">
          <span class="lab">Price</span>
          <span class="full" data-full>
            <span class="full__txt">$148.00</span>
            <span class="strike" data-strike aria-hidden="true"></span>
          </span>
        </div>
        <div class="row row--member">
          <span class="lab lab--member">Member price</span>
          <span class="member">
            <span class="save" data-save aria-hidden="true"><span class="save__txt" data-save-txt>Save 20%</span></span>
            <span class="veil" data-veil aria-hidden="true">
              <svg class="lock" viewBox="0 0 16 16"><rect x="3.5" y="7" width="9" height="6.5" rx="1.6"/><path d="M5.5 7V5.3a2.5 2.5 0 0 1 5 0V7"/></svg>
            </span>
            <span class="roll" data-roll aria-hidden="true"></span>
          </span>
        </div>
      </div>

      <button class="pill" type="button" data-pill aria-label="Show member price">
        <span class="pill__bg" data-pill-bg aria-hidden="true"></span>
        <span class="pill__face" data-face="show"><span class="pill__txt">Show member price</span></span>
        <span class="pill__face" data-face="spin" aria-hidden="true">
          <svg class="spin" viewBox="0 0 24 24" data-spin><circle class="spin__track" cx="12" cy="12" r="8.5"/><circle class="spin__arc" cx="12" cy="12" r="8.5" pathLength="1"/></svg>
        </span>
        <span class="pill__face" data-face="add" aria-hidden="true"><span class="pill__txt">Add to cart <span class="dot">·</span> <span data-add-price>$118.40</span></span></span>
        <span class="pill__face" data-face="added" aria-hidden="true">
          <svg class="tick" viewBox="0 0 16 16"><path d="M3.6 8.4 6.6 11.2 12.4 5" pathLength="1" data-tick/></svg>
          <span class="pill__txt">Added</span>
        </span>
      </button>

      <p class="note" data-note>Free for members of the Lane Club.</p>
      <p class="sr" aria-live="polite" data-live></p>
    </section>
  </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.

33 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 “Member price button” 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 hover the pill’s label widens on the width axis and the ground swells with a bounce. On tap the pill squashes a little, the label goes and the pill tightens into a circle holding a spinning ring; then the veil with the lock slides away and the digits of the member price, blurred at first, come into focus from the left, each rolling down its column to the right digit. The full price turns grey and is struck through, the saving lozenge lands and the circle opens again into «Add to cart». Tapping it says Added with a tick drawing itself, the thumbnail gives a small hop and after a moment the button goes back to Add to cart. If nobody touches it, the demo does everything by itself and starts over.

How it works

The button’s faces

The button has four absolutely positioned faces (Show member price, the ring, Add to cart, Added), all centred with inset 0 and flex: faces swap with a fade and only GSAP sets the width, from the card’s width down to the button’s height for the circle, so a hidden label never widens anything.

The price coming into focus

Every digit is a window one line tall holding a column from 0 to 9: the column slides down to its digit with yPercent while the blur filter goes from 7 to 0 pixels, the left digits first.

The strike line

A line one and a half pixels thick over the full price, with scaleX from 0 to 1 and the origin on the left, so the price is struck through as with a pen; at the same moment the price turns grey.

Values to change

NameFileDefaultWhat it changes
FULL_PRICEscript.js148The full price, in dollars.
DISCOUNTscript.js20The member discount, in per cent: the member price is worked out from it.
SPIN_TIMEscript.js0.9Seconds the ring spins before the price comes into focus.
ROLL_TIMEscript.js0.75Seconds each digit takes to roll into place.
DIGIT_GAPscript.js0.07Seconds between one digit and the next.
BLURscript.js7How blurred the hidden price is, in pixels.
SPRINGscript.js0.5How springy the pill and the lozenge are (lower = more bounce).
ADDED_HOLDscript.js1.4Seconds Added stays before going back to Add to cart.
AUTO_PAUSEscript.js1.6Seconds the demo waits at the end before it starts over.
IDLEscript.js6Seconds after your last touch before the demo plays by itself again.

Try them in the Playground

When to use it

On a product page or in the grid of a shop with a membership programme: the member price stays covered until the visitor asks for it, and the button that shows it immediately becomes the one to buy.

On phones

Everything is in em and the size depends on both the width and the height of the window, so the whole card fits the phone box. The pill is as tall and wide as the card, easy for a thumb; on touch it squashes and springs back.

With reduced motion

No springs, rolling or blur: the circle and the faces change with a fade, the member price appears already in focus and the line strikes the full price in an instant.

Pitfalls

  • The button’s faces are absolutely positioned: the longer «Show member price» in the flow would keep the pill wide and the ring would not sit in the middle of the circle.
  • The ring spins on the whole svg with transformOrigin at 50%, never svgOrigin, which on the svg itself moves the pivot and makes it orbit.
  • The blur filter on each digit is cleared at the end (blur(0px)), and each digit column sits in a window with hidden overflow: without it the neighbouring digits would show above and below.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

Tested on 1 December 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