Skip to content

Commit

Permalink
Update Particle_life.pde
Browse files Browse the repository at this point in the history
  • Loading branch information
jcponce committed Jul 8, 2024
1 parent 9c804bf commit 471f0a7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions sketches/particle-life/Particle_life/Particle_life.pde
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ class Particle {
int type;

Particle() {
position = new PVector(random(width), random(height));
float rad = random(100);
float ang = random(TWO_PI);
position = new PVector(rad * cos(ang) + width/2, rad * sin(ang)+height/2);
velocity = new PVector(0, 0);
type = int(random(numTypes));
}
Expand Down Expand Up @@ -122,6 +124,6 @@ class Particle {

void display() {
fill(this.type * colorStep, 100, 100);
ellipse(this.position.x, this.position.y, 5, 5);
ellipse(this.position.x, this.position.y, 8, 8);
}
}

0 comments on commit 471f0a7

Please sign in to comment.