{
await visibility();
const size = Math.min(width, 350);
const ctx = DOM.context2d(size, size);
ctx.canvas.style.border = "solid 1px black";
const field = fields.get("repel");
const image = await createImage(ctx, size, size, field);
const particles = createParticles(15);
let time = performance.now();
while (true) {
ctx.clearRect(0, 0, size, size);
ctx.drawImage(image, 0, 0, size, size);
const now = performance.now();
const dt = (now - time) / 1000;
time = now;
particles.forEach((particle) => {
updateParticle(particle, field, dt, 100 / size);
drawParticle(ctx, particle);
});
yield ctx.canvas;
}
}