//---------------------------------------
void setup(){
size(1200, 700);
smooth();
background(241);
noLoop();
}
void draw(){
for( int i=0; i<9; i++){
int s = int(random(7, 51));
int w = 2*s;
int n = int(random(9, 51));
drawVine( int(random(w, width-w)), n, s );
}
}
//---------------------------------------
//---------------------------------------
void drawVine( int x, int numLeaves, int leafSize ){
strokeWeight(1);
stroke( 0, int(random(0, 71)), int(random(71, 180)));
line( x, 0, x, height );
strokeWeight( 1/leafSize );
int gap = height /numLeaves;
int direction = 1;
for( int i=0; i<numLeaves; i++ ){
int colorR = 0;
int colorG = int(random(0, 71));
int colorB = int(random(71, 180));
noStroke();
fill( colorR, colorG, colorB, random(99, 255) ); //random color for fill
int r = int(random(gap));
drawLeaf( x, gap*i +r, leafSize, direction );
direction = -direction;
}
}
//---------------------------------------
//---------------------------------------
void drawLeaf( int x, int y, int size, int dir ){
pushMatrix();
translate(x, y); //move to position
scale(size); //scale to size
beginShape(); //draw the shape
vertex( dir, -0.6875 );
bezierVertex( dir, -0.6875, dir*0.4375, -1.03125, 0, 0 );
bezierVertex( 0, 0, dir, 0.375, dir, -0.6875 );
endShape();
popMatrix();
}
//---------------------------------------