
The elastic button
Buttons, Hover, Text
An AI assistant asks permission before acting, on an almost black background, in the style of the light effects of AI apps: «Halcy wants to send 3 emails to the design team» and below it the dark pill Hold to approve. A single gesture, press and hold: a cold light charges along the pill’s border from the top, with a white head and a soft halo, while the button squashes and then swells slightly; let go early and the light runs back and the pill bounces on a spring. When it reaches the end the light closes the loop, a flash runs once all the way round, the shield turns green with a drawn check and the label rolls to Approved.
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>
<!--
"Hold to approve agent" 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 hold to approve button for an AI agent</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">
<!-- an AI agent asks before acting: hold the button and a beam of light charges along its border; let go early and it
springs back, hold to the end and the beam closes, flashes round once and the label rolls to Approved -->
<section class="ask" data-ask aria-label="Agent approval">
<p class="ask__who">
<svg class="ask__mark" viewBox="0 0 20 20" aria-hidden="true"><path d="M10 2.2c.5 3.9 2.1 5.4 5.9 5.9-3.8.5-5.4 2.1-5.9 5.9-.5-3.8-2-5.4-5.9-5.9 3.9-.5 5.4-2 5.9-5.9Z"></path><path d="M15.6 13.4c.2 1.5.8 2.1 2.3 2.3-1.5.2-2.1.8-2.3 2.3-.2-1.5-.8-2.1-2.3-2.3 1.5-.2 2.1-.8 2.3-2.3Z"></path></svg>
<span><b>Halcy</b> wants to</span>
</p>
<p class="ask__what" data-what>send 3 emails to the design team</p>
<div class="btnwrap" data-wrap>
<button class="btn" type="button" data-btn aria-live="polite">
<span class="btn__glow" data-press-glow aria-hidden="true"></span>
<span class="btn__fill" data-fill aria-hidden="true"></span>
<span class="btn__in">
<svg class="btn__icon" viewBox="0 0 20 20" aria-hidden="true">
<path class="btn__shield" data-shield d="M10 2.6 16 4.9v4.6c0 3.7-2.5 6.4-6 7.9-3.5-1.5-6-4.2-6-7.9V4.9Z"></path>
<path class="btn__check" data-check pathLength="1" d="M6.6 10.2 8.9 12.5 13.6 7.6"></path>
</svg>
<span class="btn__label" data-label></span>
</span>
</button>
<svg class="beam" data-beam aria-hidden="true">
<defs>
<filter id="beamBlur" x="-30%" y="-80%" width="160%" height="260%"><feGaussianBlur stdDeviation="3.2"></feGaussianBlur></filter>
<filter id="headBlur" x="-30%" y="-80%" width="160%" height="260%"><feGaussianBlur stdDeviation="1.4"></feGaussianBlur></filter>
</defs>
<path class="beam__track" data-track pathLength="1"></path>
<path class="beam__halo" data-halo pathLength="1" filter="url(#beamBlur)"></path>
<path class="beam__line" data-line pathLength="1"></path>
<path class="beam__head" data-head pathLength="1" filter="url(#headBlur)"></path>
<path class="beam__core" data-core pathLength="1"></path>
<path class="beam__flash" data-flash pathLength="1" filter="url(#headBlur)"></path>
</svg>
</div>
<p class="ask__hint" data-hint></p>
</section>
<svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.2 19.2 11l-6.3 1.6-3.3 5.9Z"></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.
18 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 “Hold to approve agent” from Animorio and fit it into my siteAn SVG a little larger than the button holds six paths with the same drawing, the pill traced clockwise from the top centre, recomputed on resize to the real size. With pathLength set to 1 the border’s length is always 1, and the charge is just a strokeDasharray going from 0 to 1.
The blue line draws what is charged, a thicker copy blurred with a Gaussian filter makes the halo, and two short white segments, moved with strokeDashoffset to the end of the charge, make the bright head. Everything reads the same number, so they never drift apart.
On press a tween takes the charge to 1 in HOLD_TIME seconds, with power1.in the first time and linear when resuming halfway. The button reads two values, how pressed it is and how charged: it squashes to 96% and swells by 5% of the charge. On release the charge goes back to zero with power3.out and the press with elastic.out.
At the end a white segment runs once along the whole border, at most a fifth long and shorter at both ends thanks to a sine; the halo widens and settles. The label is made of letters: the old ones rise away with a 14 millisecond stagger, the new ones come in from below with back.out.
| Name | File | Default | What it changes |
|---|---|---|---|
AGENT | script.js | Halcy | The name of the assistant asking for permission. |
ACTION | script.js | send 3 emails to the design team | What the assistant wants to do. |
HOLD_TIME | script.js | 1.4 | The seconds to hold for the light to go all the way round. |
DONE_HOLD | script.js | 2.2 | The seconds it stays Approved before going back. |
BEAM_GLOW | script.js | 1 | How strong the halo of the light on the border is (0 = just the line). |
PRESS_SCALE | script.js | 0.965 | How much the button squashes when pressed. |
SWELL | script.js | 0.05 | How much it swells while the light charges. |
SPRING | script.js | 1 | How much it bounces when you let go (0 = none). |
For the actions of an AI assistant or an automation that need a calm confirmation (sending emails, paying, deleting, publishing), where a single click would be too easy: holding says «I am sure» without opening a confirmation dialog.
The same animation: the pill narrows to 78% of the width and its height is measured on the screen height too; a finger does the press, and the button does not open the long press menu.
No shake, no squash and no spring: the light still charges along the border, the final flash is just the border lighting up and fading, the labels change with a fade and the drawn pointer stays hidden.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 6.7 KB; the libraries: GSAP 28 KB.
Tested on 26 October 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.