Here’s a mostly worked out example of what we were pecking at last Wednesday. This sketch draws rectangles that adapt to fit the container. Move the mouse over the sketch in X/Y to change the grid and the gap.
Note that if you load this up in a non-square window (go to the code and load it full screen or duplicate and adjust the canvas size), the rectangle shape will match the aspect ratio of the canvas.
This sketch uses a couple concepts we haven’t talked about in class yet (but will this week!): functions and map()
.
Here’s the code.https://editor.p5js.org/bengrosser/sketches/PIkPHXrR3