Skip to content
animorio
IT
All components

Wi-Fi toggle

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

The Wi-Fi row of a settings screen: switched on, the knob slides on a spring and stretches on the way, the arcs of the icon draw themselves from the dot outwards like waves, Off below becomes Searching with three small arcs that breathe, then the tile floods with blue from the dot and the small arcs turn into the signal strength next to Home-5G · Connected. Switched off, the arcs go out from the outside in.

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>
<!--
  "Wi-Fi toggle" 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 Wi-Fi toggle with arcs that light up in waves</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 Wi-Fi row of a settings screen: switched on, the arcs of the icon draw themselves from the dot outwards like
         waves, the knob slides on a spring and stretches on the way, the line below goes from Off to Searching with
         three small arcs that breathe, then the tile floods with colour from the dot and the arcs settle into the signal
         strength next to the network name; switched off, the arcs go out from the outside in -->
    <div class="row" data-row>
      <span class="row__light" aria-hidden="true"></span>

      <span class="tile" data-tile aria-hidden="true">
        <span class="tile__flood" data-flood></span>
        <svg class="wifi" viewBox="0 0 24 24">
          <g class="wifi__base">
            <path d="M9.03 13.53A4.2 4.2 0 0 1 14.97 13.53"></path>
            <path d="M6.63 11.13A7.6 7.6 0 0 1 17.37 11.13"></path>
            <path d="M4.22 8.72A11 11 0 0 1 19.78 8.72"></path>
          </g>
          <g class="wifi__lit">
            <path data-arc pathLength="100" d="M9.03 13.53A4.2 4.2 0 0 1 14.97 13.53"></path>
            <path data-arc pathLength="100" d="M6.63 11.13A7.6 7.6 0 0 1 17.37 11.13"></path>
            <path data-arc pathLength="100" d="M4.22 8.72A11 11 0 0 1 19.78 8.72"></path>
          </g>
          <circle class="wifi__dot" data-dot cx="12" cy="16.6" r="1.55"></circle>
        </svg>
      </span>

      <span class="text">
        <span class="text__title" id="wifi-title">Wi-Fi</span>
        <span class="sub">
          <span class="meter" data-meter aria-hidden="true">
            <svg viewBox="0 0 16 12">
              <path data-bar d="M5.8 9.6A3.1 3.1 0 0 1 10.2 9.6"></path>
              <path data-bar d="M3.7 7.5A6.1 6.1 0 0 1 12.3 7.5"></path>
              <path data-bar d="M1.6 5.4A9.1 9.1 0 0 1 14.4 5.4"></path>
            </svg>
          </span>
          <span class="sub__clip"><span class="sub__word" data-sub>Off</span></span>
        </span>
      </span>

      <button class="switch" type="button" role="switch" aria-checked="false" aria-labelledby="wifi-title" data-switch>
        <span class="switch__track" data-track></span>
        <span class="switch__knob" data-knob><span class="switch__shine"></span></span>
      </button>
      <p class="sr" data-live aria-live="polite"></p>
    </div>

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

17 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 “Wi-Fi toggle” 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

In the middle, on white, there is a single settings row: a grey tile with the drawn Wi-Fi icon (the dot and three arcs), the word Wi-Fi with Off below in grey, and the switch. Tap the row and the knob stretches under the finger, slides right on a spring that settles by a pixel, and the track turns blue. The dot of the icon wakes with a small pop and the three arcs draw themselves one at a time, each from its middle towards both ends and a little thicker as it is born, like a wave leaving the dot. Below, Off rolls away and Searching… arrives, led by three small arcs that open sideways and breathe slowly from the inside out. A moment later the tile floods with blue starting from the dot, the arcs it reaches turn white one after the other and the outer one pulls back to a faint line, because the signal is two bars out of three; the small arcs below settle on the same strength and the line reads Home-5G · Connected. Switched off, the arcs pull back from the outside towards the dot, the blue drains into the dot, the dot goes out with a small bounce and Off comes back. Left alone, a drawn pointer switches the row on and off in a loop.

How it works

Arcs that grow from their middle

Each lit arc has pathLength="100" and a dash of length a followed by a gap of 200: with stroke-dashoffset equal to a/2 − 50 the visible stroke always stays centred on the arc. GSAP takes a from 0 to 100 with a stagger (WAVE) from the inner arc to the outer one, while the stroke width rises to 2.9 and back to 2.1: the wave is born at the dot.

A knob that stretches towards where it goes

The knob is described by two numbers, p (0 off, 1 on) and w (its width). Its x is p·20 − (w − 28)·p: resting on the left it stretches to the right, resting on the right it stretches to the left, mid-way on both sides. p runs on elastic.out(1, 0.78), which overshoots by a pixel and settles; w goes up to 35 and back to 28 on a softer spring.

Blue that starts from the dot

Inside the tile there is a 92-pixel circle centred on the dot of the icon, at scale 0. On connecting it scales to 1 with power3.out and covers the tile starting from the dot; the arcs turn white with the same stagger, so they colour as the blue reaches them, and the arcs past the signal strength pull back, showing their white trace at 34% underneath.

A line below that rolls

The state below Wi-Fi is a single span inside an 18-pixel window: it leaves upwards with power2.in, changes its text and comes back from below with back.out. In front of it a small SVG of three arcs opens in width; while searching a looping timeline raises and lowers their opacity from the inside out, and once connected it stops on the signal strength (SIGNAL).

A real switch role

The button has role="switch" and aria-checked, the whole row is tappable, the keyboard switches it with Enter or Space and an aria-live span says Wi-Fi on, Connected to Home-5G, Wi-Fi off.

Values to change

NameFileDefaultWhat it changes
NETWORKscript.jsHome-5GThe name of the network that connects.
ACCENTscript.js#2f6bffThe colour of the switch, the arcs and the flooded tile.
SIGNALscript.js2The signal strength: how many of the three arcs stay lit once connected.
SPRINGscript.js0.75How long the knob’s spring lasts, in seconds.
WAVEscript.js0.13How many seconds between one arc and the next in the wave that lights up.
SEARCHscript.js1.9How many seconds it stays on Searching before connecting.
HOLDscript.js2.6How many seconds it stays connected before the pointer switches it off, when left alone.

Try them in the Playground

When to use it

In the settings of a smart home app, a router, a printer or a camera, in the control panel of an operating system or a desktop app, in the onboarding of a device that joins a network: wherever switching Wi-Fi on should also show what is happening.

On phones

The row narrows to the screen width minus thirty-two pixels and a long network name ends with an ellipsis; the whole row is tappable and the knob stretches under the finger as with the mouse. Without a hovering mouse the light that follows the pointer stays off.

With reduced motion

No springs, waves or flooding: the knob changes side with a fade, the arcs appear already whole, the blue of the tile fades in, the small arcs below stay still and the words change with a fade.

Pitfalls

  • With stroke-dasharray alone the arc drew from one end to the other, not from its middle: it also needs stroke-dashoffset = a/2 − 50 with pathLength="100", and a gap of 200 so the dash does not repeat.
  • Stretching the knob by its width alone pushed it out of the track on the right: the x takes the extra width into account (− (w − 28)·p), so it always stretches towards the free side.
  • The fromTo tweens placed later in the timeline applied their start value at once (the words vanished early): they all have immediateRender: false.
  • A click on the button also reaches the row: only the row listens, so one tap switches it once.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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