Arbol Colores

De Casiopea
Giglia Schiappacasse: arbol colores


TítuloGiglia Schiappacasse: arbol colores
Tipo de ProyectoProyecto de Curso
Palabras Clavearbol, color
Período2011-
AsignaturaImagen Escrita,
Del CursoImagen Escrita,
CarrerasArquitectura
Alumno(s)Giglia Schiappacasse García
ProfesorHerbert Spencer


void setup() {

 size(500,500);
 smooth();
 background(color(#21FFD4));

}


void drawTree(float x, float y, float big, int levels) {

 pushMatrix();
 {
   translate(x, y);
   line(0, -big/2, -big/2, -big); // brazo izquierdo
   line(0, -big/2, 0, -big);         // brazo central
   line(0, -big/2, big/2, -big);  // brazo derecho
   line(0, 0, 0, -big/2);         // tronco
   if (levels > 0) {
     stroke(random(200, 66), random(150, 66), random(200, 350));                            //color hojas
     drawTree(-big/2, -big, big*(random(.2, 1)), levels - 1); // Y izquierda
     drawTree(big/2, -big, big*(random(.2, 1)), levels - 1);  // Y derecha
     stroke(random(400,600), random(10, 15), 0);                           // color ramas
     drawTree(0, -big*(random(1, 1)), big*0.8, levels - 1 );     // rama central
   }
 }
 popMatrix();

}

void draw() { }

void mouseReleased() {

 drawTree(mouseX, mouseY, 100, round(6));            //hace la recursiva
 
 saveFrame("Arbolrecursivotricolorcristobal.jpg");

}