We are about to switch to a new forum software. Until then we have removed the registration on this forum.
If I you put x = random(y); into the draw() function, the function is recalculated for each frame while draw() runs. However x = noise(y); only seems to be calculated once each time the program is run. I checked this by printing the value of x in the console for each iteration of draw(). I don't understand how to use this function.
Answers
You need to increment the value of y when using it with noise. Think like this: x=noise(t) where t is time. If t increases slowly, the change is gradual. If t increases fast, the change is as if it were random. If t doesn't change, you get the same value. More info, check shiffman's video series in hisy outube channel: PErlin noise.
Kf
@TonyRamirez -- To better understand this, read the reference:
In particular:
You can think of random() as a fixed 1D array of discontinuous random numbers. Each call to random() returns [0], [1], [2], [3] in the series. The series is seeded differently each time a sketch starts -- or you can specify it with randomSeed().
You can think of noise() as a fixed 2D or 3D array of locally continuous random numbers. Calls to noise(x,y) return elements of that array -- so if you wish you can move through it with a simple counter, or pass in millis() or frameCount, etc.
The noise array is seeded differently each time a sketch starts (just as random() is seeded) -- or you can specify the seed with noiseSeed(). For example, if you needed a whole new noise field each frame (not usually recommended) you could call
noiseSeed(frameCount)
each frame, and you would get a new array.For more information see also: https://en.wikipedia.org/wiki/Perlin_noise
Thank you, all!