xxxxxxxxxx
ArrayList<Ripple> rinple = new ArrayList();
void setup() {
fullScreen();
}
void draw() {
background(240, 120, 120);
// guidance ripple
strokeWeight(10);
for (Ripple ripley : rinple) {
stroke(255, 130, 130, (265 - ripley.cnt));
ripley.tick();
}
}
void mouseClicked() {
rinple.add(0, new Ripple(mouseX, mouseY));
}
class Ripple {
// attributes
float xOrigin, yOrigin;
float cnt;
// constructor
Ripple(float xPos, float yPos) {
xOrigin = xPos;
yOrigin = yPos;
cnt = 0;
}
// core functions
void tick() {
noFill();
strokeWeight(10);
stroke(255, 130, 130, (265 - cnt));
ellipse(xOrigin, yOrigin, (cnt + 5), (cnt + 5));
cnt += 5;
}
}