Skip to content
animorio
IT
Back to the library

Folding card transition

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

The website of a made-up letterpress studio, Corran Paper, with two pages in their own colours: Studio in paper white and Collection in ink blue, and a single vermilion accent. On a click the whole page folds in half along its middle like a greeting card: the free half turns over the other in 3D, darkening as it goes edge on, and on its back there is a solid cover in the colour of the next page, with the mark, the name and a pressed frame. The closed card lifts off the dark desk and slides to the centre, lands with a one pixel press, then opens again and it is already the new page. Going back folds from the other side.

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>
<!--
  "Folding card 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>The page transition that folds shut like a card and opens on the next page</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/bricolage-grotesque@5.3.0/standard.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>
    <!-- two pages of a made-up letterpress studio, Corran Paper. A click folds the whole page in half along its middle,
         like a greeting card: the free half swings over, its back is a cover in the colour of the next page, the closed
         card lifts off the desk, and then it opens again on the next page. Going back folds the other way -->

    <div class="pages" data-pages>
      <section class="page page--home is-on" data-page="home" aria-label="Home">
        <header class="top">
          <a href="#" class="brand" data-go="home" aria-label="Corran Paper, home">
            <svg class="mark" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 4.2 4.4 6.4v12.2L12 20.8zM12 4.2l7.6 2.2v12.2L12 20.8"></path></svg>
            <span class="brand__name">Corran<em>Paper</em></span>
          </a>
          <nav class="nav" aria-label="Main">
            <a href="#" class="nav__item is-here" data-go="home" aria-current="page"><span>Studio</span></a>
            <a href="#" class="nav__item" data-go="collection"><i class="peek" aria-hidden="true"><b></b><b></b></i><span>Collection</span></a>
          </nav>
        </header>
        <div class="body">
          <div class="text">
            <p class="eyebrow" data-in>Letterpress studio, since 2014</p>
            <h1 class="title"><span class="line"><span>Paper that</span></span><span class="line"><span>keeps its <i>crease</i></span></span></h1>
            <p class="lede" data-in>Cards, suites and letterheads, pressed by hand on cotton stock in a small room in Bristol.</p>
            <a href="#" class="pill" data-go="collection" data-in><span>See the collection</span>
              <svg viewBox="0 0 16 16" aria-hidden="true"><path d="M3.5 8h8.5M8.6 4.4 12.2 8l-3.6 3.6"></path></svg></a>
          </div>
          <figure class="sample" data-in aria-label="A folded sample card">
            <span class="sample__l"></span><span class="sample__r"><svg class="mark" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 4.2 4.4 6.4v12.2L12 20.8zM12 4.2l7.6 2.2v12.2L12 20.8"></path></svg></span>
            <figcaption><b>600 gsm cotton</b><span>Two colours, hand set</span></figcaption>
          </figure>
        </div>
      </section>

      <section class="page page--collection" data-page="collection" aria-label="Collection" hidden>
        <header class="top">
          <a href="#" class="brand" data-go="home" aria-label="Corran Paper, home">
            <svg class="mark" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 4.2 4.4 6.4v12.2L12 20.8zM12 4.2l7.6 2.2v12.2L12 20.8"></path></svg>
            <span class="brand__name">Corran<em>Paper</em></span>
          </a>
          <nav class="nav" aria-label="Main">
            <a href="#" class="nav__item" data-go="home"><i class="peek" aria-hidden="true"><b></b><b></b></i><span>Studio</span></a>
            <a href="#" class="nav__item is-here" data-go="collection" aria-current="page"><span>Collection</span></a>
          </nav>
        </header>
        <div class="body">
          <div class="text">
            <p class="eyebrow" data-in>The autumn collection</p>
            <h1 class="title"><span class="line"><span>Folded, pressed</span></span><span class="line"><span>and <i>sent</i></span></span></h1>
          </div>
          <ul class="list" data-in>
            <li class="row"><b>Wedding suite</b><span>48 pieces</span><em>from £320</em></li>
            <li class="row"><b>Thank you notes</b><span>Set of 12</span><em>£38</em></li>
            <li class="row"><b>Letterhead</b><span>250 sheets</span><em>£96</em></li>
          </ul>
        </div>
      </section>
    </div>

    <!-- the fold: made on every change from copies of the two pages -->
    <div class="fold" data-fold aria-hidden="true">
      <span class="fold__shadow" data-shadow></span>
      <div class="fold__group" data-group>
        <div class="half" data-half><div class="half__in" data-half-in></div><span class="half__shade" data-half-shade></span><span class="half__crease" data-crease></span></div>
        <div class="flap" data-flap>
          <div class="face face--front"><div class="half__in" data-front-in></div><span class="face__shade" data-front-shade></span></div>
          <div class="face face--back">
            <div class="cover" data-cover>
              <span class="cover__frame"></span>
              <svg class="mark cover__mark" viewBox="0 0 24 24"><path d="M12 4.2 4.4 6.4v12.2L12 20.8zM12 4.2l7.6 2.2v12.2L12 20.8"></path></svg>
              <span class="cover__name"><span data-cover-name>Collection</span></span>
              <i class="cover__rule" data-cover-rule></i>
              <span class="cover__brand">Corran Paper</span>
            </div>
            <span class="face__shade" data-back-shade></span>
            <span class="face__gloss" data-gloss></span>
          </div>
        </div>
      </div>
    </div>

    <div class="grain" aria-hidden="true"></div>
    <svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.5l13 7.2-5.6 1.4-2.8 5.4z"></path></svg>
    <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.

45 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 “Folding card 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 paper white background with a soft light from the top left corner and a very thin rule in the middle, where the page will fold, sits the Studio page of Corran Paper: at the top the mark, a folded card drawn in vermilion, and the menu, a pill with Studio and Collection; next to Collection a tiny card in the colour of the page it leads to. At the bottom the vermilion eyebrow, the big title ‘Paper that keeps its crease’ with the last word narrow and light, a line of text, the ‘See the collection’ pill and on the right a sample card just opened, ‘600 gsm cotton’. A drawn pointer goes over Collection: the tiny card opens. On the click the right half of the page lifts from the fold and turns over the left, darkening as it goes edge on, while on the still half falls the shadow that starts from the fold; the whole page gets a little smaller and slides to the centre, on a dark desk with the soft shadow underneath. On the back of the half there is the ink blue cover: a pressed frame, the mark, ‘Collection’ rising out of its mask, a vermilion rule and ‘Corran Paper’; a highlight passes over it as it lands with a one pixel press. Then the card opens again, the half goes back to its place going a little past flat, and inside is the Collection page: the title ‘Folded, pressed and sent’ rises line by line and three price list rows, Wedding suite, Thank you notes and Letterhead, come in on a spring. Then the pointer presses Studio and the page folds from the other side, with the paper white cover. On hover the menu items widen on the wdth axis and the tiny card opens, the pill swells and its arrow moves on, the sample card opens wider, the price list rows slide.

How it works

Two copies, a still half and a turning one

On the click the script clones the current page twice: one copy sits in the still half, the other on the front face of the turning half, moved back by half the window, so the two halves together make the whole page. The turning half has transform-style preserve-3d and two faces with backface-visibility hidden: on the back, turned by 180 degrees, there is the cover.

Folding one way forward, the other way back

Going forward the right half folds, pivoting on its left edge, to rotateY(-180deg); going back the left one, pivoting on its right edge, to 180. A one pixel translateZ before the rotation keeps the turning half always above the still one when they lie on the same plane, with no flicker.

Light and shade from the angle

Everything is written on every frame from a single state (angle, closing, press): the dark veil of each face is the sine of the angle, so it is darkest when the half is edge on; on the still half falls a shadow starting from the fold, and a highlight passes over the back. Meanwhile the group shrinks by 10 % and slides by a quarter of the window, so the closed card sits in the middle of the desk.

The change under the closed card

When the half lands (a one pixel press on elastic.out) the new page goes under the cover: the real page changes, its texts hide and the two copies become copies of the new page. After 0.55 s the card opens again on back.out(1.3), which takes the half a little past flat and brings it back down.

The new page and the details

Once the card is open the copies go away and the title rises line by line out of its mask on expo.out, the price list rows come in on a spring. The tiny card next to the menu item has the colour of the page it leads to and opens on hover; the sizes of the copies are read again on every frame, so a resize halfway through the fold breaks nothing.

Values to change

NameFileDefaultWhat it changes
CLOSE_TIMEscript.js0.95The seconds the free half takes to fold over the other.
HOLDscript.js0.55The seconds the card stays closed, with the cover of the new page.
OPEN_TIMEscript.js1.05The seconds the card takes to open again.
OPEN_OVERSHOOTscript.js1.3How far the half goes past flat as it opens (0 no bounce).
LIFTscript.js0.1How much the closed card shrinks as it lifts off the desk.
CENTREscript.js1The closed card slides to the centre (1 on, 0 off).
DEPTHscript.js1700The perspective of the fold (lower is deeper).
SHADEscript.js0.5How much the paper darkens as it turns edge on.

Try them in the Playground

When to use it

For the website of a design or print studio, a stationery shop, invitations, a portfolio or a landing page with a few pages in their own colours: when the page change should feel like a paper object, a card that closes and opens again on another page.

On phones

The same fold with adapted sizes: the brand name gets shorter, the title is sized on width and height, the sample card moves to the top right and the price list takes the full width; the closed card is a tall strip in the middle of the screen with the cover and the name.

With reduced motion

No fold and no movement: the new page fades in over the old one and the texts light up without moving.

Pitfalls

  • When the turning half is closed it lies on the same plane as the still one: without a one pixel translateZ before the rotation the two faces flicker.
  • The translateZ must come before the rotateY: after it, turning by 180 degrees pushes the half behind instead of in front.
  • The copy on the turning half must be moved back by half the window, and not on the way back: the side changes with the direction, along with the pivot.
  • The new page must be cloned with its texts already hidden, or opening the card shows it whole and then the texts come in a second time.
  • The copies have width and height in pixels: they must be read again on every frame, or a resize halfway through the fold leaves a gap in the middle.

Libraries

GSAP 3.15.0, Bricolage Grotesque (font variabile) 5.3.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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