Published
Edited
Jul 20, 2018
1 fork
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
paths = {
const paths = []

const numPoints = numPetals * numPointsPerPetal
const size = H/2
const TAU = Math.PI * 2
const pointOf = n => ([size * Math.sin((n / numPoints+rotation) * TAU), size * Math.tan((n / numPoints+rotation) * TAU)])
for (let rotate = 0; rotate < numPoints/2; rotate += numPointsPerPetal) {
for (let point = 0; point < numPoints; point++) {
const fromPoint = rotate + point
const toPoint = rotate + point * offset + 1
paths.push([pointOf(fromPoint), pointOf(toPoint)])
}
}

return paths
}
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