Home▸Nature & Climate▸Firefly Synchronization: 2D Kuramoto Flash-Coupling Lab

Firefly Synchronization: 2D Kuramoto Flash-Coupling Lab

A real mean-field Kuramoto oscillator model drives every flash: each firefly is a phase oscillator with its own natural frequency, pulled toward the swarm's average phase by a coupling strength you control — turn it up and disordered flickering locks into a unified pulse, the same mechanism that synchronizes real firefly swarms.

Nature & Climate2DModerate60 FPS📱 Mobile-adapted⇄ 3D version
2d-n62-fireflies-forest ↗ Open standalone

The 3D original renders fireflies drifting through a forest scene with a soft flicker on each particle, but nothing in it actually couples the fireflies to each other — every flash is an independent, unrelated animation. This 2D companion replaces that with the real phenomenon "fireflies in a forest" is known for: synchronized flashing, modeled with the mean-field Kuramoto equations that explain how swarms of species like Pteroptyx malaccae lock their flashes into unison purely through local visual coupling. Each firefly carries its own phase and a slightly different natural frequency (drawn from a normal distribution you widen or narrow with the frequency-spread slider); every frame, each one nudges its phase toward the population's average phase, weighted by the coupling strength K. A live readout tracks the Kuramoto order parameter R — 0 when flashes are scattered randomly, climbing toward 1 as the swarm locks into a single pulse — alongside the mean phase and the swarm's aggregate flash rate, so the underlying synchronization dynamics are visible rather than merely implied by a pretty scene.

⚙ Under the hood

2D firefly-flash synchronization lab built on the mean-field Kuramoto model: population, coupling strength K, natural-frequency spread, wander speed and fog density are all live parameters, with a real-time order-parameter readout showing the swarm's transition from disorder to synchrony.

firefly synchronizationkuramoto modelcoupled oscillatorsbioluminescenceemergent order2D simulation

2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)