Skip to content

Commit a01b5fb

Browse files
committed
added mouseY to determinate the recursive length factor
1 parent 38ef4c6 commit a01b5fb

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

day_05/beginner/sketch_01_recursive_tree/sketch_01_recursive_tree.pde

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,22 @@ void draw() {
1111
translate(width/2, height);
1212
angle = map(mouseX, 0, width, 0, PI);
1313
factor = map(mouseY, 0, height, 0.45, 0.8);
14-
branch(200, angle);
14+
branch(200);
1515
}
1616

17-
void branch(float length, float angle) {
17+
void branch(float length) {
1818
line(0, 0, 0, -length);
1919
translate(0, -length);
2020
if (length > 4) {
2121

2222
pushMatrix();
2323
rotate(angle);
24-
branch(length*factor, angle);
24+
branch(length*factor);
2525
popMatrix();
2626

2727
pushMatrix();
2828
rotate(-angle);
29-
branch(length*factor, angle);
29+
branch(length*factor);
3030
popMatrix();
3131
}
3232
}

0 commit comments

Comments
 (0)