Meg Richards – Schotter

by Meg Richards @ 8:02 am 12 January 2011

Processing.js:

Processing Applet:

Source Code:

void setup() {
 // define the window size & enable anti-aliasing
 size(550, 800);
 background(255);
 smooth();
 noFill(); // not solid squares
 noLoop(); // only draw() once
}
 
void draw() {
 // allow for some padding around the edge
 translate(30,10);
 
 int x = 0, y = 0, side = 30;
 int i = 0;    // increment just like the original
 float j1, j2; // random numbers for translation and rotation
 
 for (int k = 0; k < 24; k++ ) { // iterate through y-axis
   for (int j = 0; j < 16; j++ ) { // iterate through x-axis
     i++;
     translate(x, y); // re-define coordinate axis to square
 
     // pick increasingly variable random numbers for
     j1 = random(-15*i/244,15*i/244); // translation
     j2 = random(-15*i/244,15*i/244); // & rotation
 
     // rotation should only affect one square at a time,
     //   so push and then pop that alteration to the coordinate axis
     pushMatrix();
     rotate(radians(j2));  // rotate the axis
     rect(j1, j1, 30, 30); // plot the square
     popMatrix(); // return the axis to its original state
 
     x=30; // x-position advances for each square drawn in row
     y=0;  // y-position shouldn't change in the middle of a row
   }
   x=-450; // return x to beginning of row position
   y=30;   // adjust y to next row
 }
}

OpenFrameworks:

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.
(c) 2023 Interactive Art & Computational Design / Spring 2011 | powered by WordPress with Barecity