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

**URL:** <https://discourse.processing.org/t/i-want-something-like-persistent-ripples-on-the-pool-but-problems-occur/15271>\
**Category:** Coding Questions\
**Created:** [November 6, 2019, 3:06am UTC](https://discourse.processing.org/t/i-want-something-like-persistent-ripples-on-the-pool-but-problems-occur/15271 "2019-11-06T03:06:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![CMSwift](https://avatars.discourse-cdn.com/v4/letter/c/7ab992/32.png) [@CMSwift](https://discourse.processing.org/u/CMSwift)\
**Post date:** [November 6, 2019, 3:06am UTC](https://discourse.processing.org/t/i-want-something-like-persistent-ripples-on-the-pool-but-problems-occur/15271/1 "2019-11-06T03:06:27Z")

</div>

Refering to [https://www.openprocessing.org/sketch/775186](https://www.openprocessing.org/sketch/775186)  
I made a little bit changes 🙂

```auto
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 !!!

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [November 6, 2019, 3:56am UTC](https://discourse.processing.org/t/i-want-something-like-persistent-ripples-on-the-pool-but-problems-occur/15271/2 "2019-11-06T03:56:10Z")

</div>

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

```auto
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?

```auto
void mousePressed() {
  wavesHeight = mouseX;
  println("click wavesHeight: "+wavesHeight);
}

```
