For the wallpaper assignment I drew a pattern of corgi faces and dog treat bones. I was inspired by my puppy who would not let me sit down and do this homework assignment. I was not successful and sketching the faces myself so I used some images linked below as references.
function setup() {
createCanvas(600, 600);
rectMode(CENTER);
noLoop();
}
function draw() {
background(230, 188, 191);
strokeWeight(0);
//columns of 3 corgi faces
for(x=50; x<300; x+=100){
for(y=50; y<300; y+=100) {
push();
translate(x,y);
corgiFace(x, y, 100);
pop();
}
}
//columns of 2 corgi faces
for(x=100; x<300; x+=100) {
for(y=100; y<300; y+=100) {
push();
translate(x,y);
corgiFace(x, y, 70);
pop();
}
}
//columns of 2 dog bones
for(x=50; x<300; x+=100) {
for(y=100; y<300; y+=100) {
push();
translate(x,y);
dogBone(x, y, 20);
pop();
}
}
//columns of 3 dog bones
for(x=100; x<300; x+=100) {
for(y=50; y<300; y+=100) {
push();
translate(x, y);
dogBone(x, y, 20);
pop();
}
}
}
function dogBone(x, y, size) {
strokeWeight(0);
fill(255);
rect(x, y, size, size/2);
circle(x-size/2, y+5, size/2);
circle(x-size/2, y-5, size/2);
circle(x+size/2, y+5, size/2);
circle(x+size/2, y-5, size/2);
}
function corgiFace(x, y, size) {
fill(245, 191, 120);
//draws head shape
ellipse(x, y, size, size+10);
ellipse(x,y+10, size, size-10);
//left and right ear, respectively
triangle(x-size/2, y, x-size*4/7, y-size*5/7, x-size/7, y-size*3/7);
triangle(x+size/2, y, x + size*4/7, y-size*5/7, x+size/7, y-size*3/7);
fill(255);
//inside of ear
triangle(x-size/2, y - size*2/7, x-size/2, y-size*4.5/7, x-size*2/7, y-size*3/7);
triangle(x+size/2, y - size*2/7, x+size/2, y-size*4.5/7, x+size*2/7, y-3*size/7);
//face markings
ellipse(x,y, size/7, size*3/7);
ellipse(x, y + size*2/7, size*4/7, size*3/7);
fill(0);
//eyes
circle(x - size*2/7, y, size/7);
circle(x+size*2/7, y, size/7);
//nose
ellipse(x, y + size*15/70, size*2/7, size/7);
//mouth
arc(x, y+size*25/70, size/7, size/14, 2*PI, PI);
}