Skip to content
animorio
IT
Back to the library

3D payment cards

3D, HoverGSAP, CSS onlyMediumCompressed weight: Demo 7.1 KBGSAP 28 KBFreeDownload the zip

The cards screen of a made-up payments app, Halvik, in the style of today’s product components: four cards piled up in perspective like a tilted deck. On hover the stack opens up in 3D in steps with a short spring, each card with its own shadow on the floor; the pointer tilts the stack and a light runs over the card on top. On click the chosen card arcs out of the stack and lands in front, the others close back behind it, and below the name rolls and the balance counts up to its value.

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>
<!--
  "3D payment cards" 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 card stack that opens up in 3D on hover</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" data-stage>
    <!-- the cards screen of a made-up payments app: four cards piled up in perspective like a tilted deck. On hover the
         deck opens up in steps, the pointer tilts it and a light runs over the card on top; a click brings a card to the
         front and the others close back behind it -->
    <header class="head">
      <p class="eyebrow"><svg class="mark" viewBox="0 0 16 16" aria-hidden="true"><path d="M3 11.5 6.2 4.5 8 8.4l1.8-3.9 3.2 7"/></svg>Halvik</p>
      <h1 class="title">Your cards</h1>
    </header>

    <div class="deck" data-deck>
      <div class="tilt" data-tilt>
        <button class="card" type="button" data-card data-name="Everyday" data-end="4821" data-balance="2480.20" style="--c1:#1a1a1d;--c2:#0b0b0c;--ink:#f4f4f5;--sub:rgba(244,244,245,.55)">
          <span class="face">
            <span class="row">
              <span class="brand"><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M3 11.5 6.2 4.5 8 8.4l1.8-3.9 3.2 7"/></svg>Halvik</span>
              <svg class="wave" viewBox="0 0 20 20" aria-hidden="true"><path d="M7 5.5c1.6 1.2 2.4 2.7 2.4 4.5S8.6 13.3 7 14.5M10.4 3.5c2.2 1.7 3.3 3.9 3.3 6.5s-1.1 4.8-3.3 6.5M4 7.6c.8.6 1.2 1.4 1.2 2.4S4.8 11.8 4 12.4"/></svg>
            </span>
            <svg class="chip" viewBox="0 0 34 26" aria-hidden="true"><rect x="0.6" y="0.6" width="32.8" height="24.8" rx="5"/><path d="M0.6 9h10M0.6 17h10M23.4 9h10M23.4 17h10M11 0.6v24.8M23 0.6v24.8M11 13h12"/></svg>
            <span class="row foot"><span class="kind">Everyday</span><span class="end">4821</span></span>
          </span>
          <span class="sheen" data-sheen></span>
          <span class="edge"></span>
        </button>
        <button class="card" type="button" data-card data-name="Travel" data-end="0937" data-balance="864.75" style="--c1:#6d63f2;--c2:#3f37b8;--ink:#ffffff;--sub:rgba(255,255,255,.62)">
          <span class="face">
            <span class="row">
              <span class="brand"><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M3 11.5 6.2 4.5 8 8.4l1.8-3.9 3.2 7"/></svg>Halvik</span>
              <svg class="wave" viewBox="0 0 20 20" aria-hidden="true"><path d="M7 5.5c1.6 1.2 2.4 2.7 2.4 4.5S8.6 13.3 7 14.5M10.4 3.5c2.2 1.7 3.3 3.9 3.3 6.5s-1.1 4.8-3.3 6.5M4 7.6c.8.6 1.2 1.4 1.2 2.4S4.8 11.8 4 12.4"/></svg>
            </span>
            <svg class="chip" viewBox="0 0 34 26" aria-hidden="true"><rect x="0.6" y="0.6" width="32.8" height="24.8" rx="5"/><path d="M0.6 9h10M0.6 17h10M23.4 9h10M23.4 17h10M11 0.6v24.8M23 0.6v24.8M11 13h12"/></svg>
            <span class="row foot"><span class="kind">Travel</span><span class="end">0937</span></span>
          </span>
          <span class="sheen" data-sheen></span>
          <span class="edge"></span>
        </button>
        <button class="card" type="button" data-card data-name="Business" data-end="5560" data-balance="12904.00" style="--c1:#eef0f3;--c2:#d4d8de;--ink:#17181b;--sub:rgba(23,24,27,.5)">
          <span class="face">
            <span class="row">
              <span class="brand"><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M3 11.5 6.2 4.5 8 8.4l1.8-3.9 3.2 7"/></svg>Halvik</span>
              <svg class="wave" viewBox="0 0 20 20" aria-hidden="true"><path d="M7 5.5c1.6 1.2 2.4 2.7 2.4 4.5S8.6 13.3 7 14.5M10.4 3.5c2.2 1.7 3.3 3.9 3.3 6.5s-1.1 4.8-3.3 6.5M4 7.6c.8.6 1.2 1.4 1.2 2.4S4.8 11.8 4 12.4"/></svg>
            </span>
            <svg class="chip" viewBox="0 0 34 26" aria-hidden="true"><rect x="0.6" y="0.6" width="32.8" height="24.8" rx="5"/><path d="M0.6 9h10M0.6 17h10M23.4 9h10M23.4 17h10M11 0.6v24.8M23 0.6v24.8M11 13h12"/></svg>
            <span class="row foot"><span class="kind">Business</span><span class="end">5560</span></span>
          </span>
          <span class="sheen" data-sheen></span>
          <span class="edge"></span>
        </button>
        <button class="card" type="button" data-card data-name="Savings" data-end="2214" data-balance="6315.48" style="--c1:#c9d5c4;--c2:#9fb39a;--ink:#16211a;--sub:rgba(22,33,26,.55)">
          <span class="face">
            <span class="row">
              <span class="brand"><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M3 11.5 6.2 4.5 8 8.4l1.8-3.9 3.2 7"/></svg>Halvik</span>
              <svg class="wave" viewBox="0 0 20 20" aria-hidden="true"><path d="M7 5.5c1.6 1.2 2.4 2.7 2.4 4.5S8.6 13.3 7 14.5M10.4 3.5c2.2 1.7 3.3 3.9 3.3 6.5s-1.1 4.8-3.3 6.5M4 7.6c.8.6 1.2 1.4 1.2 2.4S4.8 11.8 4 12.4"/></svg>
            </span>
            <svg class="chip" viewBox="0 0 34 26" aria-hidden="true"><rect x="0.6" y="0.6" width="32.8" height="24.8" rx="5"/><path d="M0.6 9h10M0.6 17h10M23.4 9h10M23.4 17h10M11 0.6v24.8M23 0.6v24.8M11 13h12"/></svg>
            <span class="row foot"><span class="kind">Savings</span><span class="end">2214</span></span>
          </span>
          <span class="sheen" data-sheen></span>
          <span class="edge"></span>
        </button>
      </div>
    </div>

    <div class="caption" aria-live="polite">
      <p class="cname"><span class="roll" data-roll><span data-name-now>Everyday</span></span></p>
      <p class="balance"><span class="cur">€</span><span data-balance-now>2,480.20</span></p>
      <p class="hint" data-hint>Ending 4821 · Hover to open the stack</p>
    </div>

    <svg class="ghost" data-ghost viewBox="0 0 22 22" aria-hidden="true"><path d="M5 3.2v14.3l3.6-3.4 2.3 5.2 2.4-1-2.3-5.1h5z"/></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.

47 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 “3D payment cards” 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 white, under the Halvik mark and the title Your cards, four payment cards are piled up in perspective, tipped back and turned sideways like a deck lying on a table: a black Everyday, a violet Travel, a silver Business and a sage green Savings, each with the mark, the contactless sign, a drawn chip, the name and the last four digits. When the pointer comes in, the stack opens up in steps with a short spring that goes a pixel past and settles: the cards rise one above the other, fan out slightly and each carries its own blurred shadow on the floor, further and lighter the higher the card is. A light passes once over the card on top, and every card’s reflection follows the tilt: moving the pointer tilts the stack towards it. Clicking a card at the back, it squashes slightly, arcs up out of the stack and lands in front, the others step back behind it and the stack closes for a moment; below, the name rolls and the balance counts up to the new card’s value. The autopilot brings in a drawn pointer that tilts the stack and brings a different card forward each round.

How it works

A 3D scene in pixels

The stack is a preserve-3d container inside a box with a perspective in pixels, computed by the script as four card widths. The container tilts with rotateX, rotateY and rotateZ, and each card rises with translateZ: real depth decides which card is in front, with no z-index.

The springs

Opening, tilt and each card’s place are springs written by hand in GSAP’s ticker (stiffness 260, damping 23): they follow the pointer without restarting on every move and go a pixel past before settling.

To the front without a jump

The chosen card first arcs out of the stack (up in its plane and higher in depth), and only 0.16 seconds later changes place: so it passes over the others when it is already out, and the depth order changes without being seen.

Shadows and reflections

Each card has a blurred shadow just under the stack: it moves, widens and fades with the card’s height. The reflection is a soft-light band of light that moves with the tilt, and a tween runs it across the top card when the stack opens.

Values to change

NameFileDefaultWhat it changes
OPEN_GAPscript.js40How many pixels of height separate one card from the next when the stack is open (on a 300 wide card).
REST_GAPscript.js6The thickness of the closed stack: how many pixels between cards at rest.
ANGLE_Xscript.js56How far the stack is tipped back, in degrees.
ANGLE_Zscript.js-22How far the stack is turned in its plane, in degrees.
TILTscript.js9How many degrees the pointer tilts the stack.
STIFFNESSscript.js260The spring’s stiffness: higher is quicker.
DAMPINGscript.js23The spring’s damping: lower means more bounce.
SHEENscript.js0.6How visible the reflection on the cards is (0 = none).
PERSPECTIVEscript.js4The perspective, in card widths: lower is stronger.

Try them in the Playground

When to use it

For the cards screen of a payments or banking app, to pick a plan or an account, or to show a fintech’s products on a landing page: the stack says how many there are, hovering shows them all, a click picks one.

On phones

The same animation with the card sized on the box’s width and height. With a finger the first tap opens the stack and the second brings the tapped card forward; there is no pointer tilt.

With reduced motion

The stack stays open and still, with no tilt, springs or arcs: the chosen card comes to the front in a fade and the name and balance change in a fade.

Pitfalls

  • With preserve-3d two cards crossing in depth while they overlap on screen swap order abruptly: that is why the chosen card first arcs out and only then changes place.
  • A perspective in percent squashes the cards at the sides: it goes in pixels, recomputed on resize from the card size.
  • The shadows live in the same 3D container as the cards, just below them (translateZ -1): outside it they would not follow the tilt.
  • For the autopilot’s click it needs a point of the card that is actually visible: it looks for one with elementFromPoint over a grid inside its box.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

Tested on 26 October 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 animations