
The elastic button
Buttons, Hover, Text
The Flashlight button of a control centre, on black. Tap it and the bulb catches twice, the circle turns warm white and a cone of light opens above it, reaching the top on a spring, while a glow spreads around. The four marks below pick the brightness: the cone widens or narrows and gets brighter or dimmer, from Low to Max. One more tap and the light goes back into the button.
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>
<!--
"Flashlight 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>Flashlight button</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 Flashlight button of a control centre: it throws a cone of light above itself,
and the four marks below choose how strong and how wide the beam is -->
<div class="fl" data-fl data-level="0">
<span class="fl__sky" aria-hidden="true">
<span class="fl__beam" data-beam></span>
<span class="fl__core" data-core></span>
</span>
<button class="fl__btn" type="button" data-btn aria-pressed="false" aria-label="Flashlight">
<span class="fl__halo" data-halo aria-hidden="true"></span>
<svg viewBox="0 0 28 28" aria-hidden="true">
<path class="fl__body" d="M9.200 9.800h9.600l-2 4.300v8.700a1.300 1.300 0 0 1-1.300 1.300h-3a1.300 1.300 0 0 1-1.300-1.300v-8.700Z"></path>
<path class="fl__switch" d="M14 16.600v2.600"></path>
<g class="fl__rays" data-rays><path d="M14 3.200v3.400"></path><path d="M8.300 4.700l1.500 2.800"></path><path d="M19.700 4.700l-1.500 2.800"></path></g>
</svg>
</button>
<div class="fl__levels" role="group" aria-label="Brightness">
<button type="button" data-seg aria-pressed="false" aria-label="Low"><i></i></button>
<button type="button" data-seg aria-pressed="false" aria-label="Medium"><i></i></button>
<button type="button" data-seg aria-pressed="false" aria-label="High"><i></i></button>
<button type="button" data-seg aria-pressed="false" aria-label="Max"><i></i></button>
</div>
<p class="fl__label"><b>Flashlight</b><span class="fl__state"><span data-outstate>Off</span></span></p>
</div>
<span class="live" aria-live="polite" data-live></span>
<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 “Flashlight button” from Animorio and fit it into my siteThe cone is an element with a gradient and a trapezoid clip-path. Three numbers describe it: how far up it reaches, how wide it is at the top and how bright. GSAP animates the numbers and a function rewrites clip-path and opacity on every frame.
A small timeline makes the light catch twice in little more than a tenth of a second, then the cone’s length goes from zero to one with a slight overshoot. Inside sits a second cone, half as wide and brighter: the core of the beam.
Each mark is a button. Pick one and width and brightness go to that level’s values on an elastic spring; the big button remembers the last level used and comes back on with it.
| Name | File | Default | What it changes |
|---|---|---|---|
ACCENT | script.js | #fff1cc | The colour of the light. |
LEVEL | script.js | 2 | The brightness the flashlight comes on with: 1 to 4. |
OPEN | script.js | 0.5 | How long the cone of light takes to open. |
In the control centre of a phone or a watch, in the quick settings of a camera app, in the app of a lamp or a bike light; and wherever a switch also has an intensity: a home light, a backlight, the flash.
The same piece, at most 240 pixels wide: the circle is 76 pixels, the marks have a 30 by 24 touch area. The cone’s room is 150 pixels tall and gets shorter on low screens.
The cone does not open or bounce: it fades in and out, already at its width, without the two flashes of switching on. The demo’s pointer does not start.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 5.0 KB; the libraries: GSAP 28 KB.
Tested on 26 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.