// Gradients // Version a1 // by John Beech // http://mkv25.net/ float noiseval = 20; void mystart() { float r = random(150)+255; float b = random(200)+255; float g = random(200)+255; float average = (r+g+b)/3; colorMode(RGB, r, g, b); } private void fillZone(int width, int height, int cols, float noiseval) { float colwidth = float(width)/float(cols); for(float i=0; i<=cols; i++) { int offi = int(noise(i/20+noiseval)*400); float x1 = i * colwidth; float y1 = 0; float mc = 0; float alpha = 0; for(float j=0; j<=height; j++) { mc = (height/(j+1) * offi) * 0.8; alpha = mouseY/float(height)*10+5; stroke(int(mc), int(mc), int(mc), alpha); line(x1, j, x1+colwidth-1, j); } } noFill(); stroke(0, 0, 0); rect(0, 0, width-1, height-1); } void setup() { size(400, 100); colorMode(RGB, 1, 1, 1); background(1, 1, 1); mystart(); } void loop() { noiseval += float(float(width/2)-mouseX)/(4*width); fillZone(width, height, width/2, noiseval); //framerate(10); if(int(random(100)) == 2) { // Effectively change colour mystart(); } } void mouseReleased() { mystart(); }