Skip to content
animorio
IT
Back to the library

Recipe grid transition

Transitions, HoverGSAP, CanvasMediumCompressed weight: Demo 12 KBGSAP 28 KBFreeDownload the zip

The transition between the grid and a recipe page in Tilth, an invented recipe app: four cards with real photos of the dishes seen from above (tomatoes and mozzarella with basil on a plate with little blue flowers, spaghetti with cherry tomatoes and mushrooms, a pumpkin soup with croutons, a falafel bowl with carrot ribbons). On click the dish lifts out of its card and flies with a FLIP transition to the middle of the recipe, turning a few degrees as it lands with its shadow rising and settling, while the ingredients, the times counting up and the named steps come in around it, staggered. Back, and the dish goes home to its card. On hover a card rises on a four layer shadow and its dish turns a little.

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>
<!--
  "Recipe 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>The recipe grid with the dish that flies into the recipe</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/fraunces@5.3.0/full.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>
    <!-- Tilth, an invented recipe app: a grid of dish cards. Each dish is a real photo seen from above, drawn round on a
         canvas. A click lifts the dish out of its card and flies it (FLIP) to the middle of the recipe,
         turning a few degrees as it lands, while the ingredients, the times and the named steps come in around it. -->
    <div class="app" data-app>
      <section class="view view--grid" data-grid aria-label="Recipes">
        <header class="bar">
          <span class="brand">
            <svg class="brand__mark" viewBox="0 0 20 20" aria-hidden="true"><path d="M10 2.5c-3.6 3-4.6 6.6-3 10.2M10 2.5c3.6 3 4.6 6.6 3 10.2M10 4v13.5M4 17.5h12"/></svg>
            Tilth
          </span>
          <span class="bar__tabs"><span class="bar__tab is-on">This week</span><span class="bar__tab">Saved</span></span>
          <svg class="bar__icon" viewBox="0 0 20 20" aria-hidden="true"><circle cx="8.6" cy="8.6" r="5.2"/><path d="M12.6 12.6l4 4"/></svg>
        </header>
        <div class="grid__head">
          <h1 class="grid__title">Weeknight dinners</h1>
          <p class="grid__count">4 recipes, under 30 min</p>
        </div>
        <div class="grid" data-cards></div>
      </section>

      <section class="view view--detail" data-detail aria-label="Recipe" aria-hidden="true">
        <header class="bar">
          <button class="back" type="button" data-back aria-label="Back to recipes">
            <svg viewBox="0 0 20 20" aria-hidden="true"><path d="M12 4.5L6.5 10l5.5 5.5"/></svg>
            <span>Recipes</span>
          </button>
          <span class="brand brand--small">Tilth</span>
          <svg class="bar__icon bar__icon--save" viewBox="0 0 20 20" aria-hidden="true"><path d="M6 3.5h8v13l-4-3-4 3z"/></svg>
        </header>
        <div class="detail">
          <div class="detail__hero">
            <div class="detail__slot plate" data-slot>
              <span class="plate__shadow" aria-hidden="true"></span>
              <canvas class="plate__dish" data-slot-dish></canvas>
            </div>
          </div>
          <div class="detail__info">
            <p class="detail__kicker" data-in data-kicker></p>
            <h2 class="detail__title" data-in data-title></h2>
            <dl class="times" data-times></dl>
          </div>
          <div class="detail__cols">
            <div class="block">
              <h3 class="block__label" data-in>Ingredients</h3>
              <ul class="ingredients" data-ingredients></ul>
            </div>
            <div class="block">
              <h3 class="block__label" data-in>Method</h3>
              <ol class="steps" data-steps></ol>
            </div>
          </div>
        </div>
      </section>

      <!-- the dish while it flies: one layer above both views -->
      <div class="flyer plate" data-flyer aria-hidden="true">
        <span class="plate__shadow" data-flyer-shadow></span>
        <canvas class="plate__dish" data-flyer-dish></canvas>
      </div>
    </div>

    <svg class="cursor" data-cursor viewBox="0 0 24 24" aria-hidden="true">
      <path d="M5 3.2l13.4 9.1-6.1 1.1 3.5 6.5-2.6 1.4-3.5-6.5-4.5 4.2z"/>
    </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.

25 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 “Recipe 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 warm paper with the light coming in from the top left and a fine grain, the white window of Tilth opens, an invented recipe app: at the top the mark with its terracotta sprout, ‘This week’ and ‘Saved’, below the heading ‘Weeknight dinners’ and four cards. In each card a real photo of a dish seen from above, cut round on its rim, with a hairline of light on the edge and a soft shade just inside it: slices of tomato and mozzarella in a ring with the basil in the middle, the oil and the pepper, on a scalloped plate with little blue flowers; spaghetti with cherry tomatoes, mushrooms, flaked almonds and a basil leaf on a white plate; the pumpkin soup in a white soup plate with croutons and thyme; the falafel bowl with cucumber slices, carrot ribbons, spring onion, spinach and a herb dip. As it comes in, the cards rise one after another and the dishes turn into place. Passing over it, a card rises a few pixels on a four layer shadow and its dish turns a few degrees on a spring, its shadow stretching. On click the dish leaves the card and flies to the middle of the recipe page: the path bends because the horizontal and the vertical run on two different curves, the dish grows and turns sixteen degrees as it arrives, its shadow lifts and drifts away halfway and settles again on landing, with a pixel too far that settles back. Meanwhile the other cards fade and sink, nearest first. Around the dish, staggered, come the label, the title, the three times (Prep, Cook, Serves) with their numbers counting up from zero, the ingredients with their amounts and the thin rule that draws itself under each one, and the steps with their names (Slice, Layer, Finish), joined by a terracotta thread that runs down and three rings that light up. ‘Recipes’ at the top brings you back: the recipe leaves in reverse order, the cards return and the dish flies back into its card, turning the other way. On its own, a drawn pointer opens the tomatoes with mozzarella, goes back and opens the falafel bowl.

How it works

The dish is a real photo

Each dish is a real photo seen from above, cut square around its plate or bowl (a webp file in the demo folder). The script loads it with new Image() and draws it with drawImage into the cards, the recipe and the flying dish, each at its own size for the screen density: first a round clip on the rim, then a veil of light from the top left, a soft shade just inside the edge and two fine lines on the edge, a dark one and a light one that brightens on the side of the light. The photos arrive a moment after the script: on the load of each one every canvas is drawn again.

FLIP: measure before and after

The flying dish is a layer above both views, already placed where it has to land and as big as there. The dish in the card and the place in the recipe are measured, and it starts with an offset and a scale that put it back over the card: then it is enough to take x, y and scale to zero and one. On the way back the same in reverse, always staying as big as in the recipe, so the canvas never goes soft.

A bent path and a turn

x and y run on two different curves (power3 and power2), and the path bends instead of going straight. The dish turns TURN degrees with a back.out that passes a little and comes back; its shadow is an element of its own that drifts away and fades halfway, as if the dish were lifted, and settles on arrival. The scale reaches 1.012 and comes back to 1: the extra pixel of the landing.

The recipe comes in around it

Label, title, times, ingredients and steps carry data-in and come in staggered by STAGGER seconds; the rules under the ingredients draw with scaleX, the thread of the steps with scaleY, the rings with a back.out, and the numbers of the times count up from zero. The other cards fade starting from the one clicked, with stagger from.

The walk on its own

It starts from the load event: a drawn pointer goes to a card, lifts it, presses, waits READ seconds on the recipe, presses Recipes and does the same with another card. It is an async function that waits on GSAP tweens and timelines (which can be awaited like promises) and gsap.delayedCall, never setTimeout. At the first real touch it stops and the pointer fades.

Values to change

NameFileDefaultWhat it changes
FLIGHTscript.js0.85How long the dish flies, in seconds.
TURNscript.js16How many degrees the dish turns while it flies.
LIFTscript.js6How many pixels a card rises on hover.
HOVER_TURNscript.js7How many degrees the dish turns on hover.
STAGGERscript.js0.045The delay between the pieces of the recipe coming in, in seconds.
READscript.js3.2How long the walk on its own stays on a recipe, in seconds.
SPEEDscript.js12 = the walk on its own twice as fast, 0.5 = half.
LOOPscript.jstrueRepeats the walk through the two recipes.

Try them in the Playground

When to use it

For a food blog, a recipe app, the menu of a restaurant or a meal kit service: wherever a grid of dishes opens the page of the dish and the eye should follow the dish instead of getting lost. The same transition works for products, portfolio pieces or hotel rooms: swap the dish photos for your own (square, with the plate in the middle). The colours are --page, --app, --ink and --accent in the CSS.

On phones

The same animations at adapted sizes: the grid becomes two by two, the window is measured on width and height, the script measures the dishes on the card (on resize too), and in the recipe the dish goes to the top left beside the title and the times, with ingredients and steps in two columns below. A finger taps the card and the dish flies the same.

With reduced motion

No flight and no turning: the grid and the recipe swap with a fade, with the dish already in place, and the walk on its own opens the two recipes without the pointer; on hover the card only takes the shadow.

Pitfalls

  • The size of the dish is taken on its holder, not on the turning canvas: a rotated square has a bigger box and the flight would start off.
  • The flying dish must be as big as in the recipe and start scaled down: if it were as big as in the card and grew, the canvas would arrive soft.
  • A GSAP timeline can be awaited: the walk on its own is a chain of awaits and needs no setTimeout, so the bench controls it and the poster always falls at the same moment.
  • A photo for a round plate must be cut square with the plate touching all four sides: the round clip cuts it on the rim, and with a smaller plate you would see the table around it, with a bigger one a piece of the rim would be missing.

Libraries

GSAP 3.15.0, Fraunces (font variabile) 5.3.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