Skip to content
animorio
IT
Back to the library

Card slide transition

Transitions, HoverGSAP, CSS onlyMediumCompressed weight: Demo 9.9 KBGSAP + CustomEase 31 KBFreeDownload the zip

The site of Ferrovale, a made-up drilling and tunnelling contractor, with four pages: Home, Services, Fleet, Safety. On a click on a menu item or on the page’s button, the old page slides away to the left and gets darker, the new one comes in from the right already shrunk like a card, with round corners and a soft shadow, then lays itself down at full size while the photo behind it grows a touch and the title rises line by line. The bar at the top comes off as a frosted pill and goes back to the margins; «Back» goes back with the page returning from the left. The button has the site’s hover: the label slides and the fill turns orange. Minimal style. From the page transition of the CoMinVi site, Awwwards Site of the Day on 30/9/2026.

Rebuilt from scratch studying cominvi.com.mx by Holographik: the idea is theirs; code, copy and images are ours. Read how it’s made

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>
<!--
  "Card slide 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>Ferrovale Drilling</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/inter-tight@5.3.0/index.css">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/geist-mono@5.3.0/index.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <!-- four pages of a made-up drilling and tunnelling contractor. A click on a menu item or on a page's button slides
       the old page away to the left while the new one comes in from the right already shrunk like a card, then lays
       itself down to full size while its background grows. Back, or a page to the left, comes in from the other side -->
  <svg width="0" height="0" style="position:absolute" aria-hidden="true">
    <symbol id="freccia" viewBox="0 0 16 16"><path d="M2.5 8h10.2M8.8 3.6 13.2 8l-4.4 4.4" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="square"/></symbol>
  </svg>

  <div class="palco" data-palco>

    <section class="pagina" data-pagina="home" data-tema="scuro" aria-label="Home">
      <div class="carta" data-carta>
        <div class="fondo" data-fondo>
          <div class="fondo__arte" data-arte>
            <svg class="strati" viewBox="0 0 1200 800" preserveAspectRatio="xMidYMid slice" aria-hidden="true">
              <g class="strati__righe" fill="none" stroke="currentColor" stroke-width="1" vector-effect="non-scaling-stroke">
                <path d="M0 210 C 200 190 340 236 560 222 S 920 186 1200 204"/>
                <path d="M0 268 C 180 252 380 290 600 276 S 960 246 1200 262"/>
                <path d="M0 352 C 240 340 420 372 640 360 S 980 330 1200 346"/>
                <path d="M0 450 C 220 436 400 476 660 462 S 1000 430 1200 448"/>
                <path d="M0 520 C 200 512 420 540 620 530 S 980 500 1200 516"/>
                <path d="M0 610 C 260 596 440 632 700 618 S 1020 590 1200 606"/>
                <path d="M0 700 C 240 690 460 716 700 706 S 1000 684 1200 698"/>
              </g>
              <path class="strati__foro" data-foro pathLength="1" d="M-20 238 C 220 236 420 244 640 240 S 900 234 1010 237" fill="none" stroke-width="1.5" vector-effect="non-scaling-stroke"/>
              <circle class="strati__testa" data-testa cx="1010" cy="237" r="6" fill="none" stroke-width="1.5" vector-effect="non-scaling-stroke"/>
            </svg>
          </div>
          <span class="fondo__velo"></span>
        </div>
        <div class="contenuto">
          <p class="mono occhiello" data-su>Drilling and tunnelling</p>
          <h1 class="titolo" tabindex="-1" data-titolo><span class="riga"><span data-riga>Through rock,</span></span><span class="riga"><span data-riga>on time.</span></span></h1>
          <p class="frase" data-su>Shafts, raises and tunnels for mines, rail and water, bored by one crew from survey to hand-over.</p>
          <a class="bottone" href="#services" data-vai="services" data-su><span class="bottone__fondo" aria-hidden="true"><span class="bottone__arancio" data-arancio></span></span><span class="bottone__finestra"><span class="bottone__dentro" data-dentro><svg class="bottone__freccia bottone__freccia--entra" aria-hidden="true"><use href="#freccia"/></svg><span>Our services</span><svg class="bottone__freccia" aria-hidden="true"><use href="#freccia"/></svg></span></span></a>
        </div>
        <div class="piede mono" data-su><span>Ferrovale, since 1987</span><span>1,240,000 m bored</span></div>
        <span class="carta__velo" data-velo aria-hidden="true"></span>
      </div>
    </section>

    <section class="pagina" data-pagina="services" data-tema="chiaro" aria-label="Services">
      <div class="carta" data-carta>
        <div class="fondo" data-fondo>
          <div class="fondo__arte" data-arte>
            <img class="fondo__foto fondo__foto--destra" src="galleria.webp" width="1024" height="683" alt="A round tunnel lined with ribs, rails running to the light at the end">
          </div>
          <span class="fondo__velo fondo__velo--carta"></span>
        </div>
        <div class="contenuto">
          <p class="mono occhiello" data-su>Services</p>
          <h1 class="titolo" tabindex="-1" data-titolo><span class="riga"><span data-riga>Every bore,</span></span><span class="riga"><span data-riga>end to end.</span></span></h1>
          <p class="frase" data-su>Survey, face drilling, ground support and hauling, planned and run by the same people.</p>
          <a class="bottone" href="#fleet" data-vai="fleet" data-su><span class="bottone__fondo" aria-hidden="true"><span class="bottone__arancio" data-arancio></span></span><span class="bottone__finestra"><span class="bottone__dentro" data-dentro><svg class="bottone__freccia bottone__freccia--entra" aria-hidden="true"><use href="#freccia"/></svg><span>See the fleet</span><svg class="bottone__freccia" aria-hidden="true"><use href="#freccia"/></svg></span></span></a>
        </div>
        <div class="piede mono" data-su><span>Four crews, one plan</span><span>Survey to hand-over</span></div>
        <span class="carta__velo" data-velo aria-hidden="true"></span>
      </div>
    </section>

    <section class="pagina" data-pagina="fleet" data-tema="scuro" aria-label="Fleet">
      <div class="carta" data-carta>
        <div class="fondo" data-fondo>
          <div class="fondo__arte" data-arte>
            <img class="fondo__foto" src="binari.webp" width="1024" height="768" alt="Rails curving through a mine tunnel lit by lamps and dust">
          </div>
          <span class="fondo__velo fondo__velo--notte"></span>
        </div>
        <div class="contenuto">
          <p class="mono occhiello" data-su>Fleet</p>
          <h1 class="titolo" tabindex="-1" data-titolo><span class="riga"><span data-riga>Machines</span></span><span class="riga"><span data-riga>built for depth.</span></span></h1>
          <p class="frase" data-su>Face-drilling rigs, loaders and rock bolters, serviced underground by our own fitters.</p>
          <a class="bottone" href="#safety" data-vai="safety" data-su><span class="bottone__fondo" aria-hidden="true"><span class="bottone__arancio" data-arancio></span></span><span class="bottone__finestra"><span class="bottone__dentro" data-dentro><svg class="bottone__freccia bottone__freccia--entra" aria-hidden="true"><use href="#freccia"/></svg><span>Safety first</span><svg class="bottone__freccia" aria-hidden="true"><use href="#freccia"/></svg></span></span></a>
        </div>
        <div class="piede mono" data-su><span>Serviced on site</span><span>48 machines underground</span></div>
        <span class="carta__velo" data-velo aria-hidden="true"></span>
      </div>
    </section>

    <section class="pagina" data-pagina="safety" data-tema="chiaro" aria-label="Safety">
      <div class="carta" data-carta>
        <div class="fondo" data-fondo>
          <div class="fondo__arte" data-arte>
            <svg class="reticolo" width="100%" height="100%" aria-hidden="true">
              <defs><pattern id="croci" width="48" height="48" patternUnits="userSpaceOnUse"><path d="M24 20v8M20 24h8" stroke="currentColor" stroke-width="1" fill="none"/></pattern></defs>
              <rect width="100%" height="100%" fill="url(#croci)"/>
            </svg>
          </div>
          <span class="fondo__velo fondo__velo--salvia"></span>
        </div>
        <div class="contenuto">
          <p class="mono occhiello" data-su>Safety</p>
          <h1 class="titolo" tabindex="-1" data-titolo><span class="riga"><span data-riga>Everyone</span></span><span class="riga"><span data-riga>comes back up.</span></span></h1>
          <p class="frase" data-su>Every shift starts with a check at the portal and ends with a count at the cage.</p>
          <a class="bottone" href="#home" data-vai="home" data-su><span class="bottone__fondo" aria-hidden="true"><span class="bottone__arancio" data-arancio></span></span><span class="bottone__finestra"><span class="bottone__dentro" data-dentro><svg class="bottone__freccia bottone__freccia--entra" aria-hidden="true"><use href="#freccia"/></svg><span>Back home</span><svg class="bottone__freccia" aria-hidden="true"><use href="#freccia"/></svg></span></span></a>
        </div>
        <div class="piede mono" data-su><span>Checked at the portal</span><span>2,190 days without a lost-time injury</span></div>
        <span class="carta__velo" data-velo aria-hidden="true"></span>
      </div>
    </section>

    <header class="barra" data-barra>
      <span class="barra__fondo" data-barra-fondo aria-hidden="true"></span>
      <a class="marchio" href="#home" data-vai="home" aria-label="Ferrovale, home">
        <svg class="marchio__segno" viewBox="0 0 24 24" aria-hidden="true"><rect x="1" y="1" width="22" height="22" rx="5" fill="currentColor"/><circle cx="12" cy="12" r="5.2" fill="none" stroke="var(--barra-fondo-segno)" stroke-width="1.6"/><path d="M12 1v5.6" stroke="var(--barra-fondo-segno)" stroke-width="1.6"/></svg>
        <span class="marchio__nome">Ferrovale</span>
      </a>
      <nav class="voci mono" aria-label="Pages">
        <span class="voci__segno" data-segno aria-hidden="true"></span>
        <a href="#home" data-vai="home" data-voce="home">Home</a>
        <a href="#services" data-vai="services" data-voce="services">Services</a>
        <a href="#fleet" data-vai="fleet" data-voce="fleet">Fleet</a>
        <a href="#safety" data-vai="safety" data-voce="safety">Safety</a>
      </nav>
      <button class="indietro" type="button" data-indietro aria-label="Back to the previous page"><svg aria-hidden="true"><use href="#freccia"/></svg></button>
    </header>

    <p class="solo-lettore" aria-live="polite" data-letto></p>
  </div>

  <script src="https://cdn.jsdelivr.net/npm/gsap@3.15.0/dist/gsap.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/gsap@3.15.0/dist/CustomEase.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.

50 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 “Card slide 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

The site of Ferrovale, a made-up drilling and tunnelling contractor. At the top a bar with the mark (a square with a bore hole), the items Home, Services, Fleet and Safety with a light marker under the current one, and a round button with an arrow to go back. Each page has a big two-line title, a line of text, a button and at the bottom a monospace row with a figure: Home is black, with the rock strata drawn in fine lines and an orange line, the bore, drawing itself from the left to the drill head; Services is warm paper with a real photo of a ribbed round tunnel fading in on the right; Fleet is a photo of a mine tunnel with rails and lamps; Safety is sage grey with a grid of small crosses like a survey sheet. On a click on the button or on an item, the old page slides away to the left and gets darker, the new one comes in from the right shrunk like a card, with round corners and a soft shadow travelling under it; meanwhile the bar at the top comes off the edges and becomes a frosted pill. When the card arrives it lays itself down at full size, the corners and the shadow go, the bar goes back to the margins taking the page’s colour, and the background grows a touch. The page’s name rises line by line while the weight of the type settles, then the line, the button and the footer arrive. «Back», Esc or a page earlier in the menu make the trip the other way: the card comes in from the left. On hover the button slides its label to the right, one arrow leaves, another comes in, and the fill turns orange from the bottom. Left alone, the page takes a tour: Services, Fleet, back, Home.

How it works

Two pages in the same place

The four pages sit on top of each other, absolutely positioned, and only the current one is visible. On a change the new one goes on top (z-index 2) and the old one below: both timelines start together, like Barba’s sync transitions. Each page has a «card» that GSAP moves and scales, with the background and the content inside.

The card

The old page goes to xPercent -100 in 1.2 s; the new one starts at xPercent 100 and reaches 0 in the same time, with transformOrigin 50% 0% and a scale of (width − 64) / width (32 px under 992 px, as on the site), with 16 px corners. The curve is the site’s CustomEase, M0,0 C0.6,0 0,1 1,1: a slow start and a soft arrival.

Laying down, worked out on every frame

Scale, corners and shadow aren’t separate tweens: GSAP takes a number k from 1 to 0 and on every frame the scale is worked out from k and the width of that moment. So if the window changes size halfway, the card stays right. Together the bar goes back to its margins (2em, 1em on a phone) and the background goes from scale 1 to 1.1 (the site goes to 1.2), except on Home.

The bar that comes off

On a click the bar moves away from the edges by half the card’s margin plus 10 px, drops 8 px and lights its frosted background (backdrop-filter) with a shadow; when the card lays down it goes back to the margins, the background fades and the colour turns to the new page’s. The marker under the current item runs to the new one in .7 s.

The site’s button

Inside a window with overflow hidden the label and the two arrows slide 2.25em in .5 s with the same curve: the right arrow leaves and the hidden one on the left comes in. The orange fill rises from the bottom (yPercent from 101 to 0) and on leave keeps going up, then goes back below unseen.

Values to change

NameFileDefaultWhat it changes
SLIDEscript.js1.2Seconds the two pages slide (the site uses 1.2).
LAYscript.js1.2Seconds the card takes to lay down at full size (the site uses 1.2).
MARGINscript.js64Pixels the card is narrower than the page while it travels (the site uses 64, 32 on a phone).
RADIUSscript.js16Corner radius of the travelling card, in pixels (the site uses 1rem).
GROWscript.js1.1Scale the background reaches when the card lands (the site uses 1.2).
SHADEscript.js0.45How dark the leaving page gets, from 0 to 1.
HOVERscript.js2.25Em the button label slides (the site uses 2.25).
HOVER_TIMEscript.js0.5Seconds of the button hover (the site uses .5).
AUTOscript.js1.3Seconds between one step and the next of the tour on its own.

Try them in the Playground

When to use it

For the site of a company, a studio, an agency or a portfolio with a few important pages: a page change that adds depth and shows where you are going and where you came back from.

On phones

Same card and same curve. Under 992 px the card’s margin is 32 px and the bar sits 1em from the edges, as on the site; the brand name leaves only the mark and the title is sized on the height too.

With reduced motion

No sliding and no card: the new page fades in over the old one, the title and the rest fade in, the Home bore line is already drawn; the button only changes colour.

Pitfalls

  • The card’s scale depends on the width: worked out once at the start, a resize halfway leaves it wrong. Here a number goes from 1 to 0 and the scale is worked out again on every frame.
  • transformOrigin 50% 0%: the card shrinks towards the top, so a bigger margin is left below than at the sides; it’s on purpose, as on the site, and shows the shadow.
  • The button: GSAP writes the label’s transform, the orange fill is another element and the press (:active) sits on the button, so they don’t wipe each other out.
  • Hidden pages get inert and aria-hidden, or the Tab key lands on buttons of pages you can’t see.
  • The button’s orange fill started below with translateY(101%) in the CSS: GSAP reads it back in pixels and yPercent 0 then doesn’t bring it up, so the orange never showed. The start position is set by GSAP (yPercent 101).
  • An absolutely positioned arrow inside the label GSAP moves: as soon as GSAP writes the transform, the label becomes the arrow’s containing block and the hidden arrow peeks out. The label has position: relative from the start.

Libraries

GSAP 3.15.0, CustomEase (GSAP) 3.15.0, Inter Tight (font variabile) 5.3.0, Geist Mono (font variabile) 5.3.0.

Compressed with gzip, the three demo files weigh 9.9 KB; the libraries: GSAP + CustomEase 31 KB.

Testing

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