Project 05: Wallpaper

sketch

//Catherine Liu
//jianingl
//Section D

var catList = [1, 2, 3]; //keeps track of cat for genration of wallpaper

function setup() {
    createCanvas(600, 600);
    background(230,230,250);
}

function draw() {
    for (var y = 30; y <= 600; y += 100) {
        for (var x = 50; x <= 550; x += 150) {
            var cat = random(catList); //randomly generates a cat at that position
            if (cat == 1) {
                CatStand(x,y);
            } else if (cat == 2) {
                CatFront(x,y);
            } else if (cat == 3) {
                CatSit(x,y);
            }
        }
    }
    noLoop()
}

function CatStand (x, y) {
    strokeWeight(2);
    push();
    noFill();
    strokeWeight(5);
    stroke(233,150,122);
    arc(x + 60, y-20, 50, 50, 0, HALF_PI); //tail
    pop();

    stroke(139,69,19)
    fill(233,150,122);
    ellipse(x+60, y + 40, 5, 20); // back left leg
    ellipse(x+10, y + 40, 5, 20); // left front leg
    ellipse(x + 40, y + 20, 80, 50); //body
    triangle(x + 15, y - 15, x + 30, y - 25, x + 25, y - 5); // right ear
    triangle(x - 15, y - 15, x - 30, y - 25, x - 25, y - 5); // left ear
    ellipse(x, y, 50, 40); //head
    ellipse(x+70, y + 42, 5, 20); //back right leg
    ellipse(x+18, y + 43, 5, 20); // right front leg

    fill(100,107,47);
    ellipse(x-15, y, 10, 5); //left eye
    ellipse(x+5, y, 10, 5); //right eye
    fill(205,92,92);
    ellipse(x-7, y+5, 5, 3); //nose

    stroke(0,100,0);
    fill(50,205,50);
    circle(x-20, y+50, 10);
    push();
    noFill();
    arc(x -65, y+45, 50, 50, 0, HALF_PI);
    pop();
    circle(x-35, y +50, 15);
    push();
    noFill();
    arc(x + 83, y-20, 50, 50, 0, HALF_PI);
    pop();
    circle(x+ 85, y+3, 8);

}

function CatFront (x, y) {
    strokeWeight(2);
    push();
    noFill();
    strokeWeight(5);
    stroke(139,69,19);
    arc(x + 45, y-20, 50, 50, 0, HALF_PI); //tail
    pop();

    stroke(139,69,19)
    fill(255,218,185);
    ellipse(x+10, y+10, 90, 70); //body
    triangle(x + 15, y - 15, x + 30, y - 25, x + 25, y - 5); // right ear
    triangle(x - 15, y - 15, x - 30, y - 25, x - 25, y - 5); // left ear
    ellipse(x, y, 50, 40); //head
    fill(119,136,153);
    ellipse(x-15, y, 10, 5); //left eye
    ellipse(x+5, y, 10, 5); //right eye
    fill(244,164,96);
    ellipse(x-7, y+5, 5, 3); //nose


    fill(255,218,185);
    ellipse(x + 35, y + 40, 20, 10); // right leg
    ellipse(x - 10, y + 40, 20, 10); // left leg

    stroke(70,130,180);
    push();
    noFill();
    arc(x -60, y+45, 50, 50, 0, HALF_PI);
    arc(x + 80, y+15, 50, 50, 0, HALF_PI)
    pop();
    fill(135,206,235);
    circle(x-30, y+45, 10);
    circle(x+80, y+45, 15);
}

function CatSit (x, y) {
    strokeWeight(2);
    push();
    noFill();
    strokeWeight(5);
    stroke(119,136,153);
    arc(x + 60, y-10, 50, 50, 0, HALF_PI); //tail
    pop();

    stroke(139,69,19);
    fill(119,136,153);
    ellipse(x+5, y+50, 10, 20); //front right leg
    ellipse(x+30, y+30, 70, 60); //body
    ellipse(x+45, y+50, 30, 20); //back leg
    ellipse(x+15, y+50, 10, 20); //front left leg
    triangle(x + 15, y - 15, x + 30, y - 25, x + 25, y - 5); // right ear
    triangle(x - 15, y - 15, x - 30, y - 25, x - 25, y - 5); // left ear
    ellipse(x, y, 50, 40); //head
    fill(0,100,0)
    ellipse(x, y, 10, 5); //left eye
    ellipse(x-15, y, 10, 5); //right eye
    fill(40,26,13)
    ellipse(x-7, y+5, 5, 3); //nose

    stroke(75,0,130);
    fill(147,112,219);
    circle(x+60, y-15, 15);
    circle(x+75, y-15, 15);
    ellipse(x+75, y-5, 10, 5);
    ellipse(x+60, y-5, 10, 5);

    push();
    strokeWeight(3)
    line(x+67, y-15,x+67, y-5);
    pop();

    push();
    noFill();
    arc(x -65, y+45, 50, 50, 0, HALF_PI);
    pop();
    circle(x-35, y +50, 15);
}

Before creating this wallpaper, one of my friends from home called me and showed me pictures of her cats. In the spur of the moment, I thought that it’d be cute to create a wallpaper full of cats. I also thought it would be cool if the wallpaper could generate different versions of itself. For this, I created 3 different cats and had the draw function choose a random cat to draw each time it ran through the 2 for loops. For each cat, I drew up a quick sketch of what I wanted each cat to look like and added some decorative yarn and butterflies to make them look more like wallpaper:

quick sketches of different cat positions

Leave a Reply