/* Working with waves based on sine and cosine can create predictable (single wave) or somewhat unpredictable (adding waves) results, but to create a truly unexpected result we can tap into Perlin Noise to create a wave from. In this example we've modified our Wave class to create PerlinWave, which will generate a wave based upon Perlin Noise. */ // Our wave object PerlinWave w; void setup() { // setup the environment size(500, 250); colorMode(RGB, 255, 255, 255, 100); // The PerlinWave needs four things: // 100 -> the amplitude of the wave // 15 -> the spacing of the wave samples // width -> width of the wave // 300 -> period of the wave w = new PerlinWave(100, 15, width, 300); } void draw() { // clear the background background(0); // recalcuate the waveform w.calcWave(); // start drawing from the vertical center of our screen translate(0, height / 2); // draw the wave to screen w.render(); }