Skip to main content
assetsforwordpress

Maze Background

This animated background draws a self-solving maze that endlessly regenerates itself, with a glowing dot racing through the corridors and leaving a luminous trail behind it. It respects the user’s `prefers-reduced-motion` setting, showing a static maze instead of the animation for those who prefer less movement.

Every Wall Is a Decision.

What a brick does for your brand.

Teaching Your Computer to Draw Mazes

Algorithms for People Who Napped in Math Class.

Mazes Everyone Can Get Lost In.

For people who are weirdly competitive about walls.

Maze Background Generator

Generator instructions: Simply copy one of the sections above and paste it into your website.
To create a new effect, use the generator, then click the Export code button and paste the code into the Supa Code Block element to replace the current effect.
Maze background generator cover
ONLY AVAILABLE FOR MEMBERS

Instructions

Open the JS script in the Supa Code Block element and edit the options at the end of the script. Each option is explained below:

Here’s what each option in createMazeBackground does, in the order they appear:

style: "neon" — The overall look of the maze. Four presets are available:

  • "neon" — full glow effect, thin walls
  • "line" — thin plain lines, no glow at all
  • "blocks" — thick, chunky walls, no glow
  • "dashed" — thin walls drawn as dashes, with mild glow

Note that this style acts as a multiplier on your other values (see glow and lineWidth below), so some options behave differently depending on the style chosen.

speed: 1 — How fast the runner dot moves along the solved path. 1 is the default pace; 2 is twice as fast, 0.5 is half speed. Very small values are clamped so the dot never fully stops.

cellSize: 34 — The approximate size of each maze cell in pixels. Smaller values produce a denser maze with more corridors; larger values produce a sparse, chunky maze. Values below 10 are ignored (forced up to 10).

lineWidth: 2 — The base thickness of the maze walls, in pixels. It gets multiplied by the style’s line-width factor (e.g., "blocks" makes walls about 3× thicker, "line" makes them thinner). Always at least half a pixel.

trailWidth: 3 — The thickness of the glowing path the runner draws behind it as it moves. This also determines the size of the goal marker dot.

glow: 14 — The intensity of the neon glow (canvas shadow blur) applied to walls, trail, and player. It’s scaled by the style — "neon" uses the full value, "dashed" uses ~40%, while "line" and "blocks" ignore it entirely. Set to 0 to disable all glow.

corners: "round" — How wall ends and joints are drawn. "round" gives soft, rounded wall caps; "square" gives sharp, squared-off ends with sharp corners. This also affects the padding around the maze so square caps aren’t clipped.

marker: "circle" — The shape of the runner dot and the goal marker. Either "circle" or "square".

randomEnds: false — If false, every maze is solved from the top-left corner to the bottom-right corner. If true, the start and end points are picked randomly from the four corners (and are always different from each other), which adds visual variety between regenerations.

background: "#0a0c10" — The canvas background color (a very dark blue-black by default). Any valid CSS color works.

wall: "#1d2433" — The color of the maze walls themselves — intentionally a subtle dark blue-grey so they read as structure rather than the focus.

trail: "#38f0c0" — The color of the runner’s trail and the goal marker. This is the most visually prominent color, a bright teal/mint.

player: "#ffffff" — The color of the moving dot itself, drawn brighter and with a stronger glow than the trail so it stands out as the focal point.

holdTime: 900 — How long (in milliseconds) the completed path stays fully visible once the runner reaches the goal, before the maze fades out and a brand-new one is generated. The animation loop is: run → hold → fade out → fade in → repeat.

A couple of extra notes:

  • Every option is optional. Anything you omit falls back to the default shown in the code, since your example object actually just restates all the defaults anyway.
  • Changing options later via the returned api.set({...}) is smart about what it recomputes: changing style, cellSize, lineWidth, corners, or randomEnds regenerates the whole maze; changing wall or glow just re-renders the wall layer; color changes like trail or background only need a redraw.