function* preview2(scale, options) {
const {
width: w = width,
height: h = w / 6,
radius: r = h * .04,
pad: p = r * 2,
colorBg = '#fff',
colorStroke = '#000',
lineWidth = 2,
mapWeight = s => s.weight,
mapColor = s => s.color,
mapEase = s => s.ease,
duration = 6000
} = options;
const ctxBg = DOM.context2d(w, h);
ctxBg.fillStyle = colorBg;
ctxBg.fillRect(0, 0, w, h);
const wp = w - p * 2,
hp = h - p * 2;
ctxBg.beginPath();
for (let x = 0; x < wp; x++) {
const { fill, value } = scale(x / wp);
ctxBg.beginPath();
ctxBg.moveTo(x + p, p + hp);
ctxBg.lineTo(x + p, p + hp * (1 - value));
ctxBg.strokeStyle = fill;
ctxBg.globalAlpha = Math.random();
ctxBg.stroke();
}
yield ctxBg.canvas;
}