sketch
I got this week’s project inspiration from the facebook emojis and decided to animate them with sound. You can click on each emoji and it will generate the corresponding mood sound. The hardest part of this project was trying to figure out how to use a local host and uploading it to WordPress, but overall, it was really fun!
var laugh;
var wow;
var crying;
var angry;
function preload() { laugh = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/10/laugh.wav");
wow = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/10/wow.wav");
crying = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/10/crying.wav");
angry = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/10/angry.wav");
}
function setup() {
createCanvas(480, 300);
noStroke();
fill("#184293"); rect(0, 0, width / 4, height);
fill("#05B5C3"); rect(width / 4, 0, width / 4, height);
fill('#BC2D15'); rect(width / 2, 0, width / 4, height);
fill(0); rect(width * 3 / 4, 0, width / 4, height);
}
function draw() {
noStroke();
for (i = 0; i < 4; i++) {
fill("#FBD771");
circle(i * width / 4 + 60, height / 2, 90);
}
stroke(45);
line(35, 130, 50, 135); line(35, 140, 50, 135);
line(70, 135, 85, 130); line(70, 135, 85, 140);
noStroke();
fill(45);
arc(60, 155, 55, 50, 0, PI);
fill('#F35269');
ellipse(60,170,38,20);
fill(45);
ellipse(160, 140, 13, 20);
ellipse(200, 140, 13, 20);
ellipse(180, 170, 25, 35);
noFill();
stroke(45);
strokeWeight(3);
curve(130, 180, 152, 125, 166, 120, 140, 120);
curve(170, 140, 193, 120, 207, 125, 200, 150);
stroke(45);
strokeWeight(4);
line(270, 150, 290, 155);
line(310, 155, 330, 150);
fill(45);
circle(283, 157, 5);
circle(318, 157, 5);
ellipse(300,170,20,3);
ellipse(400, 150, 10, 12);
ellipse(440, 150, 10, 12);
noFill();
stroke(45);
strokeWeight(3);
curve(410, 130, 392, 140, 405, 135, 450, 160);
curve(410, 150, 435, 135, 448, 140, 450, 165);
arc(420, 175, 20, 15, PI, TWO_PI);
noStroke();
fill("#678ad6");
circle(445, 185, 15);
triangle(438, 182, 445, 165, 452, 182);
}
function mousePressed() {
if(mouseX < width / 4) { laugh.play();
}
if(mouseX > width / 4 & mouseX < width / 2) { wow.play();
}
if(mouseX > width / 2 & mouseX < width * 3 / 4) { angry.play();
}
if(mouseX > width * 3 / 4) { crying.play();
}
}