Released Installed
JavaScript 3D library (WebGL / WebGPU). ESM builds — three.module.js imports three.core.js from the same directory.
<script type="module">
import * as THREE from 'https://cdn.roste.org/three.js/latest/three.module.js';
// …
</script><script type="module">
import * as THREE from 'https://cdn.roste.org/three.js/latest/three.module.js';
// …
</script><script type="module">
import * as THREE from 'latest/three.module.js';
// …
</script> Root shortcuts: https://cdn.roste.org/three.module.js + https://cdn.roste.org/three.core.js (ESM relative import).
<canvas id="c"></canvas>
<script type="module">
import * as THREE from "latest/three.module.js";
const canvas = document.getElementById("c");
const renderer = new THREE.WebGLRenderer({ canvas, antialias: true });
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(60, 16 / 9, 0.1, 100);
camera.position.z = 2.5;
const mesh = new THREE.Mesh(
new THREE.BoxGeometry(),
new THREE.MeshNormalMaterial()
);
scene.add(mesh);
(function tick(t) {
mesh.rotation.x = t / 1000;
mesh.rotation.y = t / 1400;
renderer.render(scene, camera);
requestAnimationFrame(tick);
})(0);
</script>