Skip to content
animorio
IT
Back to the library

Mileage log

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

The log of drives for work, in a card on warm white: the week’s drives, each to tag “Business” or “Personal”, and at the top an odometer with four windows that adds up only the business ones, turning digit by digit like a real one, with a green tenths wheel. Beside it the deduction counts in dollars. With each choice a small chip says how many miles come in or go out, the strip on the drive’s left takes its colour and at the bottom you read how many are still to tag. Minimal style.

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>
<!--
  "Mileage log" 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>Mileage log</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 mileage log: the week's drives to tag Business or Personal, an odometer for the business total that
         turns digit by digit, and the deduction counting along -->
    <section class="ml" data-ml aria-label="Mileage log">
      <header class="ml__head">
        <div class="ml__what">
          <span class="ml__label">Business miles, this week</span>
          <div class="ml__odo" data-odo aria-hidden="true"></div>
          <span class="ml__sr" data-outsr>18.4 miles</span>
        </div>
        <div class="ml__ded">
          <span class="ml__label">Deduction</span>
          <strong data-outded>$12.33</strong>
          <span class="ml__rate" data-outrate>at $0.67 a mile</span>
        </div>
        <span class="ml__plus" data-plus aria-hidden="true">+6.2</span>
      </header>

      <ul class="ml__list">
        <li class="ml__trip" data-trip data-mi="18.4" data-tag="b"><div class="ml__info"><strong>Home to client</strong><span>Mon 08:10</span></div><b class="ml__mi">18.4 mi</b><div class="ml__seg" role="group" aria-label="Home to client"><i data-thumb></i><button type="button" data-b>Business</button><button type="button" data-p>Personal</button></div></li>
        <li class="ml__trip" data-trip data-mi="6.2" data-tag=""><div class="ml__info"><strong>Office to printer</strong><span>Tue 14:35</span></div><b class="ml__mi">6.2 mi</b><div class="ml__seg" role="group" aria-label="Office to printer"><i data-thumb></i><button type="button" data-b>Business</button><button type="button" data-p>Personal</button></div></li>
        <li class="ml__trip" data-trip data-mi="31.6" data-tag=""><div class="ml__info"><strong>Home to airport</strong><span>Wed 09:05</span></div><b class="ml__mi">31.6 mi</b><div class="ml__seg" role="group" aria-label="Home to airport"><i data-thumb></i><button type="button" data-b>Business</button><button type="button" data-p>Personal</button></div></li>
        <li class="ml__trip" data-trip data-mi="4.8" data-tag="p"><div class="ml__info"><strong>Office to gym</strong><span>Thu 18:20</span></div><b class="ml__mi">4.8 mi</b><div class="ml__seg" role="group" aria-label="Office to gym"><i data-thumb></i><button type="button" data-b>Business</button><button type="button" data-p>Personal</button></div></li>
      </ul>
      <p class="ml__foot"><span class="ml__clip"><span data-outleft>2 drives still need a tag</span></span></p>
    </section>
    <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.

36 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 “Mileage log” 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 warm white, a rounded card. At the top left “Business miles, this week” and an odometer: three black windows and a green one for the tenths, with narrow white figures and the leading zeros dimmed, “018.4” and “mi”; on the right “Deduction”, “$12.33” in green and “at $0.67 a mile”. Below, four drives separated by thin rules: name (“Home to client”), day and time, the miles on the right and a small “Business / Personal” control. The first is already business, with a green strip on its left; the last is personal, grey strip; the two in between have a dashed strip and at the bottom it says “2 drives still need a tag”. Tapping “Business” on a drive the white pill appears under the option with a bounce, the strip and the miles turn green, a “+6.2” chip rises beside the odometer and the wheels turn: the tenths run, and each wheel to the left only clicks over while the one on its right goes from 9 to 0. The deduction counts along. Switching to “Personal” the pill slides, the chip is dark with a minus and the total goes back. When all are tagged the bottom line rolls to “All drives tagged. Ready to export”.

How it works

The total is a sum

Every drive has its miles and a tag: the total is the sum of the business ones, worked out again at every tap. Nothing is added or taken away by hand.

A single running number

GSAP animates one number from the old total to the new one; at every frame that number becomes the position of the four wheels and the deduction.

Wheels like real ones

The tenths wheel follows the number continuously. Each wheel to the left rests on its digit and only advances during the last tenth of a turn of the one on its right.

The difference chip

Plus or minus comes from the difference between the total before and after, so it is right even when a tag is removed.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#1f8a5bThe colour of business drives: the strip, the miles, the deduction.
RATEscript.js0.67What a business mile is worth, in dollars.
SPINscript.js0.9How many seconds the odometer takes to turn.
LOOPscript.jstrueLeft alone, the demo’s pointer tags the drives one by one.

Try them in the Playground

When to use it

In a freelancer’s or a company’s expense app, in an expense report, a fleet tool or the page presenting a mileage reimbursement app; the same counter with rows to tag carries billable hours, deductible expenses, a week’s steps or the kilos of a harvest.

On phones

The card is at most 356 pixels wide and about 330 tall. Under 350 pixels the windows and the control’s two options narrow; long drive names are cut with an ellipsis. The control’s options are 20 pixels tall inside a 24-pixel pill.

With reduced motion

The odometer and the deduction show the new total at once, without turning; pills and texts change in one step and the difference chip does not appear. The demo’s pointer does not start.

Pitfalls

  • The odometer is decorative for screen readers: the total is also written in hidden text, and each choice is announced with the drive and the new total.
  • Miles have one decimal: adding numbers like these, floating point is slightly off, so the total is rounded to a tenth before showing it.
  • A column of eleven figures (0 to 9 and 0 again) per wheel: without the extra zero, going from 9 to 0 would show a gap.
  • The two options are buttons with `aria-pressed`: a second tap on the chosen one removes the tag, and the drive is to tag again.
  • Drives, miles and rate are invented; the rate per mile changes by country and by year.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

Tested on 2 December 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