07.26 · Ambient & Background

Lightning

Jagged bolts strike from the clouds and light up the sky. Best for dramatic intros.

Watch it

It moves by itself. Click or tap the sky to make a bolt strike there.

Try it

Change a setting and see the difference as it moves.

How often

Rarely keeps it calm behind text.

Branches

How many thinner forks split off.

Bolt color

The bolt and its glow.

More optionsFewer options

The sky glows softly with each strike.

Light rain falls through the storm.

Copy the prompt

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

Add lightning to [the dark section or storm scene you want it in]. Every so often, draw a jagged bolt from the clouds to the ground on a canvas: start from a straight line, split it again and again, pushing each new midpoint sideways at random by less each time, and let thinner forks branch off. Draw a wide, faint stroke under a thin bright one for the glow; the bolt flickers once and fades within half a second. When the settings include it, light the sky softly, never more than twice a second. A click or tap strikes where the visitor points. If the visitor has reduced motion turned on, show a still bolt with no flash. 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

  • Game sites
  • Storm and weather themes
  • Dramatic intros

Avoid on

  • Reading pages
  • Calm or health sites