/* built with Studio Sketchpad:
* https://sketchpad.cc
*
* observe the evolution of this sketch:
* https://mhmscc.sketchpad.cc/sp/pad/view/ro.xiKxt01EwfS/rev.563
*
* authors:
* Steven Dollins
*
* license (unless otherwise specified):
* creative commons attribution-share alike 3.0 license.
* https://creativecommons.org/licenses/by-sa/3.0/
*/
void tree( int level ) {
stroke(128, 64, 32);
float branch_length = (random( -60, -100 ) + random( -60, -100 )) / 2;
line( 0, 0, 0, branch_length );
translate( 0, branch_length );
if( level > 1 ) {
scale( 0.7 );
pushMatrix();
rotate( random( -0.7, -0.2 ) );
tree( level-1 );
popMatrix();
pushMatrix();
rotate( random( 0.2, 0.7 ) );
tree( level-1 );
popMatrix();
} else {
noStroke();
fill( 32, 192, 32 );
ellipse( 0, 0, 50, 80 );
}
}
void setup() {
size( 400, 400 );
background(160, 220, 255);
noStroke();
fill( 32, 192, 96 );
rect( 0, height*5/6, width, height );
strokeWeight( 10 );
translate( width/2, height*7/8 );
tree(11);
}