/** * Complexity, Intensity, Disorder * Demo for the Instruction Set website [05/2008] * by Xavier Gouchet (http://www.xgouchet.fr/) * * Dependencies : ControlP5 library (http://www.sojamo.de/libraries/controlP5/) */ import controlP5.*; public ControlP5 cp5; public float complexity, intensity, disorder; public int hueval; void setup(){ // init applet size(640,480); frameRate(12); smooth(); // init GUI cp5 = new ControlP5(this); Slider sliderCo = cp5.addSlider("complexity", 0.0, 1.0, 0.5, 10, 160, 8, 64); Slider sliderIn = cp5.addSlider("intensity", 0.0, 1.0, 0.5, 65, 160, 8, 64); Slider sliderDi = cp5.addSlider("disorder", 0.0, 1.0, 0.5, 120, 160, 8, 64); complexity = intensity = disorder = 0.5; hueval = (int)random(256); } public void draw(){ colorMode(RGB,256); noStroke(); fill(192,192,192,64); rect(0,0,width,height); int count = (int) (25*complexity) + 2; for (int j=0; j0) brightnessval = (int) ((j*256.0)/count); fill((hueval+(random(-30,30) * complexity)), intensity*256, brightnessval); vertex(vx,vy); } endShape(CLOSE); } hueval += random(-30,30) * disorder; if (hueval<0) hueval += 256; if (hueval>=256) hueval -= 256; }