five-on-it / apps/client/src/renderer/particles
apps/client/src/renderer/particles
A pool of short-lived particles as data: tyre smoke, dust, sparks and a wreck's smoke are each one pool, drawn as one mesh of thin instances (effects.ts). A pool holds at most capacity particles, oldest first; a new one past the cap takes the place of the oldest, so a long drift costs no more than a short one. Each particle drifts with its velocity, slowed by drag toward the wind's (still air without one) and pulled by gravity (negative gravity makes smoke rise), and dies at the end of its life; how big it is drawn over that life is the pool's own curve.