Published
Edited
Apr 13, 2020
1 fork
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
waves = {
const svg = d3
.create("svg")
.attr("width", scale)
.attr("height", scale)
.attr('viewBox', `0 0 ${size * 2} ${size * 2}`);

var line = d3
.line()
.curve(d3.curveBasis) //CatmullRom.alpha(0))
.x(function(d) {
return d[0];
})
.y(function(d) {
return d[1];
});

var paths = d3
.range(600, 2000 - 900, 3) //0 2200
.map(d => walk(d))
.filter(d => d.length);
console.log('done', paths.length);

paths.forEach(p => {
p = coarse(p, 6);

svg
.append("path")
.datum(p)
.attr("class", "line")
.style("stroke", '#222')
.attr('stroke-width', 0.31)
.style('fill', 'none')
.attr("id", (d, i) => i) // assign ID
.attr("d", d => line(d))
.attr('transform', `translate(${size},${size})`);
});

return svg.node();
}
Insert cell
perlin = new Noise(3)
Insert cell
Insert cell
Insert cell
Insert cell
d3 = require('d3')
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more