File tree Expand file tree Collapse file tree 1 file changed +12
-11
lines changed Expand file tree Collapse file tree 1 file changed +12
-11
lines changed Original file line number Diff line number Diff line change 1
- // Coding Rainbow
2
- // Daniel Shiffman
3
- // http ://patreon .com/codingtrain
4
- // Code for: https://youtu.be/0jjeOYMjmDU
1
+ // Fractal Tree
2
+ // The Coding Train / Daniel Shiffman
3
+ // https ://thecodingtrain .com/challenges/14-fractal-trees-recursive
4
+ // https://youtu.be/0jjeOYMjmDU
5
5
6
- var angle = 0 ;
7
- var slider ;
6
+ // https://editor.p5js.org/codingtrain/sketches/xTjmYXU3q
7
+
8
+ let angle = 0 ;
9
+ let slider ;
8
10
9
11
function setup ( ) {
10
- createCanvas ( 400 , 400 ) ;
12
+ createCanvas ( 640 , 360 ) ;
11
13
slider = createSlider ( 0 , TWO_PI , PI / 4 , 0.01 ) ;
12
14
}
13
15
14
16
function draw ( ) {
15
- background ( 51 ) ;
17
+ background ( 0 ) ;
16
18
angle = slider . value ( ) ;
17
19
stroke ( 255 ) ;
18
- translate ( 200 , height ) ;
20
+ strokeWeight ( 2 ) ;
21
+ translate ( width * 0.5 , height ) ;
19
22
branch ( 100 ) ;
20
23
}
21
24
@@ -32,6 +35,4 @@ function branch(len) {
32
35
branch ( len * 0.67 ) ;
33
36
pop ( ) ;
34
37
}
35
-
36
- //line(0, 0, 0, -len * 0.67);
37
38
}
You can’t perform that action at this time.
0 commit comments