noise() #

You have already used the random() function in your code, but there is another way to make something move or get drawn in an unpredictable way that is not quite as jumpy as the random.

Random #

If you pick 100 random values one after the other, there will be no relation to to the values before and after each number. They are random.

Random values used as the fill() color of rectangles. The result looks (and is) like white noise.

If you use random values as the x and y coordinates for drawing something, the result is very… well… random.

  • With random(), you set the minimum and maximum values as the parameters when calling the function
  • The function returns a random value between the min and max

Noise #

  • The noise() function in p5.js is based on Perlin noise
  • When you call the noise() function, it returns a value between 0.0-1.0 (so in most cases you need to scale the value somehow)
  • You can think of the parameter/parameters for noise as coordinates for moving in a cloud of noise values.
  • Each value is only slightly different from the value next to it, which creates a smooth transition between the values

2D noise #

coming soon…

noiseDetail() #

coming soon…