draw_svg = {
const svg = d3.create("svg")
.attr("viewBox", [0, 0, W, W])
.style('background', '#000')
.attr('width',W)
.attr('height',W);
const out = svg.append('g')
.attr('stroke-width', 1)
.attr('fill', 'none')
.node()
const sx = 1;
const sy = 10;
const numX = Math.ceil(W / sx);
const numY = Math.ceil(2 * W / sy);
const pool = Array.from({length: numX * numY}, (_, i) => out.appendChild(htl.svg`<line ${{
x1: i % numX,
x2: i % numX,
y1: W
}}>`));
let c = 1, f = 0
while(true) {
for(let y = 0; y < numY; y++) {
for(let x = 0; x < numX; x++) {
const px = x * sx;
const py = y * sy;
const line = pool[x + y * numX];
let n = noise(simplex.noise2D(px / 500, (py + f) / W))
line.setAttribute('y2', py + W * 2 * n - W);
line.setAttribute('stroke', (c>0) ? `${mc(py-mapColour(n)/2)}` : '#000');
}
c=-c
}
f++
yield svg.node();
}
}