Ward Penney-Schotter
Ward Penney – Schotter, Processing.js Active Object
Ward Penney – Schotter, Processing Applet
Ward Penney – Schotter, Code
/*
Interactive Art & Computational Design / Spring 2011
Carnegie Mellon University
Ward Penney
12-Jan-2011
This is an educational reproduction of the Schotter computational art, located at http://www.medienkunstnetz.de/works/schotter/
*/
// setup variables
int rows = 24; // rows of sqaures
int columns = 12; // columns of squares
int margin = 30; // margin around the matrix
int sideLength = 25; // side of each square
float factor = .5; // factor for randomness, smaller fraction means less variability in rotation and offset of squares
void setup() {
// set up the screen to have the desired margins around the determined
// amount of rows / columns of squares of a given sideLength
int sizeX = 2*margin + columns*sideLength;
int sizeY = 2*margin + rows*sideLength;
size (sizeX, sizeY);
smooth(); // turn on anti-aliasing
noFill(); // turn of rectangle fills
background(#FFFFFF); // background color
noLoop(); // execute draw() only once
}
void draw() {
// count squares
int squareCount = 1;
// print rows
for (int ir = 1 ; ir < rows ; ir ++) {
// print columns
for (int ic = 1 ; ic < columns ; ic ++) {
// translate
translate(margin + ic*sideLength + sideLength/2, margin + ir*sideLength + sideLength/2);
// get proportional counter / count amount of rotaion, over a degree range
float absRotationDegs = (map(squareCount, 0, rows * columns - 1, 0, 360) * factor)/2;
float randomRotationRadians = radians(random(-absRotationDegs, absRotationDegs));
rotate(randomRotationRadians);
// get random offsets, halved for negtive possibility
float absOffsetX = (map(squareCount, 0, rows * columns - 1, 0, sideLength/2) * factor)/2;
float absOffsetY = (map(squareCount, 0, rows * columns - 1, 0, sideLength*2) * factor)/2;
float randomOffsetX = random(-absOffsetX, absOffsetX);
float randomOffsetY = random(-absOffsetY, absOffsetY);
// draw rectangle
rectMode(CENTER);
rect(randomOffsetX, randomOffsetY, sideLength, sideLength);
// rotate back
rotate(-randomRotationRadians);
// translate back
translate(-1*(margin + ic*sideLength + sideLength/2), -1*(margin + ir*sideLength + sideLength/2));
// increment square count
squareCount += 1;
}
}
}
Ward Penney - Schotter video demo in OpenFrameworks