Public
Edited
Dec 30, 2022
Paused
Insert cell
Insert cell
Insert cell
Mandala({ design })
Insert cell
Insert cell
Insert cell
viewof mandala = {
const mandala = d3.create("svg").attr("width", size).attr("height", size);

yield mandala.node();

// board
// d3
// .create("g")
// .attr("transform", `scale(${size / 2}) translate(1, 1)`)
// .html(design.board)
// .node();
const board = svg`<g transform="scale(${size / 2}) translate(1, 1) ">${
design.board
}</g>`;
mandala.node().append(board);

// pieces
for (const type_info of design.piece_types) {
for (const i of _.times(design.num_sectors)) {
// const polygon = `<g><polygon points=${points} fill=${fill} /></g>`;
// await Promises.delay(20);
// mandala.append(piece);
}
}

// cursor
mandala.node().append(html`<style>
.mandala-piece:hover { cursor:grab; }
.mandala-piece:active { cursor:grabbing; }
</style>`);
}
Insert cell
design.board
Insert cell
Insert cell
height = width
Insert cell
size = Math.min(width, 0.8 * mutable outerHeight)
Insert cell
Insert cell
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more