Pamela Juárez: árbol

De Casiopea
La versión para imprimir ya no se admite y puede contener errores de representación. Actualiza los marcadores del navegador y utiliza en su lugar la función de impresión predeterminada del navegador.
árbol




Títuloárbol
Del CursoImagen Escrita,
CarrerasArquitectura
Alumno(s)Pamela Juárez
ProfesorHerbert Spencer
 void setup() {
  size(500, 1000);
  smooth();
  background(color(#A57932));
 
 }


 void drawTree(float x, float y, float big, int levels) {
  pushMatrix();
  {
    translate(x, y);
  
    line(0, 0, 0, -big/2);         // tronco
    line(0, -big/2, -big/2, -big); // brazo izquierdo
    line(0, -big/2, big/2, -big);  // brazo derecho
    line(1, -big/3,big/2, -big); //brazo1
    line(1, -big/3,-big/2, -big); //brazo2
    // recursividad
    if (levels > 0) {
      stroke(0,random(0,500),100);
      drawTree(-big/2, -big, big*(random(.2,1)), levels - 1); // Y izquierda
      drawTree(big/2, -big, big*(random(.2,1)), levels - 2);  // Y derecha
      drawTree(big/2, -big, big*(random(.2,1)), levels - 2);  // Y 1
      drawTree(-big/2, -big, big*(random(.2,1)), levels - 1);  // Y 2
       
    }
  }
  popMatrix();
}

 void draw() {
  
 }

 void mouseReleased() {
  drawTree(mouseX, mouseY, 60, round(6));
  saveFrame("arbolPamelaJC.jpg");
 }