Skip to content
animorio
IT
All components

Unlock article button

Buttons, Hover, SVGGSAP, CSS onlyMediumCompressed weight: Demo 4.6 KBGSAP 28 KBFreeDownload the zip

The button on top of a metered article: a dark pill with a lock and three golden bars, the free reads left this month. Pressed, the lock’s shackle jumps up and swings open on a spring, one bar runs down, a golden sheen crosses the pill and the label says how many reads are left.

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>
<!--
  "Unlock article button" 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>Unlock this article button with the lock that opens and the free reads that run down</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 button on top of a metered article: three small bars say how many free reads are left this month;
         pressed, the lock's shackle springs open, one bar drains, a sheen crosses the pill and the label says
         how many reads are left; after a moment it goes back, so the demo can be tried again -->
    <button class="unlock" type="button" data-unlock aria-pressed="false">
      <span class="unlock__glow" aria-hidden="true"></span>
      <span class="unlock__body" aria-hidden="true"><span class="unlock__wash" data-wash></span><span class="unlock__sheen" data-sheen></span><span class="unlock__light"></span></span>
      <span class="unlock__edge" aria-hidden="true"></span>

      <span class="seat" data-seat aria-hidden="true">
        <svg viewBox="0 0 24 24"><path data-shackle d="M8.4 11.2V8.4a3.6 3.6 0 0 1 7.2 0v2.8"></path><rect x="5.6" y="11.2" width="12.8" height="9" rx="2.6"></rect><path class="seat__hole" d="M12 14.6v2.2"></path></svg>
      </span>

      <span class="label"><span class="label__word" data-word>Unlock this article</span></span>

      <span class="reads" data-reads aria-hidden="true"><i></i><i></i><i></i></span>
    </button>
    <p class="sr" data-live aria-live="polite"></p>

    <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.

13 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 “Unlock article button” 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, on black, a dark pill 60 pixels tall with an edge that catches light: on the left, in a round seat, a closed lock drawn in line, then the label ‘Unlock this article’ and on the right three vertical golden bars, tall and lit. The pointer arrives, the pill lifts by a pixel and a soft light follows it; on press it squeezes and comes back on a spring. On click the lock’s shackle gives a small push down, then jumps up and swings open with a bounce, the lock and the seat take the gold, the third bar drops and dims, a golden sheen crosses the pill from left to right, a golden light appears underneath and the label rolls to ‘2 free reads left’. After a few seconds, or at another click, the shackle snaps shut, the bar rises again and the first label returns: it is a demo, the read is given back. Left alone, a pointer tries it again.

How it works

The lock

The shackle is a separate SVG path, with its rotation origin on its right foot (svgOrigin): first it drops 0.9 units, then rises 1.4 and rotates OPEN degrees with elastic.out. The body stays still.

The reads

The three bars scale vertically from the bottom: the ones left are tall and lit, the ones used are short and at 30%. On unlock, the last one left goes from one state to the other with back.out, two tenths after the lock.

The sheen and the light

Inside the pill a slanted band slides from minus 100% to 100% of the width; a golden veil stays on the lock’s side and a blurred halo lights up under the pill.

The label

It leaves upwards and the new one comes in from below; the text depends on how many reads are left: ‘2 free reads left’, ‘1 free read left’ or ‘your last free read’.

Values to change

NameFileDefaultWhat it changes
IDLEscript.jsUnlock this articleThe label at rest.
FREEscript.js3How many free reads are left this month, 1 to 3.
OPENscript.js34By how many degrees the lock’s shackle opens.
SPRINGscript.js0.8How long the lock’s spring lasts, in seconds.
ACCENTscript.js#f3c24fThe colour of the reads and the light.
HOLDscript.js2.6By itself: how many seconds it stays open before going back.
LOOPscript.jstrueLeft alone, a pointer tries it by itself.

Try them in the Playground

When to use it

For a newspaper, an online magazine, a blog or a newsletter with a few free articles a month: the button says at once how many reads are left, before and after, with no separate notice. On a real site, after unlocking the article opens and the button does not go back.

On phones

The same button: the pill takes at most the screen width minus the margins and the long label is cut with an ellipsis.

With reduced motion

No springs and no sheen: the lock appears already open, the bar changes with a fade and the label changes with a fade.

Pitfalls

  • The shackle rotates round the foot that stays in the lock’s body: with the origin at the centre it would seem to come off.
  • The bars tell screen reader users how many reads are left only thanks to the text line: by themselves they are decoration (aria-hidden).
  • The real count of reads lives on the server: the button shows it, it does not decide it.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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