
The elastic button
Buttons, Hover, Text
A soft-relief switch, carved into a pale plate. Touch it and the knob sinks (its shadow pulls in), slides across on a spring and comes back up; behind it the groove fills with green and the inner shadow widens. The knob’s three ridges light up and the word under “Quiet mode” rolls from Off to On. It can also be dragged.
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>
<!--
"Neumorphic 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>Neumorphic toggle</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">
<!-- a soft-relief switch: the knob sinks before it slides, the groove fills with colour behind it and
the inner shadow widens; it can be clicked, dragged or flipped with the keyboard -->
<div class="np" data-np>
<div class="np__text">
<span class="np__label" id="np-label">Quiet mode</span>
<span class="np__state" aria-hidden="true"><b data-state>Off</b></span>
</div>
<button class="nt" type="button" role="switch" aria-checked="false" aria-labelledby="np-label" data-nt>
<span class="nt__fill" data-fill aria-hidden="true"></span>
<span class="nt__carve" aria-hidden="true"></span>
<span class="nt__knob" data-knob aria-hidden="true"><span class="nt__dimple" data-dimple><i></i><i></i><i></i></span></span>
</button>
</div>
<svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.200 19.200 11l-6.300 1.600-3.300 5.900Z"></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.
11 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 “Neumorphic toggle” from Animorio and fit it into my siteThe knob’s position is a number from 0 to 1: it moves the knob and is written to the CSS variable --on, from which the groove’s colour, its clipping and the inner shadow work themselves out.
A second number, --lift, multiplies the measures of the knob’s shadow: it drops to 0.25 in a tenth of a second, then rises on a back.out while the knob is already sliding.
Every shadow has two halves: dark bottom right and light top left for what stands out, inset and reversed for what is carved. The layer of inner shadows sits above the colour.
pointerdown captures the pointer, pointermove shifts the number by how far the finger moved divided by the travel; on release the halfway point decides. Under four pixels it is a tap.
| Name | File | Default | What it changes |
|---|---|---|---|
ACCENT | script.js | #19c2a0 | The colour that fills the groove when the switch is on. |
DEPTH | script.js | 1 | How deep the relief is (the shadows): 0.5 = barely there, 1.6 = pronounced. |
SPRING | script.js | 1 | How much the knob bounces when it arrives: 0.3 = a little, 2 = a lot. |
START_ON | script.js | false | true = the switch starts on. |
LOOP | script.js | true | Left alone, the demo’s pointer turns it on and off. |
In the settings of a home app, a car, a music player or any product with a soft, tactile look: one entry with its switch, to repeat down a list.
The same plate, 272 pixels wide at most; the switch is 104 by 56, easy for a thumb, and with a finger it can be tapped or dragged.
The knob goes straight to the other side, with no sink and no bounce; groove, ridges and word change together. No dragging. The demo does not move by itself.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 4.5 KB; the libraries: GSAP 28 KB.
Tested on 22 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.