Skip to content
animorio
IT
All components

Set aside a loaf button

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

The button that sets a loaf aside for tomorrow in a bakery. On the right it says how many are left; pressed, the dough in the disc sinks for a moment, then rises, takes the colour of the crust and its cuts open; the tick draws itself and the tag says from 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>
<!--
  "Set aside a loaf 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>Set aside a loaf button of a bakery with the loaf that rises and the pickup time</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 sets a loaf aside for tomorrow in a bakery: pressed, the dough rises on the tray, takes the
         colour of the crust and its cuts open, then a tick draws itself and the tag says from when to pick it up -->
    <button class="bk" type="button" data-bk>
      <span class="bk__body" aria-hidden="true"><span class="bk__wash" data-wash></span><span class="bk__light"></span></span>
      <span class="bk__edge" aria-hidden="true"></span>

      <span class="seat" data-seat aria-hidden="true">
        <svg viewBox="0 0 24 24">
          <g data-loaf>
            <path class="seat__loaf" data-shape d="M4.800 17.400c0-5 3-8.800 7.200-8.800s7.200 3.800 7.200 8.800Z"></path>
            <path class="seat__score" data-score pathLength="1" d="M8.300 14.800l1.900-3"></path>
            <path class="seat__score" data-score pathLength="1" d="M11.200 15.200l1.900-3.600"></path>
            <path class="seat__score" data-score pathLength="1" d="M14.200 14.800l1.800-2.800"></path>
          </g>
          <path class="seat__tray" d="M3.200 18.600h17.600"></path>
          <path class="seat__tick" data-tick pathLength="1" d="M8.200 13.200 10.900 15.800 15.900 10.300"></path>
        </svg>
      </span>

      <span class="label">
        <span class="label__main"><span data-word>Set aside a loaf</span></span>
        <span class="label__sub"><span data-sub>Country sourdough</span></span>
      </span>
      <span class="tag" aria-hidden="true"><span data-left>5 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 “Set aside a loaf 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 black, a light pill 60 pixels high: on the left a white disc with a pale, low dough on a tray, in the middle “Set aside a loaf” and below it the bread’s name, on the right a tag with “5 left”. On hover the light follows the pointer and the dough swells slightly. Pressed: a crust-coloured tint leaves the disc, the dough sinks as if taking a breath, then rises past its size and settles, while the colour goes from pale to golden and three cuts open one after the other. At the end the disc bounces, the loaf steps aside in transparency, the green tick draws itself, the text says “Loaf saved” and the tag the pickup time. After a few seconds a new dough is back.

How it works

One number for the loaf

A value from 0 to 1 does everything: the height (scaleY from 0.52 to 1 with the origin on the tray), the width that narrows slightly, the colour (gsap.utils.interpolate between dough and crust) and the three cuts, which draw themselves staggered past 0.45.

The breath

First the value goes down to minus 0.12 in 0.16 seconds, then up to 1 with back.out(1.6): the loaf passes its size and comes back, like something leavened. It is one of the few places where a spring on the value makes sense.

The confirmation

The loaf goes to 32% opacity, the tick draws itself in 0.36 seconds, the three texts roll staggered. With LEFT at zero the button says tomorrow is sold out and does not answer.

Values to change

NameFileDefaultWhat it changes
BREADscript.js"Country sourdough"The bread to set aside (made up).
PICKUPscript.js"7:30 am"From when it can be picked up tomorrow (made up).
LEFTscript.js5How many loaves are left to reserve.
RISEscript.js1.1How many seconds the loaf takes to rise and brown.
ACCENTscript.js#d9953fThe colour of the crust.
OKscript.js#2f9d6aThe colour once the loaf is set aside.
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 the site of a bakery or a pastry shop that bakes limited batches, in a café selling tomorrow’s bread, in any shop where you reserve today what will be ready tomorrow.

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 loaf does not rise: it appears already baked with its cuts, the texts change without rolling and the tick appears.

Pitfalls

  • The cuts have opacity 0 until they start drawing: a zero-length stroke with round caps would leave three dots on the dough.
  • The colour is written into the path’s style at every frame from the same number as the height: a separate CSS transition would lag behind the spring.
  • autoRound is off at the top of the script: with pathLength 1 GSAP would open the cuts all at once.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

Compressed with gzip, the three demo files weigh 5.7 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