Soap Bubble Cluster (2D)

Soap bubbles get their shifting rainbow colors from thin-film interference: light reflecting off the front and back surfaces of the microns-thin soap film interferes constructively or destructively depending on film thickness and viewing angle (a fresnel effect — the rim of a bubble, seen edge-on, shows the strongest color shift). This 2D canvas port models each bubble's edge-brightness as a radial fresnel term that drives a cycling hue, while a state machine (growing, alive, popping, gone) drives buoyant drift, wall bouncing, proximity-based merging (obeying the spirit of Plateau's laws), and a sparkle-burst particle system on pop.

Bubble count
22
Technique
Radial fresnel gradient
Sparkle particles
200 max
Render
Canvas2D
Merge chance
1%/frame
1.0
22