plot = {
steely_dan_says;
let f = (x) => Math.exp(-(x ** 2 / 2)) * Math.sin(20 * x);
let plot = Plot.plot({
width: 900,
height: 300,
y: { domain: [-1.2, 1.2] },
marks: [
Plot.line(
d3.range(-3.2, 3.2, 0.01).map((x) => [x, f(x)]),
{ strokeWidth: 3 }
)
]
});
let path = d3.select(plot).select("g[aria-label='line']").select("path");
let length = path.node().getTotalLength();
path
.attr("stroke-dasharray", [0, length])
.transition()
.duration(1500)
.attr("stroke-dasharray", [length, length]);
return plot;
}