svg = {
const svg = d3.create("svg").attr("viewBox", [0, 0, width, height]).attr("width", width).attr("height", height);
const n = 1000;
svg
.selectAll("text")
.data(rwg(n).sort(d3.ascending))
.join("text")
.classed("label-box", true)
.text(d => d)
.attr("x", () => (width * Math.random()) | 0)
.attr("y", () => (height * Math.random()) | 0);
yield svg.node();
svg
.selectAll("text")
.on("mouseover", function () {
this.setAttribute("data-priority", 2);
occlusion(svg);
})
.on("mouseout", function () {
this.setAttribute("data-priority", 0);
occlusion(svg);
});
do {
const i = (Math.random() * n) | 0;
svg
.select(`text:nth-of-type(${i})`)
.attr("data-priority", Math.random() * 2);
occlusion(svg);
await Promises.delay(300);
} while (true);
}