Árbol inclinado

De Casiopea
Árbol inclinado



TítuloÁrbol inclinado
AsignaturaImagen Escrita
CarrerasDiseño Gráfico"Diseño Gráfico" is not in the list (Arquitectura, Diseño, Magíster, Otra) of allowed values for the "Carreras Relacionadas" property.
Alumno(s)Alessandra Robinson Torres
ProfesorHerbert Spencer
void setup() {
  size(700, 500);
  smooth();
  background(255);
}
 
 
void drawTree(float x, float y, float big, int levels) {
  pushMatrix();
  {
    translate(x, y);
 
 
strokeWeight(4);
    line(0, 0, 0, -big/2);     // tronco
    line(0, -big/2, -big/5, -big); // brazo izquierdo
    line(0, -big/2, big/2, -big);  // brazo derecho
 
    if (levels > 0) {
      drawTree(-big/5, -big, big*0.3, levels - 1); // Y izquierda
      drawTree(big/2, -big, big*0.1, levels - 1);  // Y derecha
    }
  }
  popMatrix();
}
 
 
void draw() {
}
 
 
void mouseReleased() {
  drawTree(mouseX, mouseY, random(70, 200), round(random(3, 8)));
}