
The elastic button
Buttons, Hover, Text
One page of a reading app on warm paper, like a Dribbble shot: hold a rare word and a vermilion pill fills behind it; when it is full the word lifts a pixel and a frosted glass dictionary card springs out of it, the headword gaining weight as it settles, the definition and an example. ‘Add to Words’ gives under the finger and comes back with a check, the counter rolls, the card folds back into the word, which keeps an underline and a mark in the margin, and the progress at the bottom goes from ‘32% · 14 min left’ to ‘33% · 13 min left’.
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>
<!--
"Ebook reader with dictionary" 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 ebook reader with the word that opens in the dictionary</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/mona-sans@5.3.0/wdth.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/newsreader@5.3.0/opsz.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/newsreader@5.3.0/opsz-italic.css">
<link rel="stylesheet" href="style.css">
</head>
<body>
<main class="stage">
<!-- one page of a reading app on warm paper. Hold a rare word and a soft ink pill fills behind it; the word lifts
and a frosted glass dictionary card springs out of it, its headword growing heavier as it settles. Add the
word to your list: the button gives and turns into a check, the count in the header rolls, the card folds
back into the word, which keeps a fine dashed underline and a mark in the margin, and the progress at the
bottom reads on -->
<div class="fit" data-fit>
<div class="book" data-book>
<span class="book__page book__page--2" aria-hidden="true"></span>
<span class="book__page" aria-hidden="true"></span>
<article class="rd" data-reader aria-label="Reading The Lantern Coast, chapter The Harbour Wall">
<span class="rd__sheen" data-sheen aria-hidden="true"></span>
<header class="rd__head">
<span class="rd__cover" aria-hidden="true"><span class="rd__cover-line"></span><span class="rd__cover-moon"></span></span>
<span class="rd__book">
<span class="rd__title">The Lantern Coast</span>
<span class="rd__author">Maren Oduya</span>
</span>
<button class="rd__words" type="button" data-words aria-label="Your word list">
<svg class="rd__words-icon" data-words-icon viewBox="0 0 24 24" aria-hidden="true">
<path class="rd__words-book" d="M5 4.6h9.4a2.6 2.6 0 0 1 2.6 2.6v12.2H7.6A2.6 2.6 0 0 1 5 16.8z"/>
<path class="rd__words-spine" d="M5 16.8a2.6 2.6 0 0 1 2.6-2.6H17"/>
<path class="rd__words-ribbon" data-ribbon d="M12.2 4.6v6.2l1.7-1.3 1.7 1.3V4.6"/>
</svg>
<span class="rd__words-label">Words</span>
<span class="roll rd__count" data-count aria-hidden="true"><span>6</span><span>7</span></span>
</button>
</header>
<section class="rd__body">
<p class="rd__chapter">The Harbour Wall</p>
<div class="rd__text" data-text>
<p class="rd__para" data-para>By the time the ferry left, the <button class="w" type="button" data-word="gloaming"><span class="w__fill"></span><span class="w__line"></span><span class="w__txt">gloaming</span></button> had settled over the harbour wall and the gulls had given up their quarrel. Nell took the <button class="w" type="button" data-word="littoral"><span class="w__fill"></span><span class="w__line"></span><span class="w__txt">littoral</span></button> path home with her shoes in one hand, listening to the <button class="w" type="button" data-word="susurrus"><span class="w__fill"></span><span class="w__line"></span><span class="w__txt">susurrus</span></button> of the reeds and the low talk of water against stone. Somewhere behind her a shutter closed. She counted the lamps along the quay, as she had as a child, and lost count at the same one, the one that never quite lit.</p>
<span class="rd__marks" data-marks aria-hidden="true"></span>
</div>
</section>
<footer class="rd__foot">
<span class="rd__rail" aria-hidden="true"><span class="rd__fill" data-fill></span><span class="rd__knob" data-knob></span></span>
<span class="rd__meta">
<span class="rd__where">Chapter progress</span>
<span class="rd__left" data-left>
<span class="roll" data-pct><span>32</span><span>33</span></span>%<span class="rd__sep">·</span><span class="roll" data-min><span>14</span><span>13</span></span> min left
</span>
</span>
</footer>
<div class="dict" data-dict role="dialog" aria-modal="false" aria-label="Dictionary" hidden>
<div class="dict__face" data-face>
<span class="dict__glint" data-glint aria-hidden="true"></span>
<div class="dict__top" data-row>
<span class="dict__src">Dictionary</span>
<span class="dict__lang">Quire · English</span>
</div>
<p class="dict__head" data-row><span class="dict__hw" data-hw>gloam·ing</span></p>
<p class="dict__pos" data-row data-pos>noun</p>
<p class="dict__def" data-row data-def>The soft light after sunset, before it is fully dark.</p>
<p class="dict__ex" data-row data-ex>the lamps came on one by one in the gloaming</p>
<div class="dict__foot" data-row>
<span class="dict__more" data-more>Also in Thesaurus</span>
<button class="dict__add" type="button" data-add>
<span class="dict__add-face" data-add-face>
<svg class="dict__add-icon" viewBox="0 0 16 16" aria-hidden="true">
<path class="dict__plus" data-plus d="M8 3.4v9.2M3.4 8h9.2"/>
<path class="dict__check" data-check pathLength="1" d="M3.4 8.4l3 3 6.2-6.6"/>
</svg>
<span class="dict__add-words">
<span data-add-a>Add to Words</span>
<span data-add-b>Added</span>
</span>
</span>
</button>
</div>
</div>
<span class="dict__notch" data-notch aria-hidden="true"></span>
</div>
</article>
</div>
</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.
47 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 “Ebook reader with dictionary” from Animorio and fit it into my siteThe reader is drawn at one size, 392 px wide, and .fit scales it on every resize just enough to fit the window (up to 1.3 times on big screens): the words always wrap at the same points. Positions are read with getBoundingClientRect and divided by the scale.
Every dictionary word is a real inline-block button with three children: the pill, the underline and the text. On pointerdown a HOLD long timeline fills the pill with scaleX from the middle and sinks the word to 97%; if the finger lifts first, the timeline is killed and the pill draws back. From the keyboard the click (detail 0) opens it straight away.
The card sits above the word, centred and kept inside the page; if there is no room above it goes below and the notch flips. The notch follows the word's centre through a CSS variable that is also the transform-origin of the back.out spring the card opens on. The glass is a backdrop-filter with blur and saturate, a light 1 px edge and three shadows.
The card's headword is in variable Newsreader: GSAP takes a CSS weight variable from 260 to 560 and the tracking from 0.06 em to -0.015 em in 0.9 s, while the rows come in 45 ms apart and a glint crosses the glass. The rest of the paragraph fades back through another variable, --dim, inside the text colour.
Counter, percentage and minutes are windows with two stacked figures: the old one slides up and out, the new one comes in from below on a back.out. On saving, the dashed underline opens with scaleX from the left, the margin mark grows with scaleY at the line's height (measured again on resize) and the progress rail and knob move on by one point.
| Name | File | Default | What it changes |
|---|---|---|---|
HOLD | script.js | 0.5 | How many seconds to hold a word before the dictionary opens. |
SPRING | script.js | 1.6 | How far the card springs past its size as it opens (0 = not at all). |
DIM | script.js | 0.5 | How much the rest of the page fades while the card is open. |
START_PERCENT | script.js | 32 | How much of the chapter is read at the start. |
START_MINUTES | script.js | 14 | Minutes left in the chapter at the start. |
START_WORDS | script.js | 6 | Words already in the list at the start. |
SPEED | script.js | 1 | 2 = the walk on its own twice as fast, 0.5 = half. |
LOOP | script.js | true | Repeats the walk through the three words. |
For a reading or ebook app, a language learning app, a long form articles platform or a newsletter: the gesture of looking up a word without leaving the page, with a clear confirmation that it went into your list.
The same page, scaled whole to fit the box in height too: the words wrap at the same points, the long press works with a finger (without the phone's menu) and the card always stays inside the paper.
Nothing slides or bounces: the pill, the card, the figures, the underline and the margin mark fade in, already in place; the progress rail moves without a run and the light on the paper stays still.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0, Newsreader (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 12 KB; the libraries: GSAP 28 KB.
Tested on 7 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.