xxxxxxxxxx
164
var hairX;
var hairY;
var hairR = 0;
var hairG = 0;
var hairB = 0;
var left = 200;
var right = 200;
function setup() {
createCanvas(600, 600);
background(200,200,255);
}
function draw() {
// face template
fill(100, 100, 255);
ellipse(300, 300, 500, 500);
eyebrow(left,right);
leftEye();
rightEye();
mouth();
nose(275, 300);
hair();
}
function mouth(){
noStroke()
fill(255,0,0)//upper lip
triangle(200-12.5,400,300-12.5,400,300-12.5,350)
triangle(300-12.5,350,300-12.5,400,312.5-12.5,362.5)
triangle(325-12.5,350,325-12.5,400,312.5-12.5,362.5)
triangle(300-12.5,400,325-12.5,400,312.5-12.5,362.5)
triangle(425-12.5,400,325-12.5,400,325-12.5,350)
//end of the upper lip
triangle(200-12.5,400,312.5-12.5,400,312.5-12.5,440)
triangle(425-12.5,400,312.5-12.5,400,312.5-12.5,440)
stroke("black")
fill(0,0,0)
line(200-12.5,400, 425 -12.5,400)
}
function leftEye(){
fill(255,255,255);
ellipse(200, 250, 30, 22);
if(mouseIsPressed==true){
fill(200, 0, 0);
line(220, 225, 180, 220);
}else {
fill(61, 128, 71);
line(220, 215, 180, 220);
}
ellipse(200, 250, 20, 20);
fill(0,0,0);
ellipse(200,250, 4, 20);
//Farris, Diya, Bereket
}
function nose(fx,fy){
fill(105,204,42);
noStroke();
triangle(fx,fy,fx +40, fy -80, fx +80, fy)
fill(25,25,25)
ellipse(fx + 20,fy-5, 25,25)
ellipse(fx + 60,fy-5, 25,25)
stroke(255, 0, 221);
strokeWeight(2);
line(fx+20,fy-5, fx + 5, fy + 10)
line(fx+20,fy-5, fx + 15, fy + 10)
line(fx+20,fy-5, fx + 30, fy + 10)
line(fx+60,fy-5, fx + 45, fy + 10)
line(fx+60,fy-5, fx + 60, fy + 10)
line(fx+60,fy-5, fx + 75, fy + 10)
noStroke();
fill(237, 207, 14)
rect(fx + 60, fy - 30, 12, 12)
fill(57, 99, 64);
ellipse(fx+30,fy - 30,10,10)
ellipse(fx+45,fy - 50,10,10)
ellipse(fx+55,fy - 35,10,10)
}
function eyebrow() {
fill(230, 66, 245)
ellipse(200,left, 100,50);
ellipse(400, right, 100, 50);
fill(100,100,255)
noStroke();
ellipse(200,left+20,100,50)
ellipse(400,right+20,100,50)
if (keyIsPressed == true) {
if (keyCode == UP_ARROW) {
left--;
right--;
} else if (keyCode == DOWN_ARROW) {
left++;
right++;
}
console.log(left)
}
}
function rightEye() {
var eyeR = [255, 0];
var eyeG = [0, 255];
var eyeB = [0, 0];
var i = 0;
fill(255);
ellipse(425, 250, 120,60);
fill(0);
ellipse(425, 250, 20, 20)
if (mouseIsPressed) {
i = i + 1;
}
fill(eyeR[i], eyeG[i], eyeB[i]);
ellipse(425, 250, 60, 60);
//Oscar, Annika, Aarav
}
function hair(){
console.log("hair")
for(var i = 0; i < 100; i = i + 1){
hairX = random(200,400);
hairY = random(50-frameCount/18,100);
}
strokeWeight(4);
stroke(hairR,hairG,hairB);
line(hairX,hairY,hairX+5,hairY+5);
}
function mouseClicked() {
if(hairR + hairG + hairB == 0){
hairR = random(100,255);
hairG = random(100,255);
hairB = random(100,255);
}
}