De Computer Graphics and Art vol2 n°3 page 10
// This sketch is part of the ReCode Project - http://recodeproject.com // From Computer Graphics and Art vol2 no3 pg 10 // by William Kolomyjec // "Boxes" // // Sermad Buni // 2012 // Creative Commons license CC BY-SA 3.0 function setup() { var canvaswidth = 17; var canvasheight = 17; var square_size = 40; var randomness = 0.03; var iw, jh; smooth(8); createCanvas( (canvaswidth+2)*square_size, (canvasheight+2)*square_size); background(255); noFill(); for(var i=0; i < canvaswidth; i++) { for(var j=0; j < canvasheight; j++) { push(); translate((square_size*i), (square_size*j)); if(canvasheight % 2 == 0) { iw = canvaswidth/2 - Math.abs(i - canvaswidth/2); } else { iw = canvaswidth/2 - 0.5 - Math.abs(i - canvaswidth/2 - 0.5); } if(canvasheight % 2 == 0) { jh = canvasheight/2 - 0.5 - Math.abs(j - canvasheight/2 + 0.5); } else { jh = canvasheight/2 - Math.abs(j - canvasheight/2); } if( jh != 0 || iw != 0) { rotate( radians(iw * iw * jh * jh * random(-randomness,randomness)) ); } rect(square_size, square_size, square_size, square_size); pop(); } } }