//INTERACTIVE DRAWING //WATER PUMP //MOVE MOUSE VERTICALLY //BY ZIXIANG MA void setup() { //set size of screen size(400, 400); } void draw() { //set frame rate frameRate(60); //set background color background(255, 235, 201); //another part of background noStroke(); fill(204, 149, 89); rectMode(CORNER); rect(0, 240, 400, 160); //sun noStroke(); fill(255); ellipseMode(CENTER); ellipse(320, 40, 40, 40); //handle part noStroke(); fill(127, 89, 204); rectMode (CORNER); rect(60, mouseY/3, 20, 40); rect(80, mouseY/3, 80, 20); rect(120, mouseY/3, 40, 400); fill(70, 83, 130); rectMode(CORNER); rect(60, mouseY/3, 100, 5); fill(204, 149, 89); rectMode(CORNER); rect(120, 300, 40, 100); //body part noStroke(); fill(65, 21, 153); rectMode (CORNER); rect(120, 180, 60, 120); rect(160, 220, 60, 180); rect(115, 175, 50, 5); ellipseMode(CENTER); ellipse(180, 220, 80, 80); ellipse(160, 300, 80, 80); //water pipe noStroke(); fill(65, 21, 153); rectMode (CORNER); rect(220, 280, 40, 20); triangle(260, 280, 260, 300, 280, 300); } void mouseMoved() { //water noStroke(); fill(137, 162, 255); triangle(260, 280, 280, 285, 280, 300); rectMode (CORNER); rect(280, 285, 20, 15); rect(300, 300, 15, 100); ellipseMode(CENTER); ellipse(300, 300, 30, 30); noStroke(); fill(204, 149, 89); rectMode(CORNER); rect(280, 300, 20, 20); }