Skip to content
animorio
IT
Back to the library

Breakfast door hanger

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

The breakfast card of a hotel room, the one you hang on the door, remade for the screen: a cream card with the hole for the handle. You tick what you want, pick the time with a white thumb sliding between four times and press “Hang on the door”: the card swings around its hole, less and less, and the button says when breakfast arrives.

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>
<!--
  "Breakfast door hanger" 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>Breakfast in the room door hanger with the choices that tick and the swing on the handle</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 breakfast card of a hotel room, the one you hang on the door: you tick what you want, slide the time
         and press; the card swings on its hole like on a handle and says when breakfast arrives -->
    <section class="hang" data-hang aria-label="Breakfast in the room">
      <span class="hang__hole" aria-hidden="true"></span>
      <header class="hang__head"><span>Hotel Ardesia, room 214</span><h1>Breakfast in the room</h1></header>

      <div class="items" data-items></div>

      <div class="times" role="radiogroup" aria-label="Delivery time" data-times><span class="times__thumb" data-thumb aria-hidden="true"></span></div>

      <button class="cta" type="button" data-cta aria-pressed="false">
        <span class="cta__word roll"><span data-word>Hang on the door</span></span>
        <span class="cta__n" data-n>1 item</span>
      </button>
    </section>
    <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.

14 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 “Breakfast door hanger” 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 wall-coloured background, a cream card with rounded corners and at the top the hole for the handle, through which the wall shows. Below the hole, the hotel’s name with the room and the title “Breakfast in the room”. Then four rows to tick (coffee, orange juice, croissants, eggs): touching one, its box fills with green with a bounce, the tick draws itself and the text turns dark. Below, four times in a grey strip with a white thumb sliding onto the chosen one, stretching on the way. At the bottom the green “Hang on the door” button with the count of chosen things next to it. Pressed, the card gives a little hop and swings around its hole right and left, less each time, as if hung on a handle; the button turns dark and says “Arriving at 8:00”. Changing a choice reopens the order.

How it works

The swing

The card rotates with its transform-origin on the centre of the hole (50% 30px). The sequence is written by hand like a damping pendulum: SWING degrees, then 62%, 36%, 18%, 7% and zero, each swing with sine.inOut and a little shorter than the one before; first, an 8-pixel hop.

The ticks

Each row is a button with role checkbox: inside the box a green layer goes from scale 0 to 1 with back.out and the tick, a path with pathLength 1, draws itself with stroke-dashoffset a tenth of a second later.

The time

The four times are a radiogroup (arrow keys). The white thumb is a quarter of the strip wide and moves with xPercent (100 per place), so nothing needs measuring; on the way it stretches to scaleX 1.18 and returns on a spring.

Values to change

NameFileDefaultWhat it changes
FIRSTscript.js7:00The first delivery time.
STEPscript.js30The minutes between one time and the next (four times in all).
PICKscript.js2The time chosen at the start (1 is the first).
SWINGscript.js9By how many degrees the card swings when it is hung.
ACCENTscript.js#1f6a4fThe colour of the ticks and of the button.
LOOPscript.jstrueLeft alone, a pointer chooses, hangs and starts again.

Try them in the Playground

When to use it

For the site or app of a hotel, a bed and breakfast or a holiday home with breakfast brought to the room: the order on a single card, like the real one on the door. It also suits a small order with a time: lunch at the office, a picnic basket, beach service.

On phones

The same card, with hole, rows, times and button measured on the height too so it fits the box; everything is touched with a finger.

With reduced motion

No swing, bounces or stretching thumb: ticks, time and button change in place.

Pitfalls

  • The centre of rotation is the hole, in pixels from the top: with transform-origin in the centre the card would spin like a pinwheel instead of swinging.
  • With nothing ticked the button does not hang: it says no with a shake and a line for screen readers says to choose at least one thing.
  • The time thumb moves in percent of its own width: on a phone the strip is narrower and it still lands on the right place, with no recalculation on resize.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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