Skip to content
animorio
IT
Back to the library

Stacked page transition

Transitions, 3DGSAP, CSS onlyMediumCompressed weight: Demo 7.7 KBGSAP 28 KBFreeDownload the zip

A page transition in the style of product components: the pages of an app (Home, Projects, Settings) are big cards stacked in depth. Going to a page makes the current one recede and tilt back slightly, the new one rises from below in front of it and settles on a spring, and behind them stay the edges of the two previous pages, smaller and darker. Back drops the front page away; «Pages» opens all of them in a 3D fan, like the tabs on a phone.

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>
<!--
  "Stacked page transition" 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>Ferngrove</title>
  <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>
  <!-- the pages of an invented planning app are big rounded cards in a stack: going to a page pushes the current one
       back in depth, tilting it a little, while the new one rises from below in front and settles on a spring; the
       edges of the two pages behind stay visible, smaller and darker. Back drops the front page away. "Pages" opens
       all of them in a 3D fan, like the tabs of a phone, and a tap goes back inside one -->
  <main class="palco" data-palco>
    <header class="testa">
      <button type="button" class="tasto tasto--indietro" data-indietro aria-label="Back">
        <svg viewBox="0 0 16 16" aria-hidden="true"><path d="M10 3.5 5.5 8l4.5 4.5" /></svg>
        <span>Back</span>
      </button>
      <span class="app"><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M8 2.2c2.6 2.2 3.6 4.6 3 7.4-.4 2-1.6 3.4-3 4.2-1.4-.8-2.6-2.2-3-4.2-.6-2.8.4-5.2 3-7.4Z" /><path d="M8 5.2v8.4" /></svg>Ferngrove</span>
      <button type="button" class="tasto tasto--pagine" data-pagine aria-pressed="false">
        <svg viewBox="0 0 16 16" aria-hidden="true"><rect x="3.5" y="5" width="9" height="8" rx="1.8" /><path d="M5 3h6" /></svg>
        <span data-pagine-scritta>Pages</span>
      </button>
    </header>

    <div class="pila-box">
      <div class="pila" data-pila>

        <section class="carta" data-carta="0" aria-label="Home">
          <div class="carta-dentro">
            <div class="carta-testa"><h2>Home</h2><span class="data">Sun, Oct 25</span></div>
            <p class="saluto" data-entra>Good morning, Ines.<br><span>Four things need you today.</span></p>
            <div class="numeri" data-entra>
              <div><b>4</b><span>Due today</span></div>
              <div><b>2</b><span>In review</span></div>
              <div><b>11</b><span>Shipped</span></div>
            </div>
            <ul class="oggi">
              <li data-entra><span class="ora">09:30</span><span class="voce">Review onboarding copy</span><span class="tag">Design</span></li>
              <li data-entra><span class="ora">11:00</span><span class="voce">Pricing sync with Theo</span><span class="tag">Call</span></li>
              <li data-entra><span class="ora">15:15</span><span class="voce">Ship release notes 3.2</span><span class="tag">Launch</span></li>
            </ul>
          </div>
          <nav class="sotto-nav" aria-label="Pages"></nav>
          <span class="velo" aria-hidden="true"></span>
        </section>

        <section class="carta" data-carta="1" aria-label="Projects">
          <div class="carta-dentro">
            <div class="carta-testa"><h2>Projects</h2><span class="data">6 active</span></div>
            <div class="progetti">
              <div class="progetto" data-entra><div class="mini" style="--a:#c9d8ff;--b:#7c8cf8"></div><b>Mobile app</b><span class="barra"><i style="width:72%"></i></span><span class="pc">72%</span></div>
              <div class="progetto" data-entra><div class="mini" style="--a:#ffd9c2;--b:#f2895f"></div><b>Brand refresh</b><span class="barra"><i style="width:40%"></i></span><span class="pc">40%</span></div>
              <div class="progetto" data-entra><div class="mini" style="--a:#cdeedd;--b:#4fae84"></div><b>Help centre</b><span class="barra"><i style="width:88%"></i></span><span class="pc">88%</span></div>
              <div class="progetto" data-entra><div class="mini" style="--a:#efd6f5;--b:#b06cc6"></div><b>Q4 campaign</b><span class="barra"><i style="width:15%"></i></span><span class="pc">15%</span></div>
            </div>
          </div>
          <nav class="sotto-nav" aria-label="Pages"></nav>
          <span class="velo" aria-hidden="true"></span>
        </section>

        <section class="carta" data-carta="2" aria-label="Settings">
          <div class="carta-dentro">
            <div class="carta-testa"><h2>Settings</h2><span class="data">Workspace</span></div>
            <div class="conto" data-entra><span class="avatar">IR</span><span><b>Ines Rocha</b><br>ines@ferngrove.app</span></div>
            <ul class="opzioni">
              <li data-entra><span><b>Notifications</b><br>Mentions and due dates</span><span class="interr acceso"><i></i></span></li>
              <li data-entra><span><b>Dark mode</b><br>Follows the system</span><span class="interr"><i></i></span></li>
              <li data-entra><span><b>Weekly digest</b><br>Every Monday at 8:00</span><span class="interr acceso"><i></i></span></li>
            </ul>
          </div>
          <nav class="sotto-nav" aria-label="Pages"></nav>
          <span class="velo" aria-hidden="true"></span>
        </section>

      </div>
    </div>

    <svg class="puntatore" data-puntatore viewBox="0 0 24 24" aria-hidden="true">
      <path d="M4 3l14 7.2-6.1 1.6L9.2 18z" />
    </svg>
  </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.

66 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 “Stacked page transition” 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 very light grey, under a bar with «Back», the name of the invented app Ferngrove and a «Pages» button, the app’s pages are big white cards with rounded corners, stacked one behind the other: Home (the greeting, three numbers, today’s plan), Projects (four projects with a thumbnail and a progress bar) and Settings (the account and three toggles). Each page has its own nav bar at the bottom. Picking another page makes the current one recede in depth, tilt back slightly and darken a little; the new one rises from below in front of it and settles with a hair of bounce, then its content comes in line by line. Behind, the edges of the two previous pages always show, smaller and darker each step. Back drops the front page away and brings forward the one behind, which straightens on a spring. «Pages» opens all three cards in a fan, tilted in 3D like the open tabs on a phone, and a tap on a card goes back inside it. A fake pointer does the tour: Projects, Settings, Back, Pages and Home again.

How it works

A stack with perspective

The three cards sit on top of each other in a container with transform-style preserve-3d, inside a box with a 1300 pixel perspective seen from above. A card’s position depends only on how deep it is in the stack: d. It rises 18 pixels per step, moves back ARRETRA pixels in z, tilts INCLINA degrees in rotateX and shrinks by 6%: so the two behind show above the edge of the front one.

A veil for the dark

Each card has a dark veil on top, which GSAP sets to SCURO times d: the deeper it is, the darker. It is a separate element rather than a filter, so it does not weigh on the 3D.

The new page rising

Going to a page changes the order of the stack and the chosen page goes to the front. First it leaves its place at the back in 18 hundredths of a second, then it starts again from below the stack, tilted -8 degrees, and rises into place in DURATA seconds with back.out: that hair of bounce is the spring. Meanwhile the others move to their new depth with power3.out.

Back like a real stack

Back drops the front card downwards with power3.in and puts it back at the bottom of the stack with a fade, while the others step forward with back.out. The order stays the history of the pages: Back always goes to the previous page.

The fan

In «Pages» mode each card goes to its fixed place in the fan: shrunk to 60%, tilted VENTAGLIO degrees and spread in height and depth by its number. A click on a card brings it back to the front and the others return to the stack.

Values to change

NameFileDefaultWhat it changes
DURATAscript.js0.9How long the new page takes to rise and settle, in seconds.
ARRETRAscript.js90How far back in depth each page of the stack moves, in pixels.
INCLINAscript.js6How many degrees each page of the stack tilts back.
SCUROscript.js0.1How much darker each page of the stack gets.
VENTAGLIOscript.js26How many degrees the cards are tilted in the fan.
SOSTAscript.js2.2How long each page stays in the automatic tour, in seconds.

Try them in the Playground

When to use it

For an app or web app with a few main pages (a dashboard, a team app, a back office): the page change tells you where you are going and where you came from, and the fan shows the open pages like on a phone.

On phones

The same transition: the stack fits the height of the box, the buttons on top show only their icons and the pages keep the rows that fit. A tap does what a click does.

With reduced motion

No moving depth: the cards go straight to their place in the stack and the new page fades in; the fan opens without flying.

Pitfalls

  • The cards’ transforms all belong to GSAP (x, y, z, rotationX, scale), with the origin at the top centre: a transform in the CSS would be wiped by the first tween.
  • The darkening of the pages behind is a veil with opacity, not a filter: brightness on 3D elements forces the browser to rebuild layers every frame.
  • The depths are in pixels of the stack height: on resize the cards must be put back in place, or the fan stays measured on the previous window.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

Tested on 25 October 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