Skip to content
animorio
IT
Back to the library

Travel carousel

Images, Hover, TransitionsGSAP, CSS onlyMediumCompressed weight: Demo 8.3 KBGSAP 28 KBFreeDownload the zip

The “Where next?” screen of a made-up travel app, Tidewander: five destinations in cards with real photos on a carousel that loops. Drag it with a finger or the mouse and every card follows the hand: the one leaving the middle leans back in depth, shrinks and dims, while the photo inside slides the other way, like a window onto a landscape further off. Let go and the carousel keeps the speed of the hand and settles on the nearest card with a small overshoot; below, the place name rolls letter by letter, the flight time swaps and the fare rolls digit by digit.

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>
<!--
  "Travel carousel" 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 destinations carousel with cards that tilt and photos that slide the other way</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/mona-sans@5.3.0/wdth.css">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/fraunces@5.3.0/index.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <main class="stage" data-stage>
    <!-- the "where next" screen of a made-up travel app, Tidewander. Five destination cards on a carousel you drag:
         the cards lean back in depth as they leave the middle, the photo inside slides the other way, and the place
         name, the flight time and the fare roll to the card that settles in the middle -->
    <header class="top">
      <span class="brand">
        <svg class="brand__mark" viewBox="0 0 20 20" aria-hidden="true">
          <path d="M2.5 13.2c2.4-2.6 4.6-2.6 7 0s4.6 2.6 7.5 0" />
          <path d="M2.5 8.6c2.4-2.6 4.6-2.6 7 0s4.6 2.6 7.5 0" />
        </svg>
        <span class="brand__name">Tidewander</span>
      </span>
      <span class="from">
        <svg viewBox="0 0 16 16" aria-hidden="true"><path d="M8 14.5s4.8-4.4 4.8-8.1A4.8 4.8 0 0 0 3.2 6.4C3.2 10.1 8 14.5 8 14.5z"/><circle cx="8" cy="6.4" r="1.7"/></svg>
        Flights from Lisbon
      </span>
    </header>

    <h1 class="title"><span class="title__line">Where <em>next?</em></span></h1>

    <section class="deck" data-deck aria-roledescription="carousel" aria-label="Destinations" tabindex="0">
      <article class="card" data-card data-name="Alpstein" data-region="Switzerland" data-nights="4 nights" data-time="2h 25m direct" data-fare="148" data-temp="9°">
        <div class="card__photo"><img src="lago.webp" width="768" height="1024" alt="A mountain lake under snowy peaks, with the ridge mirrored in the still water" draggable="false" style="--pos: 50% 40%"></div>
        <span class="card__sheen" aria-hidden="true"></span>
        <span class="card__temp">9°</span>
        <div class="card__foot"><span class="card__region">Switzerland</span><span class="card__nights">4 nights</span></div>
      </article>
      <article class="card" data-card data-name="Fjordlands" data-region="Norway" data-nights="5 nights" data-time="4h 05m, 1 stop" data-fare="312" data-temp="6°">
        <div class="card__photo"><img src="fiordo.webp" width="960" height="641" alt="A turquoise lake between dark mountain slopes under a heavy sky" draggable="false" style="--pos: 60% 50%"></div>
        <span class="card__sheen" aria-hidden="true"></span>
        <span class="card__temp">6°</span>
        <div class="card__foot"><span class="card__region">Norway</span><span class="card__nights">5 nights</span></div>
      </article>
      <article class="card" data-card data-name="Sand Sea" data-region="Sahara" data-nights="3 nights" data-time="3h 10m direct" data-fare="274" data-temp="31°">
        <div class="card__photo"><img src="dune.webp" width="1024" height="678" alt="Rolling sand dunes under a low orange sun" draggable="false" style="--pos: 40% 50%"></div>
        <span class="card__sheen" aria-hidden="true"></span>
        <span class="card__temp">31°</span>
        <div class="card__foot"><span class="card__region">Sahara</span><span class="card__nights">3 nights</span></div>
      </article>
      <article class="card" data-card data-name="Blue Bay" data-region="Ionian coast" data-nights="6 nights" data-time="3h 35m direct" data-fare="186" data-temp="24°">
        <div class="card__photo"><img src="baia.webp" width="960" height="640" alt="A white beach curving into bright turquoise water, seen from above" draggable="false" style="--pos: 45% 50%"></div>
        <span class="card__sheen" aria-hidden="true"></span>
        <span class="card__temp">24°</span>
        <div class="card__foot"><span class="card__region">Ionian coast</span><span class="card__nights">6 nights</span></div>
      </article>
      <article class="card" data-card data-name="Ubud" data-region="Bali" data-nights="9 nights" data-time="17h 40m, 1 stop" data-fare="529" data-temp="28°">
        <div class="card__photo"><img src="risaie.webp" width="1024" height="683" alt="Green rice terraces under tall palm trees" draggable="false" style="--pos: 50% 50%"></div>
        <span class="card__sheen" aria-hidden="true"></span>
        <span class="card__temp">28°</span>
        <div class="card__foot"><span class="card__region">Bali</span><span class="card__nights">9 nights</span></div>
      </article>
    </section>

    <section class="info" aria-live="polite">
      <div class="info__left">
        <span class="info__name" data-name-box><span class="info__word" data-word>Alpstein</span></span>
        <span class="info__time">
          <svg viewBox="0 0 16 16" aria-hidden="true"><path d="M2 9.6l12-5.2-3.2 9.2-2.6-4-6.2 0z"/></svg>
          <span data-time-text>2h 25m direct</span>
        </span>
      </div>
      <div class="info__right">
        <span class="info__from">from</span>
        <span class="fare" data-fare-box aria-label="148 euros"><span class="fare__cur">€</span></span>
      </div>
    </section>

    <div class="pager" aria-hidden="true"><span class="pager__thumb" data-thumb></span></div>

    <svg class="pointer" data-pointer viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.5 18.5 12 12.4 13.6 9.4 19.6z"/></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.

36 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 “Travel carousel” 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

A looping carousel of destination cards to drag: the cards away from the middle lean back in depth and their photo slides the opposite way; below, the place name, the flight time and the fare roll to the card that settles in the middle. It works with a finger, the mouse, the arrow keys or a tap on a side card; left alone, a drawn pointer flips through it.

How it works

One number

The whole carousel hangs on state.pos, a decimal number: 0 is the first card in the middle, 1 the second. Each frame every card works out its distance from the middle along the loop (wrap brings the difference between -N/2 and N/2, so the cards go round) and takes x, depth, rotation, scale, brightness and stacking order from it.

Leaning back in depth

The container has perspective: 1100px; each card gets rotationY = -distance × TILT and z = -distance × DEPTH, capped just under two steps so the far cards stay readable. The same number dims the card with filter: brightness.

The photo sliding the other way

The photo is 44% wider than the card and moves with xPercent opposite to the card, PARALLAX per step: as the card goes left the landscape inside goes right, and looks further away than the card. A soft soft-light sheen slides along and fades on the side cards.

Dragging and letting go

While dragging, pos follows the hand in proportion to the card width; the speed of the last moves, times FLING, decides up to two extra cards. On release a tween takes pos to the nearest whole number with back.out(1.25) in SETTLE seconds: the small overshoot is the settle. A gesture under 5 pixels is a tap and brings the tapped card to the middle.

The rolling name and fare

When the card nearest the middle changes, the old name leaves letter by letter upwards and the new one rises from below with back.out(1.6), in the direction of travel. The fare is three strips of digits from 0 to 9, each moved with yPercent to its digit, slightly later from left to right.

Values to change

NameFileDefaultWhat it changes
TILTscript.js24Degrees a card leans back for each step from the middle.
DEPTHscript.js120Pixels a card moves back in depth for each step from the middle.
PARALLAXscript.js0.16How far the photo slides the other way, as a share of the card width per step.
SPACINGscript.js0.8Distance between two cards, as a share of the card width.
SETTLEscript.js0.9Seconds to settle on a card after letting go.
FLINGscript.js0.22How much the speed of the hand carries the carousel after letting go.
ROLLscript.js0.6Seconds the name and the fare digits take to roll.
AUTO_EVERYscript.js2.6Left alone, seconds between two moves of the drawn pointer.

Try them in the Playground

When to use it

On the home page of a travel agency or app, on the offers page of a hotel group, in a tour operator's package picker: anywhere you choose between a few places worth looking at.

On phones

The same animation with adapted sizes: the cards take their size from the height of the screen and the side cards run half off the edges. You flip with a finger, and the vertical gesture stays free to scroll the page.

With reduced motion

No tilting, no depth and no sliding photos: the cards sit in a flat row and jump to the new card; name, time and fare change with a fade.

Pitfalls

  • The photo must be wider than the card (here inset 0 -22%), otherwise sliding the other way shows its edge.
  • Dragging uses touch-action: pan-y on the container, so on a phone the vertical gesture still scrolls the page.
  • The cards are ordered with a zIndex worked out from the distance: with 3D transforms the stacking alone won't bring the middle card forward.
  • The photos are about 1000 pixels wide: the middle card shouldn't go past 270 pixels, or it looks soft on a retina screen.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0, Fraunces (font variabile) 5.3.0.

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

Testing

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