-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTree.js
32 lines (27 loc) · 989 Bytes
/
Tree.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
function Tree(n,p){
this.n = n
this.p = p
this.draw = function(color){
stroke(255,255,255)
strokeWeight(window.width / maxL)
line(window.width / maxL * this.p ,360,window.width / maxL * this.p ,0)
strokeWeight(window.width / maxL - 2)
switch(color){
case 1:
stroke(255,0,0)
line(window.width / maxL * this.p ,window.height / 2 + this.n / 2,window.width / maxL * this.p ,window.height / 2- this.n / 2)
break
case 2:
stroke(0,0,0)
line(window.width / maxL * this.p ,window.height / 2 + this.n / 2,window.width / maxL * this.p ,window.height / 2- this.n / 2)
break
case 3:
stroke(50,200,50)
line(window.width / maxL * this.p ,window.height / 2 + this.n / 2,window.width / maxL * this.p ,window.height / 2- this.n / 2)
break
case 4:
stroke(0,0,255)
line(window.width / maxL * this.p ,window.height / 2 + this.n / 2,window.width / maxL * this.p ,window.height / 2- this.n / 2)
}
}
}