
The elastic button
Buttons, Hover, Text
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.
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>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
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 siteThe 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 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.
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.
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.
| Name | File | Default | What it changes |
|---|---|---|---|
DEVICE | script.js | Pebblo 3 | The phone’s name at the top. |
LEVEL | script.js | 38 | The battery charge, in percent. |
MINUTES_OFF | script.js | 310 | How many minutes are left with the switch off. |
MINUTES_ON | script.js | 460 | How many minutes are left with Low Power Mode on. |
PAUSE_STAGGER | script.js | 0.14 | The delay between one job pausing and the next, in seconds. |
KNOB_STRETCH | script.js | 8 | How many pixels the knob stretches while it slides. |
ACCENT | script.js | #f2a900 | The colour of Low Power Mode when on. |
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.
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.
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.
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.
Tested on 27 October 2026
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.
Support Animorio
Animorio stays free thanks to the people who support it. If you like, buy us a coffee: it helps us make the next animations.
You asked for
We made it for you: it’s in the library, with the preview, the Playground and the code to copy.
An animation you can’t find, or a site to take apart in the journal: tell us which. We pick the next ones from here.
With your account’s email and password.
or with your email
You’re signed in as .
With your account, you can download the zip of every animation and every pack, for free.