Skip to content
animorio
IT
All components

VPN power switch

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

A VPN switch: a round power key inside a ring. Press it and the ring closes, lighting its ticks one by one, the green light blooms, a beam starts orbiting, the session clock runs and the server row swaps country, closing the ring again.

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>
<!--
  "VPN power switch" 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>VPN power switch</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 VPN switch: the round key closes a ring of light while it connects, then a beam keeps orbiting,
         the session clock runs and the server row swaps the exit country -->
    <section class="vp" data-vp aria-label="Portal VPN">
      <span class="vp__sheen" aria-hidden="true"></span>
      <header class="vp__head">
        <span class="vp__brand">Portal VPN</span>
        <span class="vp__status" aria-live="polite"><span data-status>Not protected</span></span>
      </header>

      <div class="vp__dial">
        <span class="vp__halo" data-halo aria-hidden="true"></span>
        <svg class="vp__ring" viewBox="0 0 160 160" aria-hidden="true">
          <defs>
            <filter id="vp-glow" x="-30%" y="-30%" width="160%" height="160%"><feGaussianBlur stdDeviation="3.2"></feGaussianBlur></filter>
          </defs>
          <circle class="vp__track" cx="80" cy="80" r="70"></circle>
          <g class="vp__ticks" data-ticks></g>
          <path class="vp__arc vp__arc--glow" data-arc-glow pathLength="1" d="M80 10A70 70 0 1 1 79.990 10" filter="url(#vp-glow)"></path>
          <path class="vp__arc" data-arc pathLength="1" d="M80 10A70 70 0 1 1 79.990 10"></path>
          <g data-comet>
            <path class="vp__comet vp__comet--glow" pathLength="1" d="M80 10A70 70 0 1 1 79.990 10" filter="url(#vp-glow)"></path>
            <path class="vp__comet" pathLength="1" d="M80 10A70 70 0 1 1 79.990 10"></path>
          </g>
        </svg>
        <button class="vp__key" type="button" role="switch" aria-checked="false" aria-label="VPN connection" data-key>
          <span class="vp__key-face" data-face>
            <svg viewBox="0 0 32 32" aria-hidden="true">
              <path class="vp__power-arc" d="M10.200 9.600a9.400 9.400 0 1 0 11.600 0"></path>
              <path class="vp__power-bar" data-bar d="M16 5.200v9.600"></path>
            </svg>
          </span>
        </button>
      </div>

      <p class="vp__clock" aria-label="Session time"><span data-clock></span></p>

      <button class="vp__server" type="button" data-server aria-label="Change server">
        <svg class="vp__globe" viewBox="0 0 20 20" aria-hidden="true"><circle cx="10" cy="10" r="7.200"></circle><path d="M2.800 10h14.400M10 2.800c2.600 2.300 2.600 12.100 0 14.400M10 2.800c-2.600 2.300-2.600 12.100 0 14.400"></path></svg>
        <span class="vp__place"><span data-place></span></span>
        <span class="vp__ping"><b data-ping>0</b> ms</span>
        <svg class="vp__chev" viewBox="0 0 12 12" aria-hidden="true"><path d="M4.200 2.400 7.800 6l-3.600 3.600"></path></svg>
      </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.

16 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 “VPN power switch” 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 card with a soft light following the pointer: at the top “Portal VPN” and the status, in the middle a round power key inside a ring with sixty fine ticks, below it the session time and the server row with its ping. Pressing the key, it gives way and returns on a spring, the status rolls to “Connecting”, the green ring closes lighting the ticks one by one; when it closes the light blooms and settles, the key takes the green, a white beam starts orbiting along the ring, the status becomes “Protected”, the ping counts up to its value and the clock starts, with only the changing digits rising. Tapping the server row, the name rolls to the next country and the ring reopens and closes again, quicker. Pressing the key again, the ring unwinds, the light goes out and the time returns to zero.

How it works

One object for the state

The ring (p), the light (on), the beam’s turn and the ping live in one object: GSAP animates those numbers and a single function redraws arc, ticks, colours and digits on every frame.

Closing and blooming

The arc has pathLength 1 and closes with stroke-dashoffset in CONNECT seconds; when it closes the halo goes to 1.16 and back to 1 with elastic.out, and the CSS variable --on takes key, status and card shadow to green.

The beam and the clock

The beam is a short stroke of the same circle, rotated through the transform attribute by a number that grows 360 degrees every ORBIT seconds. The time is read from GSAP’s ticker and moves only the characters that change.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#5ef0b4The colour of the light when you are protected.
CONNECTscript.js1.5How many seconds the ring takes to close.
ORBITscript.js3.6How many seconds the light beam takes for one turn.
START_ONscript.jsfalseIt opens already connected.
HOLDscript.js3.4On its own: how many seconds it stays connected before changing server.
LOOPscript.jstrueLeft alone, a pointer connects, changes server and disconnects.

Try them in the Playground

When to use it

In the app of a VPN, an antivirus or a password manager, and wherever a protection is switched on with one gesture: a router’s firewall, private mode, a browser’s shield.

On phones

The same component: the ring never exceeds 40% of the window’s height, the key stays over a hundred pixels wide and the server row is 46 tall.

With reduced motion

No closing ring, springs or orbiting beam: on and off change at once, the time still counts.

Pitfalls

  • The connection is fake: it lasts CONNECT seconds. In a real app the ring follows the handshake with the server, and an error state is needed.
  • The key is a role switch with aria-checked and the status sits in an aria-live line; colour is not the only signal, there is the label.
  • GSAP rounds pixels: without autoRound off, the stroke-dashoffset of a path with pathLength 1 snaps from 0 to 1.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

Tested on 17 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 components