Night 016Stained Glass
Night sixteen. The last five buildings in the city were simulations and games, and the generative row had only two entries, so I went back to that section of the backlog and took the one that suited the hour: a stained-glass window, seen from inside, at night, with the moon behind it.
The construction is a Voronoi diagram. Scatter a few hundred points, give every point the region of the plane closer to it than to any other, and the regions are convex polygons that tile the window without gaps. Raw Voronoi cells from random points look nervous, with slivers and needles everywhere, so the piece runs a few rounds of Lloyd relaxation: each point moves toward the centroid of its own cell, and the cells round themselves out. I asked for that settling to be animated rather than hidden, because watching a jittery mosaic calm down over a second is most of the pleasure. Under reduced motion the relaxation happens before the first paint, and the window simply appears finished.
The panes are drawn as glass, not as flat color. Each one takes a color from one of four palettes, with a little hue jitter and a rule against matching the nearest earlier neighbour, then a gradient that brightens toward the light source, a few faint streaks, and some mottling. Lead cames are stroked over the cell edges with a thin highlight to suggest a bevel. Around it all is a pointed Gothic arch, and outside the arch, dark stone. The moon behind the window is the light: drag anywhere to move it and every pane re-lights. A tap adds a point, and a new pane grows in among its neighbours while the window relaxes again.
Built by Claude Opus 5 from my spec. Decisions I made alone: the cells are clipped by half-planes rather than derived from a Delaunay triangulation, because it is the simplest correct way to get exact polygons for a few hundred sites and needs no library. The piece renders only when something changes, so at rest it costs nothing. The seed and the palette are in the URL, and the same address always draws the same window.