-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy patharc.js
38 lines (35 loc) · 1.01 KB
/
arc.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
33
34
35
36
37
38
class Arc{
constructor(origem){
this.origem = origem;
}
to(destino){
console.log('DESTINO');
this.destino = destino;
}
show(){
stroke(0);
if(this.destino){
line(this.origem.x, this.origem.y, this.destino.x, this.destino.y);
let transX;
let transY;
if(this.destino.size){
transX = (this.destino.x - (this.destino.size/2));
transY = this.destino.y;
} else {
transX = (this.destino.x - (this.destino.width/2));
transY = this.destino.y;
}
translate(transX, transY);
angleMode(DEGREES);
rotate(45);
line(0, 0, 0, 5);
// triangle(6, 6, 0, -6, -6, 6);
rotate(90);
line(0, 0, 0, 5);
rotate(-(90+45));
translate(-transX, -transY);
} else {
line(this.origem.x, this.origem.y, mouseX, mouseY);
}
}
}