//Tim Nelson-Pyne
//tnelsonp@andrew.cmu.edu
//Section C
//Project-05-Wallpaper
//controls the spacing of the pattern
var cellSize;
//controls the width of the eyes
var eyeWidth;
//controls the height of the eyes
var eyeHeight;
//controls the x position of the patten elements
var x;
//controls the y position of the pattern elements
var y;
function setup() {
createCanvas(600, 600);
background(255);
cellSize = width / 4
}
//tileA draws everything to do with the eyes
function tileA(x, y, cellSize) {
eyeHeight = cellSize / 7;
eyeWidth = cellSize / 4;
//clown makeup
stroke(248, 24, 148);
fill(255, 204, 239);
strokeWeight(4);
bezier(x + eyeWidth / 4, y + eyeHeight + 5, x, y + eyeHeight + 5, x, y + eyeHeight + 5, x, y + cellSize / 2 - 10);
bezier(x - eyeWidth / 4, y + eyeHeight + 5, x, y + eyeHeight + 5, x, y + eyeHeight + 5, x, y + cellSize / 2 - 10);
bezier(x + eyeWidth / 4, y - eyeHeight - 5, x, y - eyeHeight - 5, x, y - eyeHeight - 5, x, y - cellSize / 2 + 10);
bezier(x - eyeWidth / 4, y - eyeHeight - 5, x, y - eyeHeight - 5, x, y - eyeHeight - 5, x, y - cellSize / 2 + 10);
//eye shadow
for (i = 0; i < 20; i += 1) {
noFill();
strokeWeight(.5);
stroke(248, map(i, 0, 20, 24, 255), map(i, 0, 20, 148, 255));
ellipse(x, y, eyeWidth + i, eyeHeight + i);
}
// eye
fill(255);
strokeWeight(3);
stroke(245, 230, 0);
ellipse(x, y, eyeWidth, eyeHeight);
fill(0, 0, 255);
ellipse(x, y, 20, eyeHeight);
fill(255);
noStroke();
arc(x, y, 20, eyeHeight, radians(220), radians(250))
}
//tileB draws the mouth
function tileB(x, y, cellSize) {
noFill();
strokeWeight(5);
stroke(248, 24, 148);
arc(x, y, cellSize / 3, cellSize / 10 + 10, radians(0), radians(180));
arc(x, y, cellSize / 3, cellSize / 10, radians(0), radians(180));
}
//tileC draws the nose
function tileC(x, y, cellSize) {
fill(248, 24, 148);
noStroke();
ellipse(x, y - cellSize / 4, cellSize / 4, cellSize / 4);
fill(255, 204, 239);
ellipse(x, y - cellSize / 4, cellSize / 5, cellSize / 5);
}
function draw() {
for (x = cellSize / 2; x < width; x += cellSize){
for (y = cellSize / 2; y < height; y += cellSize){
tileA(x, y, cellSize);
}
}
for (x = cellSize; x < width; x += cellSize){
for (y = cellSize; y < height; y += cellSize){
tileB(x, y, cellSize);
tileC(x, y, cellSize);
}
}
noLoop();
}
I made a clown face wallpaper. The walls have eyes, and they’re clowning you.