Skip to content
animorio
IT
Back to the library

Card colour page

TransitionsGSAP, CSS onlyMediumCompressed weight: Demo 7.7 KBGSAP 28 KBFreeDownload the zip

The new arrivals of a made-up homeware shop, Oakmoss, in the clean style of today’s apps: three cards, each with its own soft colour and a real photo of its object. Tap one and its colour floods out of the card to fill the page, the object’s photo flies to its big place with a shadow lifting off, the name moves and grows, and price, sizes and Add to bag come in. Back runs the way back and the colour withdraws into the 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>
<!--
  "Card colour page" 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 product page that grows out of the card’s colour</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>
  <main class="stage" data-stage>
    <!-- a row of products from a made-up homeware shop, Oakmoss: each card has its own soft colour. Tapping one, the
         colour floods out of the card until it fills the screen, the object flies to its big place, the name moves
         and grows, and price, sizes and Add to bag come in; Back runs it all the other way -->
    <div class="fit" data-fit>
      <section class="screen" data-screen aria-label="Oakmoss shop">
        <header class="bar">
          <a class="brand" href="#" aria-label="Oakmoss">
            <svg viewBox="0 0 24 24" aria-hidden="true"><path d="M5 19c0-8 5-13 14-14-1 9-6 14-14 14Z"/><path d="M5 19 13 11"/></svg>
            <span data-shop>Oakmoss</span>
          </a>
          <button class="bag" type="button" aria-label="Bag" data-bag>
            <svg viewBox="0 0 24 24" aria-hidden="true"><path d="M5.5 8h13l-1 12h-11z"/><path d="M9 8V6.5a3 3 0 0 1 6 0V8"/></svg>
            <span class="bag__count" data-count><span data-count-n>0</span></span>
          </button>
        </header>

        <div class="list" data-list>
          <div class="list__head">
            <h1 class="list__title">New in</h1>
            <span class="list__meta">3 pieces</span>
          </div>
          <div class="row">
            <button class="item" type="button" data-item="0" style="--tint: var(--sand)">
              <span class="item__pic" data-pic></span>
              <span class="item__name" data-name>Dune vase</span>
              <span class="item__price">$48</span>
            </button>
            <button class="item" type="button" data-item="1" style="--tint: var(--sage)">
              <span class="item__pic" data-pic></span>
              <span class="item__name" data-name>Moss lamp</span>
              <span class="item__price">$92</span>
            </button>
            <button class="item" type="button" data-item="2" style="--tint: var(--mist)">
              <span class="item__pic" data-pic></span>
              <span class="item__name" data-name>Milk stool</span>
              <span class="item__price">$135</span>
            </button>
          </div>
          <p class="list__note">Free returns within 30 days</p>
        </div>

        <!-- the colour that grows out of the card -->
        <div class="flood" aria-hidden="true" data-flood></div>

        <!-- the product page -->
        <div class="detail" data-detail hidden>
          <button class="back" type="button" data-back>
            <svg viewBox="0 0 24 24" aria-hidden="true"><path d="M14.5 6 8.5 12l6 6"/></svg>
            <span>Back</span>
          </button>
          <div class="hero">
            <span class="hero__shadow" data-shadow></span>
            <span class="hero__pic" data-hero></span>
          </div>
          <h2 class="detail__name" data-dname>Dune vase</h2>
          <div class="detail__line" data-in>
            <span class="detail__price" data-dprice>$48</span>
            <span class="detail__made" data-dmade>Stoneware, made in Portugal</span>
          </div>
          <div class="sizes" data-in role="radiogroup" aria-label="Size">
            <button class="size" type="button" role="radio" aria-checked="false" data-size>Small</button>
            <button class="size is-on" type="button" role="radio" aria-checked="true" data-size>Medium</button>
            <button class="size" type="button" role="radio" aria-checked="false" data-size>Large</button>
          </div>
          <button class="add" type="button" data-in data-add>
            <span class="add__fill" data-addfill></span>
            <span class="add__a" data-adda>Add to bag</span>
            <span class="add__b" data-addb>
              <svg viewBox="0 0 24 24" aria-hidden="true"><path data-check d="M6 12.5l4 4 8-9"/></svg>
              Added
            </span>
          </button>
        </div>
      </section>
    </div>

    <svg class="pointer" data-pointer viewBox="0 0 24 24" aria-hidden="true"><path d="M5 2.8v16.4l4.4-4.2 2.8 6.2 2.8-1.2-2.8-6.1h6.2Z"/></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.

35 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 “Card colour page” 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 white there is the screen of Oakmoss, a made-up homeware shop: New in, 3 pieces, and three cards side by side, each on its own soft ground, sand, sage and lilac, with a real photo of an object in a rounded frame (a white glazed stoneware vase, a small lit table lamp with a pleated linen shade on a turned wooden base, a three-legged wooden stool), its name and price. Tap a card and it sinks a little, then its colour floods out of the card and widens until it fills the whole screen, rounding its corners like it; the other cards step back and dim. Meanwhile the object flies from its small place to its big one at the top, lifting off with a shadow that grows halfway and comes back down, lands a pixel past its place and settles, and its ground shadow appears under it. The name moves from the card to the title and grows, and the price with its material line, the three sizes and the black Add to bag button come in staggered; Back arrives from the left. Pressing Add to bag the button sinks, fills with orange, writes Added and draws its check, while the number on the bag at the top rolls up and the bag swings. Back does it all the other way: the pieces leave, the colour withdraws into the card, the object and the name go back to their small places and the card gives a small nod. A drawn pointer opens the vase, picks Large, puts it in the bag, goes back and opens the stool; you can also tap for real.

How it works

The colour is a single layer

Between the list and the product page there is an empty div, the colour: on tap it takes the card’s tint, sits exactly on top of it and then animates left, top, width, height and the corner radius until it covers the screen, with expo.inOut. On the way back it runs the reverse.

Sizes in the screen’s pixels

The screen is drawn in pixels and the container scales it down to fit the box: every size taken with getBoundingClientRect is divided by the scale, so the colour and the object start exactly from the card at any size.

The object flies by itself

The product page has its own big photo, cropped to the same tall shape as the card’s small one (even the corner radius is in proportion, 12 and 18 pixels); it is measured where it sits and sent off with x, y and scale from the centre and size of the small photo, which hides meanwhile. A drop-shadow filter grows halfway and comes back down, as if the object lifted.

The name grows

The page title starts from the offset and scale of the name in the card (the ratio between the two heights) and arrives in place, with transform-origin at the top left so the text does not slide.

Add to bag

The button sinks to 0.97 and comes back with an elastic; an orange fill grows with scaleX from the left, the label leaves upwards and Added comes in with its check drawn by stroke-dashoffset. The number on the bag rolls up and the bag swings with an elastic.

Values to change

NameFileDefaultWhat it changes
SHOPscript.js'Oakmoss'The name of the made-up shop, at the top left.
OPENscript.js0.85The seconds in which the colour floods out of the card and fills the page, and back.
STAGGERscript.js0.07The seconds between one piece of the page and the next as they come in.
RECEDEscript.js0.94How far the other cards step back while one opens.
LIFTscript.js18How far the shadow under the flying object drops, in pixels.
ACCENTscript.js'#c4552f'The colour of the Add to bag button as it fills and of the number on the bag.
HOLDscript.js1.6The seconds Added stays before going back to Add to bag.

Try them in the Playground

When to use it

For the window of an online shop, where a product page opens from the list: the card’s colour becomes the page’s ground and the viewer never loses sight of the object they picked.

On phones

The same animation: the screen is drawn in pixels and the container scales it down as needed, on width and height, so the open page fits whole in the box.

With reduced motion

No flight: the colour and the product page fade in and out; Add to bag shows Added with its check at once.

Pitfalls

  • The screen sits in a scaled container: getBoundingClientRect sizes must be divided by the scale, or the colour starts outside the card.
  • Before measuring the big photo and the title, clear the transforms left from the previous round, or the measure is already offset.
  • The title grows with scale and transform-origin at the top left, not with font-size: font-size would make lines wrap halfway.
  • The big photos are made once at start and the product page reuses them: a new image on every tap would decode right when it has to fly, and the first frame of the flight would be empty.
  • The small and the big photo must share the same proportion, or the flight’s scale distorts the frame: all three are cropped to 126 by 182, and the vase’s, wider than tall, was extended at top and bottom with its own ground.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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