Skip to content
animorio
IT
All components

Hide balance toggle

Toggles, HoverGSAP, CSS onlyMediumCompressed weight: Demo 6.5 KBGSAP 28 KBFreeDownload the zip

The account card of a banking app, on white, in the style of product interface pieces: switching Hide balance on blurs the balance and the transactions one after another under a fine hatch while the eye closes its lid; switching it off rolls the figures back in from below, sharp. Pressing and holding a hidden figure shows it for as long as the finger stays down.

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>
<!--
  "Hide balance toggle" 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 Hide balance toggle that blurs the figures</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 account card of a banking app: switching Hide balance on blurs the balance and the amounts one after another
         under a fine hatch while the eye closes its lid; switching it off rolls the figures back in, sharp;
         a long press on the hidden balance shows it for a moment -->
    <section class="card" data-card aria-labelledby="hb-label">
      <header class="top">
        <span class="brand">
          <svg class="brand__mark" viewBox="0 0 20 20" aria-hidden="true">
            <rect x="1" y="1" width="18" height="18" rx="5.5"></rect>
            <path d="M5 12.2c1.6-1.6 3.4-1.6 5 0s3.4 1.6 5 0M5 8.2c1.6-1.6 3.4-1.6 5 0s3.4 1.6 5 0"></path>
          </svg>
          <span class="brand__name">Tidebank</span>
        </span>
        <span class="top__acc">Everyday account</span>
      </header>

      <div class="bal">
        <span class="bal__label">Available balance</span>
        <div class="num num--big" data-num data-peek aria-label="12,480.36 dollars">
          <span class="num__digits" data-digits>$12,480.36</span>
          <span class="num__veil" data-veil aria-hidden="true"></span>
        </div>
        <span class="bal__sub"><span data-sub>Updated just now</span></span>
      </div>

      <div class="row">
        <button class="eye" type="button" data-eye aria-hidden="true" tabindex="-1">
          <svg viewBox="0 0 24 24">
            <path class="eye__lid-top" d="M2.6 12c2.4-4 5.6-6 9.4-6s7 2 9.4 6"></path>
            <path class="eye__lid-bot" data-lidbot d="M2.6 12c2.4 4 5.6 6 9.4 6s7-2 9.4-6"></path>
            <circle class="eye__iris" data-iris cx="12" cy="12" r="3.1"></circle>
            <path class="eye__closed" data-closed d="M2.6 12c2.4 3.4 5.6 5.1 9.4 5.1s7-1.7 9.4-5.1"></path>
            <path class="eye__lash" data-lash d="M6.4 15.3 5 17.4M12 17.2v2.5M17.6 15.3l1.4 2.1"></path>
          </svg>
        </button>
        <div class="row__text">
          <span class="row__name" id="hb-label">Hide balance</span>
          <span class="row__hint"><span data-hint>Figures are visible</span></span>
        </div>
        <button class="sw" type="button" role="switch" aria-checked="false" aria-labelledby="hb-label" data-switch>
          <span class="sw__knob" data-knob></span>
        </button>
      </div>

      <ul class="moves" aria-label="Recent activity">
        <li class="move">
          <svg class="move__ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M6 9h10v4.5a5 5 0 0 1-10 0Z"></path><path d="M16 10.5h1.6a2 2 0 0 1 0 4H16"></path><path d="M9 4.5c0 1 1 1.4 1 2.4M12.4 4.5c0 1 1 1.4 1 2.4"></path></svg>
          <span class="move__text"><span class="move__name">Ferro Coffee</span><span class="move__when">Today, 08:12</span></span>
          <span class="num num--row" data-num data-peek><span class="num__digits" data-digits>−$4.80</span><span class="num__veil" data-veil aria-hidden="true"></span></span>
        </li>
        <li class="move">
          <svg class="move__ic" viewBox="0 0 24 24" aria-hidden="true"><rect x="3.5" y="6.5" width="17" height="11" rx="2.4"></rect><path d="M3.5 10.5h17"></path><path d="M7 14.5h3"></path></svg>
          <span class="move__text"><span class="move__name">Salary, Brightwell Ltd</span><span class="move__when">Oct 27</span></span>
          <span class="num num--row num--in" data-num data-peek><span class="num__digits" data-digits>+$3,200.00</span><span class="num__veil" data-veil aria-hidden="true"></span></span>
        </li>
        <li class="move">
          <svg class="move__ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M4 11.2 12 4.8l8 6.4"></path><path d="M6.2 9.6V19h11.6V9.6"></path><path d="M10.2 19v-5h3.6v5"></path></svg>
          <span class="move__text"><span class="move__name">Rent, Calder House</span><span class="move__when">Oct 25</span></span>
          <span class="num num--row" data-num data-peek><span class="num__digits" data-digits>−$1,450.00</span><span class="num__veil" data-veil aria-hidden="true"></span></span>
        </li>
      </ul>
      <p class="peek-tip"><span data-tip>Press and hold a hidden figure to peek</span></p>
    </section>

    <svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.2 19.2 11l-6.3 1.6-3.3 5.9Z"></path></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.

34 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 “Hide balance toggle” 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 very light grey background there is the white card of an invented bank, Tidebank: the everyday account, the big available balance, $12,480.36, the grey Hide balance row with the eye and the switch, and three transactions, a coffee, the salary in green and the rent. Switch on and the knob stretches and slides on a spring while the track turns blue; the eye closes its lid and the lashes come out; then the balance and the three amounts, one after another, blur and squeeze slightly while a finely hatched veil covers them from the left. The line under the balance rolls to «Hidden on this device» and under the transactions an invitation to press and hold appears. Pressing and holding a hidden figure, the veil shrinks a little and after a moment the figure comes back sharp for as long as the finger stays down; letting go hides it again. Switching off lifts the veil and the characters come back in from below one by one, sharp, with a small bounce. A drawn pointer hides, peeks at the balance and shows it again; it also works with the mouse, touch and the keyboard.

How it works

Each character in its own span

The script splits every figure into its characters, each one in an inline-block span: that way GSAP can blur them and roll them back in one after another with a stagger, without touching the text.

The blur and the veil

Hiding means three things at once: a filter blur on the characters, a slight squeeze in height and a veil on top, made of a repeating-linear-gradient at 135 degrees, that widens from the left with scaleX. The figures start one after another with a delay that is a knob.

The eyelid

The eye is an SVG with two arcs and the iris: closing it shrinks the iris to nothing, the arcs fade and the closed arc drops into their place with a back.out, then the lashes come out.

Press and hold to see

On the pointerdown of a hidden figure a delayedCall as long as HOLD starts; if the finger stays down the figure comes back sharp, and on pointerup or pointerleave it hides again. If the finger lifts earlier, the delayedCall is cancelled and the veil settles back with a small bounce.

Values to change

NameFileDefaultWhat it changes
BANKscript.jsTidebankThe bank’s name at the top.
BALANCEscript.js$12,480.36The available balance.
BLURscript.js7How much the hidden figures blur, in pixels.
STAGGERscript.js0.09The delay between one figure hiding and the next, in seconds.
HOLDscript.js0.35How long to hold a hidden figure before it shows, in seconds.
ACCENTscript.js#2f5beaThe colour of the switch when on.

Try them in the Playground

When to use it

For a banking, payments or investing app or a wallet, and for any page with numbers you do not want to show to whoever is looking at the screen: salaries, balances, private stats.

On phones

The card takes the width with a margin; the balance and the gaps are sized on the height too with clamp and vmin, and below 470 pixels of height the third transaction hides, so everything fits in the box. Press and hold with a finger works like the mouse and does not open the browser menu.

With reduced motion

No springs or rolls: the knob goes to its place, the figures blur and come back sharp as a fade, all together, and the eye changes with a fade. The fake pointer does not start.

Pitfalls

  • GSAP writes its own inline transform: the knob has no transform in the CSS, it is placed with left and top and GSAP only moves its x and width.
  • On phones a long press opens the text menu: the figures have user-select: none and the contextmenu is blocked.
  • Waits go into gsap.delayedCall and not setTimeout, so the site’s stage can pause and resume everything.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

Tested on 28 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 components