I converted this to SVG from the p5 code without too much of a rewrite.
With only 30 branches the SVG file was over 168MB with the 30th branch translation of rotates + translates being a 282,996 bytes character string.
It’s another of my SVG learning exercises that have taught me a lot and been crazy to actually do without a big rewrite to work with SVGs strengths instead of working with SVGs like they have the abilities of P5.js
They also have support for applying arbitrary geometric transformations to objects. I would expect you can express the same drawing in a few kilobytes, though it might still be very slow to render in some implementations.
MDN <Use> says, Only the attributes x , y , width , height and href on the use element will override those set on the referenced element. So stroke colour doesn’t change.
Transform isn’t changed or appended to when updated via the href.
The X1 Y1 X2 Y2 are like the stroke colour and not changed when <use> is used. Even making changes in the debugger doesn’t affect these attributes.
I could see that working if the groups g are nested as that would allow the following translates and rotates to accumulate instead of being every growing strings.
Which does 70 levels before the doomed gray cells. I guess having 7756 nested groups is a bit much. The saved SVG also has issues loading into the browser with it throwing a XML Parsing Error: But the file size is down to 2.5MB so that’s better.
After running the 168MB through SVGOMG - SVGO's Missing GUI I see it converted everything to paths.
So I have been thinking how I could do that. I figure it could be done with customs translate and rotate functions that return polar coordinates, but that would be another level of development I don’t think I would want to do as a rewrite would be easier. But that would diverge from the core I wanted was to write in a style that followed the original P5 code using SVG.