Marcelo Castañeda
De Casiopea
float ramas; void setup() { size(500, 500); smooth(); background(color(#81EDFF)); stroke (color(#CBA471));// color tronco ramas= radians(20); translate(width /4,height); strokeWeight(0); // Dibuja una línea de 50 píxeles line(160,160,160, 160); strokeWeight(20); // Dibuja una línea de 100 píxeles line(160,160,160,-80); // Mueve la funcion arbol al final de la linea translate(100,-50); // Inicia la funcion arbol } void drawTree(float x, float y, float big, int levels) { pushMatrix(); { stroke (color(#66FF03)); // color linea circulo 1 translate(x, y); strokeWeight (30); ellipse(20, 20, 20, big/2); // tronco stroke (color(#0BDE17)); ellipse(0, big/2, -big/2, big/2);// brazo izquierdo fill(#21FF00); stroke (color(#21FF00)); ellipse(0, -big/2, big/2, big); // brazo derecho // recursividad if (levels > 0) { drawTree(-big, -big, big*1, levels - 4); // Y izquierda drawTree(big/2, -big, big*2, levels -6); // Y derecha } } popMatrix(); } void draw() { } void mouseReleased() { drawTree(mouseX, mouseY, 25, round(random(1, 1))); }