Skip to content
animorio
IT
All components

Material gift card

Tickets, Transitions, HoverGSAP, CSS onlyMediumCompressed weight: Demo 11 KBGSAP 28 KBFreeDownload the zip

The gift card of a homeware shop, on near black, where every amount has its own material: 50 dollars is linen paper, 100 frosted glass, 250 brushed brass, 500 black metal. Choosing the amount, with a tap or by dragging the light pill along the picker, the new material crosses the card behind a band of light, the figures roll, the finish's name turns over and the glow under the card takes its colour. Add to bag gives under the finger, the card dips into it and the price turns into a check.

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>
<!--
  "Material gift card" 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 gift card that changes material with the amount</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 gift card of a homeware shop on a near black page. Each amount has its own finish: $50 is linen paper,
         $100 frosted glass, $250 brushed brass, $500 black onyx metal. Choosing an amount (a tap, or dragging the
         light pill along the picker) wipes the new material across the card behind a band of light, the figures roll,
         the name of the finish turns over and the glow under the card takes its colour. A soft light on the card
         follows the pointer; on the metals it is a long brushed streak. Add to bag presses, shines and says Added -->
    <div class="gc" data-gc>
      <span class="gc__pool" data-pool aria-hidden="true"></span>
      <div class="gc__card" data-card>
        <div class="gc__skin" data-skin aria-hidden="true">
          <span class="gc__mat gc__mat--linen" data-mat></span>
          <span class="gc__mat gc__mat--frost" data-mat>
            <span class="gc__blob gc__blob--a" data-blob></span>
            <span class="gc__blob gc__blob--b" data-blob></span>
            <span class="gc__frost"></span>
          </span>
          <span class="gc__mat gc__mat--brass" data-mat></span>
          <span class="gc__mat gc__mat--onyx" data-mat></span>
          <span class="gc__grain"></span>
          <span class="gc__sheen" data-sheen></span>
          <span class="gc__streak" data-streak></span>
          <span class="gc__wipe" data-wipe></span>
          <span class="gc__rim" data-rim></span>
        </div>
        <div class="gc__face" data-face>
          <div class="gc__top">
            <span class="gc__brand">
              <svg class="gc__mark" viewBox="0 0 20 20" aria-hidden="true">
                <path d="M4 16V4h12"/>
                <path d="M4 10h8"/>
                <path class="gc__mark-arc" d="M12.5 16a3.5 3.5 0 0 1 3.5-3.5"/>
              </svg>
              <span data-brand>Forma House</span>
            </span>
            <span class="gc__finish" data-finish><span class="gc__finish-word">Linen</span></span>
          </div>
          <div class="gc__bottom">
            <span class="gc__label">Gift card</span>
            <span class="gc__amount" data-amount aria-hidden="true"></span>
          </div>
          <span class="gc__valid">Valid 24 months · Online and in store</span>
        </div>
      </div>

      <div class="gc__pick" role="radiogroup" aria-label="Gift card amount" data-pick>
        <span class="gc__thumb" data-thumb aria-hidden="true"></span>
        <button class="gc__opt" type="button" role="radio" data-opt><b data-opt-amount>$50</b><span>Linen</span></button>
        <button class="gc__opt" type="button" role="radio" data-opt><b data-opt-amount>$100</b><span>Frost</span></button>
        <button class="gc__opt" type="button" role="radio" data-opt><b data-opt-amount>$250</b><span>Brass</span></button>
        <button class="gc__opt" type="button" role="radio" data-opt><b data-opt-amount>$500</b><span>Onyx</span></button>
      </div>

      <button class="gc__add" type="button" data-add>
        <span class="gc__add-face" data-add-face>
          <span class="gc__add-shine" aria-hidden="true"><span class="gc__add-band" data-add-band></span></span>
          <span class="gc__add-words" aria-hidden="true">
            <span class="gc__add-word" data-add-word>Add to bag</span>
            <span class="gc__add-word" data-add-word>Added to bag</span>
          </span>
          <span class="gc__add-chip" aria-hidden="true">
            <span class="gc__add-price" data-add-price></span>
            <svg class="gc__add-check" viewBox="0 0 16 16"><path data-add-check pathLength="1" d="M3.4 8.4l3 3 6.2-6.6"/></svg>
          </span>
        </span>
      </button>
    </div>
    <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>

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.

35 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 “Material gift card” 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 near black page with a fine grain sits the gift card of Forma House, a homeware shop: at the top the mark and a small frame with the finish's name, at the bottom ‘Gift card’, the big amount and ‘Valid 24 months · Online and in store’. Under the card a dark picker with four amounts, $50 Linen, $100 Frost, $250 Brass and $500 Onyx, with a light pill under the chosen one, and the light ‘Add to bag’ button with the price in a capsule. At 50 dollars the card is oat linen with a fine weave; at 100 it is frosted glass over two colours, violet and pink, drifting slowly; at 250 it is brushed brass with light and dark bands; at 500 it is brushed black metal with a cold edge. Choosing an amount the new material comes in from one side, in the direction of the choice, behind a slanted band of light crossing the card; the figures roll column by column, the right one first, with a small overshoot; the finish's name turns over in its frame, which widens or narrows; the words take the material's ink; the glow under the card takes its colour; the card rises a few pixels and settles on a spring. A soft light follows the pointer on the card, and on the metals it becomes a long brushed streak. Pressing Add to bag the button gives, a shine crosses it, the card dips a little towards it and comes back, the label becomes ‘Added to bag’ and the price makes way for a green check that draws itself. On its own the demo goes through the four finishes and puts one in the bag.

How it works

Four materials on top of each other

The card's skin holds the four materials stacked, all in CSS: linen is four repeating gradients (the weave) under a radial light, glass two blurred blobs under a white veil, brass and black metal a horizontal brushing of one pixel lines over a banded gradient. Over them all the grain (an feTurbulence data URI, in overlay), the pointer light and the one pixel rim.

The curtain of light

The chosen material goes on top with a new z-index and is uncovered with clip-path, from inset(0 100% 0 0) to inset(0), or from the other side when going back; a slanted band in screen mode travels the same way on the same curve, so the light always sits on the moving edge. When it is done the other materials are hidden, but only if nothing else has been chosen meanwhile.

The rolling figures

Each column is a strip of eleven cells (blank and 0-9) moved with yPercent; the blank column shrinks to zero width, so 50 becomes 100 without a jump. The figures are proportional: every column takes the width of its own digit, measured once and again on resize. The right column starts first, with back.out.

The pill you drag

A tap picks the amount under the finger; past five pixels of dragging the picker captures the pointer, the pill follows the finger and the amount changes as soon as its centre passes the next one; let go, it goes back to its place on a spring. touch-action: pan-y lets the page scroll vertically. From the keyboard the arrows, Home and End.

Light, ink and Add to bag

The light on the card chases the pointer on a spring integrated by hand on gsap.ticker; the ink, the glow under the card and the strength of the metals' streak are CSS variables GSAP takes to the material's values. Add to bag is a timeline: the shine, the card dipping and coming back on an elastic, the word turning over and the check drawn with stroke-dashoffset.

Values to change

NameFileDefaultWhat it changes
AMOUNTSscript.js50, 100, 250, 500The four amounts, from linen to black metal.
CURRENCYscript.js$The sign before the amount.
BRANDscript.jsForma HouseThe shop's name on the card.
WIPEscript.js0.75How many seconds the new material takes to cross the card.
SHEENscript.js1How strong the light following the pointer is.
SPRINGscript.js1How springy the card, the pill and the button are: 0.5 calm, 2 very bouncy.
STEPscript.js1.4How many seconds each finish stays when the demo runs by itself.
HOLDscript.js1.5How many seconds ‘Added to bag’ stays before going back.
AUTOscript.jstrueGoes through the finishes by itself until someone touches it.

Try them in the Playground

When to use it

For the gift card page of an online shop, a homeware, fashion or beauty store: the higher amount looks and feels more precious, and choosing the amount becomes a small pleasure.

On phones

The same animation with adapted sizes: everything is at most 84% of the screen wide and also measured on the height, the card's words follow its width (cqw units), the pill is dragged with a finger and the light on the card goes where you touch.

With reduced motion

Nothing moves: the new material fades in over the old one, the figures and the finish's name fade in place, the light on the card stays still, the colours under the glass stay still and Add to bag swaps its label and check with a fade.

Pitfalls

  • Mona Sans's tabular figures have a slashed zero and look typewritten: the figures are proportional and every column widens or narrows to its digit's width.
  • Choosing two amounts quickly, the end of the first curtain hid the second material: the other materials are hidden only if the chosen amount is still the same.
  • Capturing the pointer straight away, the click on the amounts never reached the buttons: the picker captures it only after five pixels of dragging, and a tap picks from the point touched.
  • On a spring, the pill coming back from 500 to 50 flew past the picker's edge: at the two ends it lands with expo.out, without overshoot; in the middle the spring stays.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

Tested on 2 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