Skip to content
animorio
IT
Back to the library

Pleated fabric background

Backgrounds, WebGL, HoverWebGL, GSAP, CSS onlyAdvancedCompressed weight: Demo 9.7 KBGSAP 28 KBFreeDownload the zip

An animated background for the opening of a made-up design festival, Fold: a curtain of plum satin pleated like an accordion, lit by a single warm spot. The light follows the pointer and the pleats catch it on every other face, with a thin glint on the crests; a slow breath of air bends them on its own, the hand brushes them aside like a real curtain and lets them spring back, and the Get tickets button sends a ripple through the whole cloth. A hand-written WebGL shader, under the title, the date and the ticket button.

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>
<!--
  "Pleated fabric background" 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 pleated fabric background of the festival with the light that follows the pointer</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 opening of an invented design festival, Fold, over a curtain of pleated satin lit by one warm spot:
       the light follows the pointer and the pleats catch it face by face, a slow breath of air runs through them on its
       own, the hand brushes them aside as it passes, and the ticket button sends a ripple through the whole cloth -->
  <main class="stage" data-stage>
    <canvas class="cloth" data-cloth aria-hidden="true"></canvas>
    <span class="scrim" aria-hidden="true"></span>
    <span class="grain" aria-hidden="true"></span>

    <section class="hero" aria-labelledby="hero-title">
      <p class="pill" data-in>
        <span class="pill__tag">Milan</span>
        <span class="pill__text">Fold Design Festival</span>
      </p>
      <h1 class="title" id="hero-title" data-in>Everything starts<br>with a <em>fold</em></h1>
      <p class="date" data-in>
        <svg class="date__icon" viewBox="0 0 16 16" aria-hidden="true"><rect x="2.5" y="3.5" width="11" height="10" rx="2"></rect><path d="M2.5 6.8h11M5.5 2v3M10.5 2v3"></path></svg>
        <span>14 to 18 April 2027</span>
        <span class="date__sep" aria-hidden="true"></span>
        <span>Ex Tessiture halls</span>
      </p>
      <div class="actions" data-in>
        <button class="cta" type="button" data-cta>
          <span class="cta__rim" aria-hidden="true"></span>
          <span class="cta__face">
            <span class="cta__row cta__row--idle" data-row="idle">
              <span class="cta__label">Get tickets</span>
              <svg class="cta__arrow" viewBox="0 0 16 16" aria-hidden="true"><path d="M3 8h9.5M8.5 4 12.5 8l-4 4"></path></svg>
            </span>
            <span class="cta__row cta__row--busy" data-row="busy" aria-hidden="true">
              <svg class="cta__spin" viewBox="0 0 16 16"><circle cx="8" cy="8" r="5.5"></circle></svg>
              <span class="cta__label">Holding your seats</span>
            </span>
            <span class="cta__row cta__row--done" data-row="done" aria-hidden="true">
              <svg class="cta__tick" viewBox="0 0 16 16"><path d="M3.6 8.4 6.6 11.2 12.4 4.9"></path></svg>
              <span class="cta__label">Two passes saved</span>
            </span>
          </span>
        </button>
        <span class="note">Day pass from &euro;28</span>
      </div>
    </section>

    <svg class="ghost" data-ghost viewBox="0 0 20 20" aria-hidden="true"><path d="M4 2.5v13.2l3.5-3.3 2.4 5.3 2.3-1-2.4-5.2 4.8-.2z"></path></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.

28 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 “Pleated fabric background” 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

The first screen of a made-up design festival, Fold, in front of a plum satin curtain pleated like an accordion: at the top a dark glass pill with Milan in orange and Fold Design Festival, then the big title in wide, light Mona Sans, «Everything starts with a fold», with the last word bold, wider and champagne, the date «14 to 18 April 2027» with a drawn calendar and the venue «Ex Tessiture halls», and the light Get tickets button with «Day pass from €28» beside it. The pleats are drawn by a shader: a warm spot lights them from close by, so the faces turned towards it light up and the others stay dark plum, with a faint cool light from below so they never go black and a thin satin glint running down the crests. On entry the cloth arrives smooth and loose, gathers into its pleats and the spot comes in from the left, then the words rise with a one-pixel settle. On its own the spot wanders slowly and a breath of air bends the pleats in slow waves; the pointer carries the spot with it on a soft spring, and the passing hand brushes the pleats aside and spreads them around it, and when it stops they go back into place. The one-pixel rim of the button takes the light from the side of the spot. Pressed, the button squashes and bounces, a ripple leaves the button and runs through the whole cloth lifting the pleats, the spot flares for a moment, the label turns to Holding your seats with a spinning circle and then to Two passes saved with a tick that draws itself, and Get tickets comes back.

How it works

One triangle over the page

The WebGL canvas draws a single triangle larger than the screen; the shader works out the whole cloth, pixel by pixel, at three quarters of the screen resolution, because satin is soft and this keeps it light on phones too.

The pleats as a phase

Every pixel has a phase, its horizontal distance divided by the pleat width; the slope is a softened square wave (the sine divided by the root of its square plus a little), so the faces are flat like real pleats while the crests and valleys stay round. The breath of air, the hand and the button’s ripple only shift the phase: the shader reads it one pixel right, left, above and below and works out which way the pleats face and how tight they are.

The spot, the cool fill and the satin

Each face’s normal takes the light of a low spot close to the cloth, in a pool that fades with distance; a cool light from below on the other side keeps the shaded faces plum, the valleys darken a little, and two highlights, one broad and one thin, make the satin. The spot and the hand follow the pointer on two different springs: the spot heavy and soft, the hand quicker, and its speed is what drags the pleats.

Values to change

NameFileDefaultWhat it changes
PLEAT_SIZEscript.js1How wide the pleats are.
DEPTHscript.js1How deep the pleats are (0 smooth satin).
AIRscript.js1How much the breath of air moves the pleats on its own (0 still).
BRUSHscript.js1How much the passing hand brushes the pleats aside.
LIGHT_HEIGHTscript.js0.5How high the spot is: low, sharper faces and a tighter light.
LIGHT_SIZEscript.js1How wide the spot’s pool of light is.
SHEENscript.js1How much the satin shines on the crests.
AUTO_PILOTscript.js3After how many seconds without a pointer the drawn one moves (0 never).
--satinstyle.css#1f1724The plum of the satin.
--sheenstyle.css#f5ddb8The champagne of the light and the highlighted word.
--accentstyle.css#ff7d52The orange of the city in the pill and of the ripple.

Try them in the Playground

When to use it

For the opening of a festival, a design week, an exhibition, a fashion show or a ticketed evening: when you need a dark, elegant background that feels like a real material, moves on its own and answers the pointer without taking the place of the title, the date and the button.

On phones

Same animations: the pleats are sized on the short side of the screen, the finger carries the spot and brushes the pleats like the pointer, and title, date and button are sized on the height too and fit inside the box; below 460 pixels of height the price beside the button hides.

With reduced motion

With reduced motion the cloth is already pleated and still, with the spot in place and no air or ripple, the words only fade in and the button goes straight to Two passes saved.

Pitfalls

  • With a plain sine the pleats look like corrugated tube, not pleats: the slope is pushed towards a square wave, so the faces stay flat and the light splits them sharply.
  • The hand cannot just move where the pleats are: if it shifts the phase without working out the slope again, the pleats move but the light stays still. The shader reads the phase around the pixel again and gets the normal from there.
  • The warm spot next to the light title makes it unreadable: behind the words the cloth is a little calmer and darker, with a soft veil in CSS.
  • Without WebGL the CSS background is left: still striped pleats and a warm pool of light, with the words on top.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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