/ p5 / re-code 15

Inspiré par Computer Graphics and Art vol3 n°2 page 16, « Untitled photoprint », 15″ x 19″ par by Aaron Marcus

// This sketch is part of the ReCode Project - http://recodeproject.com
// From Computer Graphics and Art vol3 no2 pg 16
// by Aaron Marcus
// "Untitled photoprint", 15" x 19"
// Other works in the Hieroglyphs series are "Noise Barrier", and various "Untitled" works.
// 
// Genevieve Hoffman
// 2012
// Creative Commons license CC BY-SA 3.0

function setup() {
 createCanvas(780,780);
 background(0);
 
 var gridSize = width/10;
 
 for (var x = gridSize; x <= width; x += gridSize) {
 for (var y = gridSize; y <= height; y += gridSize) {
 
 //make grid
 stroke(255);
 smooth();
 line(x, 0, x, height);
 line(x-gridSize, y, width, y);
 
 //generate random seed values for location and size
 var randLoc = random(-gridSize/2,gridSize/2);
 var randLoc2 = random(-gridSize/2,gridSize/2);
 var randLoc3 = random(-gridSize/2,gridSize/2);
 var randLoc4 = random(-gridSize/2,gridSize/2);
 var randLoc5 = random(-gridSize/2,gridSize/2);
 var randLoc6 = random(-gridSize/2,gridSize/2);
 var randLoc7 = random(-gridSize/2,gridSize/2);
 var randLoc8 = random(-gridSize/2,gridSize/2);
 var circSize = random(0, gridSize-10);
 var sqSize = random(0, (gridSize-10)/2);
 
 //draw circles
 noFill();
 ellipse(x+randLoc, y+ randLoc2, circSize, circSize);
 
 //draw squares
 push();
 translate(x+randLoc3, y+randLoc4);
 rotate(random(TWO_PI));
 rect(0, 0, sqSize, sqSize);
 pop();
 
 //draw lines
 push();
 translate(x+randLoc5, y+randLoc6);
 rotate(random(TWO_PI));
 line(0,0,randLoc7, randLoc8);
 pop();
 }
 }
}

function draw() {
 
}

function keyPressed() {
 //saveFrame("Aaron_Marcus_Untitled2_###.jpg");
}