Skip to content
animorio
IT
Back to the library

Digital car key

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

The car key in the phone’s wallet: a dark card with the car’s profile drawn in lines and three controls below. Unlock opens the padlock’s shackle, the car answers with two flashes of its lights and settles on its suspension, the card’s edge lights up blue. Trunk lifts the boot lid on a spring, Lock closes everything again with a single flash.

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>
<!--
  "Digital car key" 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>Digital car key</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 car's digital key in a phone wallet: Unlock opens the padlock and the lights answer,
         Trunk lifts the lid, Lock closes everything again -->
    <section class="ck" data-ck data-state="locked" aria-label="Digital car key">
      <div class="ck__card" data-card>
        <header class="ck__top">
          <span class="ck__name"><b>Volta Aria GT</b><span class="ck__status"><span data-outstatus>Locked</span></span></span>
          <span class="ck__lock" aria-hidden="true">
            <svg viewBox="0 0 20 20"><path class="ck__shackle" data-shackle d="M6.500 9V6.500a3.500 3.500 0 0 1 7 0V9"></path><rect x="4.500" y="9" width="11" height="8" rx="2.200"></rect></svg>
          </span>
        </header>
        <svg class="ck__car" viewBox="0 0 280 92" aria-hidden="true">
          <path class="ck__beam" data-beam d="M246 55 L280 42 V72 Z"></path>
          <path class="ck__ground" d="M6 81H262"></path>
          <g data-car>
            <path class="ck__body" d="M16 66c0-9 6-14 22-17l36-17c10-5 22-8 38-8h36c21 0 36 8 52 22l32 6c10 2 14 8 14 15v5H16Z"></path>
            <path class="ck__glass" d="M84 46 106 33c7-3 14-4 23-4h18c15 0 27 6 39 17Z"></path>
            <path class="ck__seam" d="M134 29v17M188 48v20"></path>
            <g data-trunk><path class="ck__lid" d="M38 49 17 60"></path></g>
            <path class="ck__tail" data-tail d="M17 62v5"></path>
            <path class="ck__lamp" data-lamp d="M240 55l5 2"></path>
            <circle class="ck__wheel" cx="70" cy="70" r="13"></circle><circle class="ck__hub" cx="70" cy="70" r="5"></circle>
            <circle class="ck__wheel" cx="202" cy="70" r="13"></circle><circle class="ck__hub" cx="202" cy="70" r="5"></circle>
          </g>
        </svg>
        <p class="ck__meta"><span>Battery 82%</span><span>310 km left</span></p>
        <span class="ck__shine" data-shine aria-hidden="true"></span>
      </div>
      <div class="ck__actions">
        <button type="button" data-act="lock" aria-pressed="true"><span class="ck__ico"><svg viewBox="0 0 20 20" aria-hidden="true"><path d="M6.500 9V6.500a3.500 3.500 0 0 1 7 0V9"></path><rect x="4.500" y="9" width="11" height="8" rx="2.200"></rect></svg></span><b>Lock</b></button>
        <button type="button" data-act="unlock" aria-pressed="false"><span class="ck__ico"><svg viewBox="0 0 20 20" aria-hidden="true"><path d="M6.500 9V6a3.500 3.500 0 0 1 6.700-1.400"></path><rect x="4.500" y="9" width="11" height="8" rx="2.200"></rect></svg></span><b>Unlock</b></button>
        <button type="button" data-act="trunk" aria-pressed="false"><span class="ck__ico"><svg viewBox="0 0 20 20" aria-hidden="true"><path d="M2.500 14.500h15M4 14.500v-3l4-1.500 3-4h4.500M11 6l-4.500-2.500"></path></svg></span><b>Trunk</b></button>
      </div>
    </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.

16 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 “Digital car key” 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 dark lacquer card with a cold light at the top left: the car’s name, the “Locked” state, a padlock in a circle and below the profile of a sedan drawn in light lines, its glass barely blue, the wheels and the ground line; at the bottom the battery and the kilometres left. Under the card three controls: Lock, lit, Unlock and Trunk. On opening the car comes in from the left. Tap Unlock and the button tightens and bounces, the padlock’s shackle lifts and turns open, the circle goes blue, headlights and rear lights flash twice with a cone of light in front, the car dips a pixel and comes back up, a band of light crosses the card and its edge lights up; the state rolls to “Unlocked”. Trunk lifts the boot lid around its hinge, slightly past the angle, and the state says “Trunk open”; tapped again it closes and the car gives a small start. Lock closes padlock and trunk together, with a single flash.

How it works

Two states, three controls

Two values: car open and trunk open. Each control changes them and one function updates everything: the card’s attribute for the colours, aria-pressed on the three buttons, the state label. The trunk on a locked car unlocks it first.

Padlock and lid

They are two numbers animated by GSAP and written into the svg’s transform attribute: the shackle turns around its right leg and lifts, the lid turns around its hinge. That way the pivot is in the drawing’s coordinates and does not move.

The car’s answer

A small timeline takes the opacity of headlights, rear lights and the cone in front up and down: twice for unlocking, once for locking. Meanwhile the car’s group drops a pixel and a half and comes back on a spring.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#6ea8ffThe colour of the unlocked car: state, padlock and card edge.
FLASHscript.js0.14How long each flash of the lights lasts when the car answers.
LIDscript.js52How many degrees the boot lid lifts.

Try them in the Playground

When to use it

In the app of a connected car, a rental or a car sharing service; on the page presenting a brand’s digital key; in a phone’s wallet next to the cards. The same layout serves a motorbike, a camper van, an e-bike.

On phones

The piece is at most 312 pixels wide and about 280 tall; the car’s drawing follows the card’s width and gets lower on low screens. The three controls are a third of the card wide and 44 pixels tall.

With reduced motion

No flashes, no springs and the car does not come in from the left: padlock and lid are in their new position at once, colours and state label change. The demo’s pointer does not start.

Pitfalls

  • The lights flash twice at most and briefly: nothing flashes repeatedly, and with reduced motion they are not there.
  • The unlocked car is not told by colour alone: the state label, the padlock and which control is lit all change; every change is announced in an aria-live region.
  • In a real app the command goes out to the car and the answer comes later: between tap and flash there should be a waiting state, and an error if the car cannot be reached.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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