
The elastic button
Buttons, Hover, Text
The Generate image button of an AI image app, in smoked glass on near black, like a Dribbble shot. On the left a small tile holds the preview: at rest a seed of coloured noise that stirs on hover. Pressed, the photo (an orchid at dusk, a koi pond, a sand dune under a low sun) comes out of the noise step by step like a real diffusion model, a thread of light closes around the tile, the picture’s colours spread into the glass and the steps and the percent count up; at the end the picture is sharp, a reflection crosses it, a check draws itself and the button throws its colours on the floor.
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>
<!--
"Generate image 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>The Generate image button with the preview that comes out of the noise</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 Generate image button of an AI image tool, dark smoked glass on a near black page. Inside, on the left, a
small tile with the preview: at rest a dim seed of noise, on hover the noise stirs. Pressed, the image comes
out of the noise step by step like a real diffusion model, a thin line of light closes around the tile, the
colours of the picture bleed into the glass and the steps count up. At the end the picture is sharp, a
reflection crosses it, a check draws itself and the button throws the picture's colours on the floor. -->
<div class="gi" data-wrap>
<span class="gi__glow" data-glow aria-hidden="true"></span>
<button class="gi__btn" type="button" data-btn aria-label="Generate image: orchid at dusk">
<span class="gi__body" data-body>
<span class="gi__fill" aria-hidden="true"></span>
<span class="gi__wash" aria-hidden="true"><span class="gi__wash-light" data-wash></span></span>
<span class="gi__shine" data-shine aria-hidden="true"></span>
<span class="gi__sweep" aria-hidden="true"><span class="gi__sweep-band" data-sweep></span></span>
<span class="gi__edge" aria-hidden="true"></span>
<span class="gi__row">
<span class="gi__tile" data-tile aria-hidden="true">
<span class="gi__tile-face" data-face>
<canvas class="gi__canvas" data-canvas width="96" height="96"></canvas>
<span class="gi__tile-gloss"></span>
<span class="gi__tile-flash" aria-hidden="true"><span class="gi__tile-flash-band" data-flash></span></span>
</span>
<svg class="gi__ring" viewBox="0 0 52 52">
<path class="gi__ring-track" d="M26 1H37A14 14 0 0 1 51 15V37A14 14 0 0 1 37 51H15A14 14 0 0 1 1 37V15A14 14 0 0 1 15 1Z"/>
<path class="gi__ring-run" data-ring d="M26 1H37A14 14 0 0 1 51 15V37A14 14 0 0 1 37 51H15A14 14 0 0 1 1 37V15A14 14 0 0 1 15 1Z" pathLength="1"/>
</svg>
</span>
<span class="gi__text" aria-hidden="true">
<span class="gi__state" data-state>
<span class="gi__title" data-t>Generate image</span>
<span class="gi__sub" data-s>Orchid at dusk</span>
</span>
<span class="gi__state" data-state>
<span class="gi__title gi__title--busy" data-t>Generating</span>
<span class="gi__sub" data-s>Step <b class="gi__num" data-step>0</b> of <b class="gi__num" data-steps>30</b></span>
</span>
<span class="gi__state" data-state>
<span class="gi__title" data-t>Image ready</span>
<span class="gi__sub" data-s>1024 × 1024 · 2.4 s</span>
</span>
<span class="gi__state" data-state>
<span class="gi__title" data-t>Stopped</span>
<span class="gi__sub" data-s>No credits used</span>
</span>
</span>
<span class="gi__end" aria-hidden="true">
<span class="gi__end-face" data-end>
<svg class="gi__spark" data-spark viewBox="0 0 24 24"><path d="M12 3.2c.5 4.6 2.9 7.3 8.8 8.8-5.9 1.5-8.3 4.2-8.8 8.8-.5-4.6-2.9-7.3-8.8-8.8 5.9-1.5 8.3-4.2 8.8-8.8z"/></svg>
<span class="gi__cost" data-cost>4</span>
</span>
<span class="gi__end-face" data-end><span class="gi__pct" data-pct>0</span><span class="gi__pct-unit">%</span></span>
<span class="gi__end-face" data-end>
<svg class="gi__check" viewBox="0 0 24 24"><path data-check pathLength="1" d="M6.6 12.6l3.6 3.5 7.2-7.6"/></svg>
</span>
</span>
</span>
</span>
</button>
</div>
<p class="sr" aria-live="polite" data-live></p>
</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.
31 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 “Generate image button” from Animorio and fit it into my siteEach prompt has its own real CC0 photo in the demo folder (an orchid at dusk, three koi, a dune under a low sun), loaded with new Image and decode(). drawImage crops it to a square around the subject (x, y and how tight, z) on a 96 pixel offscreen canvas, with a light vignette: it is the target of the diffusion. The photo’s two colours tint the glass and the floor.
At every step p goes from 0 to 1: the blocks start at six pixels and go down to one with (1 − p)²; the photo is shrunk to one pixel per block on a small canvas without smoothing and blown up again, weighted by smoothstep(p); on top, in lighter mode, a brightness noise with a little colour per channel, weighted by (1 − smoothstep(p)), written with putImageData on its own canvas and blown up the same way. No pixel of the photo is ever read back.
GSAP takes p from 0 to 1 in DURATION seconds with power1.inOut, but the tile is redrawn only when the step changes (floor(p · STEPS)): the picture moves forward in jumps like a real generator, and the canvas works only thirty times. The noise uses a linear congruential generator with its own seed, so every recording is the same.
The thread is a rounded rectangle SVG path starting at the top centre, with pathLength 1 and its stroke-dashoffset written by hand on every frame. Behind the words a radial light in the picture’s two colours (CSS variables changed for each prompt) grows with p, and at the end the coloured shadow under the button lights up too.
Rest, hover (light under the pointer with gsap.quickTo, the tile growing, the noise stirring at twelve frames a second on GSAP’s ticker), press, generating, ready and stopped: the labels are stacked and swap with back.out; the autopilot is a timeline that starts from the load event and stops at the first real touch or key.
| Name | File | Default | What it changes |
|---|---|---|---|
PROMPTS | script.js | Orchid at dusk|Koi pond in deep shade|Sand dune under a low sun | The prompts, one per round, split by |: each goes with its photo, in order. |
STEPS | script.js | 30 | How many steps the picture takes to come out of the noise. |
DURATION | script.js | 2.4 | How many seconds the generation lasts. |
NOISE | script.js | 0.5 | How bright the noise is: 0.2 faint, 1 strong. |
BLOCKS | script.js | 6 | How big the noise blocks are at the first step, in canvas pixels. |
COST | script.js | 4 | The credits shown next to the sparkle. |
SPRING | script.js | 1 | How springy the moves are: 0.4 calm, 2 very bouncy. |
HOLD | script.js | 1.8 | How many seconds Image ready stays before going back to rest. |
AUTO | script.js | true | The button goes round by itself until someone touches it. |
For an app or a site that generates images with AI, for the editor of a portfolio or a shop that creates covers and product shots: the button that starts the generation and shows, while it works, what is coming out, the steps and how far along it is, and lets you stop it.
On the phone the button is at most 86% of the screen wide and a long prompt ends with an ellipsis; there is no hover, so the light under the finger turns on at the touch and the rest is the same.
Nothing moves or bounces: the labels, the percent and the check swap with a fade, the picture clears in place step by step, the thread of light closes and the colours only grow in strength; the noise at rest does not stir.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 10 KB; the libraries: GSAP 28 KB.
Tested on 5 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.
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.