All examples · Experiments · As Markdown, for AIs

Lightning

What this example shows

A street at night under a storm. Click and a bolt comes down where you clicked. Left alone, the storm strikes on its own.

No image or sound files. The bolt is grown by midpoint displacement, with branches, and painted with createPixels into a white core and a glow cut into dithered bands, then shown with updatePixelTexture 30 times a second while it crackles. It flickers through return strokes and loses its branches as it fades. The sparks are particles written in code that bounce off the street through useParticleCollider2d, over bloom, an additive flash on the sky under the buildings, a camera shake and thunder from useSound's synthesizer.

Click the preview first so it hears the keyboard. Space brings a bolt down at random, and S slows everything to a fifth.

Starting
Starting
—