
The elastic button
Buttons, Hover, Text
One page of a reading app, on warm paper lit by a window, like a Dribbble shot: press on a word and drag, and a blue selection follows the finger word by word between two thin handles. On release a small dark menu springs up with four highlighter colours, a note and copy; pick a colour and the marker runs over the sentence line by line, the highlight count rolls up by one and the footer says ‘Saved to Highlights’ with a check that draws itself.
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 highlight page" 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 book page in the ebook app with the sentence you highlight</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/index.css">
<link rel="stylesheet" href="style.css">
</head>
<body>
<main class="stage">
<span class="stage__window" aria-hidden="true"><span data-window></span></span>
<!-- one page of a reading app on warm paper: drag a finger over a sentence and a soft selection follows it word by
word between two thin handles; let go and a small dark menu springs up with four marker colours. Pick one and
the marker runs over the sentence, the highlight count in the header rolls up and the footer says it is saved -->
<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 Salt Orchard, chapter Low Tide">
<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-title"></span>
<span class="rd__cover-line"></span>
<span class="rd__cover-sun"></span>
</span>
<span class="rd__book">
<span class="rd__title">The Salt Orchard</span>
<span class="rd__author">Ines Marlow · Low Tide</span>
</span>
<button class="rd__marks" type="button" data-marks aria-label="Highlight the last sentence">
<svg viewBox="0 0 24 24" aria-hidden="true">
<path class="rd__marker-body" d="M14.6 4.4l5 5-8.3 8.3-5-5z"/>
<path class="rd__marker-tip" data-tip d="M6.3 12.7l5 5-2.3 2.3H4.6l-.6-.6v-4.4z"/>
<path class="rd__marker-cap" d="M14.6 4.4l1.6-1.6a1.4 1.4 0 0 1 2 0l3 3a1.4 1.4 0 0 1 0 2l-1.6 1.6"/>
</svg>
<span class="rd__count" aria-hidden="true"><span data-count>13</span><span data-count>14</span></span>
</button>
</header>
<section class="rd__body">
<p class="rd__chapter">Low Tide</p>
<div class="rd__text" data-text>
<div class="hl" data-hl aria-hidden="true"></div>
<p class="rd__para" data-para></p>
<span class="handle handle--a" data-handle aria-hidden="true"></span>
<span class="handle handle--b" data-handle aria-hidden="true"></span>
</div>
</section>
<footer class="rd__foot">
<span class="rd__rail" aria-hidden="true"><span class="rd__fill"></span></span>
<span class="rd__meta">
<span class="rd__status">
<span class="rd__line" data-line>p. 212 of 331</span>
<span class="rd__line rd__line--saved" data-line>
<svg viewBox="0 0 16 16" aria-hidden="true"><path data-ok pathLength="1" d="M3.4 8.4l3 3 6.2-6.6"/></svg>
<span data-saved-text>Saved to Highlights</span>
</span>
</span>
<span class="rd__left">11 min left in chapter</span>
</span>
</footer>
<div class="pop" data-pop role="toolbar" aria-label="Highlight">
<span class="pop__face">
<button class="pop__sw" type="button" data-sw="0" aria-label="Amber"><span></span></button>
<button class="pop__sw" type="button" data-sw="1" aria-label="Sage"><span></span></button>
<button class="pop__sw" type="button" data-sw="2" aria-label="Rose"><span></span></button>
<button class="pop__sw" type="button" data-sw="3" aria-label="Sky"><span></span></button>
<span class="pop__rule" aria-hidden="true"></span>
<button class="pop__act" type="button" data-note aria-label="Add a note">
<svg viewBox="0 0 20 20" aria-hidden="true"><path d="M4 5.2h12M4 9.4h12M4 13.6h7"/></svg>
</button>
<button class="pop__act" type="button" data-copy aria-label="Copy">
<svg viewBox="0 0 20 20" aria-hidden="true"><rect x="7" y="7" width="9" height="9" rx="2"/><path d="M13 4.6V4a1.6 1.6 0 0 0-1.6-1.6H5.6A1.6 1.6 0 0 0 4 4v5.8a1.6 1.6 0 0 0 1.6 1.6h.6"/></svg>
</button>
</span>
<span class="pop__notch" aria-hidden="true"></span>
</div>
</article>
</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.
29 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 highlight page” from Animorio and fit it into my siteThe paragraph is written by the script, one word per span. measure() reads with getBoundingClientRect where each word sits in the text block and which line it belongs to; it reads again on every resize through a ResizeObserver, so the bars follow the words when they wrap somewhere else.
The highlight is a layer under the paragraph with one bar per line: the words on the same line join into one rectangle, and the last word is covered only as far as needed, so the end of the selection can sit halfway through a word. The script places the bar, its child is what GSAP scales.
The end of the selection is a decimal number (word plus fraction) brought to the word under the finger by gsap.quickTo in 0.16 s: the selection does not jump from word to word but glides over them, and the handles follow. Dragging before the anchor, the start goes to the finger and the end stays put.
On release the menu sits above the first line, centred on the sentence and kept inside the page; if there is no room above it goes under the last line and the notch flips. The notch follows the sentence's centre through a CSS variable, which is also the origin of the spring the menu opens on.
Once a colour is picked, a second layer of bars with uneven ends (a border-radius with different horizontal and vertical radii) and mix-blend-mode: multiply opens line by line with scaleX from the left, each line in a time proportional to its length; the counter rolls with two figures in a window and the footer swaps its line with a check drawn by strokeDashoffset.
| Name | File | Default | What it changes |
|---|---|---|---|
PASSAGE | script.js | The orchard had gone quiet by the time … | The words on the page. |
QUOTE | script.js | Some things you learn to love before you understand them. | The sentence the page highlights by itself: it has to be in the text. |
PICK | script.js | 0 | The colour the walk picks: 0 amber, 1 sage, 2 rose, 3 sky. |
SWEEP | script.js | 1.5 | How many seconds the selection takes to run over the sentence. |
FOLLOW | script.js | 0.16 | How long the end of the selection takes to catch the finger. |
SPRING | script.js | 1 | How springy the menu and the handles are. |
HOLD | script.js | 3.2 | How many seconds the highlight stays in the walk. |
SAVED | script.js | 13 | The highlights the book already has. |
AUTO | script.js | true | Highlights by itself until someone touches the page. |
For a reading or ebook app, a long form articles platform, a blog or a newsletter where people save sentences, a study app: the gesture of highlighting made pleasant, with a clear confirmation of what was saved.
The same page with adapted sizes: the paper is as wide as the box, the text and the margins shrink with the height too, the selection is made with a finger (the text does not scroll the page while dragging) and the menu always stays inside the paper.
Nothing slides or bounces: the selection, the menu, the highlight, the counter and the footer fade in, already in place; 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 11 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.