Skip to content
animorio
IT
Back to the library

Overtime chart

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

The hours worked in a week on a dark card: the total in large digits, how much overtime, and six bars from Monday to Saturday with the dashed eight-hour line. The part of each bar above the line is a second piece, coral, set a hair apart. Hovering a day dims the others and a line gives its hours and overtime; “Last week” changes the bars’ height one after the other, with a bounce, while the total counts.

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>
<!--
  "Overtime chart" 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>Overtime chart</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 hours worked in a week as bars: the eight-hour line, the part above it standing apart as
         overtime, the day you point at with its detail and the total rolling -->
    <article class="ot" data-ot aria-label="Hours worked">
      <header class="ot__head">
        <strong>Hours worked</strong>
        <div class="ot__when" role="tablist" aria-label="Week" data-when><i class="ot__pill" data-pill aria-hidden="true"></i><button type="button" role="tab" aria-selected="true" data-week="now">This week</button><button type="button" role="tab" aria-selected="false" data-week="last" tabindex="-1">Last week</button></div>
      </header>
      <div class="ot__sum"><strong data-outsum>42.0 h</strong><span class="ot__chip"><span data-outchip>2.5 h overtime</span></span></div>
      <div class="ot__chart" data-chart><svg data-svg aria-hidden="true"><line class="ot__limit" data-limit></line><text class="ot__limlab" data-limlab>8 h</text><g data-bars></g></svg><div class="ot__hits" data-hits></div></div>
      <footer class="ot__foot"><span data-outnote>Anything above 8 h a day counts as overtime</span></footer>
    </article>
    <span class="live" aria-live="polite" data-live></span>

    <svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.200 19.200 11l-6.300 1.600-3.300 5.900Z"></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.

17 values to change

Works with Claude, Claude Code, ChatGPT, Cursor, VS Code, Windsurf, Codex, Gemini CLI

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 “Overtime chart” 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 rounded dark card: “Hours worked” and on the right the “This week / Last week” selector; below, the total in large digits, “42.0 h”, and the coral label “2.5 h overtime”. Then the chart: six grey bars, “Mon” to “Sat”, and a dashed line at the height of eight hours marked “8 h”. The bars of the long days have a second coral piece above the line, set three pixels apart: that is the overtime. Saturday, at zero, has no bar. At the bottom a line: “Anything above 8 h a day counts as overtime”. On entering the bars grow from the floor one after the other and the total counts. Hovering Wednesday dims the other bars and the line rolls into “Wednesday · 9.5 h · 1.5 h overtime”. Tapping “Last week” slides the pill, the six bars change height one after the other with a small bounce, the coral pieces appear and disappear where needed, the total counts to “45.0 h” and the label says “4.0 h overtime”.

How it works

Two rectangles per bar

Every day is a number of hours. Two svg rectangles are drawn from it: one up to the limit, one for what goes past it, three pixels higher. If the day does not pass the limit, the second has zero height.

The chart is rewritten

The rectangles have no sizes in the markup: on every frame position and height are recomputed from the six animated hours, in pixels, on the frame’s real size. Changing week means animating six numbers, staggered.

The day pointed at

Over the chart sit six invisible buttons, one per column: mouse, touch and keyboard call the same function, which lights one day and dims the others with a number between zero and one.

Totals from the data

Total and overtime are summed from the days’ hours, not typed in: changing LIMIT changes the coral pieces, the label and the line’s caption.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#ff7a59The colour of overtime.
LIMITscript.js8The daily hours beyond which it is overtime.
GLIDEscript.js0.8How many seconds the bars take to go from one week to the other.
HOLDscript.js1.9How many seconds the demo’s pointer stays on each day.
LOOPscript.jstrueLeft alone, the demo’s pointer goes over the days and changes week.

Try them in the Playground

When to use it

In a company’s attendance or payroll app, on the page of the worker or of whoever approves the hours; the same chart with its threshold carries daily steps above the goal, usage above the plan, spending above the budget or calls above the quota.

On phones

The card is at most 344 pixels wide and about 300 tall; the chart is sized on the screen’s height too and redraws on resize. With a finger a day is tapped to hold it and tapped again to go back to the starting line.

With reduced motion

No growing bars and no bounces: on a week change the bars are the new ones at once with a brief fade, the total does not count and the texts change without rolling; the day pointed at lights up at once. The demo’s pointer does not start.

Pitfalls

  • The chart is a drawing (aria-hidden): the hours are given by the six buttons, each with day, hours and overtime in its aria-label, and an aria-live region with the chosen week’s total.
  • Overtime is not told by coral alone: it is a separate piece above a captioned line, and the bottom line gives it in hours.
  • Sizes are in pixels on the real frame: they are re-measured on resize and once the fonts have finished loading.
  • Here overtime is counted per day, above eight hours; in many countries it is counted per week. Hours and rule are samples.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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