Skip to content
animorio
IT
Back to the library

City guide transition

Transitions, ImagesGSAP, CSS onlyAdvancedCompressed weight: Demo 13 KBGSAP 28 KBFreeDownload the zip

The transition of Wayfare Guides, a made-up travel guide site: four city cards with real photos (Lisbon, Kyoto, Santorini, Copenhagen). Tap one and its photo leaves the card and grows into the guide's full-width cover, the city name flies with it into the title and grows, widening on the wdth axis, the other cards slide away; then the first lines of the guide rise under the cover and a small line map draws the route through three stops. Back flies it all home to the right card.

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>
<!--
  "City guide 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>From the city card to the guide, the photo becoming the cover</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>
  <!-- Wayfare Guides, a made-up travel guide site. Four city cards with real photos; picking one, its photo grows into
       the full-width cover of the guide, the city name travels into the title and grows, the other cards slide away
       and the first lines of the guide rise under the cover, with a small line map that draws the route. Back plays it
       all the other way. -->
  <main class="palco">
    <div class="sito" data-sito>

      <!-- the grid of cities -->
      <section class="griglia" data-griglia aria-label="Guides">
        <header class="barra" data-entra>
          <p class="marchio">
            <svg class="marchio__segno" viewBox="0 0 24 24" aria-hidden="true"><path d="M4 18c3.5-7 6.5-10.5 8-10.5S16.5 11 20 18" /><path d="M8.5 18c1.4-3 2.6-4.6 3.5-4.6s2.1 1.6 3.5 4.6" /></svg>
            Wayfare <span>Guides</span>
          </p>
          <nav class="barra__voci" aria-label="Main">
            <a href="#" aria-current="page">Cities</a>
            <a href="#">Journal</a>
            <a href="#">Saved</a>
          </nav>
        </header>

        <div class="intesta" data-entra>
          <h1 class="intesta__titolo">Where to next?</h1>
          <p class="intesta__riga">Slow guides to four cities, walked and rewritten this autumn.</p>
        </div>

        <ul class="carte" role="list">
          <li class="carta-posto" data-entra-carta>
            <button class="carta" type="button" data-carta="lisbon" data-autoclic>
              <span class="carta__foto"><img src="lisbon.webp" width="1024" height="683" alt="A yellow tram on a steep street in Lisbon"></span>
              <span class="carta__velo" aria-hidden="true"></span>
              <span class="carta__testo">
                <span class="carta__nome" data-nome>Lisbon</span>
                <span class="carta__meta">Portugal <i aria-hidden="true"></i> 3 days</span>
              </span>
              <span class="carta__apri" aria-hidden="true"><svg viewBox="0 0 16 16"><path d="M5 11 11 5M6 5h5v5" /></svg></span>
            </button>
          </li>
          <li class="carta-posto" data-entra-carta>
            <button class="carta" type="button" data-carta="kyoto">
              <span class="carta__foto"><img src="kyoto.webp" width="1024" height="683" alt="Stone steps under red torii gates in Kyoto"></span>
              <span class="carta__velo" aria-hidden="true"></span>
              <span class="carta__testo">
                <span class="carta__nome" data-nome>Kyoto</span>
                <span class="carta__meta">Japan <i aria-hidden="true"></i> 4 days</span>
              </span>
              <span class="carta__apri" aria-hidden="true"><svg viewBox="0 0 16 16"><path d="M5 11 11 5M6 5h5v5" /></svg></span>
            </button>
          </li>
          <li class="carta-posto" data-entra-carta>
            <button class="carta" type="button" data-carta="santorini">
              <span class="carta__foto"><img src="santorini.webp" width="960" height="677" alt="A white church with a blue dome over the sea in Santorini"></span>
              <span class="carta__velo" aria-hidden="true"></span>
              <span class="carta__testo">
                <span class="carta__nome" data-nome>Santorini</span>
                <span class="carta__meta">Greece <i aria-hidden="true"></i> 2 days</span>
              </span>
              <span class="carta__apri" aria-hidden="true"><svg viewBox="0 0 16 16"><path d="M5 11 11 5M6 5h5v5" /></svg></span>
            </button>
          </li>
          <li class="carta-posto" data-entra-carta>
            <button class="carta" type="button" data-carta="copenhagen">
              <span class="carta__foto"><img src="copenhagen.webp" width="1024" height="765" alt="Coloured houses and wooden boats along the Nyhavn canal in Copenhagen"></span>
              <span class="carta__velo" aria-hidden="true"></span>
              <span class="carta__testo">
                <span class="carta__nome" data-nome>Copenhagen</span>
                <span class="carta__meta">Denmark <i aria-hidden="true"></i> 3 days</span>
              </span>
              <span class="carta__apri" aria-hidden="true"><svg viewBox="0 0 16 16"><path d="M5 11 11 5M6 5h5v5" /></svg></span>
            </button>
          </li>
        </ul>
      </section>

      <!-- the guide -->
      <article class="guida" data-guida aria-hidden="true">
        <div class="copertina" data-copertina>
          <div class="copertina__foto"><img data-copertina-img src="lisbon.webp" width="1024" height="683" alt=""></div>
          <div class="copertina__velo" aria-hidden="true"></div>
          <button class="indietro" type="button" data-indietro>
            <svg viewBox="0 0 16 16" aria-hidden="true"><path d="M13 8H3.5M7.5 3.5 3 8l4.5 4.5" /></svg>
            <span>Back</span>
          </button>
          <button class="salva" type="button" aria-label="Save this guide" data-salva>
            <svg viewBox="0 0 16 16" aria-hidden="true"><path d="M4 2.5h8v11l-4-2.8-4 2.8z" /></svg>
          </button>
          <div class="copertina__testo">
            <p class="copertina__paese" data-paese>Portugal</p>
            <h2 class="copertina__nome" data-titolo>Lisbon</h2>
          </div>
        </div>

        <div class="corpo">
          <div class="corpo__testa">
            <h3 class="corpo__titolo" data-sale data-giorni>Three days in Lisbon</h3>
            <p class="corpo__meta" data-sale>
              <svg viewBox="0 0 16 16" aria-hidden="true"><circle cx="8" cy="8" r="5.5" /><path d="M8 5v3.2l2 1.3" /></svg>
              <span data-lettura>8 min read</span>
              <i aria-hidden="true"></i>
              <span>Updated Oct 2026</span>
            </p>
            <p class="corpo__intro" data-sale data-intro>Hills, trams and long lunches by the river.</p>
            <ul class="temi" role="list" data-sale data-temi>
              <li>Walks</li><li>Food</li><li>Views</li>
            </ul>
            <a class="leggi" href="#" data-sale data-leggi>
              <span class="leggi__fondo" aria-hidden="true"></span>
              <span class="leggi__testo">Start reading</span>
              <svg viewBox="0 0 16 16" aria-hidden="true"><path d="M3 8h9.5M8.5 3.5 13 8l-4.5 4.5" /></svg>
            </a>
          </div>

          <div class="corpo__giro">
            <figure class="mappa" data-sale aria-hidden="true">
              <svg viewBox="0 0 160 110" data-mappa>
                <path class="mappa__acqua" data-acqua d="" />
                <g class="mappa__strade">
                  <path d="M-90 22 C -40 26, -10 14, 30 18 C 60 30, 96 24, 130 16 S 200 12, 250 20" />
                  <path d="M-90 52 C -40 46, 0 58, 40 46 C 70 58, 110 52, 140 46 S 210 50, 250 44" />
                  <path d="M-90 88 C -30 84, 30 94, 80 86 S 190 92, 250 84" />
                  <path d="M22 -80 C 26 30, 18 60, 26 190" />
                  <path d="M64 -80 C 60 26, 70 52, 62 190" />
                  <path d="M112 -80 C 116 30, 104 64, 116 190" />
                  <path d="M150 -80 C 146 24, 156 44, 148 190" />
                  <path d="M-24 -80 C -20 30, -30 70, -22 190" />
                  <path d="M190 -80 C 186 30, 196 70, 188 190" />
                  <path d="M-60 -80 C -56 30, -66 70, -58 190" />
                  <path d="M226 -80 C 222 30, 232 70, 224 190" />
                  <path class="fine" d="M-90 36 C 50 40, 90 34, 250 38" />
                  <path class="fine" d="M-90 70 C 40 66, 120 74, 250 68" />
                  <path class="fine" d="M44 -80 C 46 40, 40 70, 44 190" />
                  <path class="fine" d="M88 -80 C 84 30, 92 60, 86 190" />
                  <path class="fine" d="M130 -80 C 134 40, 126 70, 132 190" />
                  <path class="fine" d="M0 -80 C 4 40, -4 70, 2 190" />
                  <path class="fine" d="M170 -80 C 166 40, 174 70, 168 190" />
                </g>
                <path class="mappa__giro-ombra" data-giro-ombra d="" />
                <path class="mappa__giro" data-giro d="" />
                <g data-tappe-mappa>
                  <g class="mappa__tappa"><g data-pop><circle r="4.4" /><circle class="cuore" r="1.6" /></g></g>
                  <g class="mappa__tappa"><g data-pop><circle r="4.4" /><circle class="cuore" r="1.6" /></g></g>
                  <g class="mappa__tappa"><g data-pop><circle r="4.4" /><circle class="cuore" r="1.6" /></g></g>
                </g>
              </svg>
            </figure>
            <ol class="tappe" role="list" data-tappe>
              <li class="tappa" data-sale><time></time><span></span></li>
              <li class="tappa" data-sale><time></time><span></span></li>
              <li class="tappa" data-sale><time></time><span></span></li>
            </ol>
          </div>
        </div>
      </article>

      <!-- the photo while it flies from the card to the cover -->
      <div class="volo" data-volo aria-hidden="true"><img data-volo-img src="lisbon.webp" alt=""></div>
    </div>
  </main>

  <svg class="puntatore" data-puntatore viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.2v15.4l4.1-3.9 2.7 6.1 2.7-1.2-2.7-6h5.6z" /></svg>

  <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.

47 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 “City guide 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 warm paper sits the window of Wayfare Guides, a made-up travel guide site: the logo, “Where to next?” and four city cards with real photos, Lisbon's yellow tram, the red torii gates of Kyoto, Santorini's blue-domed church, the coloured houses and boats of Nyhavn in Copenhagen. Each card has a dark veil at the bottom with the name and the country, a one-pixel edge of light, a layered shadow and fine grain on the photo; hovering it the photo comes closer and a glass circle with an arrow appears at the top right. Tap a card and it gives a little under the finger as its photo lifts off: it grows into the guide's full-width cover, losing its rounded corners, with a shadow that rises mid-flight and settles on arrival, while the frame shows more and more of the landscape. The city name flies with it: it leaves its place on the card small and lands big at the bottom left of the cover, widening and gaining weight on the axes of the variable font. The other cards slide away from the chosen one, nearest first, and fade; the grid's heading rises and goes. Once landed the cover settles from a slight zoom, and the country, the glass “Back” button with its drawn arrow and the bookmark appear. Below, line by line, rise “Three days in Lisbon”, the reading time with a small clock, a sentence, the line map and the three stops with their times: the terracotta route draws itself on the map and each stop pops with a small bounce as the line reaches it, while its row in the list blushes for a moment. Back does it all in reverse: the lines drop, the cover turns back into the card, the name shrinks home and the other cards return with a small settle. On its own, a drawn pointer opens a city, drifts to the stops, saves the guide, goes back and opens another.

How it works

Two layers and a flying photo

The grid and the guide are two layers of the same window, each in its own place in the layout. While the photo travels a third element, .volo, carries it with the same image in object-fit cover: neither the card nor the cover has to move, and the photo shows more landscape as it changes shape.

Hand-made FLIP

On tap the card and the cover are measured with getBoundingClientRect (relative to the window); .volo starts with the card's x, y, width, height and radius, and GSAP takes it to the cover's in FLIGHT seconds on the FLIGHT_EASE curve, radius down to 0. A proxy from 0 to 1 draws the shadow that grows mid-flight (LIFT). On landing the real cover takes the flight's place in the same frame and settles from SETTLE to 1.

The name becoming the title

The cover's title is already in place: it is measured, the offset to the name on the card (bottom left corner) and the scale as the ratio between the two font sizes are worked out, and it is put there with transform-origin at the bottom left. Then it goes back to x 0, y 0, scale 1 on the same curve as the photo, while font-stretch goes from 108% to 118% and the weight from 640 to 680.

The other cards and the guide

Every other card slides SLIDE pixels away from the chosen one, with a delay that grows with the distance, and fades. The guide's lines rise STAGGER apart; the map route is an SVG path of two quadratic curves through the three stops, drawn with stroke-dashoffset, and each stop pops when the line reaches its fraction of the length (measured with getTotalLength).

The way back and the pilot

Back measures the cover and the card again (the window may have changed) and flies it all in reverse, then the other cards return with back.out. An inner pilot with a drawn pointer tours the cities; at the first real touch it steps aside and resumes after nine quiet seconds.

Values to change

NameFileDefaultWhat it changes
FLIGHTscript.js1.0How many seconds the card's photo takes to become the cover.
FLIGHT_EASEscript.js'expo.inOut'The curve of the photo's and the name's flight.
LIFTscript.js0.5How much the photo's shadow grows mid-flight (0 none).
SLIDEscript.js28How many pixels the other cards slide away.
STAGGERscript.js0.07The delay between one line of the guide and the next, in seconds.
SETTLEscript.js1.06How zoomed in the cover is before it settles to 1.
GRAINscript.js0.14How much grain lies on the photos.
AUTO_PILOTscript.js11 a drawn pointer opens the cities on its own until someone touches, 0 turns it off.

Try them in the Playground

When to use it

For a travel site, a travel blog, a city magazine, a hotel or a group of holiday homes telling about the area: whenever a grid of photo cards leads into the page of one of them and the photo and the name should carry the viewer from one to the other. Swap the photos in the img tags of the HTML (the webp files in the folder), the guides in the script's GUIDES object, the colours in :root.

On phones

The same animations at adapted sizes: the window is measured on width and height, the cards sit two to a row, the cover takes a little under half the height and below it the map and the stops sit side by side, without the opening sentence.

With reduced motion

No flight and no movement: the grid fades out and the complete guide fades in, and Back does the same in reverse. The pilot alternates the cities without the pointer.

Pitfalls

  • Scaling the card up to the cover would stretch the photo: so a separate element flies, changing width and height with the image in object-fit cover, and the framing widens instead of stretching.
  • A name scaled from its centre would slide sideways: the origin goes at the bottom left, the same corner that lines up on the card and on the cover.
  • The map stops hold their position in the transform attribute and GSAP scales them: two transforms on the same SVG group cancel each other, so the position sits on the outer group and the bounce on the inner one.
  • If the window changes size mid-flight, the flight jumps to its end (progress(1)): the cover and the grid live in the layout and sort themselves out, and Back measures everything again before it leaves.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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