Skip to content
animorio
IT
Back to the library

Sunburst background

Backgrounds, HoverGSAP, Canvas, CSS onlyMediumCompressed weight: Demo 6.7 KBGSAP 28 KBFreeDownload the zip

An animated background to put behind a headline, in the minimal style: on warm white, a sunburst of hairline rays starts from a pivot on a thin horizon, like the light of a sun that has just set. At first it is one single upright line; then it opens like a fan, every ray on its own spring, one hair too far and back into place. The ray under the pointer takes the one accent and reaches down to the pivot, and its neighbours step aside to give it room. A click folds the fan and opens it again.

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>
<!--
  "Sunburst 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>Radia</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 background: hairline rays on a canvas behind the page, fanned out from a pivot on a thin horizon. They open
       from one line like a fan; the ray under the pointer takes the accent and its neighbours step aside to give it room -->
  <main class="pagina" data-pagina>
    <canvas class="fondo" aria-hidden="true" data-fondo></canvas>

    <header class="testa">
      <p class="marchio">Radia</p>
      <p class="testa__nota">Lighting studio</p>
    </header>

    <section class="eroe">
      <div class="blocco" data-blocco>
        <p class="occhiello" data-entra>Light for homes, shops and galleries</p>
        <h1 class="titolo">
          <span class="riga"><span class="riga__dentro" data-riga>Room for</span></span>
          <span class="riga"><span class="riga__dentro" data-riga>the light.</span></span>
        </h1>
        <div class="azione" data-entra>
          <a class="pillola" href="#">
            <span class="pillola__scritta" data-testo="See the work">See the work</span>
            <svg class="pillola__freccia" viewBox="0 0 16 16" aria-hidden="true"><path d="M2.5 8h10.5M9 3.8 13.2 8 9 12.2" /></svg>
          </a>
        </div>
      </div>
    </section>
  </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.

22 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 “Sunburst 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 empty warm white, at the bottom in the middle, there is a pivot on a thin horizon line that crosses the page, with a small hairline half circle on it. One single upright line rises from the pivot, then opens like a fan: forty-nine hairline rays draw themselves outwards, the middle ones first, and each one goes to its place on its own spring, passing the mark by a hair and coming back, until the sunburst covers the whole half circle above the horizon. Near the pivot the rays fade, so they do not make a black spot, and around the headline and the two words at the top they pull back: the words sit on clean paper. Meanwhile the headline, ‘Room for the light.’, rises line by line from its window, wide and light, and lands narrow; then the small line above and the pill below arrive. The ray nearest the pointer takes the one accent, orange, gets a little thicker and reaches down to the half circle; the rays beside it step aside, each on its own spring, and leave a clear wedge around it. As the pointer moves, the light passes from ray to ray and the clear wedge follows it, like a wave through the fan. The whole fan sways by a degree. When nobody moves the pointer, an invisible one slowly crosses the fan from one side to the other and back. A click or a tap folds the fan back into one line and opens it again.

How it works

Numbers, not drawings

Every ray is an object with four numbers: how open it is, how long it is, how far it is pushed aside and how much light it has. GSAP animates the opening and the length, a spring the push; one draw per frame, in the ticker, writes them all on a canvas.

A fan from one line

A ray’s angle is its place in the fan (from -1 to 1) times half the spread times how open it is: at zero they all stand upright, one single line. The opening uses back.out(1.25), one hair too far and back, and starts a little later for the rays at the sides.

The clear wedge

The ray nearest the pointer goes under the pointer; the others are pushed aside by x times e to the (1 minus x squared) over two, with x the distance in wedge widths: zero on the lit ray, most at one wedge, then back to rest. With the push capped at 1.3 wedges the rays never cross.

Clean paper

The zones without rays are not worked out ray by ray: after drawing, with destination-out, a soft ellipse is erased around the headline and the words at the top, and a soft circle around the pivot. The lit ray is drawn after the circle, so it reaches down to the half circle.

The invisible pointer

When the real pointer has been still for more than 2.4 seconds, the angle to follow becomes a sine that crosses the fan in SWEEP seconds; the real pointer is read as an angle seen from the pivot, kept inside the fan. Both arrive on a spring.

Values to change

NameFileDefaultWhat it changes
RAYSscript.js49How many rays the fan has.
SPREADscript.js180How wide the fan opens, in degrees.
PIVOTscript.js0.84Where the pivot sits, from the top (0) to the bottom (1) of the page.
MAKE_ROOMscript.js7How far the neighbours of the lit ray step aside, in degrees.
ROOM_WIDTHscript.js10How wide the clear wedge around the lit ray is, in degrees.
SPRINGscript.js[170, 15]The spring of the rays: how stiff and how damped.
SWAYscript.js1.2How many degrees the fan sways while it rests.
SWEEPscript.js14How many seconds the invisible pointer takes to cross the fan and come back.
WIDTHscript.js1The width of the rays, in px.

Try them in the Playground

When to use it

As the background of the first screen of a lighting studio, a photographer, a seaside hotel, a sunset festival or a product about light and energy; in general behind a short headline when you want a light, almost empty page that is still alive.

On phones

The same animations with adapted sizes: the pivot stays at the bottom, the headline is as big as the box allows in width and height, and the clean zone follows it. The finger lights the ray under it while it touches and drags; a tap folds and reopens the fan.

With reduced motion

The fan is already open and still, with the middle ray lit: no opening, no sway, no rays stepping aside. The headline, the small line and the pill fade in.

Pitfalls

  • Forty-nine rays starting from the same point make a black spot around the pivot: a soft circle is erased with destination-out instead of shortening them, so they stay straight to the edge.
  • The neighbours’ push has to stay below 1.36 times the wedge width: beyond that the curve falls faster than the gap between rays and two rays cross.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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