Skip to content
animorio
IT
All components

Cake order form

Forms, Transitions, TextGSAP, CSS onlyMediumCompressed weight: Demo 11 KBGSAP 28 KBFreeDownload the zip

The cake order form of an invented bakery, Halcyon Bakehouse, like a Dribbble shot: a warm white card with a real photo of a birthday cake with candles on top, and the choices below. How many people, 6, 8 or 10, on a pill control whose white handle slides and stretches while the cake in the photo grows a little; the flavour on three chips with a drawn tick; the words to put on the cake, which appear over the photo in raspberry script letter by letter as you type; the pick-up day on a strip of dates. The price at the bottom rolls on two drums at every choice with a small +$14 rising from it, and Place order fills with raspberry and becomes Ordered, pick up Sat 11:00 with the check drawing itself.

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>
<!--
  "Cake order form" 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 cake order form with the choices that change the price</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/fraunces@5.3.0/full.css">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/dancing-script@5.3.0/index.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <main class="stage">
    <!-- a small bakery's order form for a celebration cake: a real photo of the cake, how many it serves, the flavour,
         the words piped on top (they appear on the photo as you type), the pick-up day and a price that rolls -->
    <form class="order" data-order novalidate>
      <figure class="order__photo" data-photo>
        <span class="order__zoom" data-zoom>
          <img class="order__img" data-img src="torta.webp" width="960" height="640" alt="A birthday cake with sprinkles and candles">
        </span>
        <span class="order__piping" data-piping aria-hidden="true"></span>
        <figcaption class="order__shop">
          <span class="order__shop-name">Halcyon Bakehouse</span>
          <span class="order__shop-tag" data-serves>Serves 6</span>
        </figcaption>
      </figure>

      <div class="order__body">
        <header class="order__head">
          <h1 class="order__title">Celebration cake</h1>
          <p class="order__sub">Sponge, Swiss meringue buttercream, sprinkles</p>
        </header>

        <div class="row">
          <span class="row__label" id="size-label">Serves</span>
          <div class="seg" data-seg role="radiogroup" aria-labelledby="size-label">
            <span class="seg__thumb" data-thumb aria-hidden="true"><span class="seg__thumb-face"></span></span>
            <button class="seg__opt" type="button" role="radio" aria-checked="true" data-size="6">6</button>
            <button class="seg__opt" type="button" role="radio" aria-checked="false" data-size="8">8</button>
            <button class="seg__opt" type="button" role="radio" aria-checked="false" data-size="10">10</button>
          </div>
        </div>

        <div class="flavours" role="radiogroup" aria-label="Flavour">
          <button class="chip" type="button" role="radio" aria-checked="true" data-flavour="Vanilla" data-add="0">
            <span class="chip__face">
              <svg class="chip__tick" viewBox="0 0 16 16" aria-hidden="true"><path d="M3.6 8.4l2.8 2.8 6-6.2" pathLength="1"/></svg>
              <span class="chip__name">Vanilla</span>
            </span>
          </button>
          <button class="chip" type="button" role="radio" aria-checked="false" data-flavour="Chocolate" data-add="0">
            <span class="chip__face">
              <svg class="chip__tick" viewBox="0 0 16 16" aria-hidden="true"><path d="M3.6 8.4l2.8 2.8 6-6.2" pathLength="1"/></svg>
              <span class="chip__name">Chocolate</span>
            </span>
          </button>
          <button class="chip" type="button" role="radio" aria-checked="false" data-flavour="Raspberry" data-add="4">
            <span class="chip__face">
              <svg class="chip__tick" viewBox="0 0 16 16" aria-hidden="true"><path d="M3.6 8.4l2.8 2.8 6-6.2" pathLength="1"/></svg>
              <span class="chip__name">Raspberry</span>
              <span class="chip__add">+$4</span>
            </span>
          </button>
        </div>

        <label class="words" data-words>
          <svg class="words__pen" viewBox="0 0 16 16" aria-hidden="true"><path d="M3 13l.6-2.6 7.2-7.2a1.4 1.4 0 0 1 2 2l-7.2 7.2z"/><path d="M9.6 4.4l2 2"/></svg>
          <span class="sr">Words on the cake</span>
          <input class="words__field" data-field type="text" maxlength="24" placeholder="Words on the cake" autocomplete="off">
          <span class="words__price" data-words-price>+$3</span>
        </label>

        <div class="days">
          <div class="days__head">
            <span id="day-label">Pick up</span>
            <span class="days__time">11:00 &middot; 4 Elm Row</span>
          </div>
          <div class="days__strip" data-days role="radiogroup" aria-labelledby="day-label">
            <span class="days__thumb" data-day-thumb aria-hidden="true"></span>
            <button class="day" type="button" role="radio" aria-checked="false" data-day="Thu"><span class="day__w">Thu</span><span class="day__n">12</span></button>
            <button class="day" type="button" role="radio" aria-checked="false" data-day="Fri"><span class="day__w">Fri</span><span class="day__n">13</span></button>
            <button class="day" type="button" role="radio" aria-checked="false" data-day="Sat"><span class="day__w">Sat</span><span class="day__n">14</span></button>
            <button class="day" type="button" role="radio" aria-checked="false" data-day="Sun"><span class="day__w">Sun</span><span class="day__n">15</span></button>
            <button class="day" type="button" role="radio" aria-checked="false" data-day="Mon" disabled><span class="day__w">Mon</span><span class="day__n">16</span></button>
          </div>
        </div>

        <div class="foot">
          <div class="price" aria-hidden="true">
            <span class="price__cur">$</span>
            <span class="price__digits" data-digits></span>
            <span class="price__delta" data-delta></span>
          </div>
          <button class="place" type="submit" data-place>
            <span class="place__face" data-place-face>
              <span class="place__fill" data-place-fill aria-hidden="true"></span>
              <span class="place__state place__state--rest" data-rest>
                <span>Place order</span>
                <svg class="place__arrow" viewBox="0 0 16 16" aria-hidden="true"><path d="M3 8h9M8.5 4.2L12.3 8 8.5 11.8"/></svg>
              </span>
              <span class="place__state place__state--done" data-done aria-hidden="true">
                <svg class="place__check" viewBox="0 0 16 16" aria-hidden="true"><path d="M3.4 8.4l3 3 6.2-6.6" pathLength="1" data-check/></svg>
                <span data-done-text>Ordered, pick up Sat 11:00</span>
              </span>
            </span>
          </button>
        </div>
      </div>
    </form>
    <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.

45 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 “Cake order form” 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 white page sits a warm white card with soft corners, a one pixel edge and a layered shadow. On top, in a rounded frame, a real photo of a birthday cake covered in coloured sprinkles, candles lit, on a pale table; below it, the name Halcyon Bakehouse in white on the left and a frosted glass label saying Serves 6 on the right. On arrival the photo zooms out gently and then breathes very slowly. Below, the title Celebration cake in a serif face, then the choices: Serves with a 6, 8, 10 pill control and a white handle; three chips Vanilla, Chocolate and Raspberry +$4; the Words on the cake field with a pencil; Pick up 11:00 and a strip of five days, from Thu 12 to Mon 16, with Monday closed and struck through; at the bottom the big price, $48, and the dark Place order button, crossed now and then by a sheen. On its own the form fills itself in: the handle slides to 10 stretching and settles round, the cake in the photo grows a little on a spring, the label becomes Serves 10 and the price rolls to $76 with a +$28 rising and fading; then back to 8, $62. Raspberry lights up: the chip turns pink, a space opens and the tick draws itself. In the field, with a raspberry edge, Happy 30th, Lea writes itself, and every letter also appears on the photo, above the candles, in raspberry script, big and soft like freshly piped icing, then settles; at the first letter the price goes up by 3. A raspberry block is born under Fri and slides to Sat. Place order is pressed, the raspberry crosses it like a loading bar and fills it, the words drop away and Ordered, pick up Sat 11:00 arrives with the check drawing itself, and the words on the cake take a small bow. Then everything goes back quickly and starts again. Touched, the form is yours: size, flavour and day are chosen by tap or with the arrows, the field takes your words and they appear on the cake, Place order with no day shakes the strip.

How it works

Handles measured in pixels

Under the size pills and under the days sits an absolute handle that GSAP moves with x and width to the chosen button's offsetLeft and offsetWidth, on a back.out. The handle's face is a separate element that stretches while it travels (scaleX 1.14, scaleY 0.9) and comes back round with an elastic.out. A ResizeObserver puts the handles back in place when the card changes width.

The price on three drums

The price is made of three windows one line tall with a soft mask above and below, each holding a column from 0 to 9: to change a digit the column slides by yPercent on a back.out, ones first and tens a beat later like a real counter. The hundreds window has zero width while the price stays under 100. At every change a small +$14 or −$14 rises next to the price and fades.

Words that turn into icing

At every input the new text is compared with the letters already on the photo: the matching start stays, extra letters fade upwards, new ones are born in a span each from scale 1.35 and 3 px of blur to 1 and 0 on a strong back.out, like freshly piped icing settling. The face is variable Dancing Script, in raspberry with a white halo to lift it off the photo's wall.

Choices you can feel

The cake in the photo sits in a wrapper that GSAP scales from 0.95 to 1.05 with the size on a spring, anchored at the bottom, and the Serves label changes with a small vertical flip. In the chips the tick lives in a box 0 wide that opens to 14 pixels, so the word moves over to make room, and the stroke draws itself with pathLength=1 and stroke-dashoffset.

The order and the pilot

Under the button's words a raspberry fill grows with scaleX like a loading bar, then the two labels swap vertically and the check draws itself. A repeating GSAP timeline makes the hand's moves: the biggest size then SIZE, the flavour, the words WORDS at TYPE_SPEED letters a second, a day before and then PICKUP_DAY, orders, waits HOLD seconds and empties everything. On the first touch or key the pilot stops.

Values to change

NameFileDefaultWhat it changes
WORDSscript.jsHappy 30th, LeaThe words on the cake (24 letters at most).
SIZEscript.js8How many the form chooses the cake for: 6, 8 or 10.
PICKUP_DAYscript.jsSatThe pick-up day it chooses: Thu, Fri, Sat or Sun.
BASE_PRICEscript.js48The price of the cake for 6, in dollars.
SIZE_STEPscript.js14How much each bigger size adds.
TYPE_SPEEDscript.js11How many letters a second the words write.
HOLDscript.js2.6How many seconds it stays on Ordered before starting again.
AUTOscript.jstrueThe form fills itself in until someone touches it.

Try them in the Playground

When to use it

For a pastry shop, a bakery, an ice cream parlour or a café taking custom cake orders, and for any online shop where choices change the price: a frame, a print, a bouquet, a product to personalise. The rolling price and the rising +$ show at once what each choice costs, and the words appearing on the photo show the result before paying.

On phones

On the phone the card is 92% of the screen wide, the photo, title, controls and button get shorter with the screen's height and the ingredients line goes on short screens. The handles measure themselves again on the new width, the words on the cake get smaller with the photo. The rest is the same.

With reduced motion

Nothing moves: the handles appear already in place, the cake changes size with no spring, the price digits change in place and the +$ fades in, the letters on the photo fade in, the ticks are already drawn, the button turns raspberry and the labels swap with a fade; the photo stays still.

Pitfalls

  • Handles placed with CSS percentages vanished as soon as GSAP moved them (GSAP does not read percentages back and its transform wipes the class's): they are measured in pixels from the chosen button and a ResizeObserver puts them back when the card changes width.
  • The handle's stretch and its travel both used transform on the same element and one wiped the other: x and width sit on the handle, scaleX and scaleY on the face inside.
  • Rewriting all the words on the photo at every letter restarted the animation of every letter: the matching start is kept and only new or removed letters are animated.
  • The round started when the script was read and the photo was not there yet: it starts from the load event.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0, Fraunces (font variabile) 5.3.0, Dancing Script (font variabile) 5.3.0.

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

Testing

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