
The elastic button
Buttons, Hover, Text
The Translate button under a post in a product app, on white with a single blue: pressed, it says Translating with a spinning arc, then a soft light runs across the text and every Spanish word rises and blurs away while its English one drops into place, left to right, with a pixel of bounce. The button turns into Show original and the note below becomes «Translated from Spanish».
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>
<!--
"Translate 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 Translate button that turns the words into another language</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">
<!-- one gesture: translate. A post written in Spanish sits in a card; pressing Translate makes a soft light run
across the text while every word turns into its English one, left to right, and the button becomes
Show original -->
<article class="card" data-card aria-labelledby="autore">
<header class="head">
<span class="avatar" aria-hidden="true">
<svg viewBox="0 0 40 40"><circle cx="20" cy="15.5" r="6.4"></circle><path d="M7.5 35c1.8-7 7-10.4 12.5-10.4S30.7 28 32.5 35"></path></svg>
</span>
<span class="who">
<b id="autore">Lucía Ferrán</b>
<span class="meta">Product lead at Loomwise <span class="sep" aria-hidden="true"></span> 2h</span>
</span>
</header>
<div class="text" data-text>
<p class="lang lang--from" data-from lang="es">Ayer probamos el nuevo flujo de pago con veinte tiendas. Todo fue más rápido de lo que esperábamos.</p>
<p class="lang lang--to" data-to lang="en" aria-hidden="true">Yesterday we tested the new checkout flow with twenty shops. Everything was faster than we expected.</p>
<span class="sheen" data-sheen aria-hidden="true"></span>
</div>
<footer class="foot">
<span class="from" data-note aria-live="polite">
<span class="from__a" data-note-a>Written in Spanish</span>
<span class="from__b" data-note-b>Translated from Spanish</span>
</span>
<span class="tipwrap">
<button class="tr" type="button" data-btn aria-pressed="false">
<svg class="tr__icon" data-icon viewBox="0 0 24 24" aria-hidden="true">
<path class="tr__a" d="M3.5 16.5 7.6 5.8h.8l4.1 10.7M5 12.7h6"></path>
<path class="tr__b" d="M13.6 9.4h6.9M17 7.6v1.8M19.2 9.4c-.6 3.2-2.6 5.8-5.3 7.4M15.4 12.2c1 1.7 2.6 3.2 4.6 4.3"></path>
</svg>
<svg class="tr__arc" data-arc viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="7.5"></circle></svg>
<span class="tr__labels">
<span class="tr__label" data-l1>Translate</span>
<span class="tr__label tr__label--2" data-l2>Translating</span>
<span class="tr__label tr__label--3" data-l3>Show original</span>
</span>
</button>
<span class="tip" data-tip role="tooltip">Translate to English</span>
</span>
</footer>
</article>
<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.
25 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 “Translate button” from Animorio and fit it into my siteThe two sentences share one cell of a grid, one on top of the other, and every word is an inline-block span: each can rise, blur and vanish on its own without moving the others, and the English sentence is already in place, invisible, before it arrives.
A band almost half as wide as the text, with a blue and white gradient in multiply, runs from left to right with xPercent. The leaving and arriving words start at times proportional to their place in the sentence, so they follow the light even when the two languages have a different number of words.
The three button labels sit on top of each other in a box as wide as the one showing: on each change the box takes the new label’s width with back.out, and Show original arrives narrow on the wdth axis and widens while the pill swells.
A repeating timeline takes the drawn pointer to the button reading its real position every time, shows the tooltip, presses, lets you read the translation and goes back to the original. At the first real touch it stops, and it starts again after eight quiet seconds.
| Name | File | Default | What it changes |
|---|---|---|---|
ACCENT | script.js | #2f6bff | The colour of the reading light, of the freshly translated words and of the switched-on button. |
THINK | script.js | 0.45 | The seconds of Translating before the words start to change. |
SWEEP | script.js | 1.15 | How many seconds the light takes to cross the text while every word changes language. |
LIFT | script.js | 6 | How many pixels the leaving word rises and the arriving one drops. |
BLUR | script.js | 4 | How much a word blurs while it changes, in pixels. |
PAUSE | script.js | 1.8 | The seconds the autopilot leaves to read the translation. |
Under the posts and comments of a social app or a community, in shop or hotel reviews written in other languages, in the messages of a support app, anywhere AI translates a text in place.
The card takes the full width minus the margins, the text drops to 15 pixels and the pill stays 36 pixels tall, easy for a finger; under 360 pixels the note and the pill tighten a little to fit on one line. A tap does what a click does, and the tooltip only shows with a mouse or the keyboard.
No running light, no hops and no blur: the two sentences swap with a fade, the button labels change in light, the arc appears and fades without turning 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.5 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.