Processing; Perlin noise and a line/wave generator

471 views Asked by At

My code so-far, displayed below, uses a simple Perlin noise number generator to create a more natural looking sudo-random movement for an orb.

What I intend to happen is the procedural generation of a line describing the pattern of movement generated by Perlin noise. Imagine a wave along the y-axis but it starts from where the orb is and moves down.

My issue is that I can't find a way to program this in a way that doesn't have the background in the setup (meaning every instance of the orb would stay on screen forever) and without the line being straight as a ruler.

Here is my feeble attempt at using parts of other people's code and jamming it into what I've already written.

final int INTERVAL = 10;

float t = 0;

void setup() {
  size(600,400);
  background(0);
}

void draw() {


  fill(255);

  t = t + 0.01;

  float x = noise(t);
  x = map(x,0,1,0,width);
  ellipse(x,height/2,40,40);
  stroke(255);
  line(x,pmouseY,x,mouseY);
  loadPixels();
  arrayCopy(pixels, 0, pixels, width, (height - 1) * width);
  updatePixels();
}
0

There are 0 answers