Public
Edited
Oct 21, 2023
Insert cell
Insert cell
{
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xFFCF8B);

const camera = new THREE.PerspectiveCamera( 60, window.innerHeight / window.innerWidth, 1, 1000 );
camera.position.set(2, 2, -2)
camera.lookAt(new THREE.Vector3(0, 0, 0));

const renderer = new THREE.WebGLRenderer();
renderer.setSize( window.innerHeight / 2, window.innerWidth / 2 );

const geometry = new THREE.BoxGeometry( 1, 1, 1 );
const material = new THREE.MeshNormalMaterial();
const cube = new THREE.Mesh( geometry, material );
scene.add( cube );

function animate() {
requestAnimationFrame( animate );
renderer.render( scene, camera );

cube.rotation.z += 0.01;
}
animate();

return renderer.domElement
}
Insert cell
Insert cell
THREE = require("three")
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