{
const svg = d3.select(domEl).select('svg');
const getHilbertPath = vertices => {
let path = 'M0 0L0 0';
vertices.forEach(vert => {
switch(vert) {
case 'U': path += 'v-1'; break;
case 'D': path += 'v1'; break;
case 'L': path += 'h-1'; break;
case 'R': path += 'h1'; break;
}
});
return path;
}
svg.selectAll('path')
.datum(hilbertData)
.attr('d', d => getHilbertPath(d.pathVertices))
.attr('transform', d => `scale(${d.cellWidth}) translate(${d.startCell[0] + .5}, ${d.startCell[1] + .5})`);
svg.select('path:not(.skeleton)')
.transition().duration(order * 1000 * 2).ease(d3.easeLinear)
.attrTween('stroke-dasharray', function () {
const l = this.getTotalLength();
const i = d3.interpolateString("0," + l, l + "," + l);
return t => i(t);
});
}