Skip to content
animorio
IT
Back to the library

Shelf to book page

Transitions, HoverGSAP, CSS onlyMediumCompressed weight: Demo 11 KBGSAP 28 KBFreeDownload the zip

A page transition for an invented independent bookshop, Vellmont Books: a shelf of ten cloth and paper spines, their titles set upright in a variable serif. On hover a spine comes out by a few pixels and takes the light; on a click it slides off, turns like a flat board to show its cover and grows into the cover of the book's page, while the others step aside and fade and the title, author, price and ‘Reserve a copy’ rise in their masks. ‘Back to the shelf’ makes the journey backwards and the book drops in with a one pixel settle.

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>
<!--
  "Shelf to book 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>Shelf to book page</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/fraunces@5.3.0/full.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" data-stage>
    <!-- Vellmont Books, an independent bookshop. The first page is a shelf of cloth and paper spines; a click pulls one
         out, turns it to its cover and grows it into the cover of the book's page while the others step aside -->
    <header class="bar">
      <span class="bar__mark">Vellmont <em>Books</em></span>
      <span class="bar__slot">
        <span class="bar__label" data-label>Autumn shelf</span>
        <button class="back" type="button" data-back tabindex="-1">
          <span class="back__face">
            <svg class="back__icon" viewBox="0 0 16 16" aria-hidden="true"><path d="M13 8H4M7.6 4.2L3.8 8l3.8 3.8"/></svg>
            <span class="back__words">Back to the shelf</span>
          </span>
        </button>
      </span>
    </header>

    <section class="shelf" data-shelf aria-label="Autumn shelf">
      <div class="shelf__row" data-row>
        <span class="shelf__board" data-board aria-hidden="true"></span>
        <span class="shelf__note" data-note>Ten new books, chosen by the people at the counter</span>
      </div>
    </section>

    <section class="page" data-page aria-hidden="true">
      <span class="page__cover" data-slot aria-hidden="true"></span>
      <div class="page__info">
        <p class="m"><span class="m__in page__genre" data-f="genre">Fiction</span></p>
        <h1 class="m page__title"><span class="m__in" data-f="title">Title</span></h1>
        <p class="m"><span class="m__in page__author">by <span data-f="author">Author</span></span></p>
        <p class="m"><span class="m__in page__meta" data-f="meta">Hardback</span></p>
        <p class="m"><span class="m__in page__price" data-f="price">$0</span></p>
        <span class="page__rule" data-rule aria-hidden="true"></span>
        <p class="m"><span class="m__in page__stock">
          <svg class="page__shop" viewBox="0 0 16 16" aria-hidden="true"><path d="M2.5 6.5h11M3.2 6.5l.9-3h7.8l.9 3M3.5 6.5v6.5h9V6.5M6.5 13V9.5h3V13"/></svg>
          In stock at the shop</span></p>
        <div class="m m--btn"><span class="m__in">
          <button class="reserve" type="button" data-reserve tabindex="-1">
            <span class="reserve__face" data-reserve-face>
              <span class="reserve__words" data-reserve-words>Reserve a copy</span>
              <svg class="reserve__icon" viewBox="0 0 16 16" aria-hidden="true">
                <path class="reserve__check" data-check pathLength="1" d="M3.6 8.4l2.9 2.9 5.9-6.4"/>
              </svg>
            </span>
          </button>
        </span></div>
      </div>
    </section>

    <div class="flyer" data-flyer aria-hidden="true">
      <div class="flyer__turn" data-turn>
        <div class="face face--spine" data-face-spine></div>
        <div class="face face--cover" data-face-cover></div>
      </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.

28 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 “Shelf to book page” 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 warm paper page, the ‘Vellmont Books’ mark at the top and ‘Autumn shelf’ on the right. In the middle a thin line makes the shelf, and ten book spines rise onto it one after another on a spring: midnight blue cloth, sage, ochre, burgundy, grey, sand, slate green, black, cream, each with its own height and thickness, the title set upright in Fraunces, two rules at the top and bottom, the author's initial in italics, the round of the spine in shade and light and the grain of the paper. Under it, in italics, ‘Ten new books, chosen by the people at the counter’. Passing over a spine, it comes out by a few pixels, its shadow on the shelf lengthens and a warm light slides over it. On a click the spine slides up off the shelf, the shadow stretches further, then the book turns like a flat board: halfway it is edge on, then it shows its cover (the genre, a thin geometric sign, title and author) and grows into its place on the page, while the other spines step aside from the nearest to the farthest and fade and the shelf withdraws. On the other side, one after another, the genre, the big title, ‘by June Avery’, ‘Hardback, 344 pages’, the price ‘$26.00’, a rule that draws itself, ‘In stock at the shop’ with a drawn shopfront and the red ‘Reserve a copy’ button rise in their masks; ‘Back to the shelf’ arrives at the top right. Pressed, the button gives and comes back on a spring and becomes ‘Reserved for you’ with a checkmark that draws itself. With ‘Back to the shelf’ the words drop, the cover turns back and shrinks into a spine, the others return and the book drops into its place, passing it by one pixel and settling. On its own it opens ‘The Lantern Year’, reserves it and goes back to the shelf, again until someone touches it.

How it works

Two pages in one scene

The shelf and the book's page sit on top of each other in the same stage. The page already holds a place for the cover, an empty box: that is where the book has to land.

A flat board with two faces

The travelling book is a single element with two faces: the spine in front and the cover behind, turned 180 degrees, with backface-visibility hidden. Turning it on Y, halfway it is edge on and then the cover appears. The cover is sized in container units (cqw), so it grows with the board.

FLIP with a single value

The spine on the shelf and the cover box on the page are measured; GSAP only moves one number from 0 to 1 and every frame works out position, width, height and rotation. On resize both are measured again and the book is recalculated even halfway through.

Slide out, turn, step aside

First the spine rises by 16 pixels (it slides off), then the turn starts. The others move sideways, further the further they are, and fade with a delay that grows with distance; the page's lines rise in their staggered masks.

The shadow and the settle

The book's shadow depends on how far it is pulled out and how far into the flight: it lengthens and softens halfway and shortens as it lands. On the way back the book drops one pixel below its place and comes back up: that is the settle.

Values to change

NameFileDefaultWhat it changes
SPEEDscript.js12 = the whole journey twice as fast, 0.5 = half.
TURNscript.js1.15Seconds the book takes to turn and grow into the cover.
PULLscript.js16Pixels the spine slides up off the shelf before it turns.
SPREADscript.js44Pixels the other spines step aside.
SETTLEscript.js1Pixels the book drops past its place before it settles.
HOLDscript.js3.4Seconds the autopilot stays on the book's page.
FEATUREDscript.js5Which book the autopilot opens, from 1 (the left) to 10.
LOOPscript.jstrueOpens and closes a book again and again until the page is touched.

Try them in the Playground

When to use it

For the site of a bookshop, a publisher, a magazine or a stationery shop: the move from the product list to the single product page, with the object itself bridging the two pages.

On phones

The same animation with adapted sizes: the shelf takes the height and width there is, the cover and the words shrink with the height and stay side by side; a finger opens the book and goes back.

With reduced motion

No journey and no turn: the shelf fades, the cover appears already in its place with a fade together with the words, and on the way back the same in reverse.

Pitfalls

  • The spine on the shelf is measured from its container, not from the piece GSAP moves or the one lifted on hover: otherwise the start includes the offset and the book jumps.
  • A mask padded for the button's shadow shows the hidden button below it: the button's line drops further than the others.
  • Focus given by the script after the autopilot lights :focus-visible and leaves the spine lifted: focus moves only when a person clicked.

Libraries

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

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

Testing

Tested on 17 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