xxxxxxxxxx
251
/* User-defined Functions
Arguments and Parameters
Optional: add some interactive elements to your drawing, especially ones informed by time.
e.g. millis(), second(), minute(), hour()
*/
//Credit to Pranjal Deep for his Mirror suggestion: https://editor.p5js.org/pranjaldeep/sketches/R5OjQ70bM
let mirrorLine = 200;
function setup() {
createCanvas(400, 600);
}
//main function that creates all the ellipses for the parts of the body, including fill and stroke weight, just for kicks to make a new function. I couldn't think of anything more creative for the function.
function drawEllipse(positionX, positionY, sizeX, sizeY, fillColor1, fillColor2, fillColor3, weight) {
fill(fillColor1, fillColor2, fillColor3);
strokeWeight(weight);
ellipse(positionX, positionY, sizeX, sizeY);
}
function draw() {
background(225);
//quadConfetti() //not finished yet
//want necklace behind monkeyhead, so draw it first
drawHarleyBody();
drawMonkeyHead();
drawMonkeyFeet();
}
function drawHarleyBody() {
drawHarleypants();
drawHarleyshirt();
drawHarleyNecklace();
drawHarleyHair();
}
function drawMonkeyHead() {
//left ear
drawEllipse(mirrorLine-50, 90, 20, 20, 242, 198, 154, 2);
//right ear
drawEllipse(mirrorLine+50, 90, 20, 20, 242, 198, 154, 2);
//head
drawEllipse(mirrorLine, 100, 92, 100, 153, 102, 51, 2);
//face
drawEllipse(mirrorLine-10, 106, 55, 80, 242, 198, 154, 0);
drawEllipse(mirrorLine+10, 106, 55, 80, 242, 198, 154, 0);
// cheeks
drawEllipse(mirrorLine, 125, 68, 45, 242, 198, 154, 2);
//eyes
drawEllipse(mirrorLine-20, 90, 12, 15, 0, 0, 0, 0);
drawEllipse(mirrorLine+20, 90, 12, 15, 0, 0, 0, 0);
//nose
drawEllipse(mirrorLine, 116, 18, 20, 0, 0, 0, 0);
}
function drawHarleyNecklace() {
drawEllipse(200, 157, 175, 50, 255, 255, 255, 4);
noFill();
let start = 200;
let increment = 10;
//want there to be some non symmetrical overlap to make it look like curlycues
drawEllipse(start, 163, 20, 20, 255, 255, 255, 2);
drawEllipse(start - increment, 163, 23, 20, 255, 255, 255, 2);
drawEllipse(start - 3 * increment, 163, 19, 25, 255, 255, 255, 2);
drawEllipse(start - 5 * increment, 163, 18, 24, 255, 255, 255, 2);
drawEllipse(start - 2 * increment, 163, 20, 26, 255, 255, 255, 2);
drawEllipse(start - 4 * increment, 163, 15, 25, 255, 255, 255, 2);
drawEllipse(start, 163, 20, 22, 255, 255, 255, 2);
drawEllipse(start + 2 * increment, 163, 20, 23, 255, 255, 255, 2);
drawEllipse(start + 4 * increment, 163, 15, 24, 255, 255, 255, 2);
drawEllipse(start + 3 * increment, 163, 20, 23, 255, 255, 255, 2);
drawEllipse(start + 5 * increment, 163, 19, 25, 255, 255, 255, 2);
drawEllipse(start + increment, 163, 13, 22, 255, 255, 255, 2);
}
function drawHarleyHair() {
//Hair left side
fill(218, 209, 133);
strokeWeight(4);
beginShape();
curveVertex(mirrorLine - 90, 160);
curveVertex(mirrorLine - 90, 160);
curveVertex(mirrorLine - 150, 290);
curveVertex(mirrorLine - 105, 290);
curveVertex(mirrorLine - 75, 170);
curveVertex(mirrorLine - 75, 162);
endShape();
//below hair tie left side
fill(218, 209, 133);
strokeWeight(4);
beginShape();
curveVertex(mirrorLine - 150, 300);
curveVertex(mirrorLine - 150, 300);
curveVertex(mirrorLine - 160, 330);
curveVertex(mirrorLine - 125, 330);
curveVertex(mirrorLine - 135, 300);
curveVertex(mirrorLine - 135, 300);
endShape();
//Hair right side
beginShape();
curveVertex(mirrorLine + 90, 160);
curveVertex(mirrorLine + 90, 160);
curveVertex(mirrorLine + 150, 290);
curveVertex(mirrorLine + 105, 290);
curveVertex(mirrorLine + 75, 170);
curveVertex(mirrorLine + 75, 162);
endShape();
//below hair tie right side
beginShape();
curveVertex(mirrorLine + 150, 300);
curveVertex(mirrorLine + 150, 300);
curveVertex(mirrorLine + 170, 330);
curveVertex(mirrorLine + 135, 330);
curveVertex(mirrorLine + 155, 300);
curveVertex(mirrorLine + 155, 300);
endShape();
//Hair ties
drawEllipse(60, 300, 25, 20, 255, 0, 0, 4);
drawEllipse(350, 300, 25, 20, 255, 0, 0, 4);
}
function drawHarleyshirt() {
//left sleeve
fill(255);
strokeWeight(4);
beginShape();
curveVertex(mirrorLine - 50, 160);
curveVertex(mirrorLine - 50, 160);
curveVertex(mirrorLine - 80, 290);
curveVertex(mirrorLine - 105, 290);
curveVertex(mirrorLine - 65, 170);
curveVertex(mirrorLine - 65, 162);
endShape();
//left sleeve
beginShape();
curveVertex(mirrorLine + 50, 160);
curveVertex(mirrorLine + 50, 160);
curveVertex(mirrorLine + 80, 290);
curveVertex(mirrorLine + 105, 290);
curveVertex(mirrorLine + 65, 170);
curveVertex(mirrorLine + 65, 162);
endShape();
//line down shirt
strokeWeight(10);
arc(204, 155, 20, 260, HALF_PI, 360, OPEN);
//arc(110, 280, 350, 160, 0, QUARTER_PI, OPEN);
//arc(150, 355, 180, 180, 0, QUARTER_PI, OPEN);
//waist
line(165, 280, 240, 280);
//panels on shirt
fill(255);
strokeWeight(4);
quad(164, 286, 195, 286, 192, 400, 150, 390);
quad(204, 286, 242, 286, 256, 390, 210, 400);
//cuffs
fill(0);
//left cuff
quad(mirrorLine-104, 300, mirrorLine-90, 300, mirrorLine-90, 320, mirrorLine-110, 320);
//right cuff
quad(mirrorLine+90, 300, mirrorLine+100, 300, mirrorLine+110, 320, mirrorLine+90, 320);
//fists
//left
drawEllipse(mirrorLine - 100, 330, 22, 25, 255, 255, 255, 2);
line(mirrorLine - 100, 330,mirrorLine - 94,325)
//right
drawEllipse(mirrorLine + 100, 330, 22, 25, 255, 255, 255, 2);
line(mirrorLine + 100, 330,mirrorLine + 94,325)
}
function drawHarleypants() {
drawEllipse(200, 250, 80, 300, 255, 255, 255, 0);
triangle(mirrorLine, 350, mirrorLine - 70, 400, mirrorLine + 70, 400);
}
function drawMonkeyFeet() {
fill(0);
//left leg
quad(mirrorLine - 70, 400, mirrorLine - 50, 400, mirrorLine - 70, 450, mirrorLine - 80, 450);
//left foot
drawEllipse(mirrorLine - 80, 453, 25, 10, 0, 0, 0, 0);
//right foot
drawEllipse(mirrorLine + 80, 453, 25, 10, 0, 0, 0, 0);
//right leg
quad(mirrorLine + 50, 400, mirrorLine + 70, 400, mirrorLine + 80, 450, mirrorLine + 70, 450);
//tail
push()
stroke(153, 102, 51);
noFill();
strokeWeight(10);
arc(mirrorLine+10,414, 30, 30, 0, PI + QUARTER_PI),OPEN;
arc(mirrorLine+20,440, 30, 30, 0, PI + QUARTER_PI),OPEN;
pop()
}
// ///not finished yet
// function quadConfetti(){
// fill(random,random,random);
// quad(mouseX-104, mouseY, mouseX-90, mouseY, mouseX-90, mouseY+20, mouseX-110, mouseY+20);
// }