-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTrail_Line.pde
More file actions
42 lines (36 loc) · 929 Bytes
/
Trail_Line.pde
File metadata and controls
42 lines (36 loc) · 929 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
35
36
37
38
39
40
41
42
class Trail_Line {
PVector position1 = new PVector(0, 0, 0);
PVector position2 = new PVector(0, 0, 0);
int alpha = 200;
float strokeWeight = 2;
int counter = 0;
//planet position to scale subAlpha
PVector position = new PVector(0, 0, 0);
Trail_Line(PVector position1, PVector position2) {
this.position1.set(position1);
this.position2.set(position2);
}
void update(PVector position) {
this.position.set(position.copy());
strokeWeight = 1/scaleFactor;
if (strokeWeight < 1) {
strokeWeight = 1;
} else if (strokeWeight > 5) {
strokeWeight = 5;
}
strokeWeight(strokeWeight);
stroke(0, 255, 100, alpha);
line(position1.x, position1.y, position1.z, position2.x, position2.y, position2.z);
subAlpha();
}
void subAlpha(){
if(counter >= 1){
alpha -= 1;
counter = 0;
}
counter++;
}
int getAlpha() {
return alpha;
}
}