A fork of Ripples by Jack Zines
xxxxxxxxxx
ArrayList < Ripple > pond = new ArrayList < Ripple > ();
void setup() {
fullScreen();
}
void draw() {
background(0, 100, 255);
for (Ripple thisRipple: pond) {
thisRipple.render();
}
}
void mouseClicked() {
pond.add(new Ripple(mouseX, mouseY));
}
void mouseDragged() {
pond.add(new Ripple(mouseX, mouseY));
}
class Ripple {
//1. Attributes
float xPos, yPos, radius, alpha;
//2. Constructor
Ripple(float x, float y) {
xPos = x;
yPos = y;
radius = 0;
alpha = 255;
}
//3. Actions
void render() {
noFill();
strokeWeight(10);
stroke(0, 120, 255, alpha);
ellipse(xPos, yPos, radius, radius);
radius += 5;
alpha -= 5;
}
}