
The elastic button
Buttons, Hover, Text
The reading settings of a blog or a reading app: a piece of the article on top, and below a slider between a small A and a big A and three page themes, Paper, Sepia and Night. The text grows on a spring as the slider moves, and the new theme spreads over the card as a circle starting from the colour you chose.
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>
<!--
"Article reading panel" 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>Article reading panel with text size and page theme</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 reading settings of a blog or a reading app: a piece of the article on top, and under it the text size on
a slider between a small and a big A, and three page themes; the text grows on a spring as the slider moves,
and a new theme spreads over the card as a circle from the swatch you chose -->
<section class="panel" data-panel data-theme="paper" aria-label="Reading settings">
<span class="panel__wash" data-wash aria-hidden="true"></span>
<div class="page" aria-hidden="true">
<p class="page__kicker">Field notes</p>
<div class="page__text" data-text>
<p class="page__title">On slow mornings</p>
<p class="page__body">The kettle takes its time and so do we. Light comes round the corner of the building at nine, crosses the table, and for a while nothing on the list feels urgent. It is the best hour to read something long.</p>
</div>
</div>
<div class="tools">
<div class="size">
<span class="size__a size__a--s" aria-hidden="true">A</span>
<span class="size__track">
<span class="size__ticks" aria-hidden="true"><i></i><i></i><i></i><i></i><i></i></span>
<span class="size__fill" data-fill aria-hidden="true"></span>
<span class="size__thumb" data-thumb aria-hidden="true"><span data-thumb-in></span></span>
<input type="range" min="0" max="4" step="1" value="1" data-size aria-label="Text size">
</span>
<span class="size__a size__a--l" aria-hidden="true">A</span>
</div>
<div class="themes" data-themes role="radiogroup" aria-label="Page theme">
<span class="themes__pill" data-pill aria-hidden="true"></span>
<button type="button" role="radio" aria-checked="true" data-theme-btn="paper"><i class="sw sw--paper"></i>Paper</button>
<button type="button" role="radio" aria-checked="false" data-theme-btn="sepia"><i class="sw sw--sepia"></i>Sepia</button>
<button type="button" role="radio" aria-checked="false" data-theme-btn="night"><i class="sw sw--night"></i>Night</button>
</div>
</div>
</section>
<p class="sr" data-live aria-live="polite"></p>
<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.
23 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 “Article reading panel” from Animorio and fit it into my siteUnderneath there is an input of type range, invisible but real: it works with a finger, the mouse and the arrow keys. On top, the knob and the filled part are two elements GSAP moves by reading the input’s value.
The text size is a CSS variable, --fs, which the title and the paragraph depend on. At every change GSAP animates a number from the old size to the new one with elastic.out and writes it into the variable: the text slightly overshoots and comes back.
Inside the card there is a veil of the new colour, clipped with a circular clip-path: the centre is the disc of the theme tapped, the radius goes from zero to the distance to the farthest corner. When it has covered everything, the card takes the theme and the veil goes back to zero.
The text colour switches to the new theme’s at the start of the circle, with a 450 millisecond transition: so the words stay readable while the background changes underneath.
It is an absolute element that takes the position and width of the chosen button and goes there with elastic.out; the three buttons are a radio group, with arrow keys to move between them.
| Name | File | Default | What it changes |
|---|---|---|---|
SMALL | script.js | 14 | The smallest text size, in pixels. |
BIG | script.js | 22 | The biggest text size, in pixels. |
START | script.js | 1 | Which notch it starts from: 0 to 4. |
THEME | script.js | paper | The theme at the start: paper, sepia or night. |
ACCENT | script.js | #e2643a | The colour of the slider’s filled part. |
SPRING | script.js | 0.7 | How long the spring of the text changing size lasts, in seconds. |
SPREAD | script.js | 0.7 | In how many seconds the new theme covers the card. |
LOOP | script.js | true | Left alone, a pointer tries the sizes and the themes. |
For a blog, an online magazine, a web newsletter, an ebook or read-later app: the panel that opens from the ‘Aa’ button. It helps people who read for long and those who need bigger type.
The same card, as wide as the screen: the slider is dragged with a finger and the three themes share the row.
No springs and no circle: the text goes straight to the new size, the knob and the pill go straight to their place and the theme changes with just the fade of the colours.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 5.8 KB; the libraries: GSAP 28 KB.
Tested on 14 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.