Skip to content
animorio
IT
All components

Opening hours card

Cards, Transitions, HoverGSAP, CSS onlyMediumCompressed weight: Demo 9.2 KBGSAP 28 KBFreeDownload the zip

The opening hours card of a bakery cafe, white on white, like a Dribbble shot: a small real photo of the bread counter on top, then the name and the status line, today's bar with the open hours filled and a thin ‘Now’ hand sliding on a spring, and the week in rows with today picked out. The pilot runs the day like a time-lapse: the status line changes on a spring from ‘Open now’ to ‘Closing soon’ to ‘Closed’, with a drawn sun, setting sun and moon, and the photo dims when the shop closes. Hovering a day, the bar shows its hours.

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>
<!--
  "Opening hours card" 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 opening hours card with the time of now sliding by</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 opening hours card of a bakery cafe. A thin "Now" hand slides along today's bar (a time-lapse of the day):
         the status line on top changes on a spring from open to closing soon to closed, with a small drawn sun,
         a setting sun and a moon, and the photo of the shop dims when it closes. Hovering a day of the week, the bar
         shows that day's hours -->
    <section class="card" data-card aria-label="Opening hours, Morrow Bakehouse">
      <figure class="photo" data-photo>
        <div class="photo__move" data-photo-move>
          <img src="bancone.webp" alt="Fresh loaves of bread on the counter of the bakery" width="960" height="720" decoding="async">
        </div>
        <span class="photo__dusk" data-dusk aria-hidden="true"></span>
        <span class="photo__chip"><span>Bakery and cafe</span></span>
      </figure>

      <header class="head">
        <span class="head__mark" aria-hidden="true">
          <svg viewBox="0 0 24 24"><path d="M5.2 15.6c0-4.6 3-8 6.8-8s6.8 3.4 6.8 8c0 1.3-.9 2.1-2.1 2.1H7.3c-1.2 0-2.1-.8-2.1-2.1z"/><path d="M9.4 10.6l1.3 3.2M12 9.7v3.6M14.6 10.6l-1.3 3.2"/></svg>
        </span>
        <span class="head__who">
          <span class="head__name">Morrow Bakehouse</span>
          <span class="status" data-status aria-live="polite">
            <span class="status__icon" aria-hidden="true">
              <svg viewBox="0 0 20 20">
                <g class="ico ico--sun" data-ico="open">
                  <circle cx="10" cy="10" r="3.4"/>
                  <g class="ico__rays" data-rays><path d="M10 2.6v1.9M10 15.5v1.9M2.6 10h1.9M15.5 10h1.9M4.8 4.8l1.3 1.3M13.9 13.9l1.3 1.3M4.8 15.2l1.3-1.3M13.9 6.1l1.3-1.3"/></g>
                </g>
                <g class="ico ico--set" data-ico="soon">
                  <path d="M5.6 13.4a4.4 4.4 0 0 1 8.8 0"/>
                  <path d="M2.8 13.4h14.4M10 4.6v1.8M4.6 7.4l1.3 1.2M15.4 7.4l-1.3 1.2M6.6 16.4h6.8"/>
                </g>
                <g class="ico ico--moon" data-ico="closed">
                  <path d="M14.6 12.6A5.6 5.6 0 0 1 7.4 5.4a5.6 5.6 0 1 0 7.2 7.2z"/>
                  <path class="ico__star" d="M14.2 3.6v2.4M13 4.8h2.4"/>
                </g>
              </svg>
            </span>
            <span class="status__win"><span class="status__line" data-status-line><b>Open now</b>, closes at 19:00</span></span>
          </span>
        </span>
      </header>

      <div class="today" data-today>
        <div class="today__top">
          <span class="today__win"><span class="today__day" data-bar-day>Thursday</span></span>
          <span class="today__win today__win--end"><span class="today__hours" data-bar-hours>7:00 – 19:00</span></span>
        </div>
        <div class="bar" data-bar aria-hidden="true">
          <div class="bar__track">
            <div class="bar__open" data-open><span class="bar__done" data-done></span><span class="bar__sheen"></span></div>
            <span class="bar__shut" data-shut>Closed all day</span>
          </div>
          <div class="needle" data-needle>
            <span class="needle__tag"><span class="needle__word">Now</span> <span data-now>9:00</span></span>
            <span class="needle__line"></span>
          </div>
        </div>
        <div class="ticks" data-ticks aria-hidden="true"></div>
      </div>

      <div class="week">
        <span class="week__pill" data-pill aria-hidden="true"></span>
        <ul class="week__list" data-week aria-label="Opening hours this week"></ul>
      </div>
    </section>
  </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.

31 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 “Opening hours card” 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 a white card with round corners rises slowly, with a one pixel edge and three layers of shadow. At the top a small real photo of a bakery counter, with baskets of bread and warm light, drifting very slowly; on it a frosted glass label ‘Bakery and cafe’. Below, the mark of a loaf, the name ‘Morrow Bakehouse’ and the status line: a small drawn sun with slowly turning rays and ‘Open now, closes at 19:00’. Then today: ‘Thursday’ and ‘7:00 – 19:00’, a bar from 6 to 21 with the open hours in light orange, the part already gone filled orange with a glaze on top, and above it a thin black hand with the tag ‘Now 9:20’. Under the bar the hour marks, which turn orange as the hand passes them, and a number every three hours. At the bottom the week in seven rows, today in bold with a ‘Today’ label and a light grey pill under it. The pilot runs the day like a time-lapse: the hand runs on a spring, the minutes on the tag go up five at a time, the filled part grows. An hour before closing the status line leaves upwards and the new one comes up from below with a small bounce: ‘Closing soon, at 19:00’, with a sun setting on the horizon turning in; the photo darkens a little. At 19 it becomes ‘Closed, opens tomorrow at 7:00’ with a moon and a little star, and the photo takes the blue of the evening. Then the pilot goes over Saturday, Sunday and Monday: the pill slides onto the row on a spring, the day and hours over the bar roll, the open part narrows or widens with its small bounce and the hand fades away; on Monday the open part closes into the middle and ‘Closed all day’ appears. Back on Thursday the status turns ‘Open now’ again, the hand springs back to the morning, and the loop starts over.

How it works

Everything in minutes, drawn in pixels

Hours, the hand and the open part live in minutes from midnight; one function turns them into a share of the bar (from DAY_FROM to DAY_TO) and, every frame, into pixels with the measured width. A ResizeObserver measures the bar and the pill again, so the card stays right even if the window changes mid-loop.

The hand on a spring

The pilot only moves the time (an object with t, tweened by GSAP); the hand chases it on a spring integrated by hand, stiffness 210 and damping 20, in two half steps per frame with the step capped at 1/30 s: during the time-lapse it trails the time slightly, and when it goes back to the morning it passes the mark and settles. The Now tag stays inside the bar near the ends.

The part gone and the hour marks

Inside the open part sits the part already gone, from its left edge to the hand; the hour marks change class only when the hand passes them, so the DOM is touched only a few times.

The rolling status

The status comes from the time (open, closing soon, closed). When it changes, the old line turns absolute and leaves upwards in 0.3 s, the new one comes up from below with back.out(1.9); the old icon turns away and shrinks, the new one turns in with back.out(2.4), and a blue veil in multiply dims the photo's light.

A day on hover

Over a day (or with Tab, or a tap) the pilot stops: the pill slides onto the row on a spring, the day and hours over the bar roll, the ends of the open part go to the new hours with back.out(1.4) and the hand fades if it is not today. A closed day squeezes the open part into its middle. Leaving the week, after 2.4 s today comes back and the pilot starts again.

Values to change

NameFileDefaultWhat it changes
TODAYscript.js3Which day is today: 0 = Monday, 6 = Sunday.
DAY_FROMscript.js6The hour where today's bar starts.
DAY_TOscript.js21The hour where it ends.
SOONscript.js60How many minutes before closing it says Closing soon.
TIMELAPSEscript.js7.5How many seconds the pilot takes to run the day from morning to night.
STIFFNESSscript.js210The spring pulling the hand: higher is quicker.
DAMPINGscript.js20Lower lets the hand pass the mark and come back.
HOLDscript.js1.3How many seconds the pilot stays on each day it shows.
LOOPscript.jstrueRuns the day again and again.

Try them in the Playground

When to use it

For the contact page or the listing of a place: a cafe, a bakery, a restaurant, a shop, a gym, a clinic. It says at a glance whether it is open now, how soon it closes and the hours for the whole week. Swap the photo in the HTML img (bancone.webp), the hours in the WEEK list of the script, the colours in :root.

On phones

The same animation with adapted sizes: the card is as wide as the screen minus the margins, and the photo, rows and gaps also follow the height, so it fits the phone box. A tap on a day does what hovering does.

With reduced motion

Nothing moves: the hand jumps from one time to the next (morning, just before closing, evening), the status and hours lines and the icons change with a fade, the pill and the open part fade out and back in at their new place, and the photo stays still.

Pitfalls

  • A line changing with two texts in a window one line high: if the new one is absolute and longer, the window clips it at the side. Here the old one turns absolute and leaves, the new one stays in the flow.
  • Going back to the morning the hand passes 19 and 18 again: the status would have changed three times in a second. The pilot sets Open now first and holds the status until the hand has arrived.
  • With the open part in pixels the card broke when the window width changed mid-loop: the hours stay in minutes and the pixels are worked out every frame from the measured width.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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