int d = 5; //diameter int n = 5; //recursions void setup() { size(300,300); background(0); noFill(); stroke(255); smooth(); } void draw() { background(0); Curve (mouseX, mouseY, d, n); } void Curve (float x, float y, float d, int num) { bezier(-100, 0, x, y, x-n*d, y-n*d, 500, 0); if (num > 1) { num = num - 1; int branches = 3; for (int i = 0; i < branches; i++) { float a = random(0, 3); float newx = x + a * num; float newy = y + a * num; Curve (newx, newy, d*1.5, num); } } }