canvas = {
const length = points.length * 2;
const frequence = f * 1e-3;
const maxCount = mc;
let roots = new Float64Array(length);
let vectors = Float64Array.from({ length }, () => 0);
let now = performance.now();
let cells = [];
roots = points.flat();
context.fillStyle = `rgb(${colors.bg})`;
context.fillRect(0, 0, width, height);
while (!paused) {
const z = now * v * 1e-5;
const newPoints = Math.floor(Math.random() * c);
let i = -1;
if (cells.length > maxCount) {
const died = cells.splice(newPoints);
console.log(died);
}
cells = [...cells, ...pickStartingPoints(newPoints)];
context.fillStyle = `rgba(${colors.bg}, 0.1`;
context.fillRect(0, 0, width, height);
context.globalCompositeOperation = "source-over";
cells = cells.filter(([x,y])=>x>-width&&x<2*width&&y>-height&&y<2*height).map(([x, y, color], j) => {
const n = noise(x * frequence, y * frequence + Math.sin(z), z);
const t = (n % TAU) * Math.PI;
const dx = l * Math.cos(t);
const dy = l * Math.sin(t);
if (x > 0 && x < width && y > 0 && y < height) {
drawVector(x, y, dx, dy, color, r);
}
x = x + dx * v;
y = y + dy * v;
return [x, y, color];
});
mutable fps =
(1 + mutable fps) * (1 + .984e-3 * (now - (now = performance.now())));
yield context.canvas;
}
yield context.canvas;
}