Skip to content
animorio
IT
Back to the library

Linen curtains background

Backgrounds, WebGLWebGL, Canvas, GSAPMediumCompressed weight: Demo 13 KBGSAP 28 KBFreeDownload the zip

A WebGL animated background for the hero of a small linen house, on a dusky pink plaster wall at sunset: the low sun comes in through a window behind two sheer linen curtains and lays a long slanted patch of light on the wall. The folds of the fabric make soft bands of light and shade that sway in the breeze, the weave and the slubs of the linen show inside the light, between the two curtains the full sun comes through with the shadow of the window bars and below the hem runs a strip of bare sun. In the air, faint beams and fine dust that glints only where the light catches it; the sun sinks slowly and turns rosier. The pointer is a breath of air: it pushes the curtain aside where it passes. Pressing Order free swatches parts the curtains, the light floods in for a moment and the four swatches lift one after the other.

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>
<!--
  "Linen curtains 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>Lindra</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/newsreader@5.2.10/opsz.css">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/newsreader@5.2.10/opsz-italic.css">
  <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 hero of a small linen house on a plaster wall at sunset. A WebGL shader draws the low sun coming through a
       window behind two sheer linen curtains: the folds throw soft bands of light and shade that sway in the breeze,
       the weave of the linen shows in the light, the curtains part in the middle where the direct sun comes through
       with the shadow of the window bars, and below the hem a strip of bare sun. Fine dust glints in the beams.
       The pointer is a breath of air: it pushes the curtain aside a little where it passes -->
  <section class="stage" data-stage>
    <canvas class="wall" aria-hidden="true" data-canvas></canvas>
    <canvas class="dust" aria-hidden="true" data-dust></canvas>
    <div class="patch" aria-hidden="true"></div>

    <header class="bar" data-in>
      <span class="brand">
        <svg class="brand__mark" viewBox="0 0 24 24" aria-hidden="true">
          <path d="M5 4.5h14"/><path d="M7 4.5c-.6 5 .6 10.4-1 15h4.6c1-4.6-.4-10 .6-15"/><path d="M17 4.5c.6 5-.6 10.4 1 15h-4.6c-1-4.6.4-10-.6-15"/>
        </svg>
        Lindra
      </span>
      <nav class="nav">
        <a class="nav__link nav__link--wide" href="#">Curtains</a>
        <a class="nav__link nav__link--wide" href="#">Bedding</a>
        <a class="nav__link nav__link--pill" href="#">Our mill</a>
      </nav>
    </header>

    <div class="hero">
      <a class="chip" href="#" data-in>
        <span class="chip__new">New</span>
        <span class="chip__words">The Ochre colourway</span>
        <svg class="chip__arrow" viewBox="0 0 16 16" aria-hidden="true"><path d="M6 4l4 4-4 4"/></svg>
      </a>
      <h1 class="title" data-title><span class="title__line">Linen that lets</span> <span class="title__line">the evening in.</span></h1>
      <p class="lede" data-in>Stonewashed linen curtains, woven slowly on old looms and hemmed by hand in Flanders.</p>
      <div class="actions" data-in>
        <button class="btn" type="button" data-btn data-autoclic>
          <span class="btn__face" data-face>
            <span class="btn__shine" aria-hidden="true"></span>
            <span class="btn__words" data-words>Order free swatches</span>
            <svg class="btn__icon" viewBox="0 0 16 16" aria-hidden="true">
              <path class="btn__arrow" data-arrow d="M3 8h9M8.5 4.2L12.3 8 8.5 11.8"/>
              <path class="btn__check" data-check pathLength="1" d="M3.4 8.4l3 3 6.2-6.6"/>
            </svg>
          </span>
        </button>
        <a class="ghost" href="#">Shop curtains</a>
      </div>
      <p class="note" data-in>
        <span class="swatches" aria-hidden="true" data-swatches><span></span><span></span><span></span><span></span></span>
        <span data-note>Four colours, sent in two days</span>
      </p>
    </div>

    <p class="hint" data-in>Move the pointer to stir the curtains</p>
    <p class="sr" aria-live="polite" data-live></p>
  </section>

  <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 “Linen curtains 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

On a dusky pink plaster wall in half shade the hero of Lindra appears, an invented linen house: at the top the name with its two drawn curtains, ‘Curtains’, ‘Bedding’ and ‘Our mill’, on the left the ‘New, The Ochre colourway’ label, the heading ‘Linen that lets the evening in.’ with its second line in italics, a line that tells the story, the burnt terracotta ‘Order free swatches’ button, ‘Shop curtains’ and below four linen swatches in their colours. On the right the sunset comes in through a window out of frame and lays a long slanted patch of light on the wall, wider at the bottom like a low sun, with the sharp shadow of the mullion and the transom. The light goes through two linen curtains: the folds make lighter and darker bands, some deeper than others, with a brighter thread where a fold faces the sun; inside the light the weave of the linen and its slubs show, and the hem and the edges of the curtains are a little darker because they are folded double. Between the two curtains a slit of full sun comes through and below the hem runs a strip of bare sun where the plaster shows its relief. The curtains sway in the breeze, more at the bottom than at the top; from the top left corner faint beams cross the air and the fine dust rises slowly and glints only where the light catches it. Every loop the sun sinks a little and turns rosier, then climbs back; a breath of air crosses the curtain from left to right moving the folds, a gust passes, then the button is pressed: it gives and comes back on a spring, a band of light slides over it, the curtains part and the light comes in stronger for a moment, the four swatches lift one after the other and settle, the label turns into ‘Swatches on the way’ with a checkmark that draws itself and the note says ‘Arriving on Thursday’. With the pointer the breath follows the gesture: it pushes the curtain aside where it passes, makes it sway when it is quick and blows the dust away.

How it works

The wall is a shader

The whole background is a WebGL shader on a single triangle covering the canvas, full page under the words: the plaster in half shade, the patch of sun with the window, the curtains, the weave, the beams in the air and the grain. On top, a second 2D canvas carries the dust. Without WebGL a banded CSS patch of light remains.

The window of light

The patch is a signed-distance rectangle, slanted with a horizontal shear and a little wider at the bottom, like a low sun, with edges fading through a pink fringe. The mullion and the transom are two sharp strips of shadow, because they sit close to the glass.

The curtains: folds that let the light through

The two curtains hang from a rod above the window: each point of the wall looks at the fabric moved by the breeze, more the lower it is. The folds are two warped sines, with a depth that changes from fold to fold and a brighter thread where the cloth faces the sun; the light that comes through takes the colour of the linen. Hem and edges, folded double, let less light through; between the curtains and below the hem the sun arrives in full.

The weave of the linen

Linen is known by its slubs: two stretched noises, one along the warp and one along the weft, make the uneven lines; a fine grid is added only on dense screens, where it makes no moiré. Everything is multiplied by the light: in the shade the weave does not show.

Breeze, breath and dust

The breeze is the sum of three slow sines, plus the gusts (GSAP tweens) and what the pointer adds with its speed. The sway and the opening between the curtains are springs; the pointer's breath moves the fabric inside a Gaussian circle. The dust rises slowly, follows the wind and lights up only inside the beams, worked out in JavaScript with the same formula as the shader.

Values to change

NameFileDefaultWhat it changes
BREEZEscript.js1How strong the steady breeze is (0 = still air).
GUSTscript.js1How strong the gusts are, on their own and when the button is pressed.
FOLDSscript.js1How wide the folds of the linen are (higher = wider, fewer folds).
SHEERscript.js1How much light the linen lets through (higher = thinner fabric).
WEAVEscript.js1How much the weave and the slubs of the linen show in the light.
PUFFscript.js1How far the pointer pushes the curtain.
DUSTscript.js1How much dust glints in the beams (0 = none).
HAZEscript.js1How visible the beams in the air are.
SUNSETscript.js1How far the sun sinks and turns rosy over a loop.
GRAINscript.js0.03How strong the grain is.
SPEEDscript.js12 = the loop on its own twice as fast, 0.5 = half.
LOOPscript.jstrueRepeats the loop of the breeze and the button.

Try them in the Playground

When to use it

As the background of the first screen of a shop for fabrics, curtains and home linen, a hotel or holiday home, an interior studio, a restaurant that opens in the evening or a meditation app: wherever a slow warm end-of-day light is wanted instead of a gradient. The colours are --shade, --sun, --dusk, --linen and --clay in the CSS.

On phones

The same animations at adapted sizes: on narrow screens the window of light takes more of the wall and passes behind the words, the folds are measured on the width of the light, the heading on width and height; the Curtains and Bedding links go, and on short screens the note and the line at the bottom too. With a finger the breath follows the gesture.

With reduced motion

Curtains, sun and dust stay still: the light fades in; pressing the button the curtains part without swaying, the light warms slightly and the label, the checkmark and the note change without motion.

Pitfalls

  • Folds that are all the same look like a Venetian blind: the depth of each fold changes with a slow noise and their position is warped by two slower sines, so the bands narrow and widen as in a real curtain.
  • A weave grid as fine as a thread, on a density 1 screen, makes moiré: it only switches on above density 1 and the wider slubs of the linen do the rest.
  • Particles lit everywhere look like snow: dust only shows where the light catches it, so each mote asks the JavaScript how far it is inside a beam or the patch, with the same formula as the shader.

Libraries

GSAP 3.15.0, Newsreader (font variabile) 5.2.10, Mona Sans (font variabile) 5.3.0.

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

Testing

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