Skip to content
animorio
IT
All components

Gift article button

Buttons, Hover, TransitionsGSAP, CSS onlyMediumCompressed weight: Demo 8.6 KBGSAP 28 KBFreeDownload the zip

The «Gift this article» button of an online magazine, dark on warm paper with light and grain, like a Dribbble shot: the little gift box, the words and the counter of the gifts left this month. Pressed, the lid pops, the counter rolls down by one and a coral thread runs along the bottom; then a satin ribbon with stitched edges unrolls over the button from the left, with a fold of light on its edge, and under it is the gift link, resolving letter by letter, already copied. After a moment the ribbon slides away.

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>
<!--
  "Gift 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>The Gift article button with the ribbon that wraps the link</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/mona-sans@5.3.0/wdth.css">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/jetbrains-mono@5.3.0/index.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <main class="stage">
    <!-- the Gift this article button of Loam, an invented online magazine. A dark pill with the gift box and the
         counter of the gifts left this month. Pressed, the lid lifts, the counter rolls down by one and a coral thread
         runs along the bottom; then a satin ribbon with stitched edges unrolls over the button from left to right and
         under it is the gift link, resolving letter by letter, already copied. After a moment the ribbon slides off -->
    <div class="gift" data-wrap>
      <span class="gift__floor" data-floor aria-hidden="true"></span>
      <button class="gift__btn" type="button" data-btn aria-label="Gift this article, 5 gifts left this month">
        <span class="gift__body" data-body>
          <span class="gift__clip">
            <span class="gift__shine" data-shine aria-hidden="true"></span>
            <span class="gift__thread" data-thread aria-hidden="true"></span>

            <span class="gift__face gift__face--rest" data-rest aria-hidden="true">
              <span class="gift__icon">
                <svg viewBox="0 0 24 24">
                  <rect class="gift__box" x="4.5" y="11.2" width="15" height="9" rx="1.6"/>
                  <path class="gift__ribbon" d="M12 11.2v9"/>
                  <g data-lid>
                    <rect class="gift__box" x="3.4" y="7.6" width="17.2" height="3.6" rx="1.1"/>
                    <path class="gift__ribbon" d="M12 7.6v3.6"/>
                    <g class="gift__bow" data-bow>
                      <path class="gift__ribbon" d="M12 7.5C10.6 4.6 7.4 4.4 7.6 6.2 7.8 7.5 10.2 7.6 12 7.5z"/>
                      <path class="gift__ribbon" d="M12 7.5c1.4-2.9 4.6-3.1 4.4-1.3-.2 1.3-2.6 1.4-4.4 1.3z"/>
                    </g>
                  </g>
                </svg>
              </span>
              <span class="gift__labels">
                <span class="gift__label" data-label>Gift this article</span>
                <span class="gift__label gift__label--busy" data-label>Wrapping link</span>
                <span class="gift__label gift__label--empty" data-label>No gifts left</span>
              </span>
              <span class="gift__chip" data-chip>
                <span class="gift__roll" data-roll><span class="gift__digits" data-digits></span></span><span class="gift__left">left</span>
              </span>
            </span>

            <span class="gift__ribbonface" data-ribbon aria-hidden="true">
              <span class="gift__satin" data-satin></span>
              <span class="gift__stitch gift__stitch--t"></span>
              <span class="gift__stitch gift__stitch--b"></span>
              <span class="gift__face gift__face--done">
                <span class="gift__icon gift__icon--link">
                  <svg viewBox="0 0 24 24">
                    <path d="M10.2 13.8a3.6 3.6 0 0 0 5.1 0l3-3a3.6 3.6 0 0 0-5.1-5.1l-1.1 1.1"/>
                    <path d="M13.8 10.2a3.6 3.6 0 0 0-5.1 0l-3 3a3.6 3.6 0 0 0 5.1 5.1l1.1-1.1"/>
                  </svg>
                </span>
                <span class="gift__link" data-link>loam.pub/g/K7xQ2</span>
                <span class="gift__copied" data-copied>
                  <svg viewBox="0 0 16 16"><path class="gift__check" data-check pathLength="1" d="M3.6 8.4l2.9 2.9 5.9-6.4"/></svg>
                  <span>Copied</span>
                </span>
              </span>
            </span>
            <span class="gift__fold" data-fold aria-hidden="true"></span>
          </span>
        </span>
      </button>
    </div>
    <p class="sr" aria-live="polite" data-live></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.

24 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 “Gift 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

On cream paper with a soft light from the top left, a coral warmth below and a very fine grain, a pill button 60 pixels tall stands alone, almost black, its top edge catching the light and a soft shadow on the paper. Inside, a small line drawn gift box with a coral ribbon and bow, the words «Gift this article» and a capsule with «5 left», the gifts left this month. With the mouse over it a warm light follows the pointer inside the button and the lid of the box lifts by a pixel, while the bow sways on a spring. Pressed, the button gives and springs back, the lid pops a little higher, the 5 rolls away upwards and the 4 arrives, passing the mark and settling, the words become «Wrapping link» with a band of light running through them and a coral thread runs along the bottom from left to right. Then a coral satin ribbon unrolls over the button from the left, with two white stitched edges, the fine weave of the fabric and a fold on its advancing edge: a lip of light and the shadow it throws on the black. Under the ribbon the gift link, «loam.pub/g/K7xQ2» in a monospaced type, resolves letter by letter from the left out of random letters, while a sheen crosses the satin; on the right a «Copied» capsule appears and draws its check. The button swells by a hair and settles, and its shadow on the paper warms to coral. After a moment the ribbon slides off to the right and the button is back, one gift fewer. At zero it says «No gifts left» and shakes its head; in this demo the month then starts again and the gifts come back. Until someone touches it, the button goes round by itself.

How it works

A layered pill

The button is a button element holding a body that only GSAP moves (the press's scale and shift) and, under it, a rounded clip that holds every layer: the light under the pointer (a radial-gradient on two CSS variables), the loading thread, the rest face, the ribbon and its fold. The black has a gradient from the top and six shadows: the one pixel edge, the light at the top, the inner shadow below and three soft shadows on the paper.

The rolling counter

The digits from 0 to 9 are a column behind a window 16 pixels tall; GSAP moves it by 16 pixels per digit with back.out, so the new digit passes the mark by a pixel and settles, and the capsule swells by 6% and comes back.

The ribbon is a clip-path

The ribbon is a whole layer already in place, revealed with clip-path: inset(0 right 0 left). An object with two values, p for the covered part and from for the part already slid away, is animated by GSAP and on every frame writes the clip-path and carries the fold (a 24 pixel gradient: satin, bright lip, shadow on the black) to the moving edge; on the way out the fold flips with scaleX -1.

Satin and stitches

The satin is a coral gradient from the top with two inner shadows, a weave of one pixel vertical lines every three and a slanted sheen three times the button's width that GSAP slides with background-position; the stitches are two one pixel lines with a repeating-linear-gradient of four pixels on and four off.

The link that resolves

While the ribbon opens a value t goes from 0 to 1 and every second frame rewrites the link: the letters before t are the real ones, the others random letters from an alphabet without ambiguous characters, while dots and slashes always stay in place. On a real press the link goes to the clipboard with navigator.clipboard.

Values to change

NameFileDefaultWhat it changes
LABEL_RESTscript.jsGift this articleThe words at rest.
LABEL_BUSYscript.jsWrapping linkThe words while the link is made.
GIFT_LINKscript.jsloam.pub/g/K7xQ2The gift link under the ribbon.
GIFTSscript.js5The gifts left this month at the start, from 1 to 9.
WRAPscript.js0.9How many seconds the thread takes to run along the bottom.
UNROLLscript.js0.62How many seconds the ribbon takes to cover the button.
HOLDscript.js1.8How many seconds the ribbon stays before sliding off.
SPRINGscript.js1How springy the press is: 0.4 calm, 2 very bouncy.
AUTOscript.jstrueThe button goes round by itself until someone touches it.

Try them in the Playground

When to use it

For a magazine or a paid newsletter that lets readers gift a few articles a month, for a blog with members only posts, for a podcast gifting an episode: the button tells how many gifts are left and turns the link into a small parcel, so sharing feels like a gesture and not a copy and paste.

On phones

On the phone the button is at most 84% of the screen wide and the ribbon measures its width on every frame; without hover the light turns on under the finger at the touch, and the rest is the same.

With reduced motion

Nothing moves: the lid stays still, the counter changes with a fade, the thread fades in, the ribbon appears and disappears with a fade with the link already written and the check already drawn, and at zero the button does not shake its head but the words dim.

Pitfalls

  • The button element centres its text on its own: the monospaced link, taking all the free space, ended up in the middle with a gap after the icon. The faces have text-align: left.
  • The fold drawn with its light side towards the black looked like a bar laid on top: the satin sits on the ribbon's side, then the bright lip, then the shadow falling on the black ahead, and on the way out the fold flips.
  • At the end of the exit the fold stayed lit on the right edge for a frame: it fades out in the last 0.14 seconds.
  • While the ribbon covers the button the face beneath goes back to rest (words, thread, counter already new): so when the ribbon slides off it uncovers the button ready, without a second change.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0, JetBrains Mono (font variabile) 5.3.0.

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

Testing

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