
The elastic button
Buttons, Hover, Text
The card of the next lesson of an online school, on white, in the simple style of product interface pieces: subject, topic, the teacher’s initials in a circle and the time. Underneath, a thin line holds the time left and runs down while the seconds roll in the corner; at zero the line opens back up in the accent colour and becomes, on a spring, the «Join now» button, and a ring draws around the initials.
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>
<!--
"Next lesson card" 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 next lesson card with the time running down</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 card, one gesture: the time left runs down a thin line, and at zero the line opens into «Join now» -->
<article class="lesson" data-card aria-live="polite">
<header class="lesson__top">
<span class="lesson__state" aria-hidden="true">
<span class="lesson__tag" data-tag="next">Next lesson</span>
<span class="lesson__tag lesson__tag--live" data-tag="live">Live now</span>
</span>
<span class="lesson__left" data-left aria-hidden="true">
<span class="lesson__in" data-in>in</span>
<span class="lesson__clock" data-clock>0:06</span>
</span>
</header>
<h2 class="lesson__subject" data-subject>Linear Algebra</h2>
<p class="lesson__topic">Eigenvalues, part two</p>
<div class="lesson__who">
<span class="lesson__avatar" aria-hidden="true">
<svg class="lesson__ring" viewBox="0 0 40 40"><circle data-ring cx="20" cy="20" r="18.5"/></svg>
<span class="lesson__initials" data-initials>AK</span>
</span>
<span class="lesson__teacher">Ada Kern</span>
<span class="lesson__hours">10:30 · 45 min</span>
</div>
<div class="lesson__slot">
<span class="lesson__track" aria-hidden="true"><span class="lesson__time" data-time></span></span>
<button class="lesson__join" type="button" data-join tabindex="-1" aria-hidden="true">
<span class="lesson__joinword" data-joinword>Join now</span>
<svg class="lesson__arrow" data-arrow viewBox="0 0 16 16" aria-hidden="true"><path d="M3 8h9.5M8.5 4l4 4-4 4"/></svg>
</button>
</div>
</article>
</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.
24 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 “Next lesson card” from Animorio and fit it into my siteAn object { t } goes from 6 to 0 with a linear tween as long as the countdown; on every frame the line takes scaleX = t / 6 with its origin on the left, so it runs down continuously instead of in steps. The second on show is Math.ceil(t): the clock is rewritten only when it changes.
The clock sits in a one-line column with overflow hidden: each new second comes in from yPercent 70 to 0 with back.out, which gives the one-pixel bounce. In the last seconds the colour and the line switch to the accent and the line breathes with scaleY from 1.9 to 1.
The button fills the whole row but is cut by a clip-path: inset(48% 100% 48% 0%) is a hair on the line, inset(48% 0% 48% 0%) the whole line, inset(0%) the open pill. First the width with power3.out, then the height with elastic.out: the ease goes a pixel too far and settles by itself, and it is all in percentages, so it survives a resize.
«Join now» comes in with the wdth axis at 78 and the weight at 460 and lands at 100 and 580 with back.out; on hover it goes to 108. The tags at the top swap the same way, in the same grid cell, the old one leaving before the new one arrives.
The ring around the initials is a circle with strokeDasharray equal to its circumference, turned 90 degrees with svgOrigin: it draws from the top and, on the way back, slides off by going to minus the circumference. The pill folds back into the line, which leaves to the right (left inset at 100%), and the black line fills up again from the left.
| Name | File | Default | What it changes |
|---|---|---|---|
ACCENT | script.js | #2f62ff | The colour of the last seconds, of the ring and of the button. |
COUNTDOWN | script.js | 6 | The seconds on the clock before the lesson starts. |
LAST | script.js | 3 | The last seconds, when the line turns to the accent. |
LABEL | script.js | Join now | The word on the button. |
SPRING | script.js | 1 | How springy the button and the card are: 0.4 calm, 2 very bouncy. |
SPEED | script.js | 1 | The speed of everything: 2 twice as fast, 0.5 half. |
HOLD | script.js | 2.6 | How many seconds the button stays before the card starts over by itself. |
AUTO | script.js | true | The card starts over by itself until someone touches it. |
For the next lesson in a study app or an online school, and also for a webinar, a video appointment or a meeting in the calendar: the line tells how long is left without reading, and the button appears only when it is needed.
On the phone the card takes its width from the screen (the smaller of 320 pixels and 86vw) and its sizes from the shorter side; there is no hover, the button press is there, everything else is the same.
The line shortens in steps, one second at a time, without sliding; at zero the button, the ring and the tag arrive with a fade, with no springs or movement.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 5.6 KB; the libraries: GSAP 28 KB.
Tested on 31 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.