(Press on portrait to change background)
// Ankitha Vasudev
// Section B
// ankithav@andrew.cmu.edu
// Project-01-Face
function setup() {
createCanvas(600, 600);
}
function draw() {
noStroke();
//background squares
background(255, 218, 255);
fill(255, 180, 255);
rect(10, 10, 580, 580);
fill(213, 231, 255);
rect(20, 20, 560, 560);
rect(30, 30, 500, 500);
//background color change
if (mouseIsPressed) {
if (mouseButton === LEFT) {
fill(172, 220, 255);
rect(0, 0, 600, 600);
fill(255, 220, 255);
rect(10, 10, 580, 580);
fill(182, 234, 255);
rect(20, 20, 560, 560);
}
}
//hair
fill(1);
rect(210, 180, 212, 240, 200, 200, 15, 20);
fill(60, 0, 0);
rect(220, 190, 190, 215, 150, 150, 15, 20);
//shoulders
fill(255, 180, 255);
rect(180, 428, 260, 185, 20);
triangle(160, 600, 180, 450, 180, 600);
triangle(440, 600, 440, 450, 460, 600);
fill(189, 190, 255);
arc(310, 428, 60, 60, 0, PI, OPEN);
stroke(189, 190, 255);
strokeWeight(3);
line(220, 470, 200, 600);
line(400, 470, 415, 600);
//neck
noStroke();
fill(123, 77, 0);
rect(290, 370, 40, 75, 100);
//ears
ellipse(231, 305, 18, 30);
fill(96, 68, 0);
ellipse(232, 305, 14, 18);
fill(237, 239, 122);
ellipse(231, 320, 7, 7);
//face
fill(123, 77, 0);
rect(233, 205, 150, 200, 100);
//eyes
fill(255);
arc(270, 290, 30, 30, PI, 0, OPEN);
arc(343, 290, 30, 30, PI, 0, OPEN);
fill(0);
ellipse(270, 284, 15, 15);
ellipse(343, 284, 15, 15);
//left eyebrow
beginShape();
vertex(252, 268);
vertex(264, 265);
vertex(290, 267);
vertex(292, 263);
vertex(262, 262);
endShape(CLOSE);
//right eyebrow
beginShape();
vertex(323, 263);
vertex(351, 262);
vertex(363, 268);
vertex(352, 265);
vertex(325, 267);
endShape(CLOSE);
//glasses
stroke(115, 0, 113);
strokeWeight(3);
noFill();
rect(250, 270, 40, 30, 5, 5, 90, 90);
rect(323, 270, 40, 30, 5, 5, 90, 90);
line(290, 280, 323, 280);
line(234, 272, 251, 272);
line(361, 272, 382, 272);
//nose
stroke(0);
strokeWeight(2);
line(310, 310, 300, 335);
line(300, 339, 310, 338);
//mouth
fill(60, 0, 0);
quad(290, 365, 325, 365, 315, 372, 292, 374);
}
I tried to experiment with multiple shapes and commands using a very animated style of drawing. I wanted to include features that were specific to me; these include my purple-frame glasses and my brown and black hair. Lastly, I used a palette comprising of my favorite colors (pastel shades of blue and pink) for the background and used the mouseIsPressed command to alter the background color.