/**
xmas-tree planet - The day 17 door for my 2010 Advent calendar
by Guru
*/
void setup() {
size(300,300);
smooth();
noLoop();
}
void draw() {
background(0);
for( int i=0; i < 12; i++ ) {
pushMatrix();
translate( 150,150 );
rotate(radians(30 * i));
translate(0, -50);
float s = random( 0.3, 1 );
scale(s,s);
tree();
popMatrix();
}
strokeWeight(2);
stroke(255);
fill(255);
ellipse( 150,150,100,100 );
}
void tree() {
strokeWeight(8);
stroke(255, 128, 0);
line( 0, 0, 0, -15 );
noStroke();
fill(0, 128, 0 );
beginShape();
vertex( 0,-80 );
vertex( -20, -15 );
vertex( 20, -15 );
endShape( CLOSE );
ellipseMode( CENTER );
for( int i = 0; i < 4; i++) {
fill(255,0,0);
float y = random( 50 );
float x = random( -20 * y / 65.0, 20 * y / 65.0 ) ;
ellipse( x, -65+y, 10, 10 );
}
fill( 255,255,0);
ellipse( 0, -80, 10, 10 );
}