Skip to content
animorio
IT
All components

EV charging card

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

The charging card of an electric car app, with a single gesture: the battery fills while a thin light runs through the charge, and dragging the limit on the battery recalculates the time left, in steps of five per cent; above eighty per cent the charger slows down. Stop pauses, Resume picks it up again, and at the limit the card says Complete with a drawn tick.

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>
<!--
  "EV charging 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>The electric car charging card with the limit you drag</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">
    <!-- one gesture: drag. The charging card of an EV app: the battery fills while a thin light runs through the
         charge; dragging the limit on the battery recalculates the time left, the power tapers above 80 per cent,
         Stop pauses the session and Resume picks it up again; at the limit the card says Complete -->
    <section class="card" data-card aria-label="Charging, Volta Charge">
      <header class="card__head">
        <span class="card__mark" aria-hidden="true">
          <svg viewBox="0 0 20 20"><path d="M7 2.8v3.4M13 2.8v3.4M5 6.2h10v2.6a5 5 0 0 1-10 0Z"></path><path d="M10 13.8v3.4"></path></svg>
        </span>
        <span class="card__who">
          <span class="card__name">Volta Charge</span>
          <span class="card__place">Bay 3, Harbour Street</span>
        </span>
        <span class="card__badge" data-badge><span>Charging</span></span>
      </header>

      <div class="readout">
        <span class="readout__level"><span class="readout__num" data-level aria-live="polite"><span>42</span></span><span class="readout__pc">%</span></span>
        <span class="readout__side">
          <span class="readout__label" data-eta-label><span>Full to 80% in</span></span>
          <span class="readout__eta" data-eta><span>34 min</span></span>
        </span>
      </div>

      <div class="batt" data-batt>
        <div class="batt__body" data-body>
          <span class="batt__beyond" data-beyond aria-hidden="true"></span>
          <span class="batt__fill" data-fill>
            <span class="batt__flow" data-flow aria-hidden="true"></span>
            <span class="batt__edge" data-edge aria-hidden="true"></span>
          </span>
          <span class="batt__ticks" data-ticks aria-hidden="true"></span>
          <span class="limit" data-limit role="slider" tabindex="0" aria-label="Charge limit" aria-valuemin="50" aria-valuemax="100" aria-valuenow="80" aria-valuetext="80 per cent">
            <span class="limit__bar"></span>
            <span class="limit__tag" data-tag><span>80%</span></span>
          </span>
        </div>
        <span class="batt__cap" aria-hidden="true"></span>
      </div>
      <div class="scale" aria-hidden="true"><span>0</span><span>50</span><span>100</span></div>

      <dl class="stats">
        <div><dt>Power</dt><dd data-power><span>50 kW</span></dd></div>
        <div><dt>Added</dt><dd data-added>0.0 kWh</dd></div>
        <div><dt>Cost</dt><dd data-cost>€0.00</dd></div>
      </dl>

      <button class="cta" type="button" data-cta>
        <span class="cta__sweep" data-sweep aria-hidden="true"></span>
        <span class="cta__label" data-cta-label><span>Stop charging</span></span>
      </button>
    </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.

36 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 “EV charging 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 white background there is only a card: a charging session with Volta Charge, a made-up charging network, at bay 3 on Harbour Street. At the top the drawn plug on a light green square, the name and a green tag, Charging. Below it, big, the charge: 42 per cent; on the right the line Full to 80% in and the time left, in minutes. Then the battery, as wide as the card, with its terminal on the right: the charged part is green, with a thread of light on its edge as it moves forward and a thin bright band running from left to right inside the charge while the charger works; nine light ticks every ten per cent, pale where the charge has passed them. On the battery sits the limit, a black bar with a tag above it, 80%, and past the limit the battery is hatched. Below, three small numbers separated by thin rules: the power (50 kW, 22 kW above eighty per cent), the energy added so far and what it has cost. At the bottom the black button, Stop charging. The charge rises by itself, one point at a time, and the big number rolls upwards at every point; the kWh and the cost grow with it. Dragging on the battery, the limit follows the finger, widens a little, and the tag and the time left change in steps of five per cent, the old figure leaving before the new one comes in; released, the limit stops on the nearest step with a spring. Stop sends a sweep of light across the button, the light in the battery goes out, the power drops to 0 kW, the tag becomes Paused and the button turns green, Resume charging. When the charge reaches the limit the battery settles with a small knock, the tag says Complete, the line becomes Charged to 60% and Ready to go, and the button, pale green, shows a tick drawing itself and Unplug when ready; raise the limit and charging starts again by itself. A drawn pointer lowers the limit, pauses, resumes, waits for the end and raises it again, by itself, until you touch the card.

How it works

Charging on GSAP’s clock

The charge rises in a gsap.ticker, using the time between frames: at full pace below eighty per cent, at half pace above, like a real charger slowing down to keep the battery cool. The big number changes only when a whole point is crossed.

Time left, point by point

The time is added up for every point between the charge and the limit: three quarters of a kWh divided by that point’s power, 50 kW or 22 kW. So lowering the limit below eighty takes off a few minutes, raising it above adds many.

One continuous value, one shown

Under the finger the limit is continuous and follows with no steps; the tag, the time and the state change only in steps of five per cent, and on release the limit goes to the nearest step with elastic.out.

One text at a time

Charge, tag, time, power, label and button are windows one line high: the old text leaves and only then does the new one come in with back.out; two texts never share a place.

Three states, one button

Charging, Paused and Complete change the tag, the button, the light in the battery and the power together; at the limit the charge stops by itself, and a higher limit starts it again without touching the button.

Values to change

NameFileDefaultWhat it changes
STARTscript.js42The charge the battery starts from, in per cent.
LIMITscript.js80The starting charge limit, in per cent.
SPEEDscript.js3How many points of charge it gains per second in the demo; above eighty per cent it goes at half.
PRICEscript.js0.42How much a kWh costs, in euros.
SNAPscript.js0.55How long the limit’s spring lasts when you let go, in seconds.
SPRINGscript.js0.5How much the limit bounces into place (lower bounces more).
ACCENTscript.js#16b46cThe colour of the charge, the tag and Resume.

Try them in the Playground

When to use it

In the app of an electric car, a charging network or a home wallbox; with other words, for anything that fills up to a limit you choose: a hot water tank, a savings goal, a backup disk.

On phones

The same card at the width of the screen, with a shorter battery on short screens; a finger drags the limit on the battery, which doesn’t scroll the page.

With reduced motion

No springs, sweeps or running light: the limit goes straight to its place, the texts change with a fade and the charge rises without animation. The drawn pointer does not run.

Pitfalls

  • If the charge rises with setInterval or with the system clock, it doesn’t stop when the page is hidden and doesn’t follow the video recording: it belongs on gsap.ticker, with the time between frames capped at 64 milliseconds.
  • If the limit drops below the charge, the charge has to be brought back to the limit and the session closed; if it rises above a complete session, charging has to start again by itself.
  • The battery needs touch-action: none, otherwise on a phone the drag scrolls the page.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

Tested on 30 October 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 components