Published
Edited
Sep 11, 2022
2 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
// viewof dispersion = Inputs.range([0, 180], {label: "Dispersion", step: 1})
Insert cell
Insert cell
createBranch = (p, tree, node, branch, len, dispersion, depth) => {
let org = node.segments[1].point
let spacing = dispersion / branch
let d = -(spacing * Math.floor(branch / 2))
for (let i = 0; i < branch; i++) {
let dest = new p.Point(org.x, org.y - (depth * len)).rotate(d, org)
d += spacing

let line = new p.Path.Line({
from: org,
to: dest,
strokeColor: new p.Color(depth * 0.4, depth * 0.4, depth * 0.6),
strokeWidth: depth / 1.2,
})

tree.push(line)

// new p.Path.Circle({
// center: dest,
// radius: depth * 2,
// fillColor: "#FFFF00"
// })
}
}
Insert cell
Insert cell
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