This browser does not have a Java Plug-in.
Get the latest Java Plug-in here.

LIGHTNING BY PARTICLES
FEBRUARY 17th 2010: From scratch by Richard Wong
Cursor acts as a source of lightning that is constantly trying to find the shortest path to its target.
Updated render enginge to include flashes and glares.

Controls:
LEFT CLICK toggles Point to Point mode vs Point to Ground mode.
In Point to ground mode, the lightning simply tries to find the shortest possible path to the ground, if it exists at all. In Point to Point mode, the lightning tries to find the shortest path to another point, determined by the position of the cursor at the time this mode is enabled.

UP AND DOWN ARROW KEYS toggle the effective 'transfer radius' of each particles/electron.
The greater the radius, the higher the frequency of strikes as the lightning should be able to find a pathway more easily. But each step would be greater, causing the lightning to less realistic. Smaller radii generally makes cooler looking lightning bolts, but with a much lower frequency. The actual radius is shown in the little ellipse in the top left when toggled.

SPACEBAR toggles the visibility of the particles so you can sort of see what's going on.
(Will slow processing speeds.)


So here is my Lightning Engine, based on pseudo-lightning physics. Unseen, are thousands of particles hovering in the background.
(Much like electrons in the air, just that the air has a mega-gazillion electrons allowing much more spectacular displays of lightning. My
processor only allows me a measly 10000 max, but I've set it at 4500 for better performance on lower machines.)

Each of these particles has an effective 'charge transfer' radius. (This makes them more like atoms, but I'll just call them electrons
anyway.) If 2 electrons are in close enough proximity, they can transfer their 'charge' to each other.

Much like electricity, if there is a chain of electrons from point A which has a greater negative charge, to point B which has a lower
negative charge, a transfer of energy will take place. Much like lightning.

In this case, the 'source of great amounts of negative charge' is the cursor. If there exists a path from the cursor to the ground/point,
the lightning travels along the particles at a speed so great, that it appears as a bolt of lightning. (In my case it just draws a line
from electron to electron along the path of particles.)

Source code: More than happy to share! Email me

Built with Processing