Skip to content
animorio
IT
Back to the library

Pine forest background

Backgrounds, ImagesGSAP, Canvas, CSS onlyMediumCompressed weight: Demo 9.9 KBGSAP 28 KBFreeDownload the zip

The background of the opening of Hollin Lodge, made-up cabins in a pine wood: a real photo of a misty pine forest with sunbeams between the trunks, treated as a living background. The photo drifts a few pixels against the pointer, soft drawn beams of light come down over it and lean towards the pointer on a spring, and fine dust floats in the beams, lighting up only where the light catches it. The heading ‘Sleep where the light falls’ stays readable on a veil, and pressing ‘Book a cabin’ opens up the light in the forest for a moment and holds a cabin.

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>
<!--
  "Pine forest 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 pine forest photo background with the light that follows the pointer</title>
  <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 opening of Hollin Lodge, an invented set of cabins in the pines: a real photo of a misty pine forest is the
       background, it drifts a few pixels against the pointer, soft beams of light drawn over it lean towards the
       pointer and fine dust floats inside them. A veil keeps the heading readable. -->
  <main class="stage" data-stage>
    <div class="photo" data-photo aria-hidden="true">
      <img class="photo__img" src="bosco.webp" width="960" height="639" alt="">
    </div>
    <canvas class="rays" data-rays aria-hidden="true"></canvas>
    <span class="veil" aria-hidden="true"></span>
    <canvas class="dust" data-dust aria-hidden="true"></canvas>
    <span class="grain" aria-hidden="true"></span>

    <header class="bar" data-in>
      <p class="brand">
        <svg class="brand__mark" viewBox="0 0 24 24" aria-hidden="true">
          <path d="M12 3.2 6.4 11h3.1L5.6 16.4h12.8L14.5 11h3.1z"></path>
          <path d="M12 16.4v4.4"></path>
        </svg>
        Hollin Lodge
      </p>
      <nav class="bar__nav" aria-label="Main">
        <a href="#">Cabins</a>
        <a href="#">The forest</a>
        <a href="#">Journal</a>
      </nav>
    </header>

    <section class="hero" aria-labelledby="hero-title">
      <p class="label" data-in>Cabins in the pines, open all year</p>
      <h1 class="title" id="hero-title" data-in>Sleep where <em>the light falls.</em></h1>
      <p class="lede" data-in>Twelve timber cabins on a slope of old pines, a short walk from the road. Wake up to the mist lifting through the trunks.</p>
      <div class="actions" data-in>
        <button class="cta" type="button" data-cta>
          <span class="cta__face">
            <span class="cta__shine" aria-hidden="true"></span>
            <span class="cta__row" data-row="idle">
              <span>Book a cabin</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" 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>Larch cabin held</span>
            </span>
          </span>
        </button>
        <a class="ghostlink" href="#">See the cabins</a>
      </div>
    </section>

    <aside class="chip" data-in aria-label="Availability">
      <p class="chip__top"><span>This weekend</span><span class="chip__temp">6&#176; at dawn</span></p>
      <p class="chip__count"><span data-free>3</span> of 12 cabins free</p>
      <div class="chip__bar" aria-hidden="true">
        <i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i class="is-free"></i><i class="is-free"></i><i class="is-free" data-last></i>
      </div>
    </aside>

    <svg class="pointer" data-pointer 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.

31 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 “Pine forest 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

Out of the dark comes a real photo of a misty pine forest, with sunbeams passing between the trunks from the top left and a path of red earth: it is the background of the opening of Hollin Lodge, twelve made-up cabins in a pine wood. At the top the name with a pine drawn in gold and ‘Cabins’, ‘The forest’, ‘Journal’; at the bottom left, on a veil of shade that keeps the words readable, the gold label ‘Cabins in the pines, open all year’, the heading ‘Sleep where the light falls.’ with its second half in gold italics, a line about the place, the gold ‘Book a cabin’ button and ‘See the cabins’. On the right a small frosted glass card says ‘This weekend’, ‘6° at dawn’, ‘3 of 12 cabins free’ and has twelve dashes, the last three in gold. Over the photo seven soft drawn beams of light come down, from the same side as the real ones: they swing in from the left and settle on a spring, each one breathes slowly on its own and shifts by a hair as if the branches were moving. The dust rises slowly to the right and only shows where the light catches it. A drawn pointer crosses the forest: the photo drifts a few pixels the other way, the beams lean towards it with a small bounce, the light gathers a little where it stops and the dust nearby is pushed away. Then it goes to the button, which swells and widens its label, and presses it: it gives and comes back on a spring, a band of light slides over it, the forest brightens for a moment, the label turns into ‘Larch cabin held’ with a checkmark that draws itself, in the card the 3 rolls into a 2 and the last gold dash dips and turns grey. After a few seconds everything goes back and the loop starts again. With a real pointer the pilot stops and the light follows the hand.

How it works

A real photo as the background

The photo is an img with object-fit: cover inside a wrapper: GSAP moves the wrapper (quickTo on x and y, against the pointer), the CSS scales the image by 9% so the edges never show, and darkens and warms it a little with a filter, so the drawn light has room on top.

Small, stretched beams

The beams are long triangles starting from a sun above the top left corner, filled with a gradient along their length and added with 'lighter'. They are drawn on a canvas a third the size of the page and stretched by the CSS, with a touch of blur: that is what makes them soft like light in mist. The canvas sits on the photo in mix-blend-mode: screen, which only adds light.

The lean is a spring

From the pointer comes the angle that joins it to the sun; its difference from the resting angle, kept within LEAN, becomes the target of a hand-written damped spring that overshoots by a hair and settles. Each beam also has its own slow breathing and a small shift, like moving branches.

The dust only lights up in the light

Every mote asks how much light there is at its point with the same formula that draws the beams (angle from the sun, profile along the length, a bell around each beam): outside the beams it nearly vanishes. It rises slowly to the right with a wander of its own and the pointer pushes it away by stirring the air.

The veil and the button

Three gradients make the veil: dark on the left and at the bottom, where the words are, open on the right where the light is best. Pressing the button a timeline makes it give and come back on a spring, lifts the light in the forest for a moment, swaps the label for the checkmark and rolls the number in the card.

Values to change

NameFileDefaultWhat it changes
PARALLAXscript.js14How many pixels the photo drifts against the pointer (0 = still).
LEANscript.js0.12How far the beams lean towards the pointer, in radians.
BEAMSscript.js7How many beams of light come down between the trunks.
GLOWscript.js1How bright the beams are.
DUSTscript.js54How many dust motes float on a large screen (0 = none).
DRIFTscript.js1How much the dust moves.
AUTO_PILOTscript.js3After how many seconds without a pointer the drawn one starts moving (0 = never).

Try them in the Playground

When to use it

As the background of the first screen of a lodge, cabins or holiday homes in the woods, a mountain hotel, a glamping site, a walking travel agency or an outdoor clothing brand: wherever a real photo of the place should feel alive without becoming a video. The photo is swapped in index.html (any with light coming in from one side), the colours are --gold, --beam and --night in the CSS; if the light in the photo comes from the right, move the sun in resize().

On phones

The same animations at adapted sizes: the photo always covers the page, the beams point more behind the words, the dust thins out with the screen area, the heading is measured on width and height; on narrow screens the veil rises from the bottom, the availability card and two links go, on short screens the line under the heading too. With a finger the light follows the gesture.

With reduced motion

The photo, the beams and the dust are already in place, still, and fade in; no parallax and no lean. Pressing the button the label, the checkmark and the number in the card change with a fade.

Pitfalls

  • Beams drawn at full resolution have hard edges and look like blades: drawn on a small canvas stretched by the CSS, with a touch of blur, they become light in the mist, and cost less too.
  • Beams going a different way from those in the photo look fake at once: the drawn sun sits above the top left corner, like the real one, and the pointer only bends them by a few degrees.
  • Moving the photo would show its edges: GSAP moves the wrapper, the image inside is scaled 9% by the CSS, so GSAP's transform does not wipe the one from the class.

Libraries

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

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

Testing

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