Skip to content
animorio
IT
All components

Ebook reader with dictionary

Books, Text, HoverGSAP, CSS onlyMediumCompressed weight: Demo 12 KBGSAP 28 KBFreeDownload the zip

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’.

The code

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>

Playground

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

Or ask your AI assistant for it

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 site
Platform licenseFree on your sites and your clients’ sites. Want it inside a website builder, a template platform or a client dashboard? There’s a license for agencies and platforms.

What it does

On a white page lies one page of a reading app, warm paper with round corners, a very fine grain and the edges of two more pages underneath. At the top the small dark cover of ‘The Lantern Coast’ with a vermilion moon, the title and the author, and on the right the ‘Words’ button with a drawn booklet, a red ribbon and the number 6. Below, the chapter ‘The Harbour Wall’ and a paragraph in a serif typeface; at the bottom a thin rail with a knob and ‘Chapter progress’, ‘32% · 14 min left’. A soft light follows the pointer over the paper. On its own the page holds the word ‘gloaming’: behind it a light vermilion pill fills from the middle while the word sinks a hair; when it is full the word lifts and a frosted glass card springs out of it with a notch pointing at it, while the rest of the paragraph fades back. On the card ‘Dictionary’, ‘Quire · English’, the big headword split into syllables by a middle dot, going from thin to heavy as it settles, ‘noun’ in vermilion italics, the definition and an example in italics; a glint slides over the glass. A moment later ‘Add to Words’ is pressed: it gives and comes back on a spring, the label slides up into ‘Added’, the plus turns and makes way for a check that draws itself, the booklet at the top hops and 6 rolls into 7. The card folds back into the word, which settles with an elastic and keeps a dashed vermilion underline; a thin mark lights up in the left margin, and at the bottom the knob moves on and the figures roll: 33%, 13 min left. Then the same with ‘littoral’ and ‘susurrus’, then underlines and marks melt away, the figures roll back and the loop starts again. With a finger or a mouse you hold one of the three words, from the keyboard Enter opens it; outside the card or Esc closes it.

How it works

One page, scaled

The 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.

The long press

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 where there is room

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.

A headword that gains weight

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.

Rolling figures and the margin mark

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.

Values to change

NameFileDefaultWhat it changes
HOLDscript.js0.5How many seconds to hold a word before the dictionary opens.
SPRINGscript.js1.6How far the card springs past its size as it opens (0 = not at all).
DIMscript.js0.5How much the rest of the page fades while the card is open.
START_PERCENTscript.js32How much of the chapter is read at the start.
START_MINUTESscript.js14Minutes left in the chapter at the start.
START_WORDSscript.js6Words already in the list at the start.
SPEEDscript.js12 = the walk on its own twice as fast, 0.5 = half.
LOOPscript.jstrueRepeats the walk through the three words.

Try them in the Playground

When to use it

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.

On phones

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.

With reduced motion

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.

Pitfalls

  • A paper coloured veil over the paragraph to fade it showed as a lighter rectangle over the grain: now the text colour fades through a variable, and the lifted word keeps its own.
  • On a phone a long press opens the system's selection menu: the words have user-select: none, -webkit-touch-callout: none and the contextmenu cancelled.
  • A timeline created inside another does not follow its speed or its end: the walk on its own is a chain of steps, each with its own timeScale, and when a hand comes in the chain stops without leaving the card halfway.

Libraries

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.

Testing

Tested on 7 November 2026

  • Desktop: Done
  • Phone: Done
  • Reduced motion: Done
  • Safari on iPhone: To do

License

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.

All components