Skip to content
animorio
IT
All components

API key field

Forms, HoverGSAP, CSS onlyMediumCompressed weight: Demo 7.3 KBGSAP 28 KBFreeDownload the zip

The API keys card of a developer platform, on white: the key hides behind a row of dots in a monospaced field. The eye button opens its lid and the key scrambles into random letters that settle from left to right; the copy button folds its sheets into a drawn check and sends «Copied» up. Regenerate asks for confirmation right in the row, then the old key is wiped in strips and the new one types itself character by character.

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>
<!--
  "API key field" 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 API key field to reveal and copy</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 API keys card of a developer platform: a hidden key that reveals itself with a scramble settling left to right,
         a copy button whose icon turns into a drawn check, and a regenerate action that asks first, wipes the old key in strips and types the new one -->
    <section class="keys" data-card aria-label="Corriva API keys">
      <header class="keys__head">
        <svg class="keys__mark" viewBox="0 0 24 24" aria-hidden="true"><path d="M4 12a8 8 0 0 1 13.7-5.6"></path><path d="M20 12a8 8 0 0 1-13.7 5.6"></path><path d="M9 12h6"></path></svg>
        <div>
          <p class="keys__brand">Corriva <span>/ API keys</span></p>
          <p class="keys__sub">Use this key to call the Corriva API from your server.</p>
        </div>
      </header>

      <div class="keys__row">
        <p class="keys__label" id="etichetta">Production key</p>
        <p class="keys__scope">Full access</p>
      </div>

      <div class="field" data-field>
        <code class="field__key" data-key aria-labelledby="etichetta" aria-live="polite"></code>
        <div class="field__tools">
          <button class="tool" type="button" data-eye aria-label="Reveal key" aria-pressed="false">
            <svg class="tool__icon eye" viewBox="0 0 24 24" aria-hidden="true">
              <g class="eye__open" data-eye-open>
                <path d="M2.8 12c2.2-3.9 5.3-5.9 9.2-5.9s7 2 9.2 5.9c-2.2 3.9-5.3 5.9-9.2 5.9S5 15.9 2.8 12Z"></path>
                <circle class="eye__pupil" data-pupil cx="12" cy="12" r="2.9"></circle>
              </g>
              <g class="eye__shut" data-eye-shut>
                <path d="M3 11.2c2.3 2.5 5.3 3.8 9 3.8s6.7-1.3 9-3.8"></path>
                <path d="M6.2 13.6 4.9 15.6M12 15v2.4M17.8 13.6l1.3 2"></path>
              </g>
            </svg>
          </button>
          <span class="tools__sep" aria-hidden="true"></span>
          <button class="tool" type="button" data-copy aria-label="Copy key">
            <svg class="tool__icon copy" viewBox="0 0 24 24" aria-hidden="true">
              <g data-copy-sheets>
                <rect x="8.5" y="8.5" width="11" height="11" rx="2.4"></rect>
                <path d="M15.5 5.6V5.4c0-1.3-1-2.4-2.4-2.4H6.4C5 3 4 4 4 5.4v6.7c0 1.3 1 2.4 2.4 2.4h.2"></path>
              </g>
              <path class="copy__check" data-check d="M5.5 12.6 9.8 16.8 18.6 7.6"></path>
            </svg>
            <span class="tool__tip" data-tip>Copied</span>
          </button>
        </div>
      </div>

      <p class="keys__meta"><span data-created>Created Oct 12, 2026</span><span class="keys__gap" aria-hidden="true"></span><span data-used>Last used 2 min ago</span></p>

      <div class="keys__foot" data-foot>
        <div class="foot__idle" data-idle>
          <p class="foot__note">Keep it secret. Rotate it if it leaks.</p>
          <button class="ghostbtn" type="button" data-regen>
            <svg viewBox="0 0 24 24" aria-hidden="true"><path d="M19.4 9.2A7.6 7.6 0 0 0 5.6 7.8L4.4 9.4"></path><path d="M4.2 4.8v4.8H9"></path><path d="M4.6 14.8a7.6 7.6 0 0 0 13.8 1.4l1.2-1.6"></path><path d="M19.8 19.2v-4.8H15"></path></svg>
            <span>Regenerate</span>
          </button>
        </div>
        <div class="foot__ask" data-ask aria-hidden="true">
          <p class="foot__warn">The old key will stop working.</p>
          <div class="foot__btns">
            <button class="ghostbtn ghostbtn--plain" type="button" data-cancel tabindex="-1">Cancel</button>
            <button class="solidbtn" type="button" data-confirm tabindex="-1">Regenerate key</button>
          </div>
        </div>
      </div>
    </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.

26 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 “API key field” 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 sits the white API keys card of Corriva, an invented developer platform: the black mark, the line «Use this key to call the Corriva API from your server.», the Production key label with Full access beside it, and the grey field with the key hidden by a row of dots in a monospaced face. To the right of the field two drawn buttons: the closed eye, with its lashes, and the two sheets of the copy icon. Pressing the eye opens its lid with a small bounce, the pupil grows, the eye turns violet, and the dots turn into random violet letters that settle one after another from left to right, each with a one-pixel hop, until the real key is there. The copy button folds its sheets away, a green check draws itself in their place and a black Copied label rises above it, then fades. Under the key, the creation date and «Last used 2 min ago» in grey. Regenerate, at the bottom, does not regenerate straight away: the row slides off and in its place come the red warning «The old key will stop working.», Cancel and the black Regenerate key button. On confirming, the old key is wiped in strips of six characters, the new one types itself character by character, the field lights up with a violet border for a moment and the line below becomes Created just now and Never used. A drawn pointer does it all by itself and starts again; it also really works, with mouse, touch and keyboard, and the copy goes to the clipboard.

How it works

One character, one box

The key is a code element in a monospaced face with a 1ch-wide span for each character: the dot, the random letter and the real letter always take the same place, so the row never shifts sideways while it changes.

A scramble that settles

A GSAP tween runs a clock from zero to the chosen duration; on every frame each character checks two thresholds, when to start scrambling and when to stop, growing from left to right. Between the two it takes a random letter every other frame, after the second it takes its own and hops three pixels with back.out.

The lid and the check

The open eye is an SVG group squashed to 0.12 in height: opening brings it back to 1 with back.out while the pupil grows a moment later and the lashes fade upwards. The copy check is a stroke with a strokeDasharray that draws itself after the sheets have shrunk and gone.

Ask first, then wipe

Regenerate swaps the footer row for the confirmation row, which sits on top of it in absolute position: one rises and fades, the other comes up from below on a spring. On confirming, the old key splits into strips of six characters that squash one after another, then the new one is born with the same prefix and types itself with a 26 millisecond stagger.

The autopilot

A timeline with repeatRefresh takes the drawn pointer to the buttons reading their real position every time, turns on their hover state, presses them and calls the same functions as real clicks. At the first real touch it stops, and it starts again from the top after eight quiet seconds.

Values to change

NameFileDefaultWhat it changes
KEYscript.jscrv_live_7Hq2mXk9TzR4vLp8NwThe key the field hides and reveals.
ACCENTscript.js#5b5bd6The colour of the scrambling letters and of the new key’s border.
SCRAMBLE_TIMEscript.js0.9The seconds the key scrambles before it settles.
WIPE_TIMEscript.js0.6The seconds the old key takes to wipe in strips.
PAUSEscript.js1The seconds the autopilot waits between one gesture and the next.

Try them in the Playground

When to use it

For the settings of a developer platform or an AI app, a service’s tokens panel, a dashboard’s integrations page, any secret to show once and copy.

On phones

The card takes the full width minus the margins, the key drops to 10.5 pixels with 3.1vw and the buttons stay at 34 pixels, easy for a finger; under 380 pixels the footer text tightens a little so the warning and the buttons fit on one line. A tap does what a click does.

With reduced motion

No scramble and no hops: the key goes from dots to letters with a fade, the eye opens only in light, the check appears without drawing, the wipe and the new key are fades and the drawn pointer stays hidden.

Pitfalls

  • Without a fixed 1ch width per character the row jiggled sideways at every random letter, because even in monospaced faces the dot has a different width on some systems.
  • Changing every letter on every frame made an irritating noise: every other frame, offset per character, looks like a machine searching rather than a glitch.
  • navigator.clipboard may be missing or refuse (a page in an iframe, permissions): the call sits in a try with its catch, and the autopilot’s copy never touches the viewer’s clipboard.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

Compressed with gzip, the three demo files weigh 7.3 KB; the libraries: GSAP 28 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