Bubble Evolution is the historical name of a magnifying-glass canvas experiment. It is not an evolutionary algorithm: no population is selected, mutated, or optimized. Instead, 35 small circles continually choose new destinations around a movable lens, producing a field that evolves visually over time.
A Real Magnified View
Each particle has a world position \\(p\\), while the lens is centered at \\(c\\). A zoom factor \\(z\\) maps that position into the circular lens:
\[ p_{lens}=c+z(p-c). \]The canvas first draws the complete field as small, faint circles. It then clips drawing to the lens circle and draws the same particles again with transformed positions and enlarged radii. This produces actual spatial magnification rather than merely masking a larger copy of the original marks.
Picking the Handle
The legacy implementation recognized its diagonal grip through several hard-coded line inequalities. That method depended on page coordinates and was difficult to extend to touch input. Here, the visible handle is represented by a finite segment from \\(a\\) to \\(b\\). For pointer \\(q\\), the projected segment parameter is
\[ t=\operatorname{clamp}\left(\frac{(q-a)\cdot(b-a)}{\lVert b-a\rVert^2},0,1\right), \]and the pointer hits the handle when \\(\lVert q-(a+t(b-a))\rVert\\) is no greater than half its width. The lens itself uses a standard circle-distance test. Pointer capture keeps mouse, pen, and touch drags attached, and the lens center is clamped so both the glass and the complete diagonal handle remain visible.
Moving Particle Targets
Particles approach randomly selected destinations around the lens with frame-rate independent exponential motion:
\[ p'=q+(p-q)e^{-\lambda\Delta t}. \]Moving the magnifier shifts the pending destinations by the same displacement. The field therefore follows the newly inspected region instead of continuing toward stale coordinates. Short pauses between destinations keep the movement irregular without tying its speed to a timer frequency.
Color and Interaction
Five visible swatches replace the original global mouse-wheel handler. An optional cycle mode interpolates through the same red, magenta, blue, green, yellow, and red sequence over time. Every frame uses one solid background color; particles and lens details mix that color with white for reliable contrast.
Zoom changes the lens mapping from 1.2x to 2.6x. Pause stops autonomous motion and color cycling while leaving the magnifier draggable. Reset restores the original lens position, 1.8x zoom, and a fresh 35-particle field. Reduced motion preferences start the animation paused without disabling direct interaction.