For my wallpaper I thought to use a textile pattern I was familiar with. Houndstooth is useful in that it can be scaled to be very small or abstractly large.
//Sean B. Leo
//sleo@andrew.cmu.edu
//Section C
//Project 05 Wallpaper
var x1 = 10; //changing the value of x1 will change the scaling of the pattern
var x2 = x1*2;
var x3 = x1*3;
var x4 = x1*4;
var y1 = x1;
var y2 = y1*2;
var y3 = y1*3;
var y4 = y1*4;
var value = 0;
function setup() {
createCanvas(600, 600);
}
function draw() {
noStroke();
background(255);
//Scales the color based on the mouse position
r = map(mouseX, 0, width, 0, 200);
g = map(mouseX/mouseY, 0, 600, 0, 200);
b = map(mouseY, 0, height, 0, 200);
for (var x = 0; x < width+x1; x += x1*4) {
for (var y = 0; y <height+y1; y += y1*4) {
houndstooth (x-30, y-30);
}
}
}
function houndstooth(x,y) {
fill(r, g, b);
push();
translate(x, y);
rect(x2, y2, x2, y2);
quad(0, y4, x2, y2, x2, y3, x1, y4);
quad(x2, y4+y1, x3, y4, x4, y4, x2, y4+y2);
triangle(x3, y2, x4, y1, x4, y2);
triangle(x4, y2, x4+x1, y2, x4, y3);
pop();
}
/* the original coordinate positions draw to determine the relative values
rect(50, 50, 50, 50);
quad(0,100, 50, 50, 50, 75, 25, 100);
quad(50, 125, 75, 100, 100, 100, 50, 150);
triangle(75, 50, 100, 25, 100, 50);
triangle(100, 50, 125, 50, 100, 75);
*/