Published
Edited
Oct 23, 2020
1 fork
Insert cell
Insert cell
Insert cell
{
const threelet = new Threelet({
canvas: canvas,
//optAxes: false,
});
threelet.setup('mod-controls', THREE.OrbitControls);

// https://github.com/observablehq/stdlib#invalidation
invalidation.then(() => threelet.dispose());

const cube = new THREE.Mesh(
new THREE.BoxGeometry(0.5, 0.5, 0.5),
new THREE.MeshBasicMaterial({color: 0x00ff00}));
threelet.scene.add(cube);
threelet.render(); // first time; passive rendering per mouse interaction
return threelet;
}
Insert cell
THREE = {
const THREE = window.THREE = await require("three@0.112/build/three.min.js");
await require("three@0.112/examples/js/controls/OrbitControls.js").catch(() => {});
return THREE;
}
Insert cell
Threelet = {
const _THREE = THREE; // this ensures THREE is resolved first.
return (await require(`threelet@0.10.0/dist/threelet.esm.min.js`)).default;
}
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