//Simple Interactive `pool' program for CSC 123 - by ZJ Wood (base for lab?) //global variables to control the ripple float cx, cy; boolean draw_on; float scaleF; color dotC; //function to set up the program void setup() { size(500, 300); draw_on = false; scaleF = 1.0; //all ripples are blueish colored dotC = color(random(0, 60), random(0, 100), random(170, 255)); } void mousePressed() { //For lab please do the following //1. keep track of where the mouse is //2. only produce a ripple if the mouse clicks in the pool //3. start a new ripple if the other one grew to its max size } //function to draw the pool and ripples void draw() { background(#B79664); //draw the pool water stroke(0); fill(#213783); rect(30, 30, 440, 240); //draw any ripples if we need to if (draw_on) { pushMatrix(); translate(cx, cy); scale(scaleF); strokeWeight(1); fill(dotC); ellipse(0, 0, 10, 10); popMatrix(); if (scaleF < 20) { scaleF++; } } //draw the pool sides over any ripples noStroke(); fill(#B79664); rect(0, 0, width, 40); rect(0, 0, 40, height); rect(470, 0, 40, height); rect(0, 270, width, 40); }