int xspacing = 8; int w; int i = 2; float theta = 0.0; float amplitude = 150.0; float high = 1; float period = 150; float dx; float[] yvalues; float color_r = 100; float color_g = 50; float color_b = 20; float color_a = 100; float color_d = 50; float color_c = 20; float number = 1; float change = 1; void setup() { size(800,800); frameRate(60); smooth(); w = width+16; dx = (TWO_PI / period) * xspacing; yvalues = new float[w/xspacing]; } void mousePressed(){ color_r = random(255); color_g = random(255); color_b = random(255); color_a = random(255); color_d = random(255); color_c = random(255); number = random(300); } void draw() { background(56, 90, 94); fill(color_a, color_d, color_c); noStroke(); rect(0,0,width, height); calcWave(); renderWave(); } void calcWave() { theta += .02; float x = theta; for (int i = 0; i < yvalues.length; i++) { yvalues[i] = sin(x)*amplitude; x+= mouseY; } } void renderWave() { for (int x = 0; x < yvalues.length; x++) { noStroke(); fill(color_r, color_g, color_b); ellipseMode(CENTER); amplitude = mouseX; ellipse(x*xspacing,width/2+yvalues[x],mouseY/6,mouseY/6); } }