forked from Weelecht/Sherlock
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNode.js
31 lines (24 loc) · 855 Bytes
/
Node.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
class Node {
constructor(_transaction, _position) {
this.transaction = _transaction;
this.position = _position;
this.size = map(this.transaction.value,0,300,5,300);
}
render(_originAddress) {
let c;
if(this.transaction.to.toLowerCase() == _originAddress.toLowerCase()) {
c = color(0,255,0,100);
} else if(this.transaction.from.toLowerCase() == _originAddress.toLowerCase()) {
c = color(255,0,0,100);
}
push();
fill(c);
stroke(255,100);
circle(this.position.x,this.position.y, this.size);
push();
stroke(c,30);
line(globalTranslation.x,globalTranslation.y,this.position.x,this.position.y);
pop();
pop();
}
}