xxxxxxxxxx
var song;
function preload() {
song = loadSound("happyMusic.mp3");
}
function setup() {
createCanvas(800, 800);
song.play();
}
function draw() {
//Background
if (mouseIsPressed) {
background('#4FA3E4');
noStroke();
fill('yellow')
ellipse(windowWidth / 64, windowHeight / 64, 400, 400)
} else {
background('#696969');
}
//Setup
var skin = color('#FFE1C5');
var hair = color('#4C3209');
noStroke();
ellipseMode(CENTER);
// face
noStroke();
fill(skin);
ellipse(width / 2, height / 2, 450, 600);
// hair
noStroke()
fill(hair);
arc(width / 2, height / 2 - 125, 400, 200, 0, PI + QUARTER_PI, CHORD);
arc(width / 2, height / 2 - 125, 410, 244, 0, 0.75 * Math.PI);
fill(hair);
arc(width / 2, height / 2, 450, 600, PI + .3, -.4, OPEN);
// nose
noStroke();
fill('#FFC695');
beginShape();
vertex(400, 425);
vertex(400, 525);
vertex(430, 500);
endShape(CLOSE);
// eyes
if (mouseIsPressed == true) {
fill('white');
ellipse(300, 420, 60, 40);
ellipse(500, 420, 60, 40);
fill('#510e00');
ellipse(300, 420, 15, 15);
ellipse(500, 420, 15, 15);
} else {
fill('white');
ellipse(300, 420, 60, 50);
ellipse(500, 420, 60, 50);
fill('#510e00');
ellipse(300, 420, 15, 15);
ellipse(500, 420, 15, 15);
}
// eye brow
stroke(hair);
strokeWeight(5);
noFill();
arc(300, 430, 80, 80, PI + .9, -.9);
arc(500, 430, 80, 80, PI + .9, -.9);
// lips
if (mouseIsPressed) {
strokeWeight(20);
stroke('#e56d7e');
arc(400, 550, 150, 100, 0, PI);
noStroke();
} else {
strokeWeight(20);
stroke('#e56d7e');
arc(400, 550, 150, 100, .9, PI - .9);
noStroke();
}
// ears
fill(skin);
ellipse(175, 410, 50, 100);
ellipse(630, 410, 50, 100);
}