def setup(): size(600, 600) background(0) stroke(255) drawTree(300, 550, 9) def drawTree(x, y, depth): fork_ang = radians(20) base_len = 10 if depth > 0: pushMatrix() translate(x, y - baseLen * depth) line(0, baseLen * depth, 0, 0) rotate(fork_ang) drawTree(0, 0, depth - 1) rotate(2 * -fork_ang) drawTree(0, 0, depth - 1) popMatrix()