Noah Johnson Project 3: Wallpaper (nmjohnso)

sketch

/*
 * Noah Johnson
 * nmjohnso@andrew.cmu.edu
 * Section E
 *
 * This program draws wallpaper of circles that vary in color.
 */

 
function setup() {
    createCanvas(640, 640);
}

function draw() {
	var ox = 40;
	var oy = 40;
	var d  = 10;
	background(255);
	noStroke();
	for (var r = 0; r < 16; r++) {
		for (var c = 0; c < 16; c++) {
			if (c < 8) {
				if (r < 8) fill(238, 33, 94);
				else fill(230);
			}
			else {
				if (r >= 8) fill(238, 33, 94);
				else fill(230);
			}
			var px = d + r*ox;
			var py = d + c*oy;
			ellipse(px, py, d, d);
			ellipse(px, py, d, d);
		}
	}
	noLoop();
}