# Noise grid stops moving after a while

**URL:** <https://discourse.processing.org/t/noise-grid-stops-moving-after-a-while/11704>\
**Category:** Coding Questions\
**Tags:** homework\
**Created:** [May 30, 2019, 8:11am UTC](https://discourse.processing.org/t/noise-grid-stops-moving-after-a-while/11704 "2019-05-30T08:11:09Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [June 3, 2019, 12:16am UTC](https://discourse.processing.org/t/noise-grid-stops-moving-after-a-while/11704/2 "2019-06-03T00:16:34Z")

</div>

It does keep going, but it doesn’t keep displaying. Your problem is that you have global variables – in particular, speed (fart) – that you keep incrementing, until the number is so large your sketch doesn’t work anymore.

Try bouncing that value around between -1 and 1, for example:

```auto
float gridcelleStr =8; 
float gridBredde;
float gridHoejde;
float faktor = 2;
float fart;
float fart_diff = 0.0000002;
float xPos; 
float yPos; 
float tal; 
float strFaktor = 30;

void setup() {
  size(1200, 1200, P3D);
  gridBredde = floor(120);
  gridHoejde = floor(120);
  fart = 0;
  rectMode(CENTER);
  imageMode(CENTER);
}
void draw() {
  background(255);
  if (fart>1) {
    fart_diff = -0.0000002;
  }
  if (fart<-1) {
    fart_diff = 0.0000002;
  }
  for (int y = 0; y < gridHoejde; y++) {
    for (int x = 0; x <gridBredde; x++) {
      pushMatrix();
      translate(100, 80);
      fart += fart_diff;
      tal = floor(noise(x/gridHoejde, y / gridBredde, fart) * faktor);
      xPos = x * gridcelleStr;
      yPos = y * gridcelleStr;
      noStroke();
      fill(random(0), random(0), random(150, 255));
      rect(xPos, yPos, tal * strFaktor, tal * strFaktor);
      popMatrix();
    }
  }
}

```

---

_[View the full topic](https://discourse.processing.org/t/noise-grid-stops-moving-after-a-while/11704)._
