Skip to content
animorio
IT
Back to the library

Voronoi background

BackgroundsCanvas, GSAP, CSS onlyMediumCompressed weight: Demo 7.6 KBGSAP 28 KBFreeDownload the zip

The opening background of Pellicle, an invented biomaterials studio: on warm paper some forty Voronoi cells, really computed every frame and drawn in hairlines, drift slowly like living tissue. The pointer is one more cell: its neighbours step aside on a soft spring and its own cell, the only one, fills with moss green. A click divides the cell under the pointer and the cell counter rolls. The title stays in the middle on a pool of paper. Minimal style.

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>
<!--
  "Voronoi 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 Voronoi background</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/fraunces@5.3.0/index.css">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/geist-mono@5.3.0/index.css">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/instrument-sans@5.3.0/index.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <!-- the opening of Pellicle, an invented biomaterials studio: Voronoi cells drawn in hairlines on warm paper drift
       like living tissue; the pointer is one more cell that pushes its neighbours aside, and a click splits a cell -->
  <main class="stage" data-stage>
    <canvas class="cells" data-cells aria-hidden="true"></canvas>
    <span class="grain" data-grain aria-hidden="true"></span>
    <span class="halo" aria-hidden="true"></span>

    <section class="hero" aria-labelledby="hero-title">
      <p class="kicker" data-in>
        <svg class="kicker__mark" viewBox="0 0 16 16" aria-hidden="true"><path d="M8 1.8 13.4 5v6L8 14.2 2.6 11V5Z"></path><path d="M8 1.8V8l5.4 3M8 8l-5.4 3"></path></svg>
        <span>Pellicle, biomaterials studio</span>
      </p>
      <h1 class="title" id="hero-title">
        <span class="title__line" data-in>Grown,</span>
        <span class="title__line title__line--soft" data-in>not made.</span>
      </h1>
      <p class="line" data-in>Materials that build themselves, one cell at a time.</p>
      <button class="pill" type="button" data-pill data-in>
        <span class="pill__fill" aria-hidden="true"></span>
        <span class="pill__label">See the lab</span>
        <svg class="pill__arrow" viewBox="0 0 16 16" aria-hidden="true"><path d="M3 8h9M8.5 4.5 12 8l-3.5 3.5"></path></svg>
      </button>
    </section>

    <p class="hint" data-hint aria-hidden="true"><span data-count>40</span> cells · click to divide</p>
  </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

Works with Claude, Claude Code, ChatGPT, Cursor, VS Code, Windsurf, Codex, Gemini CLI

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 “Voronoi 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

Across the page warm paper split into some forty cells of different shapes, drawn in ink hairlines: each cell is the part of the page nearest to its point, and the points drift slowly each on its own loop, so the cells tighten and widen like tissue. In the middle, on a pool of lighter paper, «Pellicle, biomaterials studio» in small type, the title «Grown, not made.» with the second line in italics, a sentence and the «See the lab» pill. Moving the pointer one more cell is born where it is: the nearby cells step aside on a soft spring, their lines darken a little and their nuclei appear, tiny still crosses; the pointer’s cell fills with moss green. A click divides the cell under the pointer: the new point is born from the old one and runs to its place, the mother cell steps back and everything settles; at the bottom the cell count rolls. After ten divisions the oldest new cells close back into their mother. When nobody touches, an invisible pointer loops around the title and divides a cell now and then.

How it works

The cells, really computed

Each cell starts as the page rectangle and is cut by the line halfway between its point and every other point, keeping its own side (Sutherland and Hodgman clipping). The other points are tried nearest first: as soon as they are farther than twice the cell they can no longer cut it, and we stop. With some fifty points it is a small job, every frame.

The slow drift

Each point has a home on a randomly shaken grid (always the same one, from a seeded random) and a sine and cosine with their own phases and speeds. DRIFT says how far it wanders, DRIFT_TIME how long a loop takes.

The pointer is a cell

The pointer joins the list of points as one more, on a soft spring of its own: its cell is computed like the others and filled with the accent. Nearby points move their target away from it, more the nearer they are (a bell PUSH_RADIUS wide), and reach it with a hand-written spring in GSAP’s ticker, with SPRING and DAMPING.

The lines and the nuclei

Far from the pointer the lines are thin and light (LINE); near it they get a little thicker and darker, and in the middle of each cell the nucleus appears, a tiny still cross. A radial pool of paper behind the title keeps the lines away from the letters.

The division

A click finds the nearest point, the one owning the cell: a new point is born on top of it with the clicked spot as its home, while the mother gets a small push the opposite way. The two springs do the rest: the cell divides and settles. Beyond SPLIT_MAX new cells, the oldest one heads back to its mother and disappears when it reaches her, so the cells never grow forever.

Values to change

NameFileDefaultWhat it changes
CELLSscript.js40How many cells there are at the start.
DRIFTscript.js0.024How far the points wander, as a fraction of the shorter side.
DRIFT_TIMEscript.js16Seconds of one loop of the slow drift.
PUSHscript.js0.075How far the pointer pushes nearby points away.
PUSH_RADIUSscript.js0.24How far the pointer’s push reaches.
SPRINGscript.js5.5Stiffness of the points’ spring.
DAMPINGscript.js0.72Damping of the spring: lower means more settling.
LINEscript.js0.7Thickness of the lines far from the pointer, in pixels.
SPLIT_MAXscript.js10How many new cells can be born before the oldest close back.
AUTO_PILOTscript.js2.2After how many seconds without a pointer the invisible pointer returns (0 never).

Try them in the Playground

When to use it

Behind the opening headline of anyone working with nature, growth or structure: biotech, biomaterials, a lab, an architecture or engineering studio, scientific research. It gives depth without images, and the division on click says «we grow» without writing it.

On phones

The same: the finger’s cell follows it while dragging and a tap divides the cell. The pushes and the drift are measured on the shorter side, so the cells behave the same in the short wide box; the title is measured on the height too and the sentence goes below 460 pixels of height.

With reduced motion

The cells stand still: no drift and no springs. The pointer’s cell appears and fills at once, a click divides the cell without the run, and the type fades in.

Pitfalls

  • A repeated point (two points in the same spot) gives a line with no direction: the cut with a zero vector is skipped.
  • Cutting every cell with every other point costs the square: trying them nearest first, we stop early, as soon as they are farther than twice the cell.
  • The canvas must be multiplied by devicePixelRatio, otherwise the hairlines turn grey and blurry on dense screens.
  • The new cells from clicks must close again: without a limit the count grows with every click and the page becomes a web.

Libraries

GSAP 3.15.0, Fraunces (font variabile) 5.3.0, Instrument Sans (font variabile) 5.3.0, Geist Mono (font variabile) 5.3.0.

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

Testing

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