I want something like persistent ripples on the pool, But problems occur!

Refering to https://www.openprocessing.org/sketch/775186
I made a little bit changes :slight_smile:

float incX = 0.04;
float incY = 0.05;
float distance = 12;
int wavesHeight = 200;
boolean looping = true;
float frame = 0;

void setup() {
size(600,600);
background(0);
noiseDetail(2);



}

void draw() {
float zOff = frameCount * 0.01;
//println(millis());
background(0);
//noStroke();
strokeWeight(1.5);
stroke(0);
float yOff = 0;
for(int y = 0; y < height; y += distance) {
  float xOff = 0;
  float r = xOff;
  beginShape();
  for(int x = -wavesHeight; x < width *2; x += distance) {
    float n = noise(xOff, yOff, zOff);
    float g = n;
    float b = yOff;
    float value = map(n, 0, 1, -wavesHeight, wavesHeight);
    curveVertex(x, y + value);
    xOff += incX;
    r = map(xOff, 0, 3.5, 0, 255);
    g = map(n, 0.2, 0.7, 0, 255);
    b = map(yOff, 0, 4, 0, 255);
    fill(r, g, b, b*1.5);
  }
  endShape();
  yOff += incY;

}

//println(millis());

}

The problem is that the ripples aren’t PERSISTENT, and I found it had nothing to do with the millis – the ripples slowed down after several loops, not IN THE LOOP.
If possible, can anyone add some mouse-interaction to it, so that it can create ripples when the mouse click?
Thanks a lot !!!

1 Like

i think it would be a good idea if you have following lines in your code:

Waves Fork by Richard Bourne.
https://www.openprocessing.org/user/162823
mod by pikachu and CMSwift

as you now work in PDE JAVA and not have that
open processing environment/fork/copyright/ support anymore,


mouse?

void mousePressed() {
  wavesHeight = mouseX;
  println("click wavesHeight: "+wavesHeight);
}
2 Likes