Skip to content
animorio
IT
Back to the library

Read more expander

Text, TransitionsGSAP, CSS onlyEasyCompressed weight: Demo 6.0 KBGSAP 28 KBFreeDownload the zip

The «Read more» of an article excerpt, minimal style: three lines fading into the paper and a black pill. On click the text opens on a measured spring, the hidden words rise one after another out of a light blur, the reading time rolls from 2 to 6 minutes and the pill becomes «Show less» as its arrow turns over.

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>
<!--
  "Read more expander" 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>Read more</title>
  <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/mona-sans@5.3.0/wdth.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <main class="stage">
    <!-- the excerpt of a made-up journal, Lowtide: three lines that fade into the paper, a Read more pill that opens
         the rest with a measured spring, the hidden words rising one by one and the reading time rolling -->
    <article class="post" data-post aria-labelledby="post-title">
      <p class="kicker">Field notes</p>
      <h1 class="title" id="post-title">The quiet hour before the market opens</h1>
      <div class="meta">
        <span class="avatar" aria-hidden="true">IO</span>
        <span class="meta__who">Ines Okafor</span>
        <span class="meta__sep" aria-hidden="true"></span>
        <span class="meta__time"><span class="roll" data-roll aria-hidden="true"><span class="roll__cifra">2</span></span><span class="meta__unit">min read</span></span>
        <span class="sr" data-time-sr>2 min read</span>
      </div>
      <span class="rule" data-rule aria-hidden="true"></span>

      <div class="body" data-body id="post-body">
        <div class="body__inner" data-inner>
          <p>At five the stalls are bare frames, and the square belongs to the people who sweep it. Crates arrive stacked like bricks, and someone whistles while the awnings go up.</p>
          <p>The fishmonger lays ice first, until the counter looks like a winter field. The bread cools under linen.</p>
          <p>Nobody hurries. That is the hour I keep returning to.</p>
        </div>
        <span class="fade" data-fade aria-hidden="true"></span>
      </div>

      <button class="pill" type="button" data-pill aria-expanded="false" aria-controls="post-body">
        <span class="pill__bg" data-pill-bg aria-hidden="true"></span>
        <span class="pill__labels" data-labels>
          <span class="pill__label" data-label="more">Read more</span>
          <span class="pill__label" data-label="less">Show less</span>
        </span>
        <svg class="pill__arrow" data-arrow viewBox="0 0 16 16" aria-hidden="true"><path d="M4 6.2l4 4 4-4"></path></svg>
      </button>
    </article>
    <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.

26 values to change

Works with Claude, Claude Code, ChatGPT, Cursor, VS Code, Windsurf, Codex, Gemini CLI

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 “Read more expander” 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 warm white paper, the excerpt of a made-up journal, Lowtide: the rust «Field notes» kicker, the headline «The quiet hour before the market opens» in Newsreader, the author with her initials and «2 min read», a hairline whose rust stretch says how much you have read. The text stops at three lines fading into the paper, and below sits a black «Read more» pill with an arrow. On click the height opens on a spring that goes just past and back, the hidden words rise one after another out of a blur, line after line, the two of the minutes rolls into a six, the rule fills up, and the pill widens to fit the new word while «Read more» slides away and «Show less» arrives from below, with the arrow turning 180 degrees on its centre. Closing, the words dim, the height goes back to three lines and everything rolls back.

How it works

Every word is a span

The script splits the paragraphs into words, each in an inline-block span, and keeps the spaces as plain text: the lines wrap exactly as before. To know which words are hidden it reads each one’s offsetTop: the ones below the visible lines are grouped by line.

A measured height

The body is clamped to LINES_SHOWN times the line height read from the CSS. Opening, the height goes to the real height of the text with back.out(OVERSHOOT); the fade at the bottom goes out. On resize and when the fonts arrive both heights are measured again, even mid-animation.

Words, line by line

The hidden words start 10 pixels lower, transparent and blurred by BLUR pixels, and arrive one after another: WORD_STAGGER between one word and the next, plus LINE_STAGGER on every new line.

The pill and the minutes

The two labels sit one above the other in a window one line tall: one slides away, the other arrives from below, and the width follows the measured width of the new word with a small spring. The arrow, which is the whole svg, turns 180 degrees with transformOrigin 50% 50%. The minutes are a digit rolling in a window one line tall.

The tour

For the preview the pill presses itself: it opens, stays open for READ_PAUSE seconds, closes. The first real touch or key stops the tour.

Values to change

NameFileDefaultWhat it changes
LINES_SHOWNscript.js3How many lines show before Read more.
OPEN_TIMEscript.js0.9How long the opening takes, in seconds; closing is a little quicker.
OVERSHOOTscript.js1.15How far the spring goes past the right height (0 = no bounce).
WORD_STAGGERscript.js0.012The delay between one word and the next, in seconds.
LINE_STAGGERscript.js0.05The extra delay on every new line, in seconds.
BLURscript.js4The blur the words come out of, in pixels.
READ_PAUSEscript.js3.6In the tour, how long it stays open before closing, in seconds.
MINUTES_OPENscript.js6The reading time with the article open, in minutes.

Try them in the Playground

When to use it

In the excerpts of a blog or a magazine, in article previews in a list, in long product or event descriptions, in reviews: wherever the text is long but the first glance has to stay short.

On phones

The column takes the width with a margin; headline, text and pill also follow the height with clamp and vh, so the open text fits the box. A tap is the click; there is no hover.

With reduced motion

No spring, no rising words and no rolling digits: the height jumps to the new size, the hidden words fade in, the labels crossfade and the arrow is already turned.

Pitfalls

  • The word spans are inline-block: with the space inside the span the lines stopped wrapping between words. The spaces stay as plain text between the spans.
  • A height in pixels written once breaks when the font arrives or the window changes: both heights are measured again on every resize and on document.fonts.ready, and an animation halfway through jumps to its end before measuring.
  • The turning arrow is the whole svg: transformOrigin 50% 50%, never svgOrigin, which would move the pivot.

Libraries

GSAP 3.15.0, Newsreader (font variabile) 5.3.0, Mona Sans (font variabile) 5.3.0.

Compressed with gzip, the three demo files weigh 6.0 KB; the libraries: GSAP 28 KB.

Testing

Tested on 23 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 animations