
The star rating
Ratings, SVG, Hover
The power button of a smart plug in a home app: the Studio «Desk lamp» card, with a European Schuko plug drawn in profile: two round metal pins, a ribbed grip and a strain relief that bends with the cable. Press it and the round button sinks and springs back, the plug runs to the wall and clicks in, the cable pulls straight and settles, the amber ring draws itself around the button and the watts roll from 0.0 to 42.6, then drift gently like a real meter. Press again and the plug comes out with a little tug and the watts fall back to zero. On black, with a single amber accent.
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>
<!--
"Smart plug button" 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>Smart plug button</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/inter@5.3.0/index.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/jetbrains-mono@5.3.0/index.css">
<link rel="stylesheet" href="style.css">
</head>
<body>
<main class="stage">
<!-- a smart plug in a home app: press the power button, the plug clicks into the wall and the watts roll up -->
<section class="card" data-card aria-label="Smart plug">
<header class="head">
<div class="head__text">
<span class="room">Studio</span>
<span class="name">Desk lamp</span>
</div>
<span class="state" aria-hidden="true"><span class="state__roll" data-state><span>Off</span><span>On</span></span></span>
</header>
<div class="scene" aria-hidden="true">
<svg class="scene__svg" viewBox="0 0 240 80" data-scene>
<defs>
<!-- matte plastic: light from above, a soft core, darker underside -->
<linearGradient id="plastica" x1="0" y1="0" x2="0" y2="1">
<stop offset="0" stop-color="#3b3c43" />
<stop offset=".22" stop-color="#2d2e34" />
<stop offset=".62" stop-color="#222328" />
<stop offset="1" stop-color="#17181c" />
</linearGradient>
<linearGradient id="faccia" x1="0" y1="0" x2="0" y2="1">
<stop offset="0" stop-color="#44454c" />
<stop offset=".3" stop-color="#33343a" />
<stop offset="1" stop-color="#1b1c20" />
</linearGradient>
<linearGradient id="costola" x1="0" y1="0" x2="0" y2="1">
<stop offset="0" stop-color="#4a4b52" />
<stop offset=".35" stop-color="#34353b" />
<stop offset="1" stop-color="#1e1f23" />
</linearGradient>
<linearGradient id="guaina" x1="0" y1="0" x2="0" y2="1">
<stop offset="0" stop-color="#36373d" />
<stop offset=".5" stop-color="#26272c" />
<stop offset="1" stop-color="#18191d" />
</linearGradient>
<!-- a round brass-nickel pin: bright line near the top, dark belly -->
<linearGradient id="spinotto" x1="0" y1="0" x2="0" y2="1">
<stop offset="0" stop-color="#7d7f86" />
<stop offset=".28" stop-color="#eeeef0" />
<stop offset=".5" stop-color="#b9bac0" />
<stop offset=".82" stop-color="#5d5f66" />
<stop offset="1" stop-color="#3c3d43" />
</linearGradient>
<linearGradient id="placca" x1="0" y1="0" x2="0" y2="1">
<stop offset="0" stop-color="#24252a" />
<stop offset=".5" stop-color="#1c1d21" />
<stop offset="1" stop-color="#141518" />
</linearGradient>
<linearGradient id="smusso" x1="0" y1="0" x2="0" y2="1">
<stop offset="0" stop-color="#3c3d44" />
<stop offset=".5" stop-color="#2a2b31" />
<stop offset="1" stop-color="#18191c" />
</linearGradient>
<linearGradient id="incasso" x1="0" y1="0" x2="0" y2="1">
<stop offset="0" stop-color="#060608" />
<stop offset=".75" stop-color="#0d0e11" />
<stop offset="1" stop-color="#17181c" />
</linearGradient>
<linearGradient id="ombra" x1="0" y1="0" x2="1" y2="0">
<stop offset="0" stop-color="#000" stop-opacity=".75" />
<stop offset="1" stop-color="#000" stop-opacity="0" />
</linearGradient>
<linearGradient id="muro" x1="0" y1="0" x2="0" y2="1">
<stop offset="0" stop-color="#2c2d33" stop-opacity="0" />
<stop offset=".5" stop-color="#3a3b42" />
<stop offset="1" stop-color="#2c2d33" stop-opacity="0" />
</linearGradient>
</defs>
<path class="cable" data-cable d="M -4 52 C 40 70 80 70 102 40" />
<path class="cable__shine" data-cable-shine d="M -4 52 C 40 70 80 70 102 40" />
<g data-plug>
<!-- two round pins, chamfered tips; they slide behind the wall plate when the plug is in -->
<path class="prong" d="M 149 31.8 L 165.4 31.8 Q 167.4 31.8 167.8 33.2 L 167.8 34.8 Q 167.4 36.2 165.4 36.2 L 149 36.2 Z" />
<path class="prong" d="M 149 43.8 L 165.4 43.8 Q 167.4 43.8 167.8 45.2 L 167.8 46.8 Q 167.4 48.2 165.4 48.2 L 149 48.2 Z" />
<!-- strain relief: the sleeve narrows towards the cable and bends with it -->
<g data-sleeve>
<path class="sleeve" d="M 119 33.6 C 113 34.4 107 36.6 102.6 37.8 C 101.4 38.1 101.4 41.9 102.6 42.2 C 107 43.4 113 45.6 119 46.4 Z" />
<path class="sleeve__ring" d="M 107.5 36.4 C 107.9 38.6 107.9 41.4 107.5 43.6" />
<path class="sleeve__ring" d="M 111.6 35.3 C 112.1 38.2 112.1 41.8 111.6 44.7" />
<path class="sleeve__ring" d="M 115.4 34.4 C 116 37.9 116 42.1 115.4 45.6" />
</g>
<!-- body: rounded back, a grip that narrows a little, then flares into the round front face -->
<path class="plug" d="M 118 32.4 C 118 30.2 119.2 29.2 121.6 29 L 128 29.8 C 134 30.2 138.6 28.8 141 26.8 C 142.6 25.4 144 24.6 146 24.6 L 147.6 24.6 C 149 24.6 149.6 25.6 149.6 27.2 L 149.6 52.8 C 149.6 54.4 149 55.4 147.6 55.4 L 146 55.4 C 144 55.4 142.6 54.6 141 53.2 C 138.6 51.2 134 49.8 128 50.2 L 121.6 51 C 119.2 50.8 118 49.8 118 47.6 Z" />
<!-- the front face, a shade lighter, with its rim catching the light -->
<path class="plug__face" d="M 144.8 25.2 C 145.4 24.8 146 24.6 147 24.6 L 147.6 24.6 C 149 24.6 149.6 25.6 149.6 27.2 L 149.6 52.8 C 149.6 54.4 149 55.4 147.6 55.4 L 147 55.4 C 146 55.4 145.4 55.2 144.8 54.8 Z" />
<path class="plug__rim" d="M 145.2 25.4 C 146 24.9 146.8 24.8 147.6 24.8 C 148.8 24.8 149.3 25.7 149.3 27" />
<!-- the earthing clips on the top and bottom of the face -->
<rect class="plug__clip" x="145.6" y="23.9" width="3.2" height="1.1" rx=".5" />
<rect class="plug__clip" x="145.6" y="55" width="3.2" height="1.1" rx=".5" />
<!-- mould parting line along the body -->
<path class="plug__seam" d="M 120.4 40.2 L 143.6 40.2" />
<!-- grip ribs: raised rings with a dark groove between them -->
<g class="plug__ribs">
<path class="rib__groove" d="M 124.6 30.1 L 124.6 49.9" />
<path class="rib" d="M 125.2 29.4 L 126.8 29.5 L 126.8 50.5 L 125.2 50.6 Z" />
<path class="rib__groove" d="M 128.6 30 L 128.6 50" />
<path class="rib" d="M 129.2 29.5 L 130.8 29.6 L 130.8 50.4 L 129.2 50.5 Z" />
<path class="rib__groove" d="M 132.6 29.9 L 132.6 50.1" />
<path class="rib" d="M 133.2 29.4 L 134.8 29.2 L 134.8 50.8 L 133.2 50.6 Z" />
<path class="rib__groove" d="M 136.6 29.3 L 136.6 50.7" />
</g>
<!-- soft light along the top edge of the plastic -->
<path class="plug__shine" d="M 120 30 C 122 29.4 126 29.9 128 30.1 C 133.4 30.4 137.4 29.4 140 27.6" />
</g>
<g class="wall" data-wall>
<!-- shadow of the plug on the plate, darker as it gets close -->
<rect class="wall__plate" x="199" y="8" width="17" height="64" />
<path class="wall__bevel" d="M 196 12 L 199 8 L 199 72 L 196 68 Z" />
<!-- the recessed socket the pins disappear into -->
<rect class="wall__socket" x="196" y="23.4" width="3.4" height="33.2" rx="1" />
<path class="wall__lip" d="M 196.3 56.4 L 199.2 56.4" />
<rect class="wall__shadow" data-shadow x="196" y="20" width="12" height="40" opacity="0" />
<line class="wall__edge" x1="216.5" y1="0" x2="216.5" y2="80" stroke="url(#muro)" />
</g>
</svg>
</div>
<div class="power">
<div class="power__hold" data-hold>
<svg class="ring" viewBox="0 0 100 100" aria-hidden="true">
<circle class="ring__track" cx="50" cy="50" r="47" />
<circle class="ring__fill" data-ring cx="50" cy="50" r="47" pathLength="1" />
</svg>
<button class="btn" type="button" data-btn aria-pressed="false" aria-label="Desk lamp power">
<span class="btn__shine" aria-hidden="true"></span>
<svg class="btn__icon" viewBox="0 0 24 24" aria-hidden="true" data-icon>
<path d="M7.05 7.72a7 7 0 1 0 9.9 0" />
<path d="M12 4.33v8.2" />
</svg>
</button>
</div>
<div class="watts" aria-live="polite">
<span class="sr" data-sr>0.0 watts</span>
<span class="watts__num" aria-hidden="true">
<span class="col" data-col="0"></span><span class="col" data-col="1"></span><span class="dot">.</span><span class="col" data-col="2"></span>
</span>
<span class="watts__unit" aria-hidden="true">W</span>
</div>
<span class="hint" data-hint>Today 0.31 kWh</span>
</div>
</section>
</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.
25 values to change
Works with Claude, Claude Code, ChatGPT, Cursor, VS Code, Windsurf, Codex, Gemini CLI
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 “Smart plug button” from Animorio and fit it into my siteThe cord is an SVG path with one Bézier curve: an object holding the plug position and how much the cable hangs is animated by GSAP, and on every frame the path’s d attribute and the plug’s offset are rewritten.
The plug arrives with power3.in slightly past its spot and comes back with a short elastic.out: that settle is what makes the click feel real. At the same moment the socket shifts by 0.8 units and returns.
The circle has pathLength 1: switching on takes stroke-dashoffset from 1 to 0; switching off from 0 to -1, so it empties the same way round it filled.
Every digit is a column with 0 to 9 stacked, and the reading moves each column onto its digit with yPercent, one after the other, with a back.out.
The button and the ring share the same square cell, centred with place-items; the ring is an absolute SVG that fills the cell, rotated by -90 degrees around its own centre.
| Name | File | Default | What it changes |
|---|---|---|---|
WATTS | script.js | 42.6 | The watts the lamp draws once it is on. |
WOBBLE | script.js | 0.8 | How many watts the reading drifts up and down while it is on. |
PRESS | script.js | 0.94 | Scale of the button while pressed. |
SNAP | script.js | 0.55 | Seconds the plug takes to click into the wall. |
SAG | script.js | 18 | How much the cable hangs when the plug is out. |
ROLL | script.js | 0.07 | Seconds between one digit of the watts and the next. |
AUTO_PAUSE | script.js | 5 | Seconds of quiet before the demo plays by itself again. |
In a smart home app, on the panel of a plug or a light, in an energy dashboard: wherever switching something on should show straight away what came on and how much it draws.
Everything is in em and the size depends on both the width and the height of the window, so the card fits the phone box. A tap works like a click; hover only exists where there is a mouse.
No springs or movement: the plug fades out and back in at its new spot, the ring appears already whole, the colour fades and the watts change without rolling.
GSAP 3.15.0, Inter (font variabile) 5.3.0, JetBrains Mono (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 7.4 KB; the libraries: GSAP 28 KB.
Tested on 28 November 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.
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.