class SineWave { // sine wave's variables: float scaleVal = 200; // max value for the resulting sine wave (255 = white) float sine_phase = PI; float sineValue; // holds the result of the sine wave for each position int[] colorValue = new int[width]; // array that holds greyscale values int loc; // pixel index //Constructor: SineWave(float temp_periods) { periods = temp_periods; } // end of constructor void init() { for (int x = 0; x < colorValue.length; x++) { float xValue = x/float(width)*periods; // location along x axis colorValue[x] = int(( (sin(2*PI*xValue + sine_phase) * scaleVal) + scaleVal ) / 2.0); // calculate grey value for each x position } } void display() { loadPixels(); for (int x=0; x 0) { // deal with pixels above increment value: for(int i=incrementValue;i