Skip to content
animorio
IT
Back to the library

Homes grid transition

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

A holiday rental app's transition between the grid of homes and the home's page, with a shared element that flies: tap a home and its real photo lifts off with its shadow and grows into the cover; the name grows into the headline, the price drops on an arc into the booking bar, the other homes sink back. Once there, the photo breathes in and a light sweeps across it. Back makes the trip 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>
<!--
  "Homes grid 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>Lowtide stays</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 stays app of an invented holiday rental brand, Lowtide: a grid of four homes, each with a real CC0
       photo. Tap a home and its photo lifts off the grid and flies up to become the cover of the home's page, the
       name grows into the title, the price flies down into the booking bar; the rest of the grid sinks back.
       Back makes the same trip home, to the right card -->
  <main class="palco" data-palco>
    <section class="app" data-app aria-label="Lowtide stays">

      <div class="vista vista--griglia" data-griglia>
        <header class="testa" data-via>
          <div>
            <p class="marchio">
              <svg viewBox="0 0 20 20" aria-hidden="true"><path d="M2.5 12.5c2.2-2 4.4-2 6.6 0s4.4 2 6.6 0" /><path d="M2.5 8c2.2-2 4.4-2 6.6 0s4.4 2 6.6 0" /></svg>
              Lowtide
            </p>
            <h1 class="titolo-griglia">Stays by the sea</h1>
          </div>
          <span class="date"><span class="num">Nov 14</span> to <span class="num">17</span></span>
        </header>
        <nav class="filtri" data-via aria-label="Filters">
          <span class="filtro is-on">All homes</span>
          <span class="filtro">Pool</span>
          <span class="filtro">Sea view</span>
          <span class="filtro">Cabins</span>
        </nav>
        <ul class="case" data-case></ul>
      </div>

      <div class="vista vista--casa" data-casa aria-hidden="true">
        <div class="cover" data-cover>
          <span class="cover__luce" data-luce aria-hidden="true"></span>
          <span class="cover__pagine" data-pagine aria-hidden="true"><i class="is-on"></i><i></i><i></i><i></i></span>
        </div>
        <button class="tondo tondo--indietro" type="button" data-indietro aria-label="Back to all homes">
          <svg viewBox="0 0 16 16" aria-hidden="true"><path d="M10 3.5 5.5 8l4.5 4.5" /></svg>
        </button>
        <div class="foglio" data-foglio>
          <div class="foglio__testa">
            <h2 class="titolo-casa" data-titolo>Home</h2>
            <span class="voto" data-entra>
              <svg viewBox="0 0 16 16" aria-hidden="true"><path d="M8 1.8l1.8 3.9 4.2.5-3.1 2.9.8 4.2L8 11.2l-3.7 2.1.8-4.2L2 6.2l4.2-.5z" /></svg>
              <span class="num" data-voto>4.9</span>
            </span>
          </div>
          <p class="luogo" data-entra data-luogo>Place</p>
          <ul class="specs" data-entra>
            <li>
              <svg viewBox="0 0 20 20" aria-hidden="true"><path d="M3 15V6M3 11h14v4M17 11V9.5A2.5 2.5 0 0 0 14.5 7H9v4" /><circle cx="6" cy="9" r="1.4" /></svg>
              <span><b class="num" data-letti>2</b> bedrooms</span>
            </li>
            <li>
              <svg viewBox="0 0 20 20" aria-hidden="true"><path d="M3 10h14v1.5A4.5 4.5 0 0 1 12.5 16h-5A4.5 4.5 0 0 1 3 11.5zM5.5 10V5a1.8 1.8 0 0 1 3.4-.8M7 16l-.8 1.6M13 16l.8 1.6" /></svg>
              <span><b class="num" data-bagni>1</b> <span data-bagni-parola>bath</span></span>
            </li>
            <li>
              <svg viewBox="0 0 20 20" aria-hidden="true"><rect x="3" y="3" width="14" height="14" rx="2" /><path d="M3 11h6V3M13 17v-4h4" /></svg>
              <span><b class="num" data-mq>90</b> m²</span>
            </li>
          </ul>
          <p class="frase" data-entra data-frase>Sentence.</p>
          <div class="host" data-entra>
            <span class="host__volto" data-volto>IM</span>
            <span class="host__testo"><b data-host>Hosted by Ines</b><span>Replies within an hour</span></span>
          </div>
        </div>
        <footer class="barra" data-barra>
          <p class="barra__prezzo"><b class="num" data-prezzo>€240</b><span class="barra__notte"> night</span><span class="barra__date" data-entra-barra>Nov 14 to 17, <span class="num" data-totale>€720</span> total</span></p>
          <button class="prenota" type="button" data-prenota>
            <span class="prenota__faccia" data-faccia>
              <span class="prenota__parole" data-parole>Reserve</span>
              <svg class="prenota__spunta" viewBox="0 0 16 16" aria-hidden="true"><path data-spunta pathLength="1" d="M3.4 8.4l3 3 6.2-6.6" /></svg>
            </span>
          </button>
        </footer>
      </div>

      <!-- the photo that flies between the card and the cover, and the price that flies into the bar -->
      <div class="volo" data-volo aria-hidden="true">
        <span class="volo__foto" data-volo-foto></span>
        <span class="cuore cuore--volo" data-volo-cuore><svg viewBox="0 0 16 16"><path d="M8 13.6S2.2 10.2 2.2 6.1A2.9 2.9 0 0 1 8 4.6a2.9 2.9 0 0 1 5.8 1.5c0 4.1-5.8 7.5-5.8 7.5z" /></svg></span>
      </div>
      <span class="prezzo-volo num" data-prezzo-volo aria-hidden="true"></span>
    </section>
    <span class="puntatore" data-puntatore aria-hidden="true">
      <svg viewBox="0 0 24 24"><path d="M5 3.2v15.6l4.3-4.1 2.8 6.3 2.7-1.2-2.8-6.2h5.9z" /></svg>
    </span>
    <p class="sr" aria-live="polite" data-voce></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.

44 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 “Homes grid 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 sand coloured background with a soft light and a little grain sits the window of an invented holiday rental app, Lowtide: at the top the brand with two waves, «Stays by the sea», the dates in a pill and four filters (All homes, Pool, Sea view, Cabins); below, a grid of four homes, each with its own real photo (a villa with an infinity pool over the sea at dusk, with lanterns and a thatched roof; a timber boathouse on stilts in a green lake among pines and mountains; a beach house on the dunes with wooden steps down to the sand; a house alone on a rock in the bay, with a footbridge and the waves below), a frosted heart, the name, the rating, the place and the price per night. On hover the photo moves in a touch; pressing the card sinks it. Tap it and the photo lifts off and flies to the top, growing into the cover of the page while its corners straighten, its shadow rises halfway and drops on arrival, the heart follows and becomes a frosted round button; the name grows into the headline, the price drops on an arc into the booking bar that rises from below on a spring, and the other homes shrink and move away. Once there, the photo breathes in, settles slowly and a warm light sweeps across it; the sheet with the details rises with a bounce and inside, one after the other, come the rating with its star, the place, the three tiles (bedrooms, baths, square metres), the sentence and the host. Reserve sinks under the finger, becomes Requesting with a light running across it and then Requested, dark, with a check drawing itself. Back makes the trip the other way to the right card, which settles by a pixel. A fake pointer opens the villa, goes back, opens the house on the rock, reserves and goes back.

How it works

Four real photos

Each home has a real CC0 photo (a webp of 1024 pixels or less) in the demo folder, written in the home's data together with the point to keep in the middle (pos, for example «78% 60%» for the lake house, which sits on the right). It is used as a background-image with background-size: cover and that background-position, so the same photo works in the nearly square card and in the wider cover, and the house always stays in view.

Measure before and after

On tap we measure where the photo, name and price sit in the card, then show the home's page and measure where the cover, headline, bar price and heart sit. That is FLIP: First, Last, Invert, Play, with getBoundingClientRect relative to the app window.

A piece that flies

The photo is not scaled: a separate div with the same image starts over the card's photo and GSAP animates its position, width, height and radius up to the cover; with cover the image crops itself without stretching. Two more tweens on the shadow lift it halfway (SOLLEVA) and drop it on arrival, like a photo picked up by hand. The heart flies inside it by animating top, right and size.

The price on an arc

The flying price is a separate piece with two overlapping tweens: x with power3.inOut and y with power2.in. The two different curves draw an arc instead of a straight line. On arrival it gives way to the bar's real price, which does a small scale bounce.

The way back

Back measures the card again (it never moved) and makes the trip with expo.inOut; the other homes come back with back.out and the opened card, as the photo lands, drops a pixel and rises again.

Values to change

NameFileDefaultWhat it changes
VOLOscript.js0.78How long the photo's trip to the cover lasts, in seconds.
RITORNOscript.js0.62How long the trip back lasts, in seconds.
SOLLEVAscript.js0.6How high the photo lifts in flight: the strength of its shadow, 0 to 1.
AFFONDAscript.js0.9How much the other homes shrink when one opens.
MOLLAscript.js1.25The bounce of the details sheet and the bar as they rise.
SFALSAscript.js0.05The delay between one piece of the sheet and the next, in seconds.
SOSTAscript.js2.4How long a home stays open in the automatic loop, in seconds.

Try them in the Playground

When to use it

For a holiday rental, hotel or real estate site or app, for a shop catalogue or a gallery of projects: whenever a grid of photo cards opens the page of one item and you want people to keep their bearings, because the photo they tapped is the same one they find at the top.

On phones

The same animation with adapted sizes: the app window is as wide as the box and as tall as the screen allows, the grid shares the remaining space in two rows, the headlines are sized in vh too; on short screens the sentence under the tiles stays out. The flight is measured at every tap, so it follows the window as it is at that moment.

With reduced motion

No flight and no springs: the grid fades out and the home's page appears already in place, and the same on the way back; the button changes its label without growing.

Pitfalls

  • The card's press lives on its face (.casa__faccia) in CSS, while GSAP moves and shrinks the whole card: one thing per element, otherwise GSAP's inline transform wipes out the class's.
  • The bar's price is a <b>: transforms do not apply to inline elements, so it needs display: inline-block to bounce.
  • The flying photo sits under the sheet and the frosted round buttons (lower z-index) but over the grid: so on arrival the sheet already covers those sixteen pixels and the swap with the real cover cannot be seen.
  • The flying photo, the card and the cover use the same file and the same background-position: the browser already loaded it for the grid, so the flight starts without a flash, and with the same centre point the crop does not jump when the real cover takes the flying photo's place.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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