function setup() { createCanvas(500, 500); background(250); drawBar(width / 2, height - 10, 100, PI / 2, 8); } function drawBar(x0, y0, length, theta, N) { if (N > 0) { let x = x0 + length * cos(theta); let y = y0 - length * sin(theta); line(x0, y0, x, y); drawBar(x, y, length * 0.8, theta + PI / 8, N - 1); drawBar(x, y, length * 0.8, theta - PI / 8, N - 1); } }