Skip to content
animorio
IT
All components

Refill prescription button

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

The button that asks the pharmacy to refill a prescription. On the right it says how many tablets are left; pressed, the bottle’s cap swings open, the tablets drop in one after the other while the level and the count rise, then the cap shuts, the tick draws itself on the glass and the tag says when to pick it up.

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>
<!--
  "Refill prescription 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>Refill prescription button with the tablets that drop back into the bottle</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 that asks the pharmacy for a refill: pressed, the cap lifts, the tablets drop back into the bottle
         while the level and the count rise, the cap closes, a tick draws itself and the tag says when to pick it up -->
    <button class="rx" type="button" data-rx>
      <span class="rx__body" aria-hidden="true"><span class="rx__wash" data-wash></span><span class="rx__light"></span></span>
      <span class="rx__edge" aria-hidden="true"></span>

      <span class="seat" data-seat aria-hidden="true">
        <svg viewBox="0 0 24 24">
          <defs><clipPath id="rx-in"><rect x="7.4" y="8.6" width="9.2" height="10.6" rx="1.9"></rect></clipPath></defs>
          <g data-pills>
            <rect class="seat__pill" x="10.4" y="0" width="3.2" height="1.7" rx="0.85"></rect>
            <rect class="seat__pill" x="10.4" y="0" width="3.2" height="1.7" rx="0.85"></rect>
            <rect class="seat__pill" x="10.4" y="0" width="3.2" height="1.7" rx="0.85"></rect>
          </g>
          <rect class="seat__glass" x="7.4" y="8.6" width="9.2" height="10.6" rx="1.9"></rect>
          <g clip-path="url(#rx-in)"><rect class="seat__level" data-level x="7.4" y="8.6" width="9.2" height="10.6"></rect><path class="seat__shine" d="M9.3 10.4v6.800"></path></g>
          <rect class="seat__bottle" x="7.4" y="8.6" width="9.2" height="10.6" rx="1.9"></rect>
          <g data-cap><rect class="seat__cap" x="6.5" y="5" width="11" height="3.3" rx="1.1"></rect><path class="seat__ribs" d="M9.6 6v1.300M12 6v1.300M14.400 6v1.300"></path></g>
          <path class="seat__tick" data-tick pathLength="1" d="M9.5 14.1 11.3 15.9 14.700 12.200"></path>
        </svg>
      </span>

      <span class="label">
        <span class="label__main"><span data-word>Refill prescription</span></span>
        <span class="label__sub"><span data-sub>Calmera 10 mg</span></span>
      </span>
      <span class="tag" aria-hidden="true"><span data-left>4 left</span></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.

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 “Refill prescription 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 white, a dark pill 60 pixels high: on the left a light disc with an almost empty tablet bottle, in the middle “Refill prescription” and below it the medicine’s name, on the right a tag with “4 left” in orange. On hover the light follows the pointer and the cap lifts slightly. Pressed: a blue tint leaves the disc and floods the pill, the cap swings open on its corner, three tablets drop into the bottle (each one knocks the disc a little), the blue level rises and the tag counts up to 30. At the end the cap drops back and squashes for a moment, the disc bounces, the white tick draws itself on the glass, everything turns green and the tag says “5 pm”. After a few seconds it goes back.

How it works

One number of tablets

An object with the tablets in the bottle, from LEFT to FULL: the level (a rectangle clipped by the glass, scaled vertically from the bottom) and the count in the tag come from the same number, moved with power1.inOut, no spring.

The cap and the tablets

The cap is an SVG group that rotates by 58 degrees on its bottom right corner with back.out. The three tablets are rounded rectangles drawn before the glass: they fall with power2.in, spinning, and vanish behind the bottle; at each landing the disc drops by a pixel and comes back.

The confirmation

The cap drops in 0.24 seconds and squashes to 0.78 with elastic.out, the tick draws itself in 0.36 seconds, the three texts roll staggered. Below a quarter of the bottle the tag at rest is orange.

Values to change

NameFileDefaultWhat it changes
DRUGscript.js"Calmera 10 mg"The medicine on the prescription (made-up name).
LEFTscript.js4How many tablets are left in the bottle.
FULLscript.js30How many there are after the refill.
PICKUPscript.js"5 pm"The pickup time at the pharmacy (made up).
REFILLscript.js1.5How many seconds the refill lasts.
ACCENTscript.js#3b7bffThe colour of the tablets.
OKscript.js#17b877The colour once the refill is ready.
HOLDscript.js2.6Alone: how many seconds the confirmation stays before going back.
LOOPscript.jstrueLeft alone, a pointer tries it by itself.

Try them in the Playground

When to use it

In a pharmacy’s app or site, in the patient area of a medical practice, in a health app next to the list of treatments. In a real product the count comes from the prescription and the pickup time from the pharmacy’s reply.

On phones

The same pill, at most as wide as the screen minus the margins; there is no hover, the tap does the same job.

With reduced motion

No swinging cap, falling tablets, flooding tint or bounces: the level and the count still rise (they are the information), the texts change without rolling and the tick appears.

Pitfalls

  • The level is a rectangle scaled from the bottom inside a clipPath shaped like the glass: animating height and y together would make the edge shake.
  • During the refill the button has aria-busy and ignores clicks; the state is also said in words in a line for screen readers.
  • The tick has opacity 0 at rest and autoRound is off at the top of the script: with pathLength 1 GSAP would draw it all at once.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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