// TreeCurveStrokeDemoFall2022_020 void setup() { size(1500, 1000, P2D); frameRate(60); colorMode(HSB, 360, 100, 100, 100); background(200, 100, 75); } boolean firsttime = true ; void draw() { push(); translate(width/2, height-10); drawTree(height/2, height/64-1, 10); pop(); if (firsttime) { // saveFrame("TreeCurve-######.jpg"); firsttime = false ; } } void drawTree(int length, int limit, float sweight) { push(); strokeWeight(sweight); if (length < limit) { stroke(60, 100, 100); // yellow buds } else { stroke(47, 83, 25); // brownish, i.e., off-orange } line(0, 0, 0, -length); // original tree trunk or current branch //<>// if (length >= limit) { push(); translate(0, -length/2); rotate(radians(-30)); int newlen = length / 2 ; float newsw = sweight / 1.5 ; drawTree(newlen, limit, newsw); rotate(radians(60)); drawTree(newlen, limit, newsw); // replace with a for loop:... This draws a subtree at the top. rotate(radians(-30)); // in line with verical translate(0, -length/2); rotate(radians(-30)); drawTree(newlen, limit, newsw); rotate(radians(60)); drawTree(newlen, limit, newsw); pop(); } pop(); }