
The elastic button
Buttons, Hover, Text
A component in the premium style of Dribbble shots: the Trade in button of a phone shop, in brushed graphite on a warm dark page. At rest it shows the old phone's model and the most it is worth; pressed, it checks the phone (model, screen, battery) while a line of light scans its screen and the digits of the credit spin, then the digits stop one by one from the left on the value, the chip turns champagne and the phone lights up with a check.
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>
<!--
"Trade in 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 Trade in button that values your old phone</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 Trade in button of a phone shop, in brushed graphite on a warm dark page. On hover a stretched highlight
follows the pointer across the brushed metal, the rim catches the light and the old phone in the well leans
forward. Pressed, the button gives under the finger; then it checks the phone (model, screen, battery: the
caption changes, a line of light scans the little phone) while the digits of the credit spin, and they stop
one by one from the left on the value. The phone's screen lights up with a check, the chip turns champagne,
a reflection crosses the metal and the caption says how much comes off the order. Then it goes back -->
<div class="ti" data-wrap>
<span class="ti__floor" data-floor aria-hidden="true"></span>
<button class="ti__btn" type="button" data-btn aria-label="Trade in your Nova 12, up to $420 credit">
<span class="ti__body" data-body>
<span class="ti__metal" aria-hidden="true"></span>
<span class="ti__spec" data-spec aria-hidden="true"></span>
<span class="ti__scan" aria-hidden="true"><span class="ti__scan-band" data-band></span></span>
<span class="ti__glint" aria-hidden="true"><span class="ti__glint-band" data-glint></span></span>
<span class="ti__rim" aria-hidden="true"></span>
<span class="ti__rim ti__rim--hot" data-rim aria-hidden="true"></span>
<span class="ti__row">
<span class="ti__well" data-well aria-hidden="true">
<span class="ti__dev" data-dev>
<svg viewBox="0 0 24 24">
<defs>
<clipPath id="ti-screen"><rect x="8.7" y="4.7" width="6.6" height="14" rx="1.1"/></clipPath>
</defs>
<rect class="ti__case" x="7" y="2.6" width="10" height="18.8" rx="2.5"/>
<rect class="ti__glass" x="8.7" y="4.7" width="6.6" height="14" rx="1.1"/>
<rect class="ti__lit" data-lit x="8.7" y="4.7" width="6.6" height="14" rx="1.1"/>
<path class="ti__speaker" d="M10.9 3.7h2.2"/>
<g clip-path="url(#ti-screen)">
<g data-scanline>
<rect class="ti__scanglow" x="8.2" y="-1.6" width="7.6" height="3.2"/>
<path class="ti__scanline" d="M8.4 0h7.2"/>
</g>
</g>
<path class="ti__check" data-check pathLength="1" d="M9.9 11.9l1.5 1.5 2.7-3"/>
</svg>
</span>
</span>
<span class="ti__text" aria-hidden="true">
<span class="ti__stack">
<span class="ti__label" data-label>Trade in</span>
<span class="ti__label" data-label>Estimating</span>
<span class="ti__label" data-label>Credit applied</span>
</span>
<span class="ti__stack ti__stack--cap">
<span class="ti__cap" data-cap>Nova 12 · 128 GB</span>
<span class="ti__cap" data-cap>Checking model</span>
<span class="ti__cap" data-cap>$340 off your order</span>
</span>
</span>
<span class="ti__chip" aria-hidden="true">
<span class="ti__chip-fill" data-fill></span>
<span class="ti__face" data-face>Up to $420</span>
<span class="ti__face ti__odo" data-face><span class="ti__cur">$</span><span class="ti__cols" data-cols></span></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.
26 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 “Trade in button” from Animorio and fit it into my siteThe graphite is a vertical gradient with a stretched SVG feTurbulence noise on top (baseFrequency 0.003 across and 0.95 down), which becomes thin horizontal lines, blended in soft-light. The highlight on brushed metal runs across the lines: that is why the pointer's light is an ellipse 70 pixels tall and 34 wide, in screen.
The rim is an element with 1 px of padding and the content-box mask in exclude: only the ring is left, with a light gradient on top and a warm one underneath. A second identical ring has two radial spots at the pointer's x and lights up on hover, while working and with a flash at the end.
Each digit is a column 1.2 em tall holding a strip of forty digits; the position is a decimal number and the strip moves by that position modulo 10 times 1.2 em. While working a GSAP ticker moves them at different speeds; to stop them the next position with the right digit, plus one turn, is worked out and reached with a back.out, from left to right.
The chip holds ‘Up to $420’ and the digits in the same grid cell, so it takes the width of the wider one and nothing shifts when they swap. The same goes for the three words and the three small lines.
The job is a GSAP timeline: the checks swap at equal steps inside DURATION, then the digits stop and the last one calls the success. The success is another timeline with the chip, the check drawn with stroke-dashoffset, the reflection and the rim's flash; a delayedCall takes everything back to rest.
| Name | File | Default | What it changes |
|---|---|---|---|
DEVICE | script.js | 'Nova 12 · 128 GB' | The old phone, under the word at rest. |
UP_TO | script.js | 420 | The most the shop pays: the chip at rest. |
CREDIT | script.js | 340 | The credit the phone is worth, where the digits stop. |
CHECKS | script.js | 'model,screen,battery' | What it checks while it works, one after the other. |
DURATION | script.js | 2.6 | Seconds of checking before the digits start to stop. |
SPIN | script.js | 16 | How fast the digits spin, in digits per second. |
SPRING | script.js | 1 | How springy the press and the settle are: 0.4 calm, 2 very bouncy. |
HOLD | script.js | 2.2 | Seconds it stays on Credit applied before going back. |
AUTO | script.js | true | Goes round by itself until someone touches it. |
On the product page of a phone, laptop or watch in an online shop, next to the price: the button to trade in the old device and see right away how much is saved. It also fits the cart or checkout of an electronics shop.
On the phone the button is at most 88% of the screen wide and stays 60 pixels tall; there is no hover, so the highlight lights up under the finger at the touch, and the rest, digits and check included, is the same.
Nothing moves: the phone does not lean, the line of light and the band are not there, the digits do not spin but fade in already on the value, the words swap in place and the chip, the screen and the check fade in.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 8.9 KB; the libraries: GSAP 28 KB.
Tested on 2 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.