Click anywhere to fire a fractal lightning bolt from the top of the screen to your cursor.
The Physics
How real lightning forms
Step leader: Ionised channel steps down from cloud in 50 m jumps.
Return stroke: Ground connects โ current flows upward at ~1/3 light speed โ the visible flash.
Branching: Leader explores multiple paths; secondary branches fade as main channel forms.
Temperature: ~30,000 K โ 5ร hotter than the Sun's surface.
Algorithm
Fixed-segment displacement
Generates a fixed number of segments directly (no recursive subdivision). Each segment midpoint is displaced perpendicular to the line by a random jag amount โ O(n) complexity, bounded memory.
Branches are single-level only โ one branch per node, no sub-branching โ keeping total segments strictly bounded.
Keyboard
Space โ random strike A โ toggle auto C โ clear G โ toggle glow 1 โ 6 โ switch mode โ / โ โ jaggedness