Skip to content
animorio
IT
Back to the library

Infinite grid transition

TransitionsGSAP, CanvasAdvancedCompressed weight: Demo 11 KBGSAP 28 KBFreeDownload the zip

The page change of a work site, in the style of product components: an endless wall of project tiles to drag in every direction, with inertia and friction, drifting slowly on its own at rest. Click a tile and the wall stops, the others move away and fade, that one grows into the cover of the project page, and year, headline, text and details come in staggered. Close makes the trip back to the right tile.

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>
<!--
  "Infinite 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>Halvorn work</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 work page of an invented design studio: an endless wall of projects to drag in every direction; a tile
       grows into the project page, Close makes the trip home and the wall drifts again -->
  <main class="palco" data-palco aria-label="Halvorn, selected work">
    <div class="muro" data-muro></div>

    <header class="testa" data-testa>
      <p class="marchio">Halvorn</p>
      <p class="conta"><span class="num">12</span> projects</p>
    </header>

    <p class="aiuto" data-aiuto>
      <svg viewBox="0 0 16 16" aria-hidden="true"><path d="M8 1.5v13M1.5 8h13M8 1.5 6 3.5M8 1.5l2 2M8 14.5l-2-2M8 14.5l2-2M1.5 8l2-2M1.5 8l2 2M14.5 8l-2-2M14.5 8l-2 2" /></svg>
      Drag to explore
    </p>

    <div class="volo" data-volo aria-hidden="true"></div>

    <article class="pagina" data-pagina aria-hidden="true">
      <button class="chiudi" type="button" data-chiudi aria-label="Close project">
        <svg viewBox="0 0 16 16" aria-hidden="true"><path d="m4 4 8 8M12 4l-8 8" /></svg>
        <span>Close</span>
      </button>
      <div class="corpo">
        <p class="riga-alta" data-entra><span data-indice></span><span class="sep"></span><span data-disciplina></span></p>
        <h1 class="titolo" data-titolo data-entra></h1>
        <p class="testo" data-testo data-entra></p>
        <dl class="dati" data-entra>
          <div><dt>Client</dt><dd data-cliente></dd></div>
          <div><dt>Role</dt><dd data-ruolo></dd></div>
          <div><dt>Year</dt><dd data-anno></dd></div>
        </dl>
      </div>
    </article>

    <svg class="puntatore" data-puntatore viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3l14 7.4-6.3 1.7L9.6 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.

22 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 “Infinite 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 white background sits the work page of an invented studio, Halvorn: at the top its name and «12 projects» in two glass pills, at the bottom the black «Drag to explore» pill. The whole screen is a wall of rounded tiles of different sizes, each a project image drawn by the script (circles and arcs, slanted stripes with the initial, waves, buildings, a sun on the water) in the project’s two colours, with a fine grain. The wall drifts slowly on its own along a diagonal and repeats without end; you drag it with the mouse or a finger in any direction and, let go, it keeps running with inertia and stops with friction, then drifts again. On hover a tile comes a little closer and its label with name and year shows up. Click it and the wall stops: the other tiles move away from it and fade, the pills withdraw, and the tile flies and grows to fill the top of the page, where it becomes the cover; once there it drops a pixel and comes back. Then the glass Close button, the year with the discipline, the large headline, the project text and a row of details (Client, Role, Duration) come in one after the other. Close makes the trip the other way: the cover becomes a tile again in its place, the others come back and the wall drifts again. A drawn pointer drags the wall a little, opens the tile nearest the centre, closes it, drags the other way and opens another.

How it works

A wall that never ends

Twelve tiles sit on a 6 by 4 layout with no gaps, and the layout is copied four times, two by two. Each tile lives in a frame two walls wide: its position is (layout position + offset) modulo twice the wall. When it leaves one side it comes back on the other, and with two copies each way the screen is always full.

Dragging with inertia

Dragging adds the pointer’s movement to offX and offY and keeps an average speed of the last moves. Let go, each frame the wall moves by that speed and the speed is multiplied by ATTRITO, normalised on the frame time, so it runs the same at 60 and 120 Hz. A click is a press that moved less than 5 pixels.

Images drawn once

Each project has two colours and a kind of drawing: circles, stripes, waves, blocks or sun. The script draws them once in a 900 by 700 canvas with a fixed-seed random, adds grain and saves them as an image: tiles and cover use the same one, with background-size cover.

The flight to the cover

On click we read where the tile is, hide it, and a separate piece with the same image starts there and animates x, y, width, height and radius to the cover, with expo.out: the image does not stretch. The other tiles move away along the line joining them to the open tile’s centre, by FUGA pixels, while the wall fades.

The way back

The wall stays still while the page is open, so the tile is still where it was: Close brings the flying piece exactly back there with expo.inOut, gives the others their opacity back and at the end the drift turns on again gently, over 1.6 seconds.

Values to change

NameFileDefaultWhat it changes
DERIVAscript.js16How many pixels per second the wall drifts on its own, at rest.
ATTRITOscript.js0.94How much of the push is left each frame after a throw: higher means a longer run.
VOLOscript.js0.85How long the tile’s trip to the cover lasts, in seconds.
FUGAscript.js70How many pixels the other tiles move away when one opens.
SFALSAscript.js0.07The delay between one piece and the next of the incoming page, in seconds.
SPAZIOscript.js12The gap between tiles, in pixels.
ANGOLOscript.js10The corner radius of the tiles, in pixels.
SOSTAscript.js2.8How long the page stays open in the automatic tour, in seconds.

Try them in the Playground

When to use it

For the work page of a studio, a photographer, an agency or a shop with many products to look at: it invites exploring in no set order, and the tile’s flight keeps the eye on the chosen project all the way to its page.

On phones

The same transition, with tiles sized on the screen’s shorter side: you drag them with a finger (the stage does not scroll the page), the cover takes half the height and below sit the headline and two lines of text; the details hide when space is short.

With reduced motion

The wall stays still and does not run with inertia (it only moves following the finger); opening a tile the wall fades and the page fades in with the cover already in place, and Close does the same the other way.

Pitfalls

  • The script writes the tiles’ position into the transform every frame: for the entrance and the hover zoom animate the .arte child, otherwise GSAP and the loop fight over the same transform.
  • Inertia must be scaled by the frame time (ATTRITO to the power of the ratio to a 60 Hz frame): without it the wall stops twice as fast on a 120 Hz screen.
  • With setPointerCapture on the stage the pointerup reaches the stage, not the tile: to know which tile was clicked you need document.elementFromPoint.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

Compressed with gzip, the three demo files weigh 11 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