/* ANGLER FISH- Assignment 1: Interactive Drawing Let my creepy fish light up your life!! Controls: Use mouse to make fish swim. Click- Turn light ON Press any key: CHOMP! */ void setup() { size(400, 400); //canvas size } void draw() { background(21,45,82); frameRate(60); //default frame rate per second /*BACKGROUND*/ noCursor(); rectMode(CENTER); //medium ocean colour fill(10,21,38); ellipse(20, 0, 60, 40); rectMode(CORNER); rect(0, 0, 20, 160); ellipse(20, 90, 40, 60); rect(0, 300, 200, 50); rect(140, 320, 200, 50); //light ocean colour fill(17,35,64); rect(0, 220, 100, 80); ellipse(130, 260, 150, 110); triangle(180, 220, 180, 310, 250, 310); ellipse(248, 310, 60, 60); ellipse(280, 190, 60, 20); ellipse(300, 180, 20, 60); ellipse(350, 230, 40, 40); rect(270, 195, 80, 120); triangle(390,130,330,270,390,270); //ocean colour fill(21,45,82); ellipse(20, 40, 20, 40); ellipse(20, 150, 20, 60); ellipse(60, 210, 63, 40); ellipse(335, 190, 60, 60); //dark ocean colour fill(5,10,18); ellipse(0, 220, 80, 140); triangle(0, 250, 0, 400, 110, 400); ellipse(130, 380, 160, 100); rect(200, 360, 100, 40); //medium ocean colour fill(10,21,38); arc(40, 305, 70, 60, (3*PI)/12, (8*PI)/6); ellipse(60, 335, 40, 30); arc(140, 320, 160, 100, PI, (2*PI)); ellipse(355, 310, 160, 130); ellipse(400, 150, 100, 175); rect(380, 180, 20, 100); ellipse(250, 360, 93, 20); rect(380, 0, 100, 100); //light ocean colour fill(17,35,64); ellipse(380, 240, 10, 17); //dark ocean colour fill(5,10,18); ellipse(334, 340, 80, 80); triangle(270, 380, 300, 320, 300, 380); rect(300, 320, 100, 100); ellipse(400, 160, 80, 100); rect(380, 180, 20, 300); triangle(380, 276, 320, 320, 380, 350); //medium ocean colour fill(10,21,38); ellipse(380, 240, 20, 70); ellipse(310,0,25,60); //triangle(320,0,400,0,400,60); rect(310,0,100,30); //ocean colour fill(21,45,82); ellipse(347, 37, 66, 60); ellipse(270, 243, 40, 88); ellipse(247, 260, 80, 70); /*LITTLE FISH SWIMMING*/ /* x values: abs("start y axis"-((("speed"*abs(400-mouseY)*framecount)/"second speed value")%"distance travelled before looping back")) y values: "phase shift" +sin(framecount*"horizontal speed")*"horizontal distance range credits: Nathan Arcari for formula*/ fill(103, 162, 209, 80); ellipse(abs(5-(((3.4*abs(400)*frameCount)/280)%411)), 30+sin(frameCount*0.07)*18, 24, 10); ellipse(abs(5-(((3.2*abs(400)*frameCount)/150)%650)), 125+sin(frameCount*0.06)*18, 24, 10); ellipse(abs(5-(((3.4*abs(400)*frameCount)/260)%411)), 220+sin(frameCount*0.07)*18, 24, 10); ellipse(abs(5-(((3.2*abs(400)*frameCount)/150)%650)), 310+sin(frameCount*0.06)*18, 24, 10); ellipse(abs(5-(((3.4*abs(400)*frameCount)/280)%411)), 400+sin(frameCount*0.07)*18, 24, 10); ellipse(abs(5-(((3.2*abs(400)*frameCount)/150)%650)), 125+sin(frameCount*0.06)*18, 24, 10); /*FISH*/ //antenna noFill(); stroke(122,157,150); arc(mouseX-50, mouseY-20, 90, 160, (7*PI)/6, 2*PI); //body noStroke(); fill(4,100,22); ellipse(mouseX, mouseY, 100, 100); //mouth arc(mouseX-12.5, mouseY+10, 130, 125, 0, PI); //light fill(200,209,110); ellipse(mouseX-88, mouseY-60, 15, 15); //eye noStroke(); fill(16,52,14); ellipse(mouseX+20, mouseY+5, 25, 25); fill(4,100,22); ellipse(mouseX+20, mouseY, 25, 25); stroke(0,53,28); strokeWeight(3); fill(242,248,232); ellipse(mouseX+20, mouseY-5, 20, 20); fill(0,53,28); ellipse(mouseX+20, mouseY-5, 5, 5); //tail noStroke(); fill(4,100,22); triangle(mouseX+40, mouseY+10, mouseX+85, mouseY-15, mouseX+85, mouseY+35); ellipse(mouseX+85, mouseY-10, 10, 10); ellipse(mouseX+85, mouseY, 10, 10); ellipse(mouseX+85, mouseY+10, 10, 10); ellipse(mouseX+85, mouseY+20, 10, 10); ellipse(mouseX+85, mouseY+30, 10, 10); fill(0,53,28); triangle(mouseX+55, mouseY+5, mouseX+85, mouseY-10, mouseX+80, mouseY); quad(mouseX+50, mouseY+10, mouseX+80, mouseY+5, mouseX+85, mouseY+10,mouseX+80, mouseY+15); triangle(mouseX+55, mouseY+15, mouseX+85, mouseY+30, mouseX+80, mouseY+20); //fin fill(7,131,30); triangle(mouseX+25, mouseY+20, mouseX+45, mouseY+10, mouseX+45, mouseY+30); ellipse(mouseX+45, mouseY+12.5, 5, 5); ellipse(mouseX+45, mouseY+20, 10, 10); ellipse(mouseX+45, mouseY+27.5, 5, 5); fill(0,53,28); triangle(mouseX+45, mouseY+12, mouseX+42.5, mouseY+16, mouseX+35, mouseY+17.5); quad(mouseX+30, mouseY+20, mouseX+42.5, mouseY+17.5, mouseX+47, mouseY+20,mouseX+42.5, mouseY+22.5); triangle(mouseX+45, mouseY+28, mouseX+42.5, mouseY+24, mouseX+35, mouseY+22.5); //teeth fill(255); triangle(mouseX-70, mouseY+10, mouseX-65, mouseY, mouseX-60, mouseY+10); triangle(mouseX-55, mouseY+10, mouseX-50, mouseY, mouseX-45, mouseY+10); triangle(mouseX-40, mouseY+10, mouseX-35, mouseY, mouseX-30, mouseY+10); triangle(mouseX-25, mouseY+10, mouseX-20, mouseY, mouseX-15, mouseY+10); triangle(mouseX-10, mouseY+10, mouseX-5, mouseY, mouseX, mouseY+10); } /*Open mouth with any key on the keyboard*/ void keyPressed() { frameRate(3);// 3frames/second -slowed down to show open mouth //open mouth fill(21,45,82); arc(mouseX+.5, mouseY+10, 120, 123, PI, (8*PI)/6); //bottom teeth fill(255); triangle(mouseX-70, mouseY+10, mouseX-65, mouseY, mouseX-60, mouseY+10); triangle(mouseX-55, mouseY+10, mouseX-50, mouseY, mouseX-45, mouseY+10); triangle(mouseX-40, mouseY+10, mouseX-35, mouseY, mouseX-30, mouseY+10); triangle(mouseX-25, mouseY+10, mouseX-20, mouseY, mouseX-15, mouseY+10); triangle(mouseX-10, mouseY+10, mouseX-5, mouseY, mouseX, mouseY+10); //top teeth triangle(mouseX-25, mouseY-40, mouseX-35, mouseY-30, mouseX-20, mouseY-30); triangle(mouseX-27.5, mouseY-20, mouseX-20, mouseY-30, mouseX-15, mouseY-20); triangle(mouseX-25, mouseY-10, mouseX-15, mouseY-20, mouseX-10, mouseY-10); triangle(mouseX-15, mouseY, mouseX-10, mouseY-10, mouseX-5, mouseY); fill(4,100,22); //jaw arc(mouseX+.5, mouseY+10, 130, 115, (8*PI)/6, (3*PI)/2); } /*Turn light on by clicking mouse*/ void mousePressed() { fill(237, 255, 49, 70); frameRate(3); // 3frames/second -slowed down to show light //light ellipse(mouseX-88, mouseY-60, 450, 450); ellipse(mouseX-88, mouseY-60, 250, 250); ellipse(mouseX-88, mouseY-60, 140, 140); ellipse(mouseX-88, mouseY-60, 80, 80); ellipse(mouseX-88, mouseY-60, 50, 50); ellipse(mouseX-88, mouseY-60, 30, 30); }