Skip to content
animorio
IT
Back to the library

Olive leaf shadows

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

An animated background for the hero of a skincare brand, on a warm plaster wall: the afternoon sun comes in through a window and lays a slanted patch of light on the wall, with the shadow of the window frame, a linen curtain on the left that lets the light through in folds and the shadows of three olive sprigs swaying in the breeze. The leaves close to the wall cast sharp shadows, the far ones soft and pale, as real sunlight does. The pointer is the breeze: it stirs the sprigs and the curtain and gently shifts the sun, and the heading's shadow turns with it. Pressing Shop the serum sends a gust through, the sun warms for a moment and the bag counts one more.

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>
<!--
  "Olive leaf shadows" 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>Olea</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/fraunces@5.3.0/full.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 an olive leaf skincare brand on a warm plaster wall. A WebGL shader draws the afternoon sun coming
       through a window: the slanted patch of light with its frame, a sheer linen curtain on the left and the shadows
       of three olive sprigs that sway in the breeze, sharp where the leaves are close to the wall and soft where they
       are far. The pointer is the breeze: moving it stirs the leaves and the curtain and shifts the sun a little -->
  <section class="stage" data-stage>
    <canvas class="wall" aria-hidden="true" data-canvas></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="M12 21V9"/><path d="M12 13c-3.6-.4-5.6-2.6-6-6.4 3.6.3 5.6 2.4 6 6.4z"/><path d="M12 10.4c3.2-.5 5-2.6 5.4-6 -3.3.3-5 2.3-5.4 6z"/>
        </svg>
        Olea
      </span>
      <nav class="nav">
        <a class="nav__link nav__link--wide" href="#">Journal</a>
        <a class="bag" href="#" aria-label="Bag">
          <svg class="bag__icon" viewBox="0 0 20 20" aria-hidden="true"><path d="M4.5 7h11l-.9 9.2a1.4 1.4 0 0 1-1.4 1.3H6.8a1.4 1.4 0 0 1-1.4-1.3z"/><path d="M7.4 7V5.8a2.6 2.6 0 0 1 5.2 0V7"/></svg>
          <span class="bag__count" aria-hidden="true"><span class="bag__roll" data-roll><span>0</span><span>1</span></span></span>
        </a>
      </nav>
    </header>

    <div class="hero">
      <a class="chip" href="#" data-in>
        <span class="chip__new">New</span>
        <span class="chip__words">Olive leaf serum</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">Slow light,</span> <span class="title__line">soft skin.</span></h1>
      <p class="lede" data-in>Cold-pressed olive leaf serums, bottled in small batches under the trees they come from.</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>Shop the serum</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="#">Our grove</a>
      </div>
      <p class="note" data-in>Olive Leaf Serum, 30 ml, €48</p>
    </div>

    <p class="hint" data-in>Move the pointer to stir the breeze</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.

33 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 “Olive leaf shadows” 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 sand-coloured plaster wall in the shade the hero of Olea appears, an invented brand of olive leaf serums: at the top the name with its drawn sprig, ‘Journal’ and the bag with a zero, in the middle the ‘New, Olive leaf serum’ label, the heading ‘Slow light, soft skin.’ with its second half in italics, a line that tells the story, the olive green ‘Shop the serum’ button, ‘Our grove’ and the small price. Behind, the afternoon sun comes in through a window out of frame and lays a large cream patch of light on the wall, slanted, with the shadow of the window frame (a mullion and a transom) and an edge that fades through a warm fringe. On the left the light goes through a linen curtain: its folds show, lighter and darker, swaying slowly, and the hem a little darker. From the top right three olive sprigs hang in front of the window: their shadows are long narrow leaves, sharp for the sprig close to the wall, blurred and pale for the farthest one. The sprigs sway on springs in the breeze, each leaf trembles on its own, the plaster shows its grain only where the sun rakes across it and the heading casts a faint shadow on the wall. Every loop a gust passes, then a light cloud dims the sun and gives it back; then the button is pressed: it gives and comes back on a spring, a band of light slides over it, a stronger gust swings the sprigs and lifts the curtain, the sun warms for an instant, the label turns into ‘Added to bag’ with a checkmark that draws itself and the bag's digit rolls from 0 to 1. With the pointer the breeze follows the gesture: a quick move sways sprigs and curtain, and the sun shifts gently the other way, turning the heading's shadow.

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 shade colour, the patch of sun, the curtain, the leaves, the plaster and the grain. Without WebGL a CSS patch of light remains.

The window of light

The patch is a signed-distance rectangle, slanted with a horizontal shear (like a low sun) and with edges fading into a penumbra. A mullion and a transom are two strips of shadow; where the light ends a faint orange fringe warms it as real sunlight does.

Leaves: curved lances, as blurred as they are far

Each leaf is a lance: wide in the middle, pointed at both ends, slightly bent. The JavaScript works out where it sits on each sprig and passes it to the shader in a list of thirty; each sprig has its own distance from the wall, which sets the blur of the penumbra, the size and how pale the shadow is. Shadows join with the maximum, they do not add up: two leaves on top of each other do not make a darker shadow.

The breeze on springs

The breeze is the sum of three slow sines, plus the gusts (GSAP tweens) and what the pointer adds with its speed, which fades slowly. Each sprig is an angular spring with its own stiffness, the curtain another spring that moves the hem and bends the folds; each leaf trembles at its own frequency, harder when the wind blows.

Plaster and heading

The plaster is a three-octave noise: its gradient, compared with the sun's direction, makes the relief, strong where there is light and almost none in the shade. The shadow of the heading and the button is a text-shadow and a box-shadow with two CSS variables that follow the sun.

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.
STIFFNESSscript.js16The sprigs' spring: higher sways quicker and shorter.
DAMPINGscript.js1.8Lower lets the sprigs swing longer.
FLUTTERscript.js1How much each leaf trembles on its own.
SOFTNESSscript.js1How blurred the shadows of the far leaves are.
SUNscript.js1How bright the patch of sun is.
FOLLOWscript.js0.05How much the sun shifts with the pointer.
GRAINscript.js0.03How strong the grain is.
SPEEDscript.js12 = the walk 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 cosmetics or skincare brand, a country hotel or holiday home, an interior architecture studio, a meditation app or a homeware shop: wherever a calm natural light is wanted instead of a gradient. The colours are --shade, --sun and --olive in the CSS.

On phones

The same animations at adapted sizes: the window of light is measured on width and height, the sprigs start from the top corner of the light and the leaves are measured on the shorter side, the heading on width and height; on short screens the price and the line at the bottom go. With a finger the breeze follows the gesture.

With reduced motion

Sprigs, curtain and sun stay still: the light and the shadows fade in; pressing the button the sun warms slightly and the label, the checkmark and the bag's digit change without motion.

Pitfalls

  • The shadows of two leaves on top of each other do not add up: in sunlight there is shadow or there is not. Multiplying them makes darker spots where they cross and looks drawn; the maximum keeps the shadow even.
  • With thirty leaves per pixel the shader slows down: each leaf skips at once the pixels outside the circle that holds it, so almost the whole screen only looks at two or three.
  • A plaster relief the same everywhere looks like wallpaper: it has to be multiplied by the light, because only raking sun shows it.

Libraries

GSAP 3.15.0, Fraunces (font variabile) 5.3.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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