Arbolitos
De Casiopea
Título | |
---|---|
Período | 2011- |
Asignatura | Imagen Escrita, |
Del Curso | Imagen Escrita, |
Carreras | Arquitectura |
Alumno(s) | Giglia Schiappacasse García |
Profesor | Herbert Spencer |
void setup() { size(700, 300); 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/2, -big); // brazo izquierdo line(0, -big/2, big/2, -big); // brazo derecho // recursividad if (levels > 0) { drawTree(-big/2, -big, big*0.3, levels - 1); // Y izquierda drawTree(big/2, -big, big*0.3, levels - 1); // Y derecha } } popMatrix(); } void draw() { } void mouseReleased() { drawTree(mouseX, mouseY, random(60, 300), round(random(3, 8))); }