
The elastic button
Buttons, Hover, Text
The Open chest button of a made-up language app's daily rewards, on black: inside the graphite pill a small treasure chest in dark wood and brushed gold. Pressed, the chest hops twice, the lid springs open on its hinge, a beam of golden light rises, two coins and a gem jump out and fall back into the pill, +250 XP rolls in and the button becomes Claimed with a ticking countdown.
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>
<!--
"Reward chest 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 Open chest button of the daily rewards with the lid that lifts on the light</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 Open chest button of a made-up language app's daily rewards: pressed, the little chest hops twice, the lid
springs open on its hinge, a soft beam of gold light rises, three coins jump out and fall back into the pill,
+250 XP rolls in and the pill becomes Claimed with the countdown to the next chest -->
<div class="wrap" data-wrap>
<span class="glow" data-glow aria-hidden="true"></span>
<div class="pill" data-pill>
<span class="pill__floor" aria-hidden="true"></span>
<div class="pill__clip">
<span class="pill__grain" aria-hidden="true"></span>
<span class="pill__sheen" data-sheen aria-hidden="true"></span>
</div>
<span class="pill__edge" aria-hidden="true"></span>
<button class="hit" type="button" data-open aria-label="Open chest, daily reward of 250 XP"></button>
<!-- the chest, outside the clip so the light and the coins can leave the pill -->
<span class="chest" data-chest aria-hidden="true">
<span class="beam" data-beam><span class="beam__core"></span><span class="beam__dust" data-dust></span></span>
<svg class="chest__svg" viewBox="0 0 44 40">
<defs>
<linearGradient id="wood" x1="0" y1="0" x2="0" y2="1">
<stop offset="0" stop-color="#4a2e1d"/><stop offset=".55" stop-color="#2e1b11"/><stop offset="1" stop-color="#1a0f09"/>
</linearGradient>
<linearGradient id="woodlid" x1="0" y1="0" x2="0" y2="1">
<stop offset="0" stop-color="#5a3824"/><stop offset=".7" stop-color="#341f13"/><stop offset="1" stop-color="#22140c"/>
</linearGradient>
<linearGradient id="gold" x1="0" y1="0" x2="1" y2="1">
<stop offset="0" stop-color="#fbe7a6"/><stop offset=".22" stop-color="#d4a84c"/><stop offset=".45" stop-color="#8f6522"/>
<stop offset=".62" stop-color="#e8c56b"/><stop offset=".82" stop-color="#a77a2c"/><stop offset="1" stop-color="#f3d68a"/>
</linearGradient>
<linearGradient id="inside" x1="0" y1="0" x2="0" y2="1">
<stop offset="0" stop-color="#ffe9a8"/><stop offset=".5" stop-color="#e0a83c"/><stop offset="1" stop-color="#5a3510"/>
</linearGradient>
<pattern id="brush" width="44" height="1.2" patternUnits="userSpaceOnUse">
<rect width="44" height=".5" fill="#fff" opacity=".18"/>
</pattern>
</defs>
<!-- the opening, lit from inside when the lid lifts -->
<path class="chest__mouth" data-mouth d="M7 18.4 9 15.6h26l2 2.8Z" fill="url(#inside)"/>
<!-- the box -->
<g class="chest__box">
<rect x="5" y="18" width="34" height="18" rx="2.2" fill="url(#wood)"/>
<path d="M6.5 23.4h31M6.5 29.2h31" stroke="#120a05" stroke-width=".6" opacity=".7"/>
<path d="M9 21c4 .4 8-.3 12 .2M24 26.4c4 .5 8-.2 12 .3M8 32.2c5 .3 9-.2 14 .2" stroke="#6b4429" stroke-width=".35" fill="none" opacity=".55"/>
<rect x="5" y="18" width="34" height="18" rx="2.2" fill="none" stroke="url(#gold)" stroke-width="1.3"/>
<rect x="11" y="18" width="2.6" height="18" fill="url(#gold)"/>
<rect x="30.4" y="18" width="2.6" height="18" fill="url(#gold)"/>
<rect x="11" y="18" width="2.6" height="18" fill="url(#brush)"/>
<rect x="30.4" y="18" width="2.6" height="18" fill="url(#brush)"/>
<circle cx="12.3" cy="33.4" r=".55" fill="#3a2410"/><circle cx="31.7" cy="33.4" r=".55" fill="#3a2410"/>
<circle cx="12.3" cy="21" r=".55" fill="#3a2410"/><circle cx="31.7" cy="21" r=".55" fill="#3a2410"/>
</g>
<!-- the lid, on its hinge at the back left -->
<g class="chest__lid" data-lid>
<path d="M5 18.4V13c0-4.6 3.2-7.6 8-7.6h18c4.8 0 8 3 8 7.6v5.4Z" fill="url(#woodlid)"/>
<path d="M8 11.4c5-.6 10 .2 15-.3 3.6-.3 7 .1 12.6.4" stroke="#704a2e" stroke-width=".35" fill="none" opacity=".6"/>
<path d="M5 18.4V13c0-4.6 3.2-7.6 8-7.6h18c4.8 0 8 3 8 7.6v5.4Z" fill="none" stroke="url(#gold)" stroke-width="1.3"/>
<path d="M11 5.8h2.6v12.6H11zM30.4 5.8H33v12.6h-2.6z" fill="url(#gold)"/>
<path d="M11 5.8h2.6v12.6H11zM30.4 5.8H33v12.6h-2.6z" fill="url(#brush)"/>
<rect x="4.4" y="16.6" width="35.2" height="2.2" rx=".8" fill="url(#gold)"/>
<rect x="4.4" y="16.6" width="35.2" height="2.2" rx=".8" fill="url(#brush)"/>
<path d="M7 7.6c3-1.4 8-1.6 12-1.6" stroke="#fff" stroke-width=".7" stroke-linecap="round" opacity=".28" fill="none"/>
</g>
<!-- the lock plate -->
<g class="chest__lock" data-lock>
<path d="M18.6 15.4h6.8v6.4c0 2-1.5 3.6-3.4 4.2-1.9-.6-3.4-2.2-3.4-4.2Z" fill="url(#gold)"/>
<path d="M18.6 15.4h6.8v6.4c0 2-1.5 3.6-3.4 4.2-1.9-.6-3.4-2.2-3.4-4.2Z" fill="none" stroke="#6e4b17" stroke-width=".4"/>
<circle cx="22" cy="19.4" r="1.15" fill="#1a0f06"/><path d="M21.45 19.9h1.1l.35 3h-1.8Z" fill="#1a0f06"/>
<clipPath id="lockclip"><path d="M18.6 15.4h6.8v6.4c0 2-1.5 3.6-3.4 4.2-1.9-.6-3.4-2.2-3.4-4.2Z"/></clipPath>
<g clip-path="url(#lockclip)"><rect class="chest__glint" data-lockglint x="12" y="13" width="2.4" height="16" fill="#fff" opacity=".85" transform="skewX(-22)"/></g>
</g>
</svg>
<!-- three coins that jump out and fall back into the pill -->
<svg class="coin" data-coin viewBox="0 0 12 12"><circle cx="6" cy="6" r="5.2" fill="url(#gold)"/><circle cx="6" cy="6" r="3.6" fill="none" stroke="#8f6522" stroke-width=".6"/><path d="M4.2 3.6c.8-.5 2-.6 2.8-.2" stroke="#fff" stroke-width=".7" stroke-linecap="round" opacity=".6" fill="none"/></svg>
<svg class="coin" data-coin viewBox="0 0 12 12"><circle cx="6" cy="6" r="5.2" fill="url(#gold)"/><circle cx="6" cy="6" r="3.6" fill="none" stroke="#8f6522" stroke-width=".6"/><path d="M4.2 3.6c.8-.5 2-.6 2.8-.2" stroke="#fff" stroke-width=".7" stroke-linecap="round" opacity=".6" fill="none"/></svg>
<svg class="coin coin--gem" data-coin viewBox="0 0 12 12"><path d="M3 2.4h6L11 5 6 10.6 1 5Z" fill="#7fd3c6"/><path d="M1 5h10L6 10.6Z" fill="#3f9f95"/><path d="M3 2.4 4.6 5 6 2.4 7.4 5 9 2.4" fill="none" stroke="#d9fff8" stroke-width=".5" opacity=".8"/></svg>
</span>
<!-- the words: three states that take turns -->
<span class="words" data-words aria-hidden="true">
<span class="state state--rest" data-rest>
<b class="state__main" data-label>Open chest</b>
<i class="state__sub" data-sub>7 day streak · reward ready</i>
</span>
<span class="state state--xp" data-xp>
<b class="state__main xp"><span class="xp__plus">+</span><span class="xp__digits" data-digits></span><span class="xp__unit">XP</span></b>
<i class="state__sub">Added to your streak</i>
</span>
<span class="state state--done" data-done>
<b class="state__main">Claimed</b>
<i class="state__sub">next in <span class="clock" data-clock></span></i>
</span>
</span>
</div>
<p class="sr" data-live aria-live="polite"></p>
</div>
<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.
21 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 “Reward chest button” from Animorio and fit it into my siteThe pill’s body, grain and sheen sit in a layer with overflow hidden; the chest, the beam and the coins sit outside it, inside the pill but above the clip, so the light and the coins can leave the button.
The chest is an SVG: the wood is a vertical gradient with two fine grain lines, the gold a diagonal gradient with six stops alternating light and dark, with a pattern of half-pixel lines on top for the brushed look. The coins use the same gradient.
Two hops in keyframes, squashing in scaleX and scaleY from the bottom, the second one higher, then the lid turns with svgOrigin on its back hinge and an elastic.out spring that overshoots and returns (LID_ANGLE, SPRING).
The beam is a blurred clip-path trapezoid in mix-blend-mode screen, with a brighter core and dust drifting up; it grows in scaleY from the bottom. Each coin has a linear x, a y rising with power2.out and falling with power2.in: a real arc that lands back in the pill.
+250 XP is made of three reels of the figures 0 to 9 repeated twice, sliding by different heights with power3.out. The countdown has one cell per character: every second, through gsap.delayedCall, only the figures that change roll upwards.
| Name | File | Default | What it changes |
|---|---|---|---|
LABEL | script.js | Open chest | The label of the closed button. |
STREAK | script.js | 7 day streak · reward ready | The small line under the label. |
XP | script.js | 250 | The points the counter rolls to. |
NEXT | script.js | 23:59:59 | The countdown to the next chest. |
GOLD | script.js | #e6c06a | The gold of the light, the points and the edge. |
LID_ANGLE | script.js | 34 | How many degrees the lid lifts on its hinge. |
SPRING | script.js | 0.9 | How long the lid’s spring lasts, in seconds. |
HOLD | script.js | 3.2 | How many seconds Claimed stays before going back to rest. |
On the daily rewards screen of a language, fitness or gaming app, in a profile with a day streak, at the end of a lesson or a workout: wherever a reward to claim should feel like a small present.
The pill never gets wider than the screen minus twenty-four pixels, the beam and the coins stay above it; a finger presses like the mouse. Without hover the lock glints on its own now and then and the edge light stays still.
No hops, springs, coins or reels: the lid opens in a moment, the light fades in and out, +250 XP appears already written and Claimed fades in, with the countdown changing without rolling.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 9.2 KB; the libraries: GSAP 28 KB.
Tested on 13 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.