update = {
let j = 0;
const full = [width / 2, width / 2, width / 2];
let window = full;
while (playing) {
const newWindow = j === 10 ? full : [
Math.random() * width,
Math.random() * width,
2 ** (Math.random() * Math.log2(width / 2))
];
const i = d3.interpolateZoom(window, newWindow);
console.log(d3.select(grid));
const transition = d3
.select(grid)
.transition()
.duration(3000)
.attrTween(
"viewBox",
() =>
function (t) {
const [cx, cy, w] = i(t);
return `${cx - w} ${cy - w} ${w * 2} ${w * 2}`;
}
);
await transition.end();
window = newWindow;
j++;
yield true;
await Promises.delay(2000);
}
}