-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathParticle5.pde
More file actions
57 lines (48 loc) · 1006 Bytes
/
Particle5.pde
File metadata and controls
57 lines (48 loc) · 1006 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
class Particle5 {
PVector velocity;
PVector acceleration;
PVector location;
float lifespan;
PVector lastloc;
color C;
float size;
Particle5(float x, float y, float z, float px, float py, float pz, color _C, float _size) {
acceleration = new PVector(0,0, 0);
// velocity = PVector.random3D();
//
// velocity.mult(2);
location = new PVector(x, y, z);
lastloc = new PVector(px,py,pz);
lifespan = 1;
C = _C;
size = _size;
}
void run() {
update();
display();
}
// Method to update location
void update() {
// velocity.add(acceleration);
// location.add(velocity);
lifespan -= 1.0;
}
void display() {
stroke(0);
strokeWeight(1);
if (lastloc.z>10){
line(location.x, location.y, location.z, lastloc.x, lastloc.y, lastloc.z);}
if (size>0){
size --;}
else{
size = 1;}
}
boolean isDead() {
if (lifespan < 0.0) {
return true;
}
else {
return false;
}
}
}