Skip to content
animorio
IT
Back to the library

Bar shift rota

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

The weekly rota of a small bar: a row per person, a column per day, a small bar on top for the morning and one below for the evening. Pointing at a person, their shifts light up from Monday to Sunday, the others dim and at the top the hours count to their total.

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>
<!--
  "Bar shift rota" 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>Weekly shift rota of the bar with the person who lights up their shifts and the hours that count up</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 week's rota of a small bar: every row is a person, every column a day, a bar on top is a morning shift
         and a bar below an evening one; point at a person and their shifts light up while the hours count -->
    <section class="ro" data-ro aria-label="Shifts this week">
      <header class="ro__head">
        <div>
          <p class="ro__kicker">Caffè Lume, this week</p>
          <p class="ro__who"><span data-who></span></p>
        </div>
        <p class="ro__hours"><b data-hours></b><i>hours</i></p>
      </header>
      <div class="ro__grid" data-grid>
        <div class="ro__days" data-days aria-hidden="true"></div>
        <div class="ro__today" data-today aria-hidden="true"></div>
      </div>
      <p class="ro__key" aria-hidden="true"><span class="ro__chip ro__chip--am"></span>Morning, 7 to 1<span class="ro__chip ro__chip--pm"></span>Evening, 4 to 11</p>
    </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.

20 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 “Bar shift rota” 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 dark card: at the top “Caffè Lume, this week”, the words “The whole team” and on the right everyone’s hours in a large thin number. Below, the initials of the seven days with today picked out on a light band, and four rows: the disc with the initials, the name and for each day two slots, the morning bar above and the evening bar below. On opening rows and bars arrive in a cascade. Pointing at a person (or tapping them, or reaching them with Tab) their row lights up teal, the bars stretch one after the other from Monday to Sunday with a small elastic, the disc hops, the other rows dim, the words roll to “Mara, 5 shifts” and the hours count to 32. Leaving, it goes back to the whole team.

How it works

The week in letters

Each person is a list of seven entries: “m” morning, “e” evening, “me” both, empty a day off. From there the bars are drawn and shifts and hours are counted.

Lighting a row

A class on the row changes the colours; GSAP stretches the bars (scaleX from 0.55 to 1, elastic.out) day after day with SWEEP seconds between one and the next.

The hours counting

The number at the top is an object animated in 0.6 s to the person’s total, or to everybody’s when nobody is picked.

Values to change

NameFileDefaultWhat it changes
TODAYscript.js2Today: 0 Monday, 6 Sunday.
MORNINGscript.js6How many hours the morning shift lasts.
EVENINGscript.js7How many hours the evening shift lasts.
ACCENTscript.js#5fd0b4The colour of the lit shifts.
SWEEPscript.js0.045How many seconds pass between one day and the next when the row lights up.
PAUSEscript.js1.5On its own: how many seconds it stays on each person.
LOOPscript.jstrueLeft alone, it moves from one person to the next.

Try them in the Playground

When to use it

In the back office of a bar, a restaurant, a shop or any team working shifts, and on the page that presents it: to see at a glance who works when and for how many hours.

On phones

The same card, as wide as the screen: a person is picked by tapping the row, a second tap goes back to the team.

With reduced motion

The colours cross-fade, the bars do not stretch, the hours and the words change at once.

Pitfalls

  • The rows are buttons with aria-pressed and a label saying shifts and hours: without it, to a screen reader the bars do not exist.
  • The bar of a shift that is not there is hidden with visibility, not with a transparent background: the colour rules of the lit row would bring it back.
  • Team, shifts and lengths are made up: on a real site they come from the back office and the hours are counted from the real times.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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