{
const context = DOM.context2d(width, height);
const particles = new Set();
for (let i = 0; i < count; ++i) {
particles.add({
x: width / 2,
y: height / 2,
a: i / count * 2 * Math.PI
});
}
while (particles.size) {
for (const p of particles) {
const a = p.a * 2;
p.x += Math.cos(a)
p.y += Math.sin(a)
context.fillRect(p.x, p.y, 1, 1);
if (p.x < 0 || p.x >= width || p.y < 0 || p.y >= height) {
particles.delete(p);
}
}
yield context.canvas;
}
}