Published
Edited
Oct 23, 2020
2 forks
Insert cell
Insert cell
Insert cell
{
const threelet = new Threelet({
canvas: canvas,
optCameraPosition: [0, 1, 1.5],
});
// https://github.com/observablehq/stdlib#invalidation
invalidation.then(() => threelet.dispose());

threelet.setup('mod-controls', THREE.OrbitControls);
threelet.setup('mod-sky', THREE.Sky);
threelet.scene.add(createTestHemisphereLight());
threelet.scene.add(createTestDirectionalLight());
createTestObjects().forEach(obj => threelet.scene.add(obj));
threelet.render(); // first time; passive rendering per mouse interaction
return threelet;
}
Insert cell
Insert cell
Insert cell
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(() => {});
await require("three@0.112/examples/js/objects/Sky.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