
La valutazione a stelle
Valutazioni, SVG, Hover
Il pulsante d’accensione di una presa smart nell’app di casa: la card «Desk lamp» dello Studio, con la spina europea Schuko disegnata di profilo, coi due spinotti tondi di metallo, le costole dell’impugnatura e il passacavo che si piega col filo. Premuto, il tondo scende e torna con una molla, la spina corre verso il muro ed entra con uno scatto, il filo si tende e si riassesta, l’anello ambra si disegna attorno al tondo e i watt rotolano da 0.0 a 42.6, poi oscillano piano come un contatore vero. Premuto di nuovo, la spina esce con un piccolo strappo e i watt tornano a zero. Su nero, con un solo accento ambra.
Una cartella che funziona da sola: index.html, style.css, script.js e le librerie da CDN. Nelle schede React e Vue la stessa demo è già un componente, che spegne le sue animazioni quando esce dalla pagina.
<!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>Cambia valori, colori e testi con le manopole e guarda l’animazione rispondere dal vivo. Oppure scrivi tu nel codice. Poi scarica la cartella con le tue modifiche.
25 valori da cambiare
Funziona con Claude, Claude Code, ChatGPT, Cursor, VS Code, Windsurf, Codex, Gemini CLI
Col connettore di Animorio, Claude Code, ChatGPT, Cursor o VS Code la prendono da qui con tutta la sua guida e la adattano al tuo progetto. Incolla questa richiesta:
Prendi «Pulsante presa smart» da Animorio e adattala al mio sitoIl cavo è un tracciato SVG con una curva di Bézier: un oggetto con la posizione della spina e quanto pende viene animato da GSAP, e a ogni fotogramma si riscrive l’attributo d del tracciato e lo spostamento della spina.
La spina arriva con power3.in un po’ oltre il suo posto e torna con un elastic.out corto: è l’assestamento che fa sembrare lo scatto vero. Nello stesso istante la presa si sposta di 0,8 unità e torna.
Il cerchio ha pathLength 1: acceso, stroke-dashoffset va da 1 a 0; spento, da 0 a -1, così si svuota nello stesso verso in cui si era riempito.
Ogni cifra è una colonna con i numeri da 0 a 9 uno sopra l’altro, e la lettura sposta ogni colonna con yPercent sulla sua cifra, una dopo l’altra, con un back.out.
Il tondo e l’anello stanno nella stessa cella quadrata, centrati con place-items; l’anello è un SVG assoluto che riempie la cella, ruotato di -90 gradi attorno al suo centro.
| Nome | File | Di partenza | Cosa cambia |
|---|---|---|---|
WATTS | script.js | 42.6 | I watt che la lampada consuma da accesa. |
WOBBLE | script.js | 0.8 | Di quanti watt la lettura sale e scende mentre è accesa. |
PRESS | script.js | 0.94 | La scala del tondo mentre è premuto. |
SNAP | script.js | 0.55 | I secondi che la spina impiega a entrare nel muro. |
SAG | script.js | 18 | Quanto pende il filo quando la spina è fuori. |
ROLL | script.js | 0.07 | I secondi fra una cifra dei watt e la successiva. |
AUTO_PAUSE | script.js | 5 | I secondi di quiete prima che la demo riparta da sola. |
Nell’app di una casa intelligente, nel pannello di una presa o di una luce, nella dashboard dei consumi: dove accendere qualcosa deve far vedere subito che cosa si è acceso e quanto consuma.
Tutto è in em e la grandezza dipende sia dalla larghezza sia dall’altezza della finestra, così la card sta nella casella del telefono. Il tocco fa come il clic; il passaggio del mouse c’è solo dove c’è un mouse.
Niente molle né spostamenti: la spina sparisce e ricompare al suo posto in dissolvenza, l’anello compare già intero, il colore cambia sfumando e i watt cambiano senza rotolare.
GSAP 3.15.0, Inter (font variabile) 5.3.0, JetBrains Mono (font variabile) 5.3.0.
Compressi con gzip, i tre file della demo pesano 7,4 KB; le librerie: GSAP 28 KB.
Provata il 28 novembre 2026
Puoi usarla nei tuoi progetti e in quelli dei tuoi clienti. Non puoi rivenderla né ridistribuirla così com’è. GSAP resta sotto la sua licenza Standard. Licenza completa.
Avevi chiesto
L’abbiamo fatta per te: è nella libreria, con l’anteprima, il Playground e il codice da copiare.
Un’animazione che non trovi o un sito da smontare nel giornale: dicci quale. Le prossime le scegliamo da qui.
Con l’email e la password del tuo account.
oppure con l’email
Hai fatto l’accesso come .
Con l’account scarichi lo zip di ogni animazione e di ogni pacchetto, gratis.