Published
Edited
Dec 8, 2018
3 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
function drawCircles([x, y, r], depth, context) {
if (depth === 0) return;
circle([x, y, r], context, { fill: false });
const nextR = r / 3;
const inner = [[x, y, nextR]];
for (let i = 0; i < n; ++i) {
const nextCoords = coordsFromDeg((360 / n) * i, r - nextR, [x, y]);
inner.push([...nextCoords, nextR]);
}
inner.forEach(c => drawCircles(c, depth - 1, context));
}
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