Visualizations
461 / 500

461 · Generative art

Millefiori Cane

Build glass canes by casing, moulding and bundling, then slice them into a paperweight.

A cane's cross-section is a stack of coloured polygons in a unit circle, painted back to front, and every working step is an exact map of those polygons. Casing scales the section into a fresh disc of glass, a star or petal mould is a radial map that dents the outer layers and spares the core, bundling packs seven pulled-down copies on a hex lattice, a rosette rings copies of a second cane around the first, and stirring is a differential rotation. Curved maps are refined by mapping the exact midpoints of long segments and shrunken copies are decimated, so a twice-bundled cane stays at tens of thousands of points. The side of the cane is a glass cylinder whose rows composite the glass along a chord front to back, so clear crystal shows the colours inside and twisting turns them into a helix, and slices fly into a paperweight whose dome magnifies the bed of murrine through a radial lens table.

Try it. Pick a glass colour, then build: Core starts a new cane, Case and Clear add a layer, Star and Petal press it into a mould, Bundle and Rosette pack copies together, Stir swirls it. Click the cane or press Space to slice a murrina into the paperweight, and drag across the cane (or use the arrow keys) to twist it. Keys: C, E, X, S, P, B, R and W for the steps, 1 to 9 for colours.

  • Polygon cross-sections
  • Radial and affine maps
  • Hex packing
  • Front-to-back glass compositing
  • Lens lookup table

View the source · one module, plus a small shared runtime for sizing, the animation loop and input

Build your own

Paste this into Claude Code, Codex or any coding agent to get a simple version running, then take it wherever you like.

Build a millefiori glass cane designer with JavaScript and the HTML canvas element. Put everything in a single index.html file with no libraries or build step, so I can open it directly in a browser.

The idea: a glass cane's cross-section is just a list of coloured polygons inside a unit circle, drawn back to front. Every glassworking step is a function that transforms those polygons.

Start simple:
- Make a canvas that fills the window, stays sharp on high-DPI screens, and has a dark background. Draw the current cane as a large circle in the middle.
- Represent a cane as an array of objects with points and color, where points is a closed polygon in a unit circle.
- Core: a new cane that is one circle of 120 points.
- Case: scale every polygon by 1 / (1 + t) and insert a new full circle of a new color at the front of the list (so it is drawn first, behind everything).
- Star mould: move every point radially with r' = r * (1 - depth * (0.5 - 0.5 * cos(k * theta)) * r^2), which dents the outer layers into k points and leaves the core almost untouched.
- Bundle: replace the cane with seven copies scaled by 1/3, one in the middle and six around it at distance 2/3, on top of a filler circle.
- Add a row of buttons for these steps and a palette of six glass colours.

Once that works, make it beautiful:
- Refine polygons after a mould: wherever two neighbouring points end up far apart, insert the transformed midpoint of the original segment.
- Make it look like polished glass: a soft diagonal sheen, a bright rim highlight and a thin darker seam around each polygon.
- Add Slice: copy the current cross-section into a growing grid of little murrine at the side, like a paperweight.

Explain the key ideas in short code comments. When you're done, tell me how to open it and suggest three directions I could take it next, such as a rosette of copies around a centre cane, a side view of the cane as a glass cylinder with twisted stripes, or a magnifying paperweight dome.
PreviousSocial AmoebaeStarving amoebae relay spiral waves of cAMP and stream together into mounds. NextGravity TurnA two-stage rocket flies pad to orbit on a live blueprint, max-Q and all.

Related visualizations

  • Paper MarblingGenerative art Ink drops, combs and styluses on a size bath, then a print pulled onto paper.
  • Shattered PanePhysics A sunny window breaks into radial and ring cracks, then shards tumble and glint.
  • Roman MosaicGenerative art Thousands of tesserae laid in rows that follow every outline, as a Roman mosaicist would.
  • Floral OrnamentGenerative art Scrolls, acanthus leaves and flowers grow to fill any frame, like an engraver's panel.
  • Rose WindowGenerative art Compass-drawn Gothic tracery, glazed panes, and colored sunlight pouring across a nave.
  • Girih Star PatternsGenerative art Interlaced Islamic star patterns built live from one angle over a hidden tiling.
  • Damascus SteelGenerative art Forge pattern-welded steel as a chain of exact maps, then grind and etch the blade.
  • Ambiguous ObjectsIllusions Paper tubes that look round on the table and square in the mirror behind them.
  • Snowflake CutterMath Fold paper into a 12-layer wedge, snip it, and unfold a six-fold snowflake.

Use ← and → to move between demos. While the canvas has focus, keys go to the demo instead.

← More from Emergent Mind Labs