
Second go at an online chocolate bar configurator, rebuilt from scratch three years after Chocolade Chaud. Pick a tablet and its chocolate, stack a few implicit surfaces - gyroid, Schwarz P and D, Neovius - into a pattern, and export the bar as STL or OBJ to 3D print a mould.
The pattern is a tree of distance functions, its output is how far the top of the bar moves, in mm. Besides the methods there are SVG shapes, text on a straight line or along a curve, and waves that turn the distance of whatever they hold into ripples, so a wave around a text echoes its outline. A combined tablet fills the 6 x 2 units of a whole 150 x 70 mm bar with smaller pieces, picked from all 30 ways to fill it, which share one design, each repeat it, or differ from it piece by piece.
The preview bakes the pattern on the GPU into a top surface. The exported mesh is made in a web worker instead: closed, tilted on its side and with an internal support structure for printing. Entire state stored in the url, packed with densing! Though an uploaded SVG does not fit in a link, it only lives in the browser it was uploaded in.

The patterns a bar can start from in simple mode, each in another chocolate.
One of the 30 ways to fill the whole tablet, with the pattern as one design, repeated on every piece, or unique per piece.