Skip to content
animorio
IT
Back to the library

Quiet hours

Hover, SVGGSAP, CSS onlyMediumCompressed weight: Demo 6.4 KBGSAP 28 KBFreeDownload the zip

Quiet hours for notifications: on a 24-hour bar the violet night band is dragged by its two handles, the moon for the start and the sun for the end, and carries over midnight by itself. The large times and the hours of quiet follow the finger; when the present time falls inside the band, the bell is struck through and the line says “Silenced right now”.

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>
<!--
  "Quiet hours" 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>Quiet hours</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">
    <!-- quiet hours for notifications: the night band is dragged along a 24-hour bar by its two handles,
         and the bell gets struck through when the present time falls inside it -->
    <section class="qh" data-qh aria-label="Quiet hours">
      <header class="qh__head">
        <h1>Quiet hours</h1>
        <span class="qh__len" data-len></span>
      </header>
      <p class="qh__range"><b data-from></b><i>to</i><b data-to></b></p>

      <div class="qh__track" data-track>
        <div class="qh__ticks" data-ticks aria-hidden="true"></div>
        <span class="qh__band" data-band="a" aria-hidden="true"></span>
        <span class="qh__band" data-band="b" aria-hidden="true"></span>
        <span class="qh__now" data-now aria-hidden="true"></span>
        <button class="qh__knob" type="button" data-knob="s" role="slider" aria-label="Quiet hours start" aria-valuemin="0" aria-valuemax="24">
          <i><svg viewBox="0 0 12 12" aria-hidden="true"><path d="M9.800 7.300A4.300 4.300 0 0 1 4.700 2.200a4.300 4.300 0 1 0 5.100 5.100Z"></path></svg></i>
        </button>
        <button class="qh__knob" type="button" data-knob="e" role="slider" aria-label="Quiet hours end" aria-valuemin="0" aria-valuemax="24">
          <i><svg viewBox="0 0 12 12" aria-hidden="true"><circle cx="6" cy="6" r="2.100"></circle><path d="M6 1v1.200M6 9.800V11M1 6h1.200M9.800 6H11M2.500 2.500l.8.8M8.700 8.700l.8.8M9.500 2.500l-.8.8M3.300 8.700l-.8.8"></path></svg></i>
        </button>
      </div>
      <div class="qh__scale" aria-hidden="true"><span>00</span><span>06</span><span>12</span><span>18</span><span>24</span></div>

      <p class="qh__status">
        <svg class="qh__bell" data-bell viewBox="0 0 20 20" aria-hidden="true">
          <path d="M10 3.200a4.600 4.600 0 0 0-4.600 4.600v2.700L4 13.200h12l-1.400-2.700V7.800A4.600 4.600 0 0 0 10 3.200Z"></path>
          <path d="M8.400 15.400a1.700 1.700 0 0 0 3.200 0"></path>
          <path class="qh__slash" data-slash d="M4 3.400 16.400 16.600"></path>
        </svg>
        <span class="qh__st"><span data-status aria-live="polite"></span></span>
        <em data-clock></em>
      </p>
    </section>

    <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.

20 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 “Quiet hours” 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 near-black ground with a violet glow at the top, a dark card. At the top “Quiet hours” and on the right, in violet, “9 h”. Below, large, “22:00 to 07:00”. Then the 24-hour bar: a dark well with a tick for each hour, taller every six, and over it the violet night band in two pieces, one on the right from 22 and one on the left up to 7, with a few stars inside. At its two ends two round white handles, one with the moon and one with the sun. A thin white rod marks the present time, 20:30. Under the bar the hours 00, 06, 12, 18, 24 and at the bottom a bell, “Notifications are on” and “Now 20:30”. Drag the moon to the left and the large time steps down a quarter of an hour at a time, the hours of quiet go up and the band lengthens; as soon as it passes the rod, the bell swings, a violet stroke crosses it and the line rolls into “Silenced right now”. On release the handle springs back to its size. A tap on the bar brings the nearer handle there.

How it works

Two hours, one drawing

The state is two numbers, start and end in hours. One function derives everything from them: handle positions, band, written times and length.

Past midnight

If the start comes after the end, the band is drawn in two pieces: from the start to 24 and from 0 to the end. Everything is in percentages, so nothing needs measuring again on resize.

The handle

The captured pointer becomes an hour (x over width times 24), rounded to STEP minutes; the disc inside the button grows while held and comes back on an elastic.

The bell

At each drawing the code checks whether the present time is in the band: when the answer changes, the stroke draws itself with the dashoffset, the bell swings and the line rolls.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#8f7dffThe colour of the night band, the hours of quiet and the stroke on the bell.
STARTscript.js22When the quiet starts (22.5 = 22:30).
ENDscript.js7When it ends.
NOWscript.js20.5The present time marked by the white rod.
STEPscript.js15By how many minutes at a time the handles move.
SPRINGscript.js1How much the handles bounce on release: 0.3 = a little, 2 = a lot.
LOOPscript.jstrueLeft alone, the demo’s pointer brings the start forward, extends the end and then puts everything back.

Try them in the Playground

When to use it

In an app’s notification settings, in the do-not-disturb of a work chat, in the hours when a thermostat, a light or an online shop goes quiet: wherever you pick a range of hours that may cross midnight.

On phones

The same card, 312 pixels wide at most: each handle has a 30 by 44 pixel grab area around the disc, the bar has touch-action none and the large times shrink with the width.

With reduced motion

The handles follow the finger as always, but with no bounces or growing; the stroke on the bell and the line change at once. The demo does not move by itself.

Pitfalls

  • The present time is fixed and made up: in a real app it comes from the clock and the rod moves every minute.
  • The handles are two sliders for the keyboard: arrows for a step, Shift for an hour, and the written time goes into aria-valuetext.
  • Start and end cannot coincide: a move that would make them meet is ignored.
  • The digits are deliberately not tabular (in this typeface the tabular zero is slashed): the two large times have a minimum width, so they do not push the “to”.
  • The bar is in percentages: handles, band and rod stay in place at every width with nothing recomputed.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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