07.23 · Ambient & Background

Game of Life

Cells live and die by their neighbors, and patterns grow. Best for tech sites.

Watch it

It moves by itself. Click, drag or touch it to draw new cells, or press Reset to start again.

Try it

Change a setting and see the difference as it moves.

Speed

How quickly one generation follows the next.

Cell size

Smaller cells make a bigger world; on phones the small ones are a little larger.

Start pattern

The glider gun fires gliders forever; the acorn grows from seven cells.

More optionsFewer options

Color

The color of the living cells.

Cells that die fade out instead of vanishing at once.

Shows the squares the cells live in.

Copy the prompt

Paste it into an AI assistant such as ChatGPT, Claude or Cursor to build this in your own project.

Add a Game of Life background to [the section you want it behind]. Split a canvas into a grid of square cells, each alive or dead, and at a steady pace work out the next generation from each cell's eight neighbors: a dead cell with exactly three live neighbors is born, a live cell with two or three stays alive, and every other cell dies. Time the generations by elapsed time, not by frames, and when the settings include trails, let dying cells fade out. Let the visitor click, drag or touch to draw cells, and start again when the world settles. Keep the cells from getting too small on phones. If the visitor has reduced motion turned on, show one still frame. Match the settings listed below.

Replace the words in brackets with your own element. Your settings are added at the end.

Free and open source. If this helped, a star on GitHub helps other people find it.

Star on GitHub

What it is

The full explanation is in README.md.

Good for

  • Tech and science sites
  • Developer portfolios
  • Loading and idle screens
  • 404 pages

Avoid on

  • Calm brands
  • Long reading pages