five-on-it / apps/client/src/renderer/particles / ParticlePool
Class: ParticlePool
Defined in: apps/client/src/renderer/particles.ts:45
A pool of particles, oldest first.
Constructors
Constructor
new ParticlePool(
capacity,motion):ParticlePool
Defined in: apps/client/src/renderer/particles.ts:54
A pool of at most capacity particles moving as motion says.
Parameters
capacity
number
motion
Returns
ParticlePool
Properties
items
readonlyitems:Particle[] =[]
Defined in: apps/client/src/renderer/particles.ts:47
The live particles, oldest first.
spawned
spawned:
number=0
Defined in: apps/client/src/renderer/particles.ts:49
Particles spawned since the start.
Methods
spawn()
spawn(
p):void
Defined in: apps/client/src/renderer/particles.ts:60
Adds a particle (its age starts at 0); past the cap, the oldest gives way.
Parameters
p
Omit<Particle, "age">
Returns
void
step()
step(
dt):void
Defined in: apps/client/src/renderer/particles.ts:67
Moves and ages every particle by dt seconds and drops the ones whose life is over.
Parameters
dt
number
Returns
void