Skip to content
animorio
IT
Back to the library

Sunlit room cards

Images, HoverGSAP, CSS onlyMediumCompressed weight: Demo 8.7 KBGSAP 28 KBFreeDownload the zip

The room picker of a small made-up hotel, in a premium minimal style with real photos: four tall cards side by side; hover one and it widens on a spring while the others narrow, the photo drifts a little like a parallax, a warm afternoon light slides across it and the name, size, view and nightly price rise from below. Click «Check availability» and the button opens into a small calendar of the next free nights.

The code

A folder that runs on its own: index.html, style.css, script.js and the libraries from a CDN. The React tab holds the same demo as a ready component, which switches its animations off when it leaves the page.

<!doctype html>
<!--
  "Sunlit room cards" 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>Casa Lumea, choose your room</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 rooms of a small made-up hotel, Casa Lumea, as tall cards side by side. Hover one and it widens on a
       spring while the others narrow; the photo drifts a little, a warm afternoon light slides across it and the
       name, size, view and price rise from below. Check availability turns into a small calendar of free nights -->
  <main class="stage" data-stage>
    <div class="wrap">
      <header class="head">
        <div class="brand">
          <svg class="brand__mark" viewBox="0 0 24 24" aria-hidden="true"><path d="M4.5 19.5h15"/><path d="M6.5 19.5v-6a5.5 5.5 0 0 1 11 0v6"/><path d="M12 5.2V3.5M5.4 8.4 4.2 7.2M18.6 8.4l1.2-1.2"/></svg>
          <span data-hotel>Casa Lumea</span>
        </div>
        <p class="head__note">Four rooms, one garden</p>
      </header>

      <div class="row" data-row role="list" aria-label="Rooms"></div>
    </div>

    <svg class="pointer" viewBox="0 0 24 24" aria-hidden="true" data-pointer><path d="M5 3.5 18.5 12 12.4 13.6 9.4 19.6z"/></svg>
  </main>

  <template data-card>
    <article class="card" role="listitem" tabindex="0">
      <div class="card__photo"><img data-img alt="" draggable="false"></div>
      <div class="card__light" aria-hidden="true"><span class="card__sweep" data-sweep></span><span class="card__glow" data-glow></span></div>
      <div class="card__shade" aria-hidden="true"></div>
      <span class="card__spine" data-spine></span>
      <div class="info" data-info>
        <p class="info__line info__kind"><span data-kind></span></p>
        <h2 class="info__line info__name"><span data-name></span></h2>
        <p class="info__line info__meta"><span data-meta></span></p>
        <div class="info__line info__foot">
          <span class="info__price"><strong data-price></strong> / night</span>
        </div>
        <div class="book" data-book>
          <button class="book__btn" type="button" data-open>
            <span>Check availability</span>
            <svg viewBox="0 0 24 24" aria-hidden="true"><path d="M5 12h13M13 7l5 5-5 5"/></svg>
          </button>
          <div class="cal" data-cal aria-hidden="true">
            <div class="cal__top">
              <span class="cal__title" data-month></span>
              <button class="cal__x" type="button" aria-label="Close calendar" data-close>
                <svg viewBox="0 0 24 24" aria-hidden="true"><path d="M7 7l10 10M17 7 7 17"/></svg>
              </button>
            </div>
            <div class="cal__days" data-days></div>
            <div class="cal__grid" data-grid><span class="cal__range" data-range></span></div>
            <p class="cal__sum"><span data-nights>2 nights</span><strong data-total></strong></p>
          </div>
        </div>
      </div>
    </article>
  </template>

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

14 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 “Sunlit room cards” 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 white background sits Casa Lumea, a small made-up hotel, with four rooms as tall cards side by side, each with a real photo: The Lantern Room, Olive Suite, Library Room and The Salon, with the name written vertically. Hover a card and it widens on a spring that goes slightly past and comes back, lifts by a few pixels with a deeper shadow, while the others narrow. The photo arrives from one side and settles, then follows the pointer by a few pixels; a band of warm afternoon light slides across the photo and leaves an amber glow in the top corner. From below rise, one after another, the kind of room, the name, the size with the view and the price per night, then the Check availability pill. Click it and the pill presses in, then swells into a small calendar of the next two weeks: booked nights are struck through, free ones dark, and an orange pill stretches over the two chosen nights while the total counts up to the price. A drawn pointer does the tour: it passes over the rooms, opens the calendar, changes the nights and closes it.

How it works

Cards in a row

The four cards sit in a flex row, all with flex-grow 1. Widening one means raising its flex-grow to 3.2 with GSAP and back.out: the others narrow by themselves, always touching, and the spring goes slightly past and comes back.

The text never reflows

The block with name, size and price has the width of the open card, computed by the script and again on resize: while the card widens the text does not wrap differently, it is only revealed. Each line rises from below out of its own overflow hidden window.

The afternoon light

Over the photo sits a soft-light layer with a warm, slanted gradient band that GSAP slides from one side to the other, and an amber radial gradient in the corner that stays on. The photo is a little larger than the card and follows the pointer with quickTo.

The button that becomes a calendar

The pill and the calendar share one container: on click the label fades, the container grows to the calendar's height and the corners go from pill to 14 pixels, then the days come in staggered. The selection is a single pill under the numbers, moved and stretched with offsetLeft and offsetWidth.

Values to change

NameFileDefaultWhat it changes
HOTELscript.jsCasa LumeaThe made-up hotel’s name, written at the top.
GROWscript.js3.2How much the chosen card widens compared with the others.
SPRINGscript.js0.9The seconds of the spring that resizes the cards.
PARALLAXscript.js18How many pixels the photo moves with the pointer: 0 no parallax.
LIGHTscript.js1.5The seconds of the afternoon light sliding across the photo.
ACCENTscript.js#c9733aThe accent colour.
HOLDscript.js2.2The seconds the calendar stays open before the drawn pointer closes it.

Try them in the Playground

When to use it

For the rooms page of a hotel, a B&B or a holiday home: every room is visible at once, you look closely at one without leaving the page and check the free nights right from the card.

On phones

The same four cards in the same row, with the open card wider (weight 4) so text and calendar fit; tap a card to open it.

With reduced motion

No spring, parallax or sliding light: the cards change width at once, and text, glow and calendar simply fade in.

Pitfalls

  • If the text block follows the card's width, its lines wrap and jump while the card widens: it must be fixed to the open card's width, recomputed on resize.
  • The vertical label rotated with CSS must not be animated with GSAP x or y: its inline transform would wipe out the rotation. Only its opacity is animated.
  • The calendar's height is measured after making it visible (visibility, not display), otherwise offsetHeight is zero.
  • The photo must be a little larger than the card, otherwise the parallax shows its edges.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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