/* By Sajid Saiyed http://www.ssdesigninteractive.com/g2 http://www.ssdesigninteractive.com/blog Do let me know if you happen to imrovise this code Flowers (v.0.0.1) --- {early explorations} */ // Color parameters (Tarbell's colour technique) //import processing.opengl.*; int maxpal = 512; int numpal = 0; color[] goodcolor = new color[maxpal]; float w = width; float h = height; float r; float count; float cc; color c; float y2; void setup() { size(500, 500, P3D); takecolor("111.gif"); noStroke(); smooth(); //background(255); //flower(random(10, 50), random(10, 50), random(10, 50), random(10, 50)); } void draw(){ //makeStem(); translate(width/2, height/2); if(count < 1){ background(255); for(int i=0; i<1; i++){ flower(random(10, 100), random(10, 100), random(10, 100), random(10, 100)); r = random(10, 30); } count++; } } public void flower(float p1x, float p1y, float p2x, float p2y){ //scale(0.3); y2 = p2y; for(int i=0; i<10; i++){ c = somecolor(); fill(c,90); bezier(0,0, -1*p1x, p1y, -1*p2x, p2y, 0, p2y); bezier(0,p2y, p2x, p2y, p1x, p1y, 0, 0); rotate(r); } c = somecolor(); fill(c, 70); ellipseMode(RADIUS); ellipse(0,0,10,10); //translate(w/2, h/2); } void makeStem(){ float inc = 0.02f; float sx0 = random(width); float sx1 = random(200, 400); float sy1 = random(400,450); float sx2 = random(200,300); float sy2 = random(10, 600); if(cc < 1){ for(int j=0; j<5; j++){ //sx0 *= inc; //sx1 *= inc; //sy1 *= inc; sx2 *= inc; //sy2 *= inc/4; c = somecolor(); noFill(); stroke(c, 10); bezier(sx0,height, sx1, sy1, sx2, sy2, width/2, height/2); noStroke(); } cc++; } } void mousePressed(){ cc = 0; background(255); flower(random(10, 100), random(10, 100), random(10, 100), random(10, 100)); flower(random(10, 100), random(10, 100), random(10, 100), random(10, 100)); r = random(10, 30); } // // COLOR METHODS ---------------------------------------------------------------- color somecolor() { // pick some random good color return goodcolor[int(random(numpal))]; } void takecolor(String fn) { PImage b; b = loadImage(fn); image(b,0,0); for (int x=0;x