three.js dev template - module
HTML
<!-- Import maps polyfill -->
<!-- Remove this when import maps will be widely supported -->
<script async src="https://unpkg.com/es-module-shims@1.3.6/dist/es-module-shims.js"></script>
<script type="importmap">
{
"imports": {
"three": "https://unpkg.com/three/build/three.module.js"
}
}
</script>
CSS
body {
margin: 0px;
}
JavaScript
// Simple three.js example
import * as THREE from "three";
init();
function init() {
const renderer = new THREE.WebGLRenderer();
const texture1 = new THREE.Texture(10, 10);
const texture2 = new THREE.Texture(10, 10);
renderer.copyTextureToTexture(
new THREE.Vector2(10, 10),
texture1,
texture2,
);
}