Skip to content
animorio
IT
All components

Low Power Mode toggle

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

The battery page of a phone’s settings, on white, in the style of product interface pieces: switching Low Power Mode on stretches the knob and slides it on a spring, the big battery turns amber with a glint running through it, the time left climbs from 5 h 10 to 7 h 40 and below it the background jobs pause one after another. Switching off puts everything back.

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>
<!--
  "Low Power Mode 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 Low Power Mode toggle that stretches the battery</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 battery page of a phone's settings: switching Low Power Mode on stretches the knob, turns the battery amber
         with a glint running through it, rolls the time left up and pauses the background jobs one after another;
         switching it off brings everything back -->
    <section class="card" data-card aria-labelledby="lp-name">
      <header class="top">
        <span class="top__dev" data-device>Pebblo 3</span>
        <svg class="top__sep" viewBox="0 0 8 12" aria-hidden="true"><path d="M2 1.5 6 6l-4 4.5"></path></svg>
        <span class="top__page">Battery</span>
        <svg class="mini" viewBox="0 0 26 13" aria-hidden="true">
          <rect class="mini__body" x="0.75" y="0.75" width="21.5" height="11.5" rx="3.4"></rect>
          <rect class="mini__fill" data-mini x="2.6" y="2.6" width="7" height="7.8" rx="1.8"></rect>
          <path class="mini__cap" d="M23.6 4.6v3.8a1.9 1.9 0 0 0 0-3.8Z"></path>
        </svg>
      </header>

      <div class="hero">
        <div class="cell" data-cell aria-hidden="true">
          <svg class="cell__svg" viewBox="0 0 132 60">
            <defs>
              <clipPath id="cell-in"><rect x="6" y="6" width="112" height="48" rx="9"></rect></clipPath>
              <linearGradient id="glint" x1="0" x2="1" y1="0" y2="0">
                <stop offset="0" stop-color="#fff" stop-opacity="0"></stop>
                <stop offset="0.5" stop-color="#fff" stop-opacity="0.75"></stop>
                <stop offset="1" stop-color="#fff" stop-opacity="0"></stop>
              </linearGradient>
            </defs>
            <rect class="cell__body" x="1.5" y="1.5" width="121" height="57" rx="13"></rect>
            <path class="cell__cap" d="M126 21v18a7 7 0 0 0 0-18Z"></path>
            <g clip-path="url(#cell-in)">
              <rect class="cell__track" x="6" y="6" width="112" height="48"></rect>
              <rect class="cell__fill" data-fill x="6" y="6" width="42" height="48"></rect>
              <rect class="cell__shine" x="6" y="6" width="112" height="14" opacity="0.22"></rect>
              <rect class="cell__glint" data-glint x="-40" y="0" width="34" height="60" fill="url(#glint)" transform="skewX(-18)"></rect>
            </g>
            <g class="cell__ticks">
              <path d="M34 6v4M62 6v4M90 6v4"></path>
            </g>
          </svg>
        </div>
        <div class="hero__text">
          <p class="pct"><span data-pct>38</span><span class="pct__u">%</span></p>
          <p class="left"><span class="left__h" data-h>5</span> h <span class="left__m" data-m>10</span> min left</p>
        </div>
      </div>

      <div class="row">
        <span class="tile" data-tile aria-hidden="true">
          <svg viewBox="0 0 24 24"><path class="tile__bolt" d="M13.2 3.5 6.6 13.1h4.6l-1 7.4 6.8-9.8h-4.7l.9-7.2Z"></path></svg>
        </span>
        <div class="row__text">
          <label class="row__name" id="lp-name" for="lp-switch">Low Power Mode</label>
          <span class="status" aria-live="polite"><span class="status__t" data-status>Off</span></span>
        </div>
        <button class="switch" id="lp-switch" type="button" role="switch" aria-checked="false" data-switch>
          <span class="switch__knob" data-knob></span>
        </button>
      </div>

      <p class="label">While it’s on</p>
      <ul class="jobs">
        <li class="job" data-job>
          <svg class="job__ic" viewBox="0 0 20 20" aria-hidden="true"><path d="M15.5 8.2A6 6 0 0 0 4.6 7M4.5 11.8A6 6 0 0 0 15.4 13"></path><path d="M15.8 4.6v3.8H12M4.2 15.4v-3.8H8"></path></svg>
          <span class="job__name">Background refresh</span>
          <span class="job__state"><span class="job__t" data-state>On</span></span>
        </li>
        <li class="job" data-job>
          <svg class="job__ic" viewBox="0 0 20 20" aria-hidden="true"><path d="M10 3.5v9M6.2 9l3.8 3.8L13.8 9M4.5 16h11"></path></svg>
          <span class="job__name">Automatic downloads</span>
          <span class="job__state"><span class="job__t" data-state>On</span></span>
        </li>
        <li class="job" data-job>
          <svg class="job__ic" viewBox="0 0 20 20" aria-hidden="true"><path d="M10 3c.6 3.6 2.4 5.4 6 6-3.6.6-5.4 2.4-6 6-.6-3.6-2.4-5.4-6-6 3.6-.6 5.4-2.4 6-6Z"></path></svg>
          <span class="job__name">Motion effects</span>
          <span class="job__state"><span class="job__t" data-state>Full</span></span>
        </li>
      </ul>
    </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.

35 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 “Low Power Mode 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

On a very light grey background there is a white card with, at the top, the settings path of an invented phone, Pebblo 3, and on the right the small battery of the status bar. Below, a big drawn battery, 38% full, with the number next to it and the time left, 5 h 10 min; then the Low Power Mode row, with the bolt tile and the switch, and the list of what stops: background refresh, automatic downloads and motion effects. Pressed, the knob stretches; then it slides on a spring and the track turns amber. The bolt lights up with a small turn, the big battery breathes, its fill turns amber and a glint runs through it; the small battery at the top changes colour too. The time left climbs, with the hours hopping when they change, and the three jobs pause one after another: the icon squeezes and dims, the name turns grey and the state rises from On to Paused (Full to Reduced for the effects). Switching off brings everything back, from the bottom up. A drawn pointer switches it on, looks at the battery and switches it off, then starts again; it also really works, with mouse, touch and keyboard.

How it works

A knob that stretches

The knob is a span placed on the left: GSAP only moves its x and width. On press it widens by a few pixels, and as it slides it stretches towards its goal and then pulls back with elastic.out. The track turns amber at the same moment.

The battery that breathes

The battery is an SVG: the fill is a rectangle inside a clipPath, and GSAP animates its width attribute, which shrinks by five units and springs back, and its colour. A slanted rectangle with a white gradient slides from left to right: that is the glint.

The time that climbs

An object holding the minutes goes from 310 to 460 with power2.out, and every update rewrites hours and minutes. When the hour changes, its number hops in from above or below, depending on the direction.

The jobs that pause

Each row keeps its state in a one line window: the old word rises out and the new one comes in from below with back.out. The rows start one after another with a delay that is a knob, and switching off starts from the last one.

Values to change

NameFileDefaultWhat it changes
DEVICEscript.jsPebblo 3The phone’s name at the top.
LEVELscript.js38The battery charge, in percent.
MINUTES_OFFscript.js310How many minutes are left with the switch off.
MINUTES_ONscript.js460How many minutes are left with Low Power Mode on.
PAUSE_STAGGERscript.js0.14The delay between one job pausing and the next, in seconds.
KNOB_STRETCHscript.js8How many pixels the knob stretches while it slides.
ACCENTscript.js#f2a900The colour of Low Power Mode when on.

Try them in the Playground

When to use it

For the settings of an app or a phone, for the page of a battery powered device (headphones, watches, scooters, smart home sensors) or for any switch that changes several things at once and needs to show what changes.

On phones

The card takes the width with a margin; battery, rows and gaps are sized on the height too with clamp and vmin, so the whole page fits in the box. A tap switches it on like a click.

With reduced motion

No springs, breaths or glints: the knob goes to its place, the colours fade, the time changes at once and the states fade over all together. The fake pointer does not start.

Pitfalls

  • GSAP writes its own inline transform: the knob must not have a transform in the CSS. It is placed with left and top and GSAP only moves its x and width.
  • The glint already has a transform as an attribute (skewX): GSAP must not touch its transform, so its x attribute is animated with attr and not the x property.
  • Waits go into gsap.delayedCall and not setTimeout, and the real :hover sits inside @media (hover: hover) so it does not stay on after a tap on iPhone.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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