var gridarr = [ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1], [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0], [0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0], [0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0] ]; var a = 0; function setup() { createCanvas(1500, 800); background(50); function drawarray(fade) { for (var i = 0; i < 16; i++) { for (var j = 0; j < 16; j++) { a = gridarr[i][j]; if (a === 1) { fill(158, 255, 164); } else { fill(255, 130, 177); } // typical way of mapping out a grid (counter * scale) + offset // where counter is a var from the forloop // scale is value that will term the size/position of each drawing // offset is a relative movement to place // the grid collection around on the canvas rect((j * 30) + 15, (i * 30) + 15, 20, 20); } } } push(); translate(20, 20); drawarray(255); pop(); push(); translate(850, 20); rotate(radians(45)); drawarray(255); pop(); push(); translate(900, 700); rotate(radians(-45)); scale(.3); drawarray(100); pop(); push(); translate(1000, 150); rotate(radians(-65)); scale(.5); drawarray(100); pop(); }