Skip to content
animorio
IT
All components

Add to Wallet button

Buttons, HoverGSAP, CSS onlyAdvancedCompressed weight: Demo 12 KBGSAP 28 KBFreeDownload the zip

The Add to Wallet button of a festival app, in black lacquer on a dark velvet stage, like a Dribbble shot. On hover the ticket peeks out of the slit on the edge of the pill; pressed, it is pulled out of it: a holographic card with the concert’s name, the date, the row, the seat and a QR code, with an iridescent sheen and a tilt that follow the pointer. Then the stub folds in half along the perforation, the folded ticket lifts, drops into a small wallet pocket that takes it with a spring, the counter goes from 2 to 3 and the pill settles on Added · Gate B opens 19:00.

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>
<!--
  "Add to Wallet 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>The Add to Wallet button with the concert ticket that folds into its pocket</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 Add to Wallet button of a festival app on a dark velvet stage. Pressed, the ticket is pulled out of the
         pill: a foil card with the event, the date, the row, the seat and a QR code, whose holographic sheen follows
         the pointer. It folds in half along its perforation and drops into a small wallet pocket that takes it with a
         spring; then the pill settles on Added · Gate B opens 19:00 -->
    <div class="fit" data-fit>
      <div class="aw" data-aw>
        <span class="aw__spill" data-spill aria-hidden="true"></span>

        <!-- everything above the middle of the pill: the ticket comes out of the pill through this window -->
        <div class="aw__clip" aria-hidden="true">
          <div class="aw__space">
            <div class="pk" data-pocket>
              <span class="pk__back"></span>
              <span class="pk__pass pk__pass--a"><span class="pk__pass-band"></span></span>
              <span class="pk__pass pk__pass--b"><span class="pk__pass-band"></span></span>
            </div>

            <div class="tk" data-tk>
              <div class="tk__half tk__main" data-main>
                <span class="tk__foil" data-foil></span>
                <span class="tk__crease" data-crease></span>
                <span class="tk__brand">SALTMOON</span>
                <span class="tk__event">Live at Harbour Arena</span>
                <span class="tk__date"><b>SAT</b> 12 JUN</span>
                <span class="tk__meta">Doors 19:00 · Gate B</span>
                <svg class="tk__wave" viewBox="0 0 96 14"><path d="M0 7c6 0 6-5 12-5s6 10 12 10 6-10 12-10 6 10 12 10 6-10 12-10 6 10 12 10 6-5 12-5"/></svg>
              </div>
              <div class="tk__half tk__stub" data-stub>
                <span class="tk__foil" data-foil></span>
                <span class="tk__perf"></span>
                <span class="tk__qr"><svg viewBox="0 0 25 25" data-qr><rect class="tk__qr-bg" width="25" height="25" rx="2.4"/><path data-qr-path/></svg></span>
                <span class="tk__seat">
                  <span><i>Row</i><b>12</b></span>
                  <span><i>Seat</i><b>24</b></span>
                </span>
              </div>
              <div class="tk__half tk__back" data-back>
                <span class="tk__foil tk__foil--strong" data-foil></span>
                <span class="tk__back-mark">SALTMOON</span>
                <span class="tk__back-line">Admit one · Block C</span>
                <svg class="tk__back-moon" viewBox="0 0 40 40"><circle cx="20" cy="20" r="13"/><circle cx="20" cy="20" r="17.5"/></svg>
              </div>
            </div>

            <div class="pk__front" data-front>
              <span class="pk__stitch"></span>
              <span class="pk__glint" data-glint></span>
              <span class="pk__label">
                <svg viewBox="0 0 16 16"><rect x="1.6" y="3.4" width="12.8" height="9.6" rx="2.4"/><path d="M1.6 6.4h12.8"/><path d="M10.4 9.6h1.6"/></svg>
                Wallet
              </span>
              <span class="pk__count"><span class="pk__digit" data-digit><span>2</span><span>3</span></span><span class="pk__count-word">passes</span></span>
            </div>
          </div>
        </div>

        <button class="aw__btn" type="button" data-btn data-autoclic aria-label="Add the Saltmoon ticket to Wallet">
          <span class="aw__body" data-body>
            <span class="aw__fill" aria-hidden="true"></span>
            <span class="aw__shine" data-shine aria-hidden="true"></span>
            <span class="aw__sweep" aria-hidden="true"><span class="aw__sweep-band" data-sweep></span></span>
            <span class="aw__edge" aria-hidden="true"></span>
            <span class="aw__slit" data-slit aria-hidden="true"></span>
            <span class="aw__row">
              <span class="aw__disc" data-disc aria-hidden="true">
                <span class="aw__plate" data-plate></span>
                <svg class="aw__icon" data-icon viewBox="0 0 24 24">
                  <path d="M5 8.2c0-1 .8-1.8 1.8-1.8h10.4c1 0 1.8.8 1.8 1.8v1.4a2.4 2.4 0 0 0 0 4.8v1.4c0 1-.8 1.8-1.8 1.8H6.8c-1 0-1.8-.8-1.8-1.8v-1.4a2.4 2.4 0 0 0 0-4.8z"/>
                  <path class="aw__icon-perf" d="M14.2 7.6v8.8"/>
                </svg>
                <svg class="aw__tick" data-tick viewBox="0 0 24 24"><path data-tick-path d="M7 12.4l3.3 3.2L17.2 8.6" pathLength="1"/></svg>
              </span>
              <span class="aw__text" aria-hidden="true">
                <span class="aw__state" data-state>
                  <span class="aw__title">Add to Wallet</span>
                  <span class="aw__sub">Saltmoon Live · Sat 12 Jun</span>
                </span>
                <span class="aw__state" data-state>
                  <span class="aw__title aw__title--busy" data-busy>Adding to Wallet</span>
                  <span class="aw__sub">Folding your ticket</span>
                </span>
                <span class="aw__state" data-state>
                  <span class="aw__title">Added <span class="aw__title-soft">· Gate B opens 19:00</span></span>
                  <span class="aw__sub">Block C · Row 12 · Seat 24</span>
                </span>
              </span>
            </span>
          </span>
        </button>
      </div>
    </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.

42 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 “Add to Wallet 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 a dark stage, with a violet light behind, a trace of pink rising from the floor and a very fine grain, a single pill button 60 pixels tall in black lacquer, its edge catching the light at the top. On the left a pink and violet disc with a ticket drawn on it, in the middle Add to Wallet and under it, in grey, Saltmoon Live · Sat 12 Jun. Above the pill waits a small wallet pocket in dark leather, with stitching, a thumb cut and two passes already inside peeking out, one teal and one paper coloured; at the bottom it says Wallet and 2 passes. On hover a soft light follows the pointer, a slit lights up on the top edge of the pill and the edge of the ticket peeks out by a few pixels. Pressed, the pill gives and springs back, the label becomes Adding to Wallet with a band of light running through it, the slit glows and the ticket is pulled out of the pill with a small turn of the wrist: a violet card with a pink and amber glow, SALTMOON, Live at Harbour Arena, SAT 12 JUN, Doors 19:00 · Gate B, and on the stub, past the dashed line with its two notches, the QR code, row 12 and seat 24. A holographic sheen of fine lines and rainbow runs over the card, and the card tilts a few degrees towards the pointer. Then the stub stands up on the perforation and lays down over the other half, showing its back with the moon and Admit one · Block C, while the half underneath goes dark; the folded ticket moves to the middle, lifts a little turning and drops into the pocket, behind the leather: the pocket gives by a pixel and comes back on a short elastic, a glint crosses it, the counter rolls from 2 to 3, in the disc the ticket gives way to a tick that draws itself and the pill says Added · Gate B opens 19:00 with Block C · Row 12 · Seat 24 underneath. Pressed again, the ticket leaves the pocket and everything goes back to rest; by itself, the button goes round and starts again.

How it works

It really comes out of the pill

Pocket and ticket live in a window with overflow hidden that ends exactly at the middle of the pill, and the pill sits above the window. The ticket starts with its top edge right on that line: rising, it comes out of the edge of the pill, and whatever is still below never shows, with no mask to animate.

The fold without real 3D

The fold is two flat faces, each with its own perspective (transformPerspective) and no preserve-3d: the stub turns to -90 degrees on its left edge, then its back, a third face lying on the left half, starts at 90 degrees on its right edge and lays down to 0. DOM order decides which one is on top, so there is no flicker between two coinciding planes; a dark gradient on the half underneath makes the shadow of the fold.

One background and one foil for two halves

The two halves of the ticket share the same background, 200% wide (one shows its left side, the other its right) and a holographic foil as wide as the whole ticket, shifted by -100% in the stub: so glow and rainbow pass over the perforation with no seam. The notches of the perforation are two radial gradients in each half’s mask, and the shadow is a drop-shadow on the container, which follows the notches.

The light that follows the pointer

An object H with the pointer’s position on the ticket (in percent) is driven by gsap.quickTo: it writes three CSS variables (the rainbow band, the spot of light) and the tilt, rotationX and rotationY, multiplied by a factor GSAP brings to 1 while the ticket is out and to 0 when it drops into the pocket. Without a real pointer, one pass of light runs over the foil by itself.

Into the pocket

The back of the pocket and the two passes sit under the ticket, the leather front above it: on the way up the ticket passes in front of everything, and once it is higher than the pocket its z-index drops by two and it falls behind the front. On arrival the leather squashes from its bottom edge for 80 thousandths and comes back with elastic.out, and the counter is a column of two digits in a window one line tall.

Values to change

NameFileDefaultWhat it changes
EVENTscript.jsSALTMOONThe festival’s name, on the ticket and on its back.
GATEscript.jsGate B opens 19:00What the pill says after Added.
ROWscript.js12The row on the ticket.
SEATscript.js24The seat on the ticket.
PULLscript.js0.95How many seconds the ticket takes to come out of the pill.
FOLDscript.js0.6How many seconds the ticket takes to fold along the perforation.
SHEENscript.js1How strong the holographic foil is: 0 off, 1.6 very bright.
TILTscript.js7How many degrees the ticket tilts towards the pointer.
SPRINGscript.js1How springy the moves are: 0.4 calm, 2 very bouncy.
HOLDscript.js3In the loop, how many seconds it stays on Added before going back to rest.
AUTOscript.jstrueThe button goes round by itself until someone touches it.

Try them in the Playground

When to use it

For the app or site of a festival, a concert, a theatre or a club, an online box office or the confirmation page after a purchase: it says the ticket goes into the phone’s wallet, shows what is on it (date, row, seat, QR) and confirms when the gates open.

On phones

On the phone the whole piece (ticket, pocket and pill) scales down together as much as it needs to fit the screen, in width and in height; there is no hover, so the light turns on under the finger and the holographic sheen follows the finger as it moves on the screen.

With reduced motion

Nothing moves: the ticket fades in above the pocket, the stub gives way to its back with a fade, then the ticket appears already in the pocket; the labels, the counter and the tick change in place, with no tilt.

Pitfalls

  • With preserve-3d the folded face and the half underneath ended up on the same plane and flickered: each face has its own perspective and DOM order decides.
  • The mask that cuts the notches of the perforation cuts the box-shadow too: the ticket’s shadow is a drop-shadow filter on the container, which follows the cut shape.
  • Scaled with transform: scale the piece still took its 300 pixels and on narrow phones made the page scroll sideways: an outer box takes the already scaled size.
  • The loop started when the script was read and the poster landed on different moments: it starts from the page’s load event.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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