Skip to content
animorio
IT
Back to the library

Silk ribbon background

WebGL, BackgroundsWebGL, GSAP, CSS onlyMediumCompressed weight: Demo 8.2 KBGSAP 28 KBFreeDownload the zip

A WebGL animated background for a product’s hero, on warm black, in the style of Libraries.dev: a wide silk ribbon folding and swaying slowly behind the headline, with a pale highlight running along its folds. The pointer pushes it a little and the wave runs along the cloth, a click sends a ripple, and the headline takes the silk’s reflection.

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>
<!--
  "Silk ribbon 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 background with a silk ribbon swaying behind the headline</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 hero of an invented design system, Organza, on warm near black: behind the words a wide silk ribbon folds
       and sways in WebGL, with soft light running along its folds. The pointer pushes it a little and the wave travels
       along the ribbon; a click sends a ripple -->
  <main class="stage" data-stage>
    <canvas class="silk" data-silk aria-hidden="true"></canvas>
    <span class="grain" aria-hidden="true"></span>
    <span class="hush" aria-hidden="true"></span>

    <section class="hero" aria-labelledby="hero-title">
      <p class="pill" data-in>
        <span class="pill__tag">New</span>
        <span class="pill__text">Motion tokens 2.0</span>
        <svg class="pill__arrow" viewBox="0 0 16 16" aria-hidden="true"><path d="M6 3.5 10.5 8 6 12.5"></path></svg>
      </p>
      <h1 class="title" id="hero-title" data-in data-title>Interfaces that<br>move like silk</h1>
      <p class="lede" data-in>Organza gives every component a motion that folds, settles and follows the hand.</p>
      <div class="actions" data-in>
        <button class="cta" type="button" data-cta>
          <span class="cta__sheen" aria-hidden="true"></span>
          <span class="cta__label">Get early access</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>
        </button>
        <span class="note">Free while in beta</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.

23 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 “Silk ribbon 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 warm black there is the opening of Organza, a made-up design system: the New pill with Motion tokens 2.0, the large headline Interfaces that move like silk, a line of explanation and the light Get early access button. Behind the words a wide apricot silk ribbon crosses the page diagonally, and a second thinner and darker ribbon runs behind it. On arrival the ribbon unrolls from the left. The ribbon sways slowly up and down and turns on itself: where it goes edge-on it narrows and the fold catches a pale line, where it faces the light it widens and a pale highlight runs across it and slides along the cloth with the folds; the reverse is a shade darker, and a faint warm light surrounds it. The pointer pushes the ribbon: the nearby cloth moves away and turns a little, and when the pointer leaves it goes back to its place; moving it, small waves start from it and run along the ribbon. A click sends a stronger ripple that spreads out and crosses the silk. The headline takes a reflection from the silk: a pale, peach-coloured light runs through the letters following the fold behind it. A stripe of satin light crosses the button, and pressed it squashes, comes back with an elastic and sends the ripple. A drawn pointer crosses the ribbon, pushes it, clicks, then goes to the button and presses it.

How it works

The ribbon as a line that turns

Everything is in one fragment shader on a triangle that covers the page. For each column of pixels the ribbon has a centre line, a diagonal bent by two slow sines, and a twist angle that grows along the page. The visible width is the true width times the absolute cosine of the twist: where the ribbon goes edge-on it narrows, where it faces forward it widens, and that is how the folds show.

The light on the silk

Across its width the cloth curves a little: the normal turns with the twist and with the position on the ribbon. A diffuse light gives the colour between the shadow tone and the silk tone, a narrow highlight (cosine to the twenty-second power) gives the pale stripe that slides with the folds, and the reverse, where the cosine is negative, is a shade darker. Where the ribbon is edge-on the fold catches a pale line.

The push and the waves

The pointer enters the shader as a bell along x: the centre line moves away from it, above or below according to a hyperbolic tangent, and the twist turns a little. There are four ripples, each with a point, a start and a strength: a wave packet that spreads at 0.62 units per second and fades in a little over two seconds, added to the line and to the twist.

The headline’s reflection

The headline’s text is filled with a gradient of peach and white, clipped to the letters with background-clip: text. With the same formula as the shader, the script works out the ribbon’s twist behind the centre of the page and moves the gradient’s light with a CSS variable: the reflection in the letters comes and goes with the silk’s.

Values to change

NameFileDefaultWhat it changes
SILKscript.js#e9a27eThe colour of the silk: the shaded folds and the highlights are worked out from it.
SPEEDscript.js1How fast the ribbon sways (0 stops it).
TWISTscript.js1How many folds the ribbon makes along the page.
WIDTHscript.js1How wide the ribbon is.
PUSHscript.js1How much the pointer pushes the ribbon (0 leaves it alone).
RIPPLEscript.js1How strong the ripple of the click and of the moving pointer is (0 turns it off).
AUTO_PILOTscript.js3After how many seconds without a pointer the drawn one moves (0 never).

Try them in the Playground

When to use it

As the background of the first screen of a product that wants to feel soft and refined on a dark background: a design system, an animation library, a fashion or beauty brand, an app that talks about fluidity. The ribbon sits behind the headline without covering it, and the reflection in the letters ties the words to the cloth.

On phones

The same ribbon at adapted sizes: the shader works in units of the height, so on a narrow phone the ribbon crosses the page more steeply and stays wide, and the headline goes on two smaller lines. A sliding finger pushes the silk, and a tap sends the ripple.

With reduced motion

The ribbon stays still in one pose, already unrolled: no waves, no push, no ripples and no drawn pointer. The words only fade in and the reflection in the headline stays where it is.

Pitfalls

  • The hyperbolic tangent does not exist in GLSL ES 1.0, the one of WebGL 1: with tanh the shader did not compile and only the fallback background was left. It is written by hand with an exponential.
  • A visible width equal to the cosine of the twist means zero where the ribbon is edge-on, and the ribbon broke into pieces: a tenth of the width is kept as a minimum, and the fold catches a pale line.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

Tested on 27 October 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