Skip to content
animorio
IT
All components

Transfer ticket button

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

The Transfer ticket button of a made-up ticketing app, Stagecall, on black: one tap and the graphite pill stretches on a spring into a lane with a friend’s avatar at the far end. The coral ticket tugs twice at the perforation, tears off its stub and slides along the dotted track leaving a warm trail, while a light runs round the rim. It slips into the avatar, a ring waits for her to accept (Cancel brings it back and rejoins it to the stub), then the ring closes green, the badge pops, the stub stays hatched as a receipt and the line below says the seat is hers now.

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>
<!--
  "Transfer ticket 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 Transfer ticket button with the ticket tearing off its stub and passing to a friend</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 Transfer ticket button of a made-up ticketing app, Stagecall: one tap tears the ticket off its stub,
         it slides along the pill to a friend's avatar, waits for her to accept, and the stub stays behind as proof. -->
    <div class="wrap" data-wrap>

      <div class="pill" data-pill>
        <span class="pill__glow" aria-hidden="true"></span>
        <span class="pill__light" data-light aria-hidden="true"></span>
        <span class="pill__beam" data-beam aria-hidden="true"></span>
        <span class="pill__sweep" data-sweep aria-hidden="true"></span>

        <!-- the lane: the track the ticket travels and the friend at the end -->
        <div class="lane" data-lane aria-hidden="true">
          <span class="track"><span class="track__dots"></span><span class="track__trail" data-trail></span></span>
          <span class="who" data-who>
            <svg class="who__ring" viewBox="0 0 44 44">
              <circle class="who__track" cx="22" cy="22" r="20"></circle>
              <circle class="who__run" data-run cx="22" cy="22" r="20"></circle>
            </svg>
            <span class="who__face"><span class="who__shine"></span><span class="who__initials" data-initials>MO</span></span>
            <span class="who__badge" data-badge>
              <svg viewBox="0 0 12 12"><path data-tick d="M3 6.3 5.1 8.3 9.1 3.9"></path></svg>
            </span>
          </span>
        </div>

        <!-- the ticket: the stub stays, the body travels -->
        <span class="ticket" data-ticket aria-hidden="true">
          <span class="ticket__stub" data-stub>
            <svg viewBox="0 0 12.4 28">
              <defs>
                <linearGradient id="gStub" x1="0" y1="0" x2="44" y2="28" gradientUnits="userSpaceOnUse">
                  <stop offset="0" class="stop-a"></stop>
                  <stop offset="1" class="stop-b"></stop>
                </linearGradient>
              </defs>
              <path class="ticket__paper" fill="url(#gStub)" d="M3 0H9.9A2.5 2.5 0 0 0 12.4 2.5V25.5A2.5 2.5 0 0 0 9.9 28H3A3 3 0 0 1 0 25V3A3 3 0 0 1 3 0Z"></path>
              <path class="ticket__rim" d="M3 0.5H9.6"></path>
              <rect class="ticket__mark" x="3.4" y="8" width="5" height="1.6" rx="0.8"></rect>
              <rect class="ticket__mark" x="3.4" y="12" width="3.4" height="1.6" rx="0.8"></rect>
              <path class="ticket__perf" d="M12.1 4.6V23.4"></path>
            </svg>
            <span class="ticket__void" data-void></span>
          </span>
          <span class="ticket__body" data-body>
            <svg viewBox="12.4 0 31.6 28">
              <defs>
                <linearGradient id="gBody" x1="0" y1="0" x2="44" y2="28" gradientUnits="userSpaceOnUse">
                  <stop offset="0" class="stop-a"></stop>
                  <stop offset="1" class="stop-b"></stop>
                </linearGradient>
              </defs>
              <path class="ticket__paper" fill="url(#gBody)" d="M12.4 2.5A2.5 2.5 0 0 0 14.9 0H41A3 3 0 0 1 44 3V25A3 3 0 0 1 41 28H14.9A2.5 2.5 0 0 0 12.4 25.5Z"></path>
              <path class="ticket__rim" d="M15.2 0.5H41"></path>
              <rect class="ticket__mark" x="17" y="7" width="12" height="2" rx="1"></rect>
              <rect class="ticket__mark ticket__mark--soft" x="17" y="11.6" width="8" height="1.6" rx="0.8"></rect>
              <g class="ticket__code">
                <rect x="33" y="7" width="1.1" height="14"></rect><rect x="35" y="7" width="0.6" height="14"></rect>
                <rect x="36.5" y="7" width="1.6" height="14"></rect><rect x="39" y="7" width="0.6" height="14"></rect>
                <rect x="40.4" y="7" width="1" height="14"></rect>
              </g>
              <rect class="ticket__mark ticket__mark--soft" x="17" y="18.4" width="10" height="1.6" rx="0.8"></rect>
            </svg>
            <span class="ticket__glint" data-glint></span>
          </span>
        </span>

        <button class="rest" type="button" data-go aria-label="Transfer ticket to Maya Okafor">
          <span class="rest__label" data-label>Transfer ticket</span>
          <svg class="rest__arrow" data-arrow viewBox="0 0 20 20" aria-hidden="true"><path d="M4.5 10h10.4M11 5.8 15.2 10 11 14.2"></path></svg>
        </button>
      </div>

      <div class="cap" aria-live="polite">
        <span class="cap__win"><span class="cap__now" data-cap>Lumen Hall · Sat 28 Nov · Row 12, Seat 7</span></span>
        <button class="cap__cancel" type="button" data-cancel tabindex="-1">Cancel</button>
      </div>
    </div>
  </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.

23 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 “Transfer ticket 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 black ground sits a graphite pill with a thin rim of light and a coral glow under it: inside, the drawn ticket, stub and body with its barcode, the label Transfer ticket and an arrow; below, the line with the night and the seat. On hover the pill rises a pixel, a light follows the pointer and the ticket tugs at the perforation as if about to tear. On the tap the label leaves, the pill stretches on a spring, the dotted track unrolls and the friend’s avatar comes in with a bounce. The ticket tugs twice, tears off, the stub shivers a pixel, and the body slides to the avatar on a small arc with a glint crossing it, leaving a warm trail; a light runs round the rim. In the avatar the ticket shrinks and goes, the avatar nods, and an amber arc spins round it: «Waiting for Maya to accept», with Cancel opening beside it. When she accepts the ring closes green, the badge pops with its tick drawing itself, the stub is hatched, a green light crosses the pill and the line says the seat is hers. With Cancel the ticket comes out of the avatar, travels back and rejoins its stub one pixel too far. Then the pill closes.

How it works

A ticket in two pieces

The ticket is two SVGs side by side sharing a user-space gradient: the stub’s viewBox runs from 0 to 12.4 and the body’s from 12.4 to 44, so the colour flows on without a seam. The perforation notches are 2.5 arcs in both paths. The body is an HTML element GSAP moves along the pill.

The tear and the trip

Two tugs of 1.5 and 2.5 pixels with a rotation round the bottom corner, the stub stepping back a pixel and springing home; then the body travels to the avatar’s centre, distance worked out from offsets at the open width, on an arc in y, with the trail stretching by scaleX alongside it.

The light on the rim

A conic-gradient in an element with one pixel of padding and a mask that keeps only the border: GSAP turns the --a variable from 0 to 360 degrees while the ticket travels. On acceptance a blade of green light crosses the pill.

Waiting, accepted and cancel

The avatar’s ring is an SVG circle with a short dash spinning forever; once accepted the dash closes and turns green and the badge tick draws from its dasharray. Cancel stops the wait and brings the body back to x = -1, then 0 with back.out: the one-pixel overshoot of the snap. The line below rolls, its window following the width of the new sentence.

Values to change

NameFileDefaultWhat it changes
LABELscript.jsTransfer ticketThe label of the closed button.
FRIENDscript.jsMaya OkaforWho the ticket goes to (the initials go in the avatar).
SEATscript.jsRow 12, Seat 7The ticket’s seat.
EVENTscript.jsLumen Hall · Sat 28 NovThe night, in the line under the pill.
TRAVELscript.js1.05The seconds of the ticket’s trip along the pill.
WAITscript.js1.7The seconds of waiting before the friend accepts.
SPRINGscript.js1How much the pill bounces as it stretches.
HOLDscript.js2.2The seconds the final message stays before closing.
IDLEscript.js0.9The seconds before the autopilot starts.
--bigliettostyle.css#ff6b3dThe colour of the ticket.

Try them in the Playground

When to use it

In the app or site of a box office, a festival, a theatre or a stadium, next to a ticket already bought: passing it to a friend, with the wait for her to accept and the chance to change your mind.

On phones

The open pill takes almost the whole width and the trip is worked out again on that size; the finger taps like the mouse. Without hover the light stays off and the ticket does not tug.

With reduced motion

No springs, tugs or trip: the pill opens in a fade, the ticket body fades out and the full trail appears, the ring holds still half drawn while waiting, the tick appears already drawn and the line below changes in a fade.

Pitfalls

  • stop-color with var() written as an SVG attribute does not work: it goes in a CSS class.
  • The trip distance is worked out from offsets, not getBoundingClientRect: with the ticket shrunk inside the avatar or the pill still pressed the rectangle is a few pixels off, and on resize the body ended up outside the avatar.
  • The rolling line below: the new sentence, absolutely positioned, took the old one’s width and ended in an ellipsis; now the window tweens to the new sentence’s width.
  • The Cancel that opens beside it must be measured with scrollWidth plus padding: measured closed it came out cut in half.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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