class Particle {
constructor(x, y, phi) {
this.pos = {x, y};
this.angle = phi;
this.val = 0;
}
update(index) {
this.pos.x += Math.cos(this.angle);
this.pos.y += Math.sin(this.angle);
let nx = 1.8 * scale(this.pos.x);
let ny = 1.8 * scale(this.pos.y);
let n = {x: nx, y: ny};
let nval = (perlin.noise(n.x + mutable perlinSeedX, n.y - mutable perlinSeedY) + 0.045 * (index - numSets / 2)) % 1;
this.angle += 3 * (nval * 2 - 1);
this.val = nval;
}
display(index) {
if (this.val > bottomEnd && this.val < topEnd) {
c.fillRect(this.pos.x, this.pos.y, 1, 1);
}
}
}