Pablo Robles: Árbol

De Casiopea



TítuloPablo Robles: Árbol
Tipo de ProyectoProyecto de Curso
AsignaturaTaller Inicial 1ª y 2ª Etapa,
Del CursoImagen Escrita,
CarrerasArquitectura
Alumno(s)Pablo Robles
ProfesorHerbert Spencer
Blacktree.jpg


void setup() {

size(400, 600);
smooth();
background(color(#E5E527));
}


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

pushMatrix();
{
  translate(x, y);

  line(0, 0, 0, -big);         // base
  line(0, -big/3, -big/2, -big); // izquierda
  line(0,-big/2,0,-big);         // centro
  line(0, -big/4, big/2, -big);  // derecha

  // recursividad
  if (levels > 0) {
    stroke(0,random(15,000),0);
    drawTree(-big/4, -big, big*(random(.10,1)), levels - 2); // Y izquierda
    drawTree(big/2, -big, big*(random(.19,1)), levels - 1);  // Y derecha
    drawTree(0, -big,big*(random(.14,1)), levels - 2 );     // rama central

     
  }
}
popMatrix();

} void draw() {

}

void mouseReleased() {
drawTree(mouseX, mouseY, 100, round(9));
saveFrame("blacktree.jpg");
}