Skip to content
animorio
IT
Back to the library

Pharmacy pickup transition

Transitions, HoverGSAP, CSS onlyMediumCompressed weight: Demo 12 KBGSAP 28 KBFreeDownload the zip

The page transition of Calden Pharmacy, a made-up neighbourhood pharmacy: the summary of a click and collect order with three medicines becomes the pickup ticket. With «Confirm pickup» the three drawn packs slide into a paper bag that shuts with a fold and a staple, the bag flies into the icon of the ticket, the card grows into the ticket, the stub tears along the perforation and the pickup number rolls to its digits. «Back» goes the way home.

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>
<!--
  "Pharmacy pickup transition" 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>Calden Pharmacy, from the order to the pickup ticket</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/geist-mono@5.3.0/index.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <!-- Calden Pharmacy, a made-up neighbourhood pharmacy. The first page is the summary of a click and collect order:
       three medicines with small packs drawn in SVG. Press Confirm pickup and the packs slide into a paper bag that
       folds shut and takes a staple, the bag shrinks into the icon of the pickup ticket, the card grows into the
       ticket and its stub tears along the perforation, and the pickup number rolls to its digits. Back goes home -->
  <main class="stage" data-stage>
    <div class="wrap" data-wrap>

      <div class="stub" data-stub aria-hidden="true">
        <span class="stub__teeth" data-teeth></span>
        <div class="stub__paper">
          <span class="stub__perf" data-perf></span>
          <svg class="stub__code" data-code viewBox="0 0 220 40" preserveAspectRatio="none"></svg>
          <div class="stub__row">
            <span class="stub__num">CLD 2140 7781</span>
            <span class="stub__note">Show at the counter</span>
          </div>
        </div>
      </div>

      <article class="card" data-card>
        <span class="card__paper" aria-hidden="true"></span>
        <span class="card__teeth" data-teeth aria-hidden="true"></span>
        <span class="card__sheen" data-sheen aria-hidden="true"></span>

        <section class="page page--order" data-order aria-label="Your order">
          <header class="head" data-fade>
            <span class="brand">
              <svg class="brand__mark" viewBox="0 0 24 24" aria-hidden="true">
                <rect x="3" y="3" width="18" height="18" rx="6.5"/>
                <path d="M8.2 15.8 15.8 8.2"/>
                <circle cx="9.4" cy="9.4" r="1.15"/>
              </svg>
              <span class="brand__name">Calden Pharmacy</span>
            </span>
            <span class="chip">Click &amp; collect</span>
          </header>

          <div class="title" data-fade>
            <h1>Your order</h1>
            <p>3 items, ready in 20 minutes</p>
          </div>

          <ul class="items" data-items>
            <li class="item">
              <span class="item__tile"><span class="item__bg" data-tilebg></span>
                <span class="item__fly" data-icon><svg class="item__icon" viewBox="0 0 40 40" aria-hidden="true">
                  <path class="p-shadow" d="M9 33.5h22"/>
                  <path class="p-side" d="M27 12.5 31 9.5v21l-4 3z"/>
                  <path class="p-top" d="M9 12.5 13 9.5h18l-4 3z"/>
                  <rect class="p-face" x="9" y="12.5" width="18" height="21" rx="1.2"/>
                  <rect class="p-band" x="9" y="19" width="18" height="4.2"/>
                  <path class="p-print" d="M12 27.5h7M12 30h4.5"/>
                  <circle class="p-dot" cx="23.2" cy="28.4" r="1.7"/>
                </svg></span>
              </span>
              <span class="item__text" data-fade>
                <span class="item__name">Allergy relief 10 mg</span>
                <span class="item__meta">30 tablets</span>
              </span>
              <span class="item__price" data-fade>$7.90</span>
            </li>
            <li class="item">
              <span class="item__tile"><span class="item__bg" data-tilebg></span>
                <span class="item__fly" data-icon><svg class="item__icon" viewBox="0 0 40 40" aria-hidden="true">
                  <path class="p-shadow" d="M12 34.5h16"/>
                  <path class="p-bulb" d="M17 4.8c0-1.6 6-1.6 6 0V11h-6z"/>
                  <rect class="p-cap" x="15.6" y="10.4" width="8.8" height="4.6" rx="1"/>
                  <path class="p-glass" d="M15.4 15h9.2v2.2c3 .8 4.4 2.8 4.4 5.6v9.4c0 1.3-1 2.3-2.3 2.3H13.3c-1.3 0-2.3-1-2.3-2.3v-9.4c0-2.8 1.4-4.8 4.4-5.6z"/>
                  <rect class="p-label" x="11" y="23.5" width="18" height="7.4"/>
                  <path class="p-print" d="M14 26.4h7M14 28.6h4.5"/>
                  <path class="p-glint" d="M13.6 22.4v9"/>
                </svg></span>
              </span>
              <span class="item__text" data-fade>
                <span class="item__name">Vitamin D3 drops</span>
                <span class="item__meta">10 ml, 1000 IU</span>
              </span>
              <span class="item__price" data-fade>$11.50</span>
            </li>
            <li class="item">
              <span class="item__tile"><span class="item__bg" data-tilebg></span>
                <span class="item__fly" data-icon><svg class="item__icon" viewBox="0 0 40 40" aria-hidden="true">
                  <path class="p-shadow" d="M7 33h26"/>
                  <path class="p-tube" d="M8.5 13.6h17l5.6 3.2v6.4l-5.6 3.2h-17c-1 0-1.6-.6-1.6-1.6V15.2c0-1 .6-1.6 1.6-1.6z"/>
                  <path class="p-crimp" d="M8.6 13.6v12.8M10.4 13.6v12.8"/>
                  <rect class="p-cap" x="31" y="17.2" width="3.6" height="5.6" rx=".8"/>
                  <rect class="p-band" x="13.5" y="13.6" width="3.4" height="12.8"/>
                  <path class="p-print" d="M19 18.4h6M19 21h4"/>
                  <path class="p-glint" d="M12 15.6h13"/>
                </svg></span>
              </span>
              <span class="item__text" data-fade>
                <span class="item__name">Soothing skin cream</span>
                <span class="item__meta">50 g tube</span>
              </span>
              <span class="item__price" data-fade>$8.20</span>
            </li>
          </ul>

          <div class="total" data-fade>
            <span>Pay at pickup</span>
            <strong>$27.60</strong>
          </div>

          <button class="btn" type="button" data-confirm data-autoclic>
            <span class="btn__face" data-btnface>
              <span class="btn__sheen" aria-hidden="true"></span>
              <span class="btn__words">
                <span class="btn__word" data-word-a>Confirm pickup</span>
                <span class="btn__word btn__word--b" data-word-b aria-hidden="true">Packing your order</span>
              </span>
            </span>
          </button>
        </section>

        <section class="page page--ticket" data-ticket aria-label="Pickup ticket">
          <header class="thead" data-tin>
            <button class="back" type="button" data-back data-autoclic>
              <svg viewBox="0 0 16 16" aria-hidden="true"><path d="M9.8 3.6 5.4 8l4.4 4.4"/></svg>
              <span>Back</span>
            </button>
            <span class="thead__brand">Calden Pharmacy</span>
          </header>

          <div class="ready" data-tin>
            <span class="ready__slot" data-slot aria-hidden="true"></span>
            <span class="ready__text">
              <strong>Ready for pickup</strong>
              <span>Packed and stapled at 4:52 pm</span>
            </span>
          </div>

          <div class="number" data-tin>
            <span class="number__label">Pickup number</span>
            <span class="number__digits" data-digits data-value="214" aria-label="214"></span>
          </div>

          <dl class="cells" data-tin>
            <div class="cell">
              <dt>Time slot</dt>
              <dd>Today, 5:30 to 6 pm</dd>
            </div>
            <div class="cell">
              <dt>Collect at</dt>
              <dd>Shelf B <span class="mid">&middot;</span> 14</dd>
            </div>
          </dl>
        </section>

        <!-- the paper bag: the back wall sits under the packs, the front over them -->
        <svg class="bag bag--back" data-bag viewBox="0 0 100 112" aria-hidden="true">
          <g data-wall>
          <path class="bag__inside" d="M14 30V8l6 3 6-3 6 3 6-3 6 3 6-3 6 3 6-3 6 3 6-3 6 3 4-2v22z"/>
          <path class="bag__inside-shade" d="M14 30V20h72v10z"/>
          </g>
        </svg>
        <svg class="bag bag--front" data-bag viewBox="0 0 100 112" aria-hidden="true">
          <defs>
            <linearGradient id="kraft" x1="0" y1="0" x2="1" y2="0">
              <stop offset="0" stop-color="#cdb68f"/>
              <stop offset=".14" stop-color="#dcc7a2"/>
              <stop offset=".55" stop-color="#e3d0ad"/>
              <stop offset=".86" stop-color="#d9c39d"/>
              <stop offset="1" stop-color="#c7af86"/>
            </linearGradient>
            <linearGradient id="kraftFold" x1="0" y1="0" x2="0" y2="1">
              <stop offset="0" stop-color="#b99d6e"/>
              <stop offset="1" stop-color="#d0b88f"/>
            </linearGradient>
          </defs>
          <path class="bag__body" d="M12 30h76l3 76c0 2.2-1.6 4-3.8 4H12.8C10.6 110 9 108.2 9 106z"/>
          <path class="bag__gusset" d="M12 30 9 106c0 2.2 1.6 4 3.8 4H18l-2-80z"/>
          <path class="bag__gusset" d="M88 30l3 76c0 2.2-1.6 4-3.8 4H82l2-80z"/>
          <path class="bag__crease" d="M16 31.5v76M84 31.5v76M14 99h72"/>
          <path class="bag__lip" d="M12 30h76"/>
          <g class="bag__print">
            <rect x="42" y="58" width="16" height="16" rx="5.4"/>
            <path d="M46.6 69.4 53.4 62.6"/>
            <circle cx="47.6" cy="63.6" r="1"/>
            <path class="bag__word" d="M38 82h24"/>
          </g>
          <g class="bag__fold" data-fold>
            <path class="bag__flap" d="M12 30h76v15l-4 2-6-3-6 3-6-3-6 3-6-3-6 3-6-3-6 3-6-3-6 3-6-3-4 2z"/>
            <path class="bag__flap-shadow" d="M12 45l4-2 6 3 6-3 6 3 6-3 6 3 6-3 6 3 6-3 6 3 6-3 6 3 4-2v3l-4 2-6-3-6 3-6-3-6 3-6-3-6 3-6-3-6 3-6-3-6 3-6-3-4 2z"/>
            <path class="bag__flap-edge" d="M12 31h76"/>
          </g>
          <g class="bag__staple" data-staple>
            <rect x="43" y="35.2" width="14" height="3.2" rx="1.2"/>
            <path class="bag__staple-hi" d="M44.6 35.9h10.8"/>
          </g>
        </svg>
      </article>
    </div>
  </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.

51 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 “Pharmacy pickup transition” 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 sage background, with a warm light in the middle and a light grain, the white card of Calden Pharmacy, a made-up neighbourhood pharmacy with its own mark, a capsule in a green square. It is the summary of a click and collect order: «Your order», three rows with small packs drawn in SVG (the box of «Allergy relief 10 mg», the dropper bottle of «Vitamin D3 drops», the tube of «Soothing skin cream»), the prices, «Pay at pickup» 27.60 dollars and the green «Confirm pickup» button. Pressing it the button squashes and its words slide up into «Packing your order»; the rows step aside and a kraft paper bag stands up in the middle of the card. The three packs, one after the other, rise over the lip of the bag turning a little and drop in, and the bag gives by a pixel at each one. The top folds down over the front, the staple snaps in the middle and the bag settles. Then it flies, shrinking and swaying, into the icon slot of the ticket, while the card grows into the ticket: «Ready for pickup», the pickup number rolling to its digits, the time slot and «Shelf B · 14». From underneath comes the stub with the barcode: the row of small holes opens into teeth, the stub drops and tips as if torn and hangs with a small bounce, while the bars of the code rise from the middle. A band of light crosses the finished ticket, and with the pointer over it a soft green light follows. «Back» does it all in reverse, faster.

How it works

One timeline, forward and back

The whole gesture is one paused GSAP timeline. «Confirm pickup» plays it (timeScale SPEED), «Back» plays it home with reverse() and timeScale BACK_SPEED. If Back is pressed while the ticket is still arriving, the request is kept: the ticket arrives, stays HOLD seconds and then goes back, so it never breaks off halfway.

Everything in em, and 1em follows the card

The card and the stub sit in a container with container-type: inline-size, min(86vw, 64vh, max(56vh, 350px), 600px) wide, and inside every size is in em with font-size: 4.45cqw: the whole piece grows and shrinks as one thing, also on the height of the phone box.

The bag in two layers

The bag is two identical SVGs on top of each other: the inside wall under the packs (z-index 1) and the front over them (z-index 3), with the packs at z-index 2 in between. So as they drop they really disappear inside the bag. The fold is a group that opens with scaleY from 0 to 1 around the lip, the staple comes down with power3.in.

Measures in pixels, worked out again

The heights of the two pages, the stub's, the point where each pack drops and the icon slot are measured with offsetLeft and offsetTop (which ignore transforms) and become the values of the timeline. At every resize the timeline is rebuilt and picks up from the same point, even mid-gesture.

The perforation that tears

The paper of the card and of the stub is a layer of its own with a mask of two radial-gradients that dig the notches in the corners (--notch). The tear is --tooth: the paper gets a quarter of an em shorter and the teeth show there, a conic-gradient in 90 degree wedges; the stub drops, tips by TEAR_TILT degrees around one corner and straightens with elastic.out.

The rolling number

Every digit is a window 1em tall holding a column from 0 to 9 repeated ROLL_LAPS + 1 times; the column slides down with yPercent to its digit with power4.out, one digit a little after the other. A mask fades the window at the top and bottom while it rolls.

Values to change

NameFileDefaultWhat it changes
SPEEDscript.js1How fast the way to the ticket plays (1 = as designed).
BACK_SPEEDscript.js1.55How fast Back plays it in reverse.
PACK_STAGGERscript.js0.14Seconds between one pack and the next as they slide into the bag.
ARCscript.js1.5How high the packs lift before dropping into the bag, in em of the card.
TEAR_TILTscript.js1.6Degrees the stub tips when it tears along the perforation.
ROLL_LAPSscript.js1Full turns the digits make before they land.
NUMBERscript.js214The pickup number (up to four digits).
HOLDscript.js1.6Seconds the ticket stays when Back was pressed while it was still arriving.
ACCENTscript.js#2e6a54The accent colour: the button, the bands of the packs, the number.

Try them in the Playground

When to use it

For the step from the cart to the confirmation in a shop with in-store pickup: a pharmacy, a herbalist, a bookshop, a deli, a flower shop. It works every time one page «becomes» the next: the order turning into a receipt, the ticket coming out of the summary, the booking becoming the voucher.

On phones

The same. The piece is the smallest of 86% of the width, 64% of the height and the larger of 56% of the height and 350 pixels (600 at most), and every size inside follows its width, so the order and the ticket with its stub fit the box even when it is short. A tap does what the click does; the light following the pointer is there only with a mouse.

With reduced motion

No motion: with «Confirm pickup» the order fades out and the ticket appears already in place, with the shut bag in its icon, the stub torn off, the number and the code already written. Back fades the other way.

Pitfalls

  • A mask cuts everything outside the element: the teeth of the tear cannot sit outside the card. So the paper is a layer of its own that gets shorter by --tooth, and the teeth live inside the card, in the space it leaves.
  • The bag has to be in front of and behind the packs at the same time: one SVG cannot do it. There are two SVGs, inside and front, with the packs between them; and the order page must not go under opacity 1 until the packs are in, or it becomes a stacking context and the three z-indexes stop talking to each other.
  • The bag's transforms have their origin at the bottom centre (the squash at each pack needs it): the landing point in the icon slot is worked out with that in mind, with the bag already scaled down.
  • Back pressed halfway through the way there would rewind an unfinished gesture: the request is kept and starts once the ticket has arrived, after HOLD seconds.

Libraries

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

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

Testing

Tested on 18 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 animations