Skip to content
animorio
IT
Back to the library

Accordion ribbon transition

Transitions, HoverGSAP, CSS onlyMediumCompressed weight: Demo 8.0 KBGSAP 28 KBFreeDownload the zip

Two pages of Quire, a made-up writing app: a paper coloured home and an ink blue pricing page. Clicking the Pricing pill, it stretches into a band as wide as the screen, in the colour of the page it leads to, and the band unfolds up and down like an accordion, pleat after pleat, each catching the light or the shadow as it opens, until the ribbon covers everything and becomes the new page. The creases fade and the words rise. Back does the same in paper; left alone it goes and comes back.

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>
<!--
  "Accordion ribbon 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>Quire: the ribbon that unfolds like an accordion</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>
    <!-- two pages of a made-up writing app, Quire. The clicked pill stretches into a ribbon as wide as the screen, in
         the colour of the page it leads to, and the ribbon unfolds up and down like an accordion until it covers
         everything; then it becomes the new page. The way back does the same in the other colour -->
    <div class="grain" aria-hidden="true"></div>

    <section class="page page--home is-on" data-page="home" aria-label="Quire, home">
      <header class="nav">
        <a class="brand" href="#home" aria-label="Quire">
          <svg class="brand__mark" viewBox="0 0 24 24" aria-hidden="true">
            <path d="M4 5.5h16M4 10.5h16M4 15.5h16M4 20h10"/>
            <path class="brand__fold" d="M4 5.5l8 5-8 5 8 4.5"/>
          </svg>
          <span>Quire</span>
        </a>
        <nav class="nav__links" aria-label="Sections">
          <span>Product</span>
          <span>Journal</span>
        </nav>
        <button class="pill pill--navy" type="button" data-go="pricing">
          <span class="pill__bg" aria-hidden="true"><span class="pill__sheen"></span></span>
          <span class="pill__label">Pricing</span>
          <svg class="pill__arrow" viewBox="0 0 16 16" aria-hidden="true"><path d="M3 8h9M8.5 4.5L12 8l-3.5 3.5"/></svg>
        </button>
      </header>

      <div class="hero">
        <p class="eyebrow">The writing app for long projects</p>
        <h1 class="title" data-in><span>Write in pages.</span> <span>Plan in folds.</span></h1>
        <p class="lede" data-in>Chapters, notes and outlines on one long sheet that folds wherever you need it.</p>
        <article class="note" data-in aria-label="A note in Quire">
          <div class="note__top">
            <span class="note__name">Chapter four, the harbour</span>
            <span class="note__count">2,140 words</span>
          </div>
          <span class="note__line" style="--w: 92%"></span>
          <span class="note__line" style="--w: 78%"></span>
          <span class="note__line note__line--crease" style="--w: 100%"></span>
          <span class="note__line" style="--w: 64%"></span>
        </article>
      </div>
    </section>

    <section class="page page--pricing" data-page="pricing" aria-label="Quire, pricing" aria-hidden="true">
      <header class="nav">
        <button class="pill pill--cream" type="button" data-go="home">
          <span class="pill__bg" aria-hidden="true"><span class="pill__sheen"></span></span>
          <svg class="pill__arrow pill__arrow--back" viewBox="0 0 16 16" aria-hidden="true"><path d="M13 8H4M7.5 4.5L4 8l3.5 3.5"/></svg>
          <span class="pill__label">Back</span>
        </button>
        <span class="brand brand--small">Quire</span>
      </header>

      <div class="hero hero--pricing">
        <p class="eyebrow" data-in>Pricing</p>
        <h1 class="title title--pricing" data-in>One sheet, as long as you need.</h1>
        <div class="plans">
          <article class="plan" data-in>
            <span class="plan__glow" aria-hidden="true"></span>
            <span class="plan__name">Personal</span>
            <span class="plan__price">$0</span>
            <span class="plan__note">Three projects, every fold</span>
          </article>
          <article class="plan plan--star" data-in>
            <span class="plan__glow" aria-hidden="true"></span>
            <span class="plan__name">Studio <em>most chosen</em></span>
            <span class="plan__price">$8<small>/month</small></span>
            <span class="plan__note">Unlimited projects, shared sheets</span>
          </article>
        </div>
      </div>
    </section>

    <div class="ribbon" data-ribbon aria-hidden="true"></div>
  </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.

40 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 “Accordion ribbon 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 paper coloured home with fine grain, at the top the Quire mark (the lines of a sheet with a coral fold), two links and the ink blue Pricing pill; in the middle the title “Write in pages. Plan in folds.”, one line and the card of a note with its word count and a dashed fold. Under the mouse the pill swells with a bounce, its label widens on the width axis, a sweep of light crosses it and the arrow steps forward. On click the pill squeezes, then stretches to both edges and becomes a band as tall as one pleat; from there the ribbon unfolds like an accordion up and down: every pleat starts closed and opens a little after the one before, those facing the light get brighter and those turned away darker until they are flat, with a thin line on the crease, and they go a breath past flat before settling. The home behind slides and dims. When the ribbon covers everything it is already the pricing page: the creases fade, the Back pill, the title and two plans arrive, Personal and Studio, with a coral light following the pointer. Back does the same in paper from the top left corner. Left alone it shows the hover on the pill, clicks, waits and comes back.

How it works

One strip per pleat

The ribbon is a stack of absolute strips, one per pleat, each a ninth of the screen tall. The starting band is centred on the pill: the script counts how many pleats it needs above and below to reach the edges. Inside every strip the colour of the arrival page is as big as the screen and moved to its final place, so once the ribbon is flat the page’s gradient is already whole and the change cannot be seen.

The pill that becomes a band

The middle strip starts with the pill’s box and radius and goes to full width in 0.6 s on expo.inOut: x and width follow the curve, the height follows it on power2.in so it stays thin until it is nearly wide, and the radius closes last.

The accordion is a cosine

Every pleat has an angle going from 90 degrees (closed, zero height) to 0 (flat) on back.out, which goes a little past zero and returns: the strip’s height is the pleat times the cosine of the angle, and the strips stack one under the other (or above, for the top part) adding up the heights. Each pleat starts 0.07 s after the one nearer the pill.

Light and shadow from the sine

Even and odd pleats face opposite ways: one has a light veil from the top, the other a dark one towards the bottom, and the veil’s opacity is the sine of the angle, so full when closed and zero when flat. The thin line on the pleat’s edge does the same and fades at the end.

The swap under the ribbon

While the ribbon opens the old page rises 10 px and dims. Once it is flat the new page, with the same background, is shown and its pieces rise on back.out, 0.07 s apart, while the creases fade; then the ribbon is removed.

Values to change

NameFileDefaultWhat it changes
PLEATSscript.js9Pleats of the ribbon over the height of the screen.
STRETCH_TIMEscript.js0.6Seconds the pill takes to stretch into a band as wide as the screen.
PLEAT_TIMEscript.js0.62Seconds each pleat takes to open.
PLEAT_LAGscript.js0.07Seconds between one pleat and the next along the ribbon.
OVERSHOOTscript.js1.5How far each pleat opens past flat before it settles (0 none).
SHADEscript.js0.9How strongly a folded pleat catches the light or the shadow.
IDLEscript.js2.4Seconds it waits before the next click when nobody touches it.
LOOPscript.jstrueLeft alone, it goes to pricing and back again and again.

Try them in the Playground

When to use it

For moving between two pages of a product site, an app, a landing page or a studio: from the home to pricing, from the menu to a section, from an offer’s button to its details. When every page has its own solid colour and the change should feel like a sheet unfolding from the very thing you pressed.

On phones

The same animation with adapted sizes: there are always nine pleats over the height, so shorter on a small screen, and the band starts from the pill wherever it is; titles, note and plans are sized on the height too to fit. The pill’s hover shows only with a mouse; the press and its spring back stay.

With reduced motion

No ribbon and no movement: the old page fades out and the new one fades in, its pieces already in place.

Pitfalls

  • If the colour inside every strip is not as big as the screen and fixed at its final place, the page’s gradient shows in bands and the background jumps on the swap: every strip holds a piece of the page moved back by its position.
  • With scaleY instead of the height the crease line would squash away too: here the real height changes, and there are at most about twenty strips.
  • The demo’s window can change height while the ribbon is half open: on resize the ribbon is rebuilt with the new sizes and goes on from the same point.
  • back.out goes past zero: the sine turns negative and the veil must use its absolute value, or the light vanishes suddenly at the end of a pleat.

Libraries

GSAP 3.15.0, Instrument Sans (font variabile) 5.3.0.

Compressed with gzip, the three demo files weigh 8.0 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