Skip to content
animorio
IT
All components

Wine case button

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

The button that adds a case of six to the basket in an online wine shop. On the right it says the case discount; pressed, the six bottles drop into the crate one after the other while the tag counts them, then they clink, the tick draws itself on the crate and the tag says the price.

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>
<!--
  "Wine case 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>Add a case button of a wine shop with the six bottles that drop into the crate</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 adds a case of six in a wine shop: pressed, the six bottles drop into the crate one after
         the other while the tag counts them, then the crate settles, a tick draws itself and the tag says the price -->
    <button class="wn" type="button" data-wn>
      <span class="wn__body" aria-hidden="true"><span class="wn__wash" data-wash></span><span class="wn__light"></span></span>
      <span class="wn__edge" aria-hidden="true"></span>

      <span class="seat" data-seat aria-hidden="true">
        <svg viewBox="0 0 24 24">
          <g data-bottles></g>
          <g data-crate>
            <path class="seat__crate" d="M3.600 12.200h16.800v6.300a1.300 1.300 0 0 1-1.300 1.300H4.900a1.300 1.300 0 0 1-1.300-1.300Z"></path>
            <path class="seat__slat" d="M3.600 15.900h16.800"></path>
            <path class="seat__tick" data-tick pathLength="1" d="M9 15.800 11.200 17.900 15.300 13.500"></path>
          </g>
        </svg>
      </span>

      <span class="label">
        <span class="label__main"><span data-word>Add a case</span></span>
        <span class="label__sub"><span data-sub>Six bottles, 10% off</span></span>
      </span>
      <span class="tag" aria-hidden="true"><span data-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.

16 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 “Wine case 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 empty crate, in the middle “Add a case” and below it “Six bottles, 10% off”, on the right a tag with the discount in orange. On hover the light follows the pointer and the crate tilts as if lifted. Pressed: a wine red tint leaves the disc and floods the pill, the texts roll to the wine’s name, and six bottles seen from the side drop behind the crate’s edge one every two tenths of a second: each lands with a hair of bounce, makes the crate dip and ticks the count in the tag. At the sixth the bottles clink from the middle outwards, the disc bounces, the green tick draws itself on the crate, everything turns green and the tag says the price of the case. After a few seconds the bottles rise again and it goes back.

How it works

Six paths behind the crate

The bottles are six SVG paths made by the script (body, shoulder and neck in one path), drawn before the crate: falling, they vanish behind its edge with no clipping needed.

One fall, three consequences

Each bottle drops with power2.in in 0.26 seconds; at the instant it lands it bounces by 0.9 units, the crate dips by 0.7 and comes back with back.out(3), and the number in the tag ticks.

The clink

At the end the six bottles swing by four degrees on their base with a stagger from the centre, and the tick draws itself in 0.36 seconds on the front of the crate.

Values to change

NameFileDefaultWhat it changes
WINEscript.js"Colle Brina Rosso 2021"The wine (made-up name).
PRICEscript.js14The price of one bottle, in euros (made up).
OFFscript.js10The case discount, in percent.
FALLscript.js0.2How many seconds between one bottle and the next.
ACCENTscript.js#b02a4aThe colour of the wine.
OKscript.js#17b877The colour once the case is added.
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

On a wine’s page of an online wine shop or winery, in a beer or olive oil shop, wherever things are sold in multiples with a discount (the case of six, the pack of twelve).

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

The bottles do not fall: they appear already in the crate, the tag says six, the texts change without rolling and the tick appears.

Pitfalls

  • The count in the tag is only the number of bottles that have dropped: no “3 of 6”, which would be a numbering.
  • During the fall 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 5.8 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