Skip to content
animorio
IT
Back to the library

String lights background

Backgrounds, HoverCanvas, GSAPMediumCompressed weight: Demo 9.4 KBGSAP 28 KBFreeDownload the zip

The background of the holiday page of Thimble & Pine, a made-up cafe and gift shop opening its December season: on a midnight blue that is almost black, a string of fairy lights crosses the top in a soft curve, behind the serif headline «Lights on, December». The bulbs, small drops of glass with their socket, filament and a reflection, light up in a wave along the wire: a flicker, then a warm light rising from ember red to amber and settling, with a soft halo on the night; then they breathe slowly, each on its own. The pointer brushing the wire sways it, the bulbs swing like pendulums and settle, and the one under the pointer burns brighter. The headline catches the light.

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>
<!--
  "String lights 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 of the string lights that light up in waves</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/fraunces@5.3.0/full-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>
  <main class="stage" data-stage>
    <!-- the holiday page of a made-up cafe and gift shop, Thimble & Pine, opening its December season. A string of
         fairy lights crosses the top of the page in a soft curve on a midnight blue: the glass bulbs light up in a wave
         along the wire, warming from ember to amber, and each throws a soft halo on the night. The pointer sways the
         wire, the bulbs swing like pendulums and settle, and the bulb under the pointer burns brighter -->
    <canvas class="sky" data-sky aria-hidden="true"></canvas>
    <span class="grain" aria-hidden="true"></span>

    <section class="hero" data-hero>
      <p class="eyebrow" data-rise>
        <svg class="eyebrow__mark" viewBox="0 0 20 20" aria-hidden="true">
          <path d="M10 2.2 15.6 11H4.4Z"/>
          <path d="M10 7.4 16.8 17H3.2Z"/>
          <path d="M10 17v1.6"/>
        </svg>
        <span>Thimble <em>&amp;</em> Pine</span>
        <span class="eyebrow__rule" aria-hidden="true"></span>
        <span>Winter season</span>
      </p>
      <h1 class="title" data-title>
        <span class="title__line" data-rise>Lights on,</span>
        <span class="title__line title__line--it" data-rise>December</span>
      </h1>
      <p class="line" data-rise>Open late from the first of the month: spiced cider, ginger loaf and small gifts wrapped by hand.</p>
      <a class="pill" href="#menu" data-rise data-pill>
        <span class="pill__bg" aria-hidden="true"></span>
        <span class="pill__text">See the winter menu</span>
        <svg class="pill__arrow" viewBox="0 0 16 16" aria-hidden="true"><path d="M3 8h9.2M8.6 4.2 12.4 8l-3.8 3.8"/></svg>
      </a>
    </section>

    <svg class="cursor" data-cursor viewBox="0 0 24 24" aria-hidden="true"><path d="M5 2.8v16.4l4.2-4 2.8 6.2 2.9-1.3-2.8-6.1h5.9Z"/></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.

30 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 “String lights 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

A midnight blue page that is almost black, with a fine grain and a slightly lighter sky at the top. Across the top hangs a dark green string of fairy lights, in a soft and slightly uneven curve, with a twist that catches the light. On the wire hang fifteen bulbs (fewer on a phone): a dark socket with its ridges clipped to the wire and a drop of glass with its filament and a white reflection; one in four is cranberry red, the others amber. Under the wire, the mark of Thimble & Pine with «Winter season», the serif headline «Lights on, December», «December» in italics, a line and the pill «See the winter menu». On arrival the words rise one after the other and the bulbs light up in a wave from the left: each flickers, goes dark for an instant and then slowly rises from ember red to amber, goes a touch past and settles; a halo grows around it and a soft crown of light on the night, and the headline warms with them. Once lit they breathe very slowly, each in its own time. The pointer brushing the wire pushes it: the wave runs along the wire and dies away, the bulbs swing like pendulums and settle; over a bulb, that bulb burns brighter. Left alone, a pointer crosses the wire, rests on a bulb and leaves, then the wave lights up again from the other side.

How it works

The wire as a string of springs

The wire is made of 64 points. Each is held to its rest curve (a slightly uneven sine between two anchors off screen) by a soft spring and to its neighbours by a strong one: the difference between the displacement of a point and that of its neighbours pulls it, so a push runs along the wire like a wave and damping puts it out. The physics step is fixed, 1/240 of a second, whatever the refresh rate of the screen.

The bulbs as pendulums

Each bulb is a damped pendulum hanging from a point of the wire: the acceleration of the wire at that point, divided by the length of the pendulum, pushes it; gravity brings it back down and damping stops it. Each has a slightly different rest lean, so the row does not look stamped out.

The drawn glass

The socket is a rounded rectangle with a left to right gradient and two ridges; the glass is a drop made of four Bézier curves, filled first with a dark tint and then with a radial gradient in the colour of the light; the filament is two leads and a curl, the reflection a white curve that is stronger when the bulb is dark.

The warm ignition

The brightness of each bulb is a number GSAP takes to 0.42, to 0.08, to 0.3 (the flicker) and then to 1.06 in 0.9 s on sine.out and to 1 (the touch too far and the settle). The colour comes from the brightness on a tungsten scale, from ember red to amber to warm white: so the light also rises in temperature. The bulbs start 0.11 s apart: that is the wave.

The halos and the crown on the night

Each bulb draws, in lighter mode, a tight halo around the glass and a wide faint crown a little lower, on the night: where two bulbs are close the lights add up. The breath is the sum of two very slow sines with different phases for each bulb. The average of the lights goes into the --lit variable, which warms the colour and the glow of the headline.

The pointer and the walk on its own

The points of the wire near the pointer take its velocity, weighted by the squared distance; the bulb under the pointer rises by 0.55 on a spring and gets a sideways nudge. Left alone, a GSAP timeline brings a drawn pointer across the wire, rests it on a bulb, takes it out and lights the wave again the other way; every 13 s, if someone is using the page, the wave passes again.

Values to change

NameFileDefaultWhat it changes
BULBSscript.js15How many bulbs hang on the wire on a wide screen (fewer on a narrow one).
ACCENT_EVERYscript.js4Every how many bulbs one is cranberry instead of amber (0 for none).
SAGscript.js0.2How deep the wire hangs, as a share of the height of the page.
WAVE_GAPscript.js0.11Seconds between one bulb lighting up and the next.
WARM_TIMEscript.js0.9Seconds a bulb takes to warm up from ember to full light.
WAVE_EVERYscript.js13Seconds between one wave and the next while someone is using the page.
BREATHscript.js0.06How much the lit bulbs breathe, very slowly (0 for still).
HOVER_BOOSTscript.js0.55How much brighter the bulb under the pointer burns.
GLOWscript.js1The size of the halos and of the crowns of light on the night.
SWAYscript.js1How much the pointer sways the wire.
SWINGscript.js1How much the bulbs swing on the wire.
IDLEscript.js4.4Seconds before the pointer brushes the wire on its own.
LOOPscript.jstrueLeft alone, brush the wire and light the wave again and again.

Try them in the Playground

When to use it

For the holiday header of a cafe, a bakery, a restaurant, a shop or a Christmas market, the page of a December event, the landing of a winter collection or an advent calendar. The string alone also works at the top of a newsletter or a greetings page.

On phones

The same animation with adapted sizes: the bulbs are measured on the shorter side of the screen and there are fewer (at least seven), the wire hangs at most a third of the width, the headline is measured with min(vw, vh). A finger sliding over the wire sways it, and the bulb under the finger burns brighter.

With reduced motion

The wire and the bulbs stay still: no sway and no pendulums. The bulbs light up all together in a fade and, every so often, dim and slowly come back, always together; the words fade in. The bulb under the pointer still burns brighter. No pointer on its own.

Pitfalls

  • With a physics step tied to the frame, the strong spring between the points of the wire blows up on a 30 Hz screen: the step is fixed at 1/240 s and as many as needed are run each frame.
  • A dot pulsing forever looks like a status light, not a bulb: here the ignition is a wave that settles, and the breath afterwards is very slow and different for each bulb, with two sines of different periods.
  • Halos in normal mode cover one another and muddy the night: in lighter mode nearby lights add up like real light, and they are drawn before the wire, which stays dark in front of the light.
  • A colour from one tint with rising opacity gives a bulb that comes on «on a dimmer»: the colour comes from a tungsten scale tied to the brightness, so the light starts red and turns amber.
  • With the drawing measured only once, the card window changing height would leave the wire crooked: on resize the rest curve, the bulbs and the path of the pointer on its own are made again.
  • The headline over the canvas would take the pointer moves: the hero has pointer-events: none and only the pill takes them back, so the wire can be brushed even when passing over the words.

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 9.4 KB; the libraries: GSAP 28 KB.

Testing

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