/* With this example we'll take a look at drawing wave motion using sines and cosines. The Wave class does most of the work, but there is still more that could be done. */ // We'll use one wave Wave w; void setup() { // setup the environment size(500, 250); colorMode(RGB, 255, 255, 255, 100); /* When we create a wave we pass it a number of parameters. Wave.SIN -> Should the wave generator use sin or cos 75 -> The amplitude of the wave 8 -> Space between each point calculated for the wave width -> How wide is the entire wave 600 -> Period of the wave, the distance from one peak to the next */ w = new Wave(Wave.SIN, 75, 8, width, 600); } void draw() { // clear the background background(0); // let the wave figure itself out w.calcWave(); // Because the wave has positive and negative values, we need to center the // screen vertically. Ideally this would take place in the Wave class. translate(0, height / 2); // let the wave draw itself w.render(); }