Skip to content
animorio
IT
Back to the library

Screen time card

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

A card for the time spent on the phone: switching from today to the week, the total counts, the bars are redrawn on the new scale and the apps swap places, the climbers first. The app past its limit shows the extra part, striped and in another colour; moving over a row turns its time into its share of the 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>
<!--
  "Screen time 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>Screen time card</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">
    <!-- a screen time card: switch between today and the week and the apps change place, the bars are
         redrawn and the total counts; the app past its limit shows the part that went over -->
    <section class="sc" data-sc aria-label="Screen time">
      <header class="sc__head">
        <span class="sc__title">Screen time</span>
        <div class="sc__seg" data-seg role="radiogroup" aria-label="Period">
          <span class="sc__tile" data-tile aria-hidden="true"></span>
          <button type="button" role="radio" aria-checked="true" data-period="0">Today</button>
          <button type="button" role="radio" aria-checked="false" data-period="1" tabindex="-1">Week</button>
        </div>
      </header>

      <p class="sc__read" aria-live="polite">
        <b class="sc__num" data-num></b>
        <span class="sc__note"><span data-note></span></span>
      </p>

      <div class="sc__list" data-list></div>
    </section>

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

15 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 “Screen time 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 light ground, a white card: at the top “Screen time” and the “Today / Week” switch; below, the large total in hours and minutes and a comparison line; then four apps, each with its initial’s tile, the name, the time and a purple bar. The first, Loop, has a one-hour daily limit and has passed it: on the bar there is a dark tick at the limit, the part after it is orange with slanted lines and next to the name sits the “Limit 1h” tag. Choosing “Week”, the switch’s tile slides, the total counts to 28 hours gaining weight, the bars grow or shrink on the new scale and the rows swap: Chatter climbs to the top with a small lunge, Loop goes down. Moving over an app the others dim, its bar jolts and the time becomes “32% of the total”.

How it works

Rows with a place, not an order

The four rows are absolutely positioned and each has a number, its place, turned into a translateY of one row per unit. Changing period means animating that number: no layout measuring, no jump.

Minutes and scale together

Each app animates its minutes while the scale (the period’s highest value) animates too. The bar, the part past the limit and the tick are recomputed every frame from these two numbers.

Climbers go first

Rows going up leave at once with back.out and a tile that grows for a moment; those going down leave a little later, with no lunge. That way the eye follows the overtake.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#5b5bf0The colour of the bars.
OVERscript.js#f0653aThe colour of the part past the limit.
LIMITscript.js60The first app’s daily limit, in minutes.
SWAPscript.js0.7How many seconds the rows take to swap places.
HOLDscript.js1.5On its own: how many seconds it stops on each step.
LOOPscript.jstrueLeft alone, a pointer switches to the week and looks at two apps.

Try them in the Playground

When to use it

In a phone’s settings or a digital wellbeing app, in parental controls, in a weekly summary; and wherever a ranking changes with the period: spending by category, most viewed pages, most played tracks.

On phones

The same card: rows are 46 pixels tall (40 in short windows), tapping one shows its share and tapping it again brings the time back.

With reduced motion

No swaps or counting: on changing period the rows, bars and total are already in place.

Pitfalls

  • Apps, minutes and comparisons are made up: real data comes from the operating system, which gives it only with explicit permission.
  • The order changes only on screen: in the DOM the rows stay where they are, so the keyboard always goes through them in the same order. If visual order is needed, the rows must also be reordered in the DOM when the animation ends.
  • The passed limit is not told by colour alone: there are the tick, the slanted lines and the tag with the limit.

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