addParticlesMaybe = (t) => {
const particlesToAdd = Math.round(Math.random() * density)
for (let i = 0; i < particlesToAdd && particles.length < totalParticles; i++) {
const target = targetScale(Math.random())
const length = cache[target.path].points.length
const particle = {
id: `${t}_${i}`,
speed: speedScale(Math.random()),
color: colorScale(target.group),
offset: offsetScale(Math.random()),
pos: 0,
createdAt: t,
length,
target,
}
particles.push(particle)
}
}