{
const w = 250;
const context = DOM.context2d(2 * w, 2 * w);
yield context.canvas;
context.translate(w, w);
let alpha = 0;
const points = new Float32Array(60 * 60 * 2);
const v = new d3.Delaunay(points).voronoi([-w + 10, -w + 10, w - 10, w - 10]);
while (true) {
context.clearRect(-w, -w, 2 * w, 2 * w);
const ca = Math.cos(alpha),
sa = Math.sin(alpha);
const c = Array.from(
d3
.range(-30, 30)
.map(i =>
d3
.range(-30, 30)
.map(j => [15 * (i * ca + j * sa), 15 * (i * sa - j * ca)])
)
)
.flat()
.map(([x, y]) => [
x + ((x + w / 2) * y * y) / w / w,
y + (x + w / 2) * 0.25
])
.flat();
for (let i = 0; i < c.length; i++) points[i] = c[i];
v.update();
context.beginPath();
for (let i = 0; i < points.length; i++) {
if ((Math.floor(i / 60) + (i % 60)) % 2) v.renderCell(i, context);
}
context.fillStyle = "pink";
context.fill();
context.beginPath();
for (let i = 0; i < points.length; i++) {
if ((Math.floor(i / 60) + (i % 60)) % 2 === 0) v.renderCell(i, context);
}
context.fillStyle = "lightblue";
context.fill();
context.beginPath();
v.render(context);
context.stroke();
alpha += 0.003;
yield context.canvas;
}
}