Skip to content
animorio
IT
Back to the library

Virtual card reveal

Text, HoverGSAP, CSS onlyMediumCompressed weight: Demo 7.5 KBGSAP 28 KBFreeDownload the zip

A text and hover animation for a banking app: the graphite virtual card with its number hidden behind thin bars. Passing over it a band of light crosses it and every digit develops exactly when the light touches it, wide and heavy on the variable font's axes, then settles to its width on a small elastic. The card leans toward the pointer and the pill underneath changes its words: Show details, Copy number, Copied.

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>
<!--
  "Virtual card reveal" 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 virtual card with the number that reveals itself as you pass</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 virtual card of a banking app. The number is hidden behind thin bars; passing over the card a band of
         light crosses it and every digit develops where the light touches it, wide and heavy for an instant, then it
         settles to its normal width. The pill under the card changes its words: Show details, Copy number, Copied -->
    <div class="wallet" data-wallet>
      <div class="card" data-card>
        <div class="card__body" data-body>
          <span class="card__grain" aria-hidden="true"></span>
          <span class="card__aura" data-aura aria-hidden="true"></span>
          <span class="card__sheen" data-sheen aria-hidden="true"></span>
          <header class="card__head">
            <span class="card__brand">norrow</span>
            <span class="card__kind">Virtual</span>
          </header>
          <div class="card__marks" aria-hidden="true">
            <svg class="card__chip" viewBox="0 0 34 26">
              <defs>
                <linearGradient id="chip" x1="0" y1="0" x2="1" y2="1">
                  <stop offset="0" stop-color="#d9d4c7"/>
                  <stop offset=".5" stop-color="#9c978b"/>
                  <stop offset="1" stop-color="#cfc9ba"/>
                </linearGradient>
              </defs>
              <rect x=".5" y=".5" width="33" height="25" rx="5" fill="url(#chip)"/>
              <path d="M.5 9h10M.5 17h10M23.5 9h10M23.5 17h10M10.5 .5v25M23.5 .5v25M10.5 13h13" fill="none" stroke="rgba(40,38,34,.45)" stroke-width=".8"/>
            </svg>
            <svg class="card__wave" viewBox="0 0 18 20">
              <path d="M4 6.5a5 5 0 0 1 0 7M8 4a8.5 8.5 0 0 1 0 12M12 1.5a12 12 0 0 1 0 17" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"/>
            </svg>
          </div>
          <p class="card__number" data-number aria-hidden="true"></p>
          <footer class="card__foot">
            <span class="card__field">
              <span class="card__label">Card holder</span>
              <span class="card__value">Ava Lindqvist</span>
            </span>
            <span class="card__field">
              <span class="card__label">Expires</span>
              <span class="card__value">08/29</span>
            </span>
            <span class="card__field card__field--cvv">
              <span class="card__label">CVV</span>
              <span class="card__value card__digits" data-cvv></span>
            </span>
          </footer>
        </div>
      </div>
      <div class="row">
        <span class="row__name">
          <span class="row__title">Groceries card</span>
          <span class="row__note" data-note>Number hidden</span>
        </span>
        <button class="pill" type="button" data-pill>
          <span class="pill__face" data-face>
            <svg class="pill__icon" viewBox="0 0 16 16" aria-hidden="true">
              <g class="pill__eye" data-eye>
                <path d="M1.6 8s2.4-4.4 6.4-4.4S14.4 8 14.4 8 12 12.4 8 12.4 1.6 8 1.6 8z"/>
                <circle cx="8" cy="8" r="2"/>
              </g>
              <g class="pill__copy" data-copy>
                <rect x="5.2" y="5.2" width="8" height="8.6" rx="2"/>
                <path d="M10.6 3.4V3.1a1.5 1.5 0 0 0-1.5-1.5H4a1.8 1.8 0 0 0-1.8 1.8v5.4a1.5 1.5 0 0 0 1.5 1.5h.3"/>
              </g>
              <path class="pill__check" data-check pathLength="1" d="M3.4 8.4l3 3 6.2-6.6"/>
            </svg>
            <span class="pill__words" data-words>Show details</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.

28 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 “Virtual card reveal” 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 a graphite card with round corners and a violet aura in the top corner rises slowly: the ‘norrow’ brand, the ‘Virtual’ label, the silver chip, the contactless mark, the number in four groups, the name ‘Ava Lindqvist’, the expiry and the CVV. The first twelve digits and the CVV are hidden behind thin bars; only the last four show, 4821. Under the card, on the left ‘Groceries card’ with ‘Number hidden’, on the right the light ‘Show details’ pill with its eye. Passing over it a band of light crosses the card from the side you come in and every digit develops exactly when the light reaches it: its bar shrinks and disappears, the figure rises out of a blur wide and heavy (width 125 and weight 760 of the variable font) and settles to its normal width on a small elastic that passes the mark by a pixel. The card leans a few degrees toward the pointer and the aura follows. The pill changes its words squeezing and widening on the width axis: ‘Copy number’ with the copy icon, and on a click ‘Copied’ with a checkmark drawing itself, while the number blinks softly and the note says ‘Copied to clipboard’. Leaving, the digits go back behind their bars starting from the far side. Left alone, the card does it all by itself: enter, reveal, look around, copy, leave.

How it works

Each digit in its cell

The script splits the number into cells 0.6 em wide, each holding the digit and, on top, the bar that hides it. The cell never changes width: so the digit can swell on the wdth axis without pushing the others.

The light sets the delay

On a pass the band of light crosses the card in 0.85 s from the side the pointer comes in. Each digit's delay is the position of its centre along that path, measured at that moment: the digit develops exactly when the light passes over it.

Wide and heavy, then in place

The bar shrinks to zero, the digit rises 5 px out of a blur at width 125 and weight 760 (two CSS variables inside font-variation-settings, tweened by GSAP), then goes back to 100 and 500 on an elastic.out(1, 0.5): it passes the mark slightly and settles.

The pill that changes words

The old label leaves squeezing to width 75, the new one comes in at 125 and settles; the pill measures the new label's width and gets there on a back.out. The three icons (eye, copy, check) swap with a small scale; the check draws itself with stroke-dashoffset.

The walk on its own

A GSAP timeline moves a fake pointer that tilts the card, comes in from the left, reveals, goes down to the pill, copies and leaves on the right. At the first real mouse move or the first touch the timeline stops and whoever is watching takes over.

Values to change

NameFileDefaultWhat it changes
NUMBERscript.js'4921 0738 5562 4821'The card number, in four groups: the last one always stays visible.
CVVscript.js'417'The three digits on the back.
SWELLscript.js125How wide a digit is while it develops (width axis, 75 to 125).
WEIGHTscript.js760How heavy a digit is while it develops (200 to 900).
SETTLEscript.js0.9How long a digit takes to settle, in seconds.
SWEEPscript.js0.85How long the light takes to cross the card, in seconds.
TILTscript.js5How far the card leans toward the pointer, in degrees.
SPEEDscript.js12 = the walk on its own twice as fast, 0.5 = half.
LOOPscript.jstrueRepeats the walk on its own.

Try them in the Playground

When to use it

For the app or website of a bank, a fintech, a digital wallet or a virtual card service: the card screen where the details show only when they are needed, and for the landing page of a payment product.

On phones

The same animation with adapted sizes: the card is as wide as the box allows and the words are sized on its width; with a finger a tap on the card reveals or hides the number and the pill copies it.

With reduced motion

No light crossing, no tilt and no swelling digits: the bars and the digits swap with a fade, and the pill's words change with a fade.

Pitfalls

  • If the digit sits in an auto-width element, swelling it on the wdth axis pushes all the others and the number jitters: each digit goes into a fixed-width cell.
  • Each digit's delay has to be measured at the moment of the pass, not once at the start: the card changes width on resize and the light comes in from different sides.
  • Leaving the card to reach the pill the number must not hide: the hover sits on the group of card and pill, not on the card alone.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

Tested on 10 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 animations