Skip to content
animorio
IT
Back to the library

Course page transition

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

The course list of a made-up online design school, Halyard: three cards with a painted cover and its geometric mark, the title, lessons and hours, the rating, the price and an Enroll pill. Tapping a course the card becomes the page: its white sheet grows to the whole app, the cover becomes the header, and title, numbers, rating and price fly to their places on a slight curve, growing (a shared element morph); the pill stretches into the wide Start the course button and takes the course’s colour. Then the lessons come out from under the counter, one after the other, unrolling down and to the right. Back rolls them up into the counter, flies every piece home and the card lands sinking one pixel, with a light running over it.

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>
<!--
  "Course page 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>Halyard: your courses</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/instrument-sans@5.3.0/wdth.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <main class="stage" data-stage>
    <!-- the course list of a made-up online design school, Halyard. Tap a course: the card becomes the page, its
         cover becomes the header, the title, the numbers, the price and the Enroll pill fly to their places, and the
         lessons come out from under the lesson counter. Back flies everything home and the card lands -->
    <div class="glow" aria-hidden="true"></div>
    <div class="grain" aria-hidden="true"></div>

    <section class="app" data-app>
      <div class="list" data-list>
        <header class="list__head" data-head>
          <div>
            <p class="eyebrow">
              <svg class="mark" viewBox="0 0 16 16" aria-hidden="true"><path d="M3 13V3M13 13V3M3 8h10"/></svg>
              Halyard School
            </p>
            <h1 class="list__title">Your courses</h1>
          </div>
          <button class="round" type="button" aria-label="Search courses">
            <svg viewBox="0 0 20 20" aria-hidden="true"><circle cx="9" cy="9" r="5.5"/><path d="M13.2 13.2 17 17"/></svg>
          </button>
        </header>
        <ul class="cards" data-cards>
          <!-- filled in by script.js from COURSES -->
        </ul>
      </div>

      <div class="detail" data-detail aria-hidden="true">
        <div class="sheet" data-sheet></div>
        <div class="hero paint" data-hero>
          <span class="hero__sheen" data-sheen></span>
        </div>
        <div class="hero__glyph" data-hero-glyph></div>
        <button class="back" type="button" aria-label="Back to your courses" data-back>
          <svg viewBox="0 0 20 20" aria-hidden="true"><path d="M12 4.5 6.5 10l5.5 5.5"/></svg>
        </button>
        <span class="chip" data-in data-chip>Motion</span>

        <div class="body">
          <h2 class="d-title" data-d="title">Motion Basics</h2>
          <p class="by" data-in>with <span data-by>Noor Haddad</span></p>
          <div class="stats">
            <div class="stat">
              <b class="stat__n" data-d="lessons">12</b>
              <span class="stat__l" data-in>Lessons</span>
            </div>
            <i class="stat__rule" data-in aria-hidden="true"></i>
            <div class="stat">
              <b class="stat__n" data-d="hours">4h 20m</b>
              <span class="stat__l" data-in>In total</span>
            </div>
            <i class="stat__rule" data-in aria-hidden="true"></i>
            <div class="stat">
              <span class="stat__n stat__n--rate" data-d="rating"><svg class="star" viewBox="0 0 16 16" aria-hidden="true"><path d="M8 1.6l1.9 4 4.4.5-3.3 3 .9 4.3L8 11.2l-3.9 2.2.9-4.3-3.3-3 4.4-.5z"/></svg><b>4.9</b></span>
              <span class="stat__l" data-in>Rating</span>
            </div>
          </div>
          <p class="cur-head" data-in><span>Curriculum</span><span class="cur-head__n" data-cur-n>12 lessons</span></p>
          <div class="lessons-box">
            <ul class="lessons" data-lessons></ul>
          </div>
        </div>

        <div class="bar">
          <span class="bar__bg" data-in aria-hidden="true"></span>
          <div class="bar__price">
            <b data-d="price">€89</b>
            <span data-in>one payment, yours forever</span>
          </div>
          <button class="cta" type="button" data-d="cta">
            <span class="cta__a">Enroll</span>
            <span class="cta__b">Start the course
              <svg viewBox="0 0 16 16" aria-hidden="true"><path d="M3.5 8h8.5M8.5 4.5 12 8l-3.5 3.5"/></svg>
            </span>
          </button>
        </div>
      </div>
    </section>
  </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 “Course page 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 grey background with fine grain and a soft light in the course’s colour, the Halyard app in the middle: at the top the mark, Your courses and the search, below three white cards with a layered shadow and a one pixel edge. Every card has a painted cover (a gradient with its highlight at the top left) with a white geometric mark (three circles in motion for Motion Basics, three overlapping circles for Colour Systems, three lines and a caret for Type on Screen), the topic and the rating with its star, the title, lessons and hours, the price and the Enroll pill in the course’s colour. Under the mouse the card rises two pixels with a longer shadow and the mark turns a little; pressed, it sinks. Tapped, the card disappears under its white sheet that grows to fill the app losing its shadow, the cover widens into the header with its mark flying to the top right, and title, lesson count, hours, rating and price each fly to their place on the page, a little staggered and on a curve, growing from the card’s size to the page’s; the Enroll pill stretches into the full Start the course button with its arrow, while the other cards sink and fade. Then come the topic pill on the header, the teacher, the labels of the numbers, the one-payment line and the glass back arrow; a light crosses the header; the lesson counter gives a small nod and the lessons come out of it one after the other, as narrow as the counter at first, unrolling down and to the right with their thin rule. Back rolls the lessons up into the counter from the last one, the pieces go back into the card on the same curve reversed, the other cards rise with a small bounce and the card lands sinking one pixel and springing back, with a light running over it. Left alone, it opens the three courses in turn.

How it works

Measure before and after

On tap the course page is filled in, made visible without transforms and the pieces are measured relative to the app, in the card (sheet, cover, mark, title, numbers, price, pill) and their partners on the page. The card hides: from here on everything you see belongs to the page, placed where the card was.

Sheet and cover really resize

The white sheet and the header are not scaled: GSAP animates left, top, width, height and the corner radius from the card to the whole app, so the corners stay properly round and the gradient never stretches. The mark sits outside the header, in a fixed place, and flies with x, y and a uniform scale.

Flying on a curve

Title, numbers, rating and price have white-space nowrap in the card and on the page, so the same line and proportions: they start with x, y and a scale equal to their width in the card divided by their width on the page, origin at the top left. x uses power3.inOut, y a curve that blends inOut and out by ARC: y arrives before x and the piece draws an arc; on the way back the curve is flipped and the arc is the same.

The pill that becomes a button

To keep the label sharp the pill is not scaled: width, height, background and text colour change. Since the button is right-aligned, its left edge moves as it grows: the starting offset is source.x minus (target.x + final width − starting width). The two labels, Enroll and Start the course, swap halfway.

The lessons from the counter

Each row starts raised to the top edge of its box (which has overflow hidden, so it comes out from under the row of numbers), at scaleX 0.12 with its origin under the centre of the counter: it widens and drops with expo.out, one every 0.07 s, and its thin rule draws with a CSS variable. The counter nods to 1.06 on a spring as it lets them go.

The landing

On the way back, when the sheet exactly covers the card, the card shows again and the page goes in the same frame; the card sinks SETTLE pixels in 0.09 s and comes back with elastic.out, and a soft-light glint runs over it. After every trip the inline styles are cleared: at rest only the CSS rules, and a resize halfway takes the trip to its end.

Values to change

NameFileDefaultWhat it changes
OPEN_TIMEscript.js0.9Seconds the card takes to become the page.
CLOSE_TIMEscript.js0.75Seconds the page takes to go back into its card.
ARCscript.js0.55How much the flying pieces curve (0 straight, 1 a wide curve).
LESSON_STAGGERscript.js0.07Seconds between one lesson and the next as they come out of the counter.
OTHERS_DROPscript.js18Pixels the other cards sink while they fade.
SETTLEscript.js1.5Pixels the card sinks and springs back when it lands.
HOLDscript.js2.6Seconds the page stays open when it plays by itself.
SHEENscript.jstrueA light runs over the header on arrival and over the card on landing.
LOOPscript.jstrueLeft alone, it opens the three courses in turn.

Try them in the Playground

When to use it

For the list of an app or a site with cards that lead to a page: courses, flats, podcasts, events, products. When the person tapping should understand that the new page is the same thing as the card, only bigger, and find the numbers they just read exactly where they expect them.

On phones

The same animation with adapted sizes: the app takes almost the whole box, the cards share its height, the header is a third of the page and fewer lessons show, fading at the bottom. Tap and return are the same; hover gives way to the press.

With reduced motion

No flights or movement: the list fades out and the course page fades in, already complete with its lessons; back does the opposite.

Pitfalls

  • The cover mark cannot live inside the header while the header resizes: its CSS position would change every frame and the FLIP would miss. It sits outside, at a fixed point of the page.
  • A title that wraps differently in the card and on the page cannot be scaled: the lines would jump. Here titles are short and nowrap in both places.
  • Stretching a right-aligned button moves its left edge: the starting offset must allow for it, or it starts to one side of the pill.
  • The card is measured without the y GSAP gave it (getProperty), or a return during the settle would send the pieces a pixel too high or too low.

Libraries

GSAP 3.15.0, Instrument Sans (font variabile) 5.3.0.

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

Testing

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