float x, y; float easing = 0.025; int min = 50; int max = width - 50; int maxBubbles = 5; PShape[] bubbles = new PShape[maxBubbles]; void setup() { size(500, 500); colorMode(HSB, 360, 100, 100, 100); } void mouseClicked() { float size = random(1, 15); PShape bubble = createShape(ELLIPSE, x, y, size, size); for(int i = 0; i < maxBubbles; i++) { if (bubbles[i] == null) { bubbles[i] = bubble; } } } void draw() { background(179, 25, 91); noStroke(); float targetX = mouseX; float targetY = mouseY; x = constrain(x + (targetX - x) * easing, 40, width - 40); y = constrain(y + (targetY - y) * easing, 30, height - 75); //sand fill(58, 57, 95); rect(0, height - 50, width, 50); //back seaweed fill(141, 86, 62); ellipse(width - 70, height - 115, 30, 150); //fish fill(41, 89, 99); ellipse(x, y, 80, 75); //front seaweed fill(141, 64, 93); ellipse(50, height - 200, 50, 400); //layer of water fill(179, 25, 91, 50); rect(0, 0, width, height); for(int i = 0; i < maxBubbles; i++) { fill(0, 0, 100); if (bubbles[i] == null) { break; } else { shape(bubbles[i]); //PShape bubble = bubbles[i] } } }