xxxxxxxxxx
65
/*
Assignment 2: Self Portrait
*/
var r = 0;
var b = 255;
function setup() {
createCanvas(500, 500);
}
function draw() {
r = map(mouseX, 0, 500, 0, 255);//background
b = map(mouseX, 0, 500, 255, 0);
background(r, 0, b);
noStroke(); //face
fill("#E0AC69");
ellipse(250, 250, 210, 265);
stroke("#8D5524"); //teeth
strokeWeight(4);
line(190, 320, 290, 330);
noStroke(); //eyes
fill("white");
arc(290, 230, 40, 60, -PI, PI * 2, CHORD); //outer R
arc(210, 230, 40, 60, -PI, PI * 2, CHORD); //outer L
fill("#8D5524");
arc(290, 230, 20, 40, -PI, PI * 2, CHORD); //pupil R
arc(210, 230, 20, 40, -PI, PI * 2, CHORD); //pupil L
fill("black");
arc(295, 230, 10, 15, -PI, PI * 2, CHORD); //pupil R
arc(215, 230, 10, 15, -PI, PI * 2, CHORD); //pupil L
fill("#E0AC69"); //ears
arc(350, 230, 50, 50, -PI / 2, PI / 2); //ear R
arc(150, 230, 50, 50, PI / 2, -PI / 2); //ear L
stroke("#8D5524"); //nose
strokeWeight(4);
fill("#E0AC69");
triangle(240, 275, 250, 250, 260, 275);
fill("white"); //hat
stroke("black");
strokeWeight(8);
arc(250, 180, 195, 170, -PI, PI * 2, CHORD);
fill("black"); //hat bill
noStroke();
arc(250, 180, 195, 60, -PI, PI * 2, CHORD);
fill("black");
textSize(30);
text('Move the mouse Left to Right', 60, 50);
}