Skip to content
animorio
IT
All components

Currency converter

Forms, HoverGSAP, CSS onlyMediumCompressed weight: Demo 9.7 KBGSAP + Flip 37 KBFreeDownload the zip

The converter of an app for sending money abroad, on near-white grey: two fields, You send and They receive, with the amount set large and the currency in a pill. On every change the digits roll in their columns to the new value and any extra ones come in widening; the round button in the middle turns half a turn and swaps the two rows, the pill opens the currency menu and underneath the rate updates, with a thin arc counting down the thirty seconds the rate stays locked.

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>
<!--
  "Currency converter" 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 currency converter with rolling digits</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>
    <!-- a money transfer card: two fields, a round swap button between them, digits that roll to every new value,
         the live rate underneath and an arc that counts down how long the rate stays locked -->
    <section class="card" aria-label="Tidewire currency converter">
      <header class="card__head">
        <span class="card__title">Send money</span>
        <span class="card__brand">Tidewire</span>
      </header>

      <div class="rows" data-rows>
        <div class="row" data-row="send">
          <span class="row__label">You send</span>
          <div class="row__slot" data-slot>
          <div class="amt" data-amt="a">
            <label class="sr-only" for="amt-a">Amount</label>
            <input class="amt__input" id="amt-a" data-input type="text" inputmode="decimal" autocomplete="off" spellcheck="false">
            <div class="amt__num" data-num aria-hidden="true"></div>
            <span class="amt__caret" data-caret aria-hidden="true"></span>
            <button class="pill" type="button" data-pill aria-haspopup="listbox" aria-expanded="false">
              <span class="pill__sym" data-sym></span>
              <span class="pill__code" data-code></span>
              <svg class="pill__chev" viewBox="0 0 16 16" aria-hidden="true"><path d="M4.5 6.5 8 10l3.5-3.5"></path></svg>
            </button>
          </div>
          </div>
        </div>

        <button class="swap" type="button" data-swap aria-label="Swap currencies">
          <svg class="swap__icon" data-swap-icon viewBox="0 0 20 20" aria-hidden="true">
            <path d="M7 3.5v12M3.8 6.7 7 3.5l3.2 3.2"></path>
            <path d="M13 16.5v-12M9.8 13.3l3.2 3.2 3.2-3.2"></path>
          </svg>
        </button>

        <div class="row" data-row="receive">
          <span class="row__label">They receive</span>
          <div class="row__slot" data-slot>
          <div class="amt" data-amt="b">
            <label class="sr-only" for="amt-b">Converted amount</label>
            <input class="amt__input" id="amt-b" data-input type="text" inputmode="decimal" autocomplete="off" spellcheck="false">
            <div class="amt__num" data-num aria-hidden="true"></div>
            <span class="amt__caret" data-caret aria-hidden="true"></span>
            <button class="pill" type="button" data-pill aria-haspopup="listbox" aria-expanded="false">
              <span class="pill__sym" data-sym></span>
              <span class="pill__code" data-code></span>
              <svg class="pill__chev" viewBox="0 0 16 16" aria-hidden="true"><path d="M4.5 6.5 8 10l3.5-3.5"></path></svg>
            </button>
          </div>
          </div>
        </div>
      </div>

      <div class="meta">
        <p class="rate" aria-live="polite"><span>1</span> <span data-rate-from></span> <span class="rate__eq">=</span> <span class="rate__num" data-rate-num></span> <span data-rate-to></span></p>
        <p class="lock">
          <svg class="lock__arc" viewBox="0 0 16 16" aria-hidden="true">
            <circle class="lock__track" cx="8" cy="8" r="6"></circle>
            <circle class="lock__ring" data-lock-ring cx="8" cy="8" r="6"></circle>
          </svg>
          <span class="lock__text" data-lock-text>Rate locked for <span class="lock__num" data-lock-num></span>s</span>
        </p>
      </div>

      <button class="cta" type="button" data-cta>Review transfer</button>
    </section>

    <div class="menu" data-menu role="listbox" aria-label="Currency" hidden>
      <span class="menu__hi" data-hi aria-hidden="true"></span>
    </div>

    <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="https://cdn.jsdelivr.net/npm/gsap@3.15.0/dist/Flip.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.

27 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 “Currency converter” 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

In the middle of a near-white grey background sits the white card of Tidewire, a made-up app for sending money: Send money at the top, then two rounded grey fields, You send and They receive, each with the amount set large in equal-width digits and on the right a white pill with the currency symbol in a small blue circle, the code and a chevron. Between the two fields a round button with two arrows, set into the card by a white rim. Below, the rate, 1 USD = 0.9213 EUR, and on the right Rate locked for 30s with a thin arc wearing down second by second while the number of seconds rolls; at the bottom the black Review transfer button. A fake pointer comes in and taps the amount: the field turns white with a blue border, the number is highlighted and then cleared, and the pointer types 2,450 one digit at a time: with every key the digits of both fields roll in their columns to the new value, pass their place by a hair and settle, extra digits come in widening, while the blue caret follows the end of the number. Then it presses the swap: the arrows make half a turn with a bounce and the two amounts with their pills trade rows, sliding, and the bottom one works itself out again, rolling. Finally it opens the bottom pill: the menu of five currencies opens on a spring, the grey light slides from item to item, the pointer picks the pound and the pill changes code with a little hop, the rate updates and the arc refills. Then it starts again with another amount and another currency.

How it works

One column per digit

Each digit is a window one line tall holding the column of numbers from 0 to 9: to show a 7 the column rises by 70% of its height (yPercent -70). Digits are aligned from the right, so when the number changes each place knows which digit it had before and only rolls as far as it needs to; commas and the point are fixed places. A gradient mask fades the column at the top and the bottom.

Digits that come and go

If the number gets longer, the new places come in on the left with their width growing from zero while their column rolls from 0; if it gets shorter, the extra ones shrink to zero and disappear. The curve is back.out(1.15): the digit passes its place by a hair and comes back, and the digits start 25 milliseconds apart from the left.

The swap with Flip

The two blocks, amount and pill, are the same elements changing rows: Flip.getState records them, appendChild moves them, Flip.from slides them from the old position to the new one. The one arriving at the top becomes the amount to send and the bottom one works itself out again, rolling. The arrows turn a further 180 degrees with every swap.

The menu and the arc

The menu opens below the pill, or above when there is no room, on a spring with the items arriving staggered; a grey light slides under the item being pointed at and the other field’s currency is greyed out. The arc is a circle with stroke-dasharray: a thirty second linear tween wears it down and rolls the seconds; picking a currency refills it, and when it reaches zero the rate moves very slightly and starts again.

A real field

Over the number sits a transparent input with inputmode decimal: you really type, the value is cleaned up (a single point, the right decimals for the currency, none for the yen) and the number follows it, rolling. At the first touch or key press the fake pointer stops.

Values to change

NameFileDefaultWhat it changes
START_AMOUNTscript.js1000The amount the You send field starts from.
AMOUNTSscript.js2450, 1200, 860The amounts the autopilot types, one per round.
ACCENTscript.js#3b5bfdThe accent colour: caret, arc, symbols and the active field’s border.
ROLLscript.js0.7How long a digit takes to roll, in seconds.
STAGGERscript.js0.025The delay between one digit and the next, from the left.
BOUNCEscript.js1.15How far the digit passes its place before settling (1 = none).
SWAP_TIMEscript.js0.6How long the two rows take to swap, in seconds.
LOCK_SECONDSscript.js30How many seconds the rate stays locked.

Try them in the Playground

When to use it

For a payments or international transfer app, the checkout of a shop selling abroad, a calculator on a pricing page, a finance dashboard: anywhere a number changes and you want to show what changed.

On phones

The card narrows to the screen width with less padding, the fields get shorter and the amount drops to 26 pixels; the menu opens above the pill when there is no room below. Tapping the field opens the numeric keyboard.

With reduced motion

The digits change without rolling, with a short fade; the swap happens in place with a fade, the arrows and the menu do not bounce and the fake pointer is not shown.

Pitfalls

  • The digits must be tabular (font-variant-numeric: tabular-nums) and the window 1ch wide: with proportional digits the 1 is narrower and the number jiggles at every roll.
  • Digits are aligned from the right: aligned from the left, adding a leading digit would roll all the others.
  • Flip.from with absolute: true, so the two blocks do not push the rows during the swap; the editable field has to move to the block arriving at the top (readOnly on the other).
  • The caret is drawn and follows the last digit on every frame (gsap.ticker): the real caret of the transparent input would not know where the digits are.

Libraries

GSAP 3.15.0, Flip (plugin di GSAP) 3.15.0, Mona Sans (font variabile) 5.3.0.

Compressed with gzip, the three demo files weigh 9.7 KB; the libraries: GSAP + Flip 37 KB.

Testing

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