/ p5 / re-code 09

De Computer Graphics and Art vol1 no4 page 29 // par Reiner Schneeberger and students

// This sketch is part of the ReCode Project - http://recodeproject.com
// From Computer Graphics and Art vol1 no4 pg 29
// by Reiner Schneeberger and students
// Computer graphics made at the University of Munich (West Germany)
// 
// Genevieve Hoffman
// 2012
// Creative Commons license CC BY-SA 3.0


var cols = 10;
var rows = 80;
var counter = 0;

function setup() {
 createCanvas(540, 800);
 background(255);
 stroke(0);

 var horiz = width/cols;
 var vert = horiz/2;

 for (var i = 0; i < rows; i++) {
 for (var j = 0; j < cols; j++) {
 var rand = random(0, 2); 
 if (rand > 1) {
 //draw vertical lines
 for (var k = 0; k < horiz; k+=horiz/8) {
 line(j*horiz+k, i*vert, j*horiz+k, i*vert+vert);
 }
 } 
 else {
 //draw horizontal lines
 for(var k = 0; k < vert; k+=vert/8) {
 line(j*horiz, i*vert+k, j*horiz+horiz, i*vert + k);
 }
 }
 }
 }
}

function draw() {
}

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