/*Title: Ribbit Description: Watch the frog bobb up and down on a lilly pad. move the mouse left and right to sway the cattails and make the rasie his body. His eyes follows your mouse. Click and he'll sing. Author: Shane Logtenberg; Student ID: 991435131 PROG14998 Introduction to Media Computation - 1179_25819; Instructor: Nicolas Hesler*/ void setup() { //Set the size of window size(400, 400); smooth(); frameRate(10) ; } void draw() { //println(frameCount % 255); rectMode(CORNERS); ellipseMode(CORNERS); noStroke(); // set background color to skyblue background(132, 220, 255); // set lighter green fill(157, 214, 78); ellipse(-50, 80, 450, 200); // set Blue fill(50, 190, 255); ellipse(0, 140, 400, 200); rect(0, 170, 400, 400); //Cattails Stems ellipseMode(CENTER); strokeWeight(3); // set darker green stroke(138, 180, 76); noFill(); curve((pmouseX/8+20), 150, 40, 150, (pmouseX/8+20), 50, (pmouseX/8+20)*3-20, 0); curve((pmouseX/8+40), 150, 45, 150, (pmouseX/8+40), 40, (pmouseX/8+40)*3-40, 0); curve((pmouseX/8+60), 150, 50, 150, (pmouseX/8+60), 50, (pmouseX/8+60)*3-60, 0); curve((pmouseX/8+300), 150, 330, 150, (pmouseX/8+280), 50, (pmouseX/8+300)*3-780, 0); curve((pmouseX/8+320), 150, 335, 150, (pmouseX/8+300), 40, (pmouseX/8+320)*3-800, 0); curve((pmouseX/8+340), 150, 340, 150, (pmouseX/8+320), 50, (pmouseX/8+340)*3-820, 0); //Cattails Tops noStroke(); // set murky Orange fill(210, 145, 0); ellipse((pmouseX/8+20), 40, 20, 30); ellipse((pmouseX/8+40), 30, 20, 30); ellipse((pmouseX/8+60), 40, 20, 30); ellipse((pmouseX/8+280), 40, 20, 30); ellipse((pmouseX/8+300), 30, 20, 30); ellipse((pmouseX/8+320), 40, 20, 30); //Water Ripple stroke(255, 255, 255, 255-frameCount*50 % 255); fill(170, 225, 245, 255-frameCount*50 % 255); ellipse(200, 300, frameCount*100 % 510, frameCount*50 % 255); //Lillypad // set darker green stroke(138, 180, 76); // set lighter green fill(157, 214, 78); arc(200, sin(frameCount)*5+305, 400, 120, PI*0.75, PI*2.625); //Frog Left Eye ellipseMode(CENTER); // set white fill(255, 255, 255); // set darker green stroke(138, 180, 76); strokeWeight(3); ellipse(140, sin(frameCount)*4+abs(pmouseX-200)/6+80, 80, 80); // Pupil fill(138, 180, 76); ellipse(mouseX/10+120, sin(frameCount)*3+abs(pmouseX-200)/6+mouseY/10+60, 30, 30); //Frog Right Eye fill(255, 255, 255); ellipse(260, sin(frameCount)*4+abs(pmouseX-200)/6+80, 80, 80); // Pupil fill(138, 180, 76); ellipse(mouseX/10+240, sin(frameCount)*3+abs(pmouseX-200)/6+mouseY/10+60, 30, 30); //Frog Body // set fill color to darker green ellipseMode(CORNERS); fill(138, 180, 76); arc(120, sin(frameCount)*3+abs(pmouseX-200)/6+100, 278, sin(frameCount)*3+300, PI, TWO_PI); rect(120, sin(frameCount)*3+abs(pmouseX-200)/6+180, 278, sin(frameCount)*3+abs(pmouseX-200)/6+267); //Left Leg stroke(157, 214, 78); rect(75, sin(frameCount)*3+273, 120, sin(frameCount)*3+300); arc(75, sin(frameCount)*3+250, 120, sin(frameCount)*3+300, PI, 2*PI); triangle(25, sin(frameCount)*3+300, 75, sin(frameCount)*3+300, 75, sin(frameCount)*3+275); //Right Leg rect(280, sin(frameCount)*3+273, 325, sin(frameCount)*3+300); arc(280, sin(frameCount)*3+250, 325, sin(frameCount)*3+300, PI, 2*PI); triangle(325, sin(frameCount)*3+280, 325, sin(frameCount)*3+300, 375, sin(frameCount)*3+300); //Front flippers triangle(170, sin(frameCount)*3+250, 150, sin(frameCount)*3+301, 190, sin(frameCount)*3+301); triangle(230, sin(frameCount)*3+250, 210, sin(frameCount)*3+301, 250, sin(frameCount)*3+301); //Smile arc(160, sin(frameCount)*3+abs(pmouseX-200)/6+120, 240, sin(frameCount)*3+abs(pmouseX-200)/6+160, PI*-0.0625, PI*1.0625); } void mousePressed() { //Open mouth fill(170, 0, 110); rect(160, abs(pmouseX-200)/6+120, 240, abs(pmouseX-200)/6+203); arc(160, abs(pmouseX-200)/6+180, 240, abs(pmouseX-200)/6+220, 0, PI); fill(255, 180, 226); noStroke(); ellipse(161, abs(pmouseX-200)/6+180, 240, abs(pmouseX-200)/6+220); fill(138, 180, 76); stroke(157, 214, 78); arc(160, abs(pmouseX-200)/6+100, 240, abs(pmouseX-200)/6+130, 0, PI); //Music Note stroke(255, 180, 226); strokeWeight(6); fill(255, 255, 255); line(209, 20, 209, 50); strokeWeight(3); ellipse(180, 40, 210, 70); rect(210, 18, 235, 35); println("Ribbit"); }