-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharc.js
More file actions
34 lines (29 loc) · 709 Bytes
/
arc.js
File metadata and controls
34 lines (29 loc) · 709 Bytes
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
33
34
class Arc{
constructor(start,end,dir){
this.start = start;
this.end = end;
this.dir = dir;
this.hu = 0;
this.hu2 = 255;
}
show(){
let diameter = abs(this.end-this.start);
let x = (this.end+this.start)/2;
stroke(this.hu,this.hu2,0);
noFill();
strokeWeight(0.5);
if(this.dir === 0){
arc(x,0,diameter,diameter,PI,0);
}else{
arc(x,0,diameter,diameter,0,PI);
}
this.hu += 1;
if(this.hu > 255){
this.hu = 0;
}
this.hu2 -= 1;
if(this.hu2 < 0){
this.hu2 = 255;
}
}
}