Catenary sag
Light pattern
💡 Bulb color
Live readouts
Span L—
Max sag—
Arc length—
How it works

A string of lights hung freely between two posts of equal height settles into a catenary: the curve a chain of uniform weight per unit length takes under gravity when its own tension is the only thing holding it up. Its equation is y = a·cosh(x/a), where a = horizontal tension ÷ weight per unit length. A large a means a tauter, straighter string; a small a means more sag — exactly the tension slider above, computed live and redrawn every frame, not a fixed image.

The lowest point of the curve is directly below the midpoint between the posts. The max sag readout is the vertical drop from post height down to that lowest point: sag = a·(cosh(L/2a) − 1) for a span L. The arc length readout integrates the same formula numerically along the curve, so a taut string reads close to the straight-line span while a saggy one reads noticeably longer.

Bulbs are placed at equal horizontal spacing along the string and ride the catenary curve exactly, so a wider span or a slacker tension visibly bunches or spreads them. Four lighting patterns are modeled independently of the curve shape:

  • Twinkle — each bulb flickers on its own random phase, like real fairy-light strings with independent LED drivers.
  • Chase — a bright band runs from post to post and wraps, like a running-light program.
  • Fade — every bulb breathes in and out together on one shared sine wave.
  • Solid — all bulbs stay lit at full brightness, showing just the curve and bulb spacing.

This is the flat 2D companion to the 3D firefly-garland simulation: the same catenary sag equation and per-bulb lighting logic, viewed as a plain side profile instead of a full night-time 3D pergola scene.