mondrian-generator
mondrian-generator copied to clipboard
Make canvas white; fake Earl Brown scores; set line width dynamically; fix bugs.
More prep work in anticipating of extending script functionality to non-Mondrian works of art.
There are 3 types of changes in this P.R., maintainability changes, feature changes, and bug fixes:
Feature Changes:
- Make canvas background white, not transparent (while it appears white on index.html, that's only because it's the default styling; downloading the image will show weird, transparent spaces where there is no RYB color.)
- Generate .png files that imitate the work of artists besides Piet Mondrian, like Earle Brown and his aleatoric music scores (as in his work "December 1952")
- Make line widths differ dynamically (a major feature of Mondrian's work, previously absent from the abilities of this
mondrian-generator
repo.)
Maintainability Changes:
- Removed comments that are now redundant, in view of code changes (like var renames & func modularizations);
- Divided functions into smaller, more re-usable parts;
- Made var names more specific, particularly to underline the evolution of the canvas' drawn lines from internal points, to external points, and, finally, to 2-dimensional realizations.
- Modularize tag into its own external
.css
file.
Bug Fixes:
- Fixed bug in use of
.getRandomInt
that would generate erroneous indexes for arrays (was accidentally passing inarray.length
, notarray.length - 1
.)
N.B.: There is one outstanding bug — the code here will sometimes generate undefined
values. If xPtr
or yPtr
is the last index in an array, then xLineStarts[xPtr + 1]
will obviously not exist. However, this bug is not surfacing in the actual .png
images themselves anywhere, so I'll leave it aside for now.