{
const height = 60;
const context = DOM.context2d(width, height);
const drawAxis = await svg2canvas(context, svg =>
d3
.select(svg)
.append("g")
.attr("transform", "translate(0,36)")
.call(axis)
);
function draw(t) {
context.clearRect(0, 0, width, height);
context.globalAlpha = 0.4;
for (let i = 0; i < width; i += 3) {
context.fillStyle = d3.interpolateRainbow(i / width);
context.fillRect(i, 0, 3, height);
}
drawAxis();
context.globalAlpha = 1;
context.strokeStyle = "white";
context.lineWidth = 3;
context.beginPath();
context.arc(x(t), 30, 25, 0, 2 * Math.PI);
context.stroke();
}
const ease1 = d3.easeBounceInOut,
ease2 = d3.easeCubic;
for (let t = 0; t < 1; t += .003) {
draw(.1 + ease1(t) - .4 * ease2(t));
yield context.canvas;
}
return context.canvas;
}