Skip to content
animorio
IT
All components

Black Friday button

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

The ‘Unlock early access’ button for an online shop’s members-only Black Friday: a near-black pill on white with a small line lock. On hover the lock gives a little shake and a thin light runs along the edge; pressed, the shackle lifts and swings on its pivot, lime floods the pill from the lock, the pill widens, the label rolls to ‘−40% unlocked’ and a real countdown starts with rolling figures, then ‘Shop the sale’ arrives with the arrow. A small × locks it again.

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>
<!--
  "Black Friday 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>Black Friday early access button with the lock that opens</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 members-only button of an online shop on Black Friday: a near-black pill with a small line lock on the
         right. Pressed, the shackle lifts and swings open on its pivot, the lime floods the pill from the lock, the
         pill widens, the label rolls to the discount and a real countdown starts, then Shop the sale with the arrow.
         A small close button (or a few seconds in the demo) locks it again -->
    <div class="bf" data-wrap>
      <span class="bf__glow" aria-hidden="true"></span>
      <span class="bf__body" aria-hidden="true">
        <span class="bf__fill" data-fill></span>
        <span class="bf__sheen" data-sheen></span>
        <span class="bf__light"></span>
      </span>
      <span class="bf__edge" aria-hidden="true"></span>
      <span class="bf__ray" data-ray aria-hidden="true"></span>

      <button class="bf__btn" type="button" data-btn data-autoclic aria-pressed="false" aria-describedby="bf-note">
        <span class="bf__text">
          <span class="line line--top"><span class="line__in" data-top>Unlock early access</span></span>
          <span class="line line--sub" id="bf-note"><span class="line__in" data-sub>Black Friday &middot; members only</span></span>
        </span>
        <span class="seat" data-seat aria-hidden="true">
          <svg class="lock" viewBox="0 0 24 24">
            <g data-lock>
              <g data-lift>
                <g data-arc>
                  <path class="lock__arc" d="M8.6 13.4V8.3a3.4 3.4 0 0 1 6.8 0v3"></path>
                </g>
              </g>
              <rect class="lock__body" x="5.8" y="11.1" width="12.4" height="9.2" rx="2.6"></rect>
              <path class="lock__hole" d="M12 14.6v2.2"></path>
            </g>
          </svg>
        </span>
      </button>

      <button class="bf__close" type="button" data-close aria-label="Lock the offer again" tabindex="-1">
        <svg viewBox="0 0 24 24" aria-hidden="true"><path d="M8 8l8 8M16 8l-8 8"></path></svg>
      </button>
    </div>
    <p class="sr" data-live aria-live="polite"></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.

18 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 “Black Friday 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 white, a near-black pill 60 pixels tall with a soft shadow under it: on the left the label ‘Unlock early access’ and under it, small and grey, ‘Black Friday · members only’; on the right, in a dark round seat, a small lock drawn in white lines. The pointer arrives, the pill lifts by a pixel, a light follows it inside, the lock shakes as if tugged and a thin light runs once round the edge. On press the pill squeezes and comes back on a spring; the shackle lifts and swings on the pivot of its long leg, the lock gives a small kick, and lime floods the pill in a widening circle from the lock while the pill grows sixty pixels wider; a sheen crosses it and the shadow under it turns into a lime light. The label rolls to ‘−40% unlocked’, now dark, and the line under it becomes ‘Ends in 2d 06:12:09’, a real countdown where every figure that changes rolls up; the open lock turns lime on a black disc and a small × spins in on the right. A moment later the label becomes ‘Shop the sale’ with the arrow coming in from the left. Touching the × (or, in the demo, after a few seconds) closes it all again: the lime goes back into the lock, the pill narrows, the shackle drops into the body with a click.

How it works

The lock in three groups

In the SVG the shackle sits inside two groups: the outer one lifts by 2.6 units, the inner one rotates by SWING degrees with svgOrigin 8.6 13.4, the foot of the long leg, the real pivot. The long leg goes into the lock body, drawn after it and filled with the seat colour, so it stays attached as it lifts. A third group, the whole lock, shakes round the centre of the body.

The lime that starts from the lock

The accent colour is a layer inside the pill’s body, cut by a clip-path circle: its centre is worked out in percent where the lock will sit once the pill is wide, and the radius goes from 0 to 120%. Closing, the centre is read back from the style and the circle goes back to 0.

The pill that widens

Widths in pixels from the window (at most the width minus 32): the pill and the button inside widen together with back.out, the button 44 pixels less to leave room for the ×, which is a separate button. On resize the widths are set again, even half way through.

The countdown

The end of the offer is fixed when the page opens (ENDS). The GSAP ticker compares the figures with the real second every frame and rolls only those that changed: each figure has its own window with overflow hidden, the old one rises and fades, the new one comes from below with a pixel of overshoot.

The light on the edge

A conic-gradient with a single light band, seen through a one-pixel ring (mask with content-box and exclude): GSAP turns the --a variable from minus 40 to 320 degrees once, when the pointer arrives.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#d4ff3aThe colour that fills the pill when it opens.
DISCOUNTscript.js40The discount that unlocks, in percent.
CTAscript.jsShop the saleThe label that comes after the discount.
ENDSscript.js2d 06:12:09How long is left before the offer ends when the page opens.
WIDENscript.js60By how many pixels the unlocked pill widens.
SWINGscript.js32By how many degrees the shackle swings on its pivot.
SPRINGscript.js1How lively the springs are: 0.4 calm, 2 very bouncy.
RESETscript.js5After how many seconds the demo locks again by itself (0 = stays open).

Try them in the Playground

When to use it

For the Black Friday or sale page of an online shop, for early access kept for newsletter subscribers or members, for a timed drop or a presale: the button that makes you feel you opened something and shows at once how long is left.

On phones

The same button: the widths always stay inside the screen minus the margins. On touch there is no light following the pointer nor the hover shake; the rest is the same, and the × is 30 pixels wide.

With reduced motion

No springs, no swings and no rolling lines: the lime fades in, the pill is wide at once, the lock is already open, the labels and figures change with a fade.

Pitfalls

  • The shackle rotates with svgOrigin on the real pivot inside the viewBox (8.6 13.4), and the lift sits on a separate group: rotation and lift on the same element shift the pivot in ways that are hard to predict.
  • A button cannot sit inside another: the × is a sibling button, above the pill, and the main button narrows by 44 pixels to make room for it.
  • With the click autopilot the stage clicks every few seconds: a synthetic click on the open pill does nothing, so the demo reaches its own return instead of skipping.
  • The centre of the lime circle must be where the lock will be once the pill is wide, not where it is before the click, or the colour starts off to one side.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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