JSFiddle - React, Tailwind, and code Playground
JavaScript
import * as THREE from 'https://cdn.skypack.dev/[email protected]/build/three.module.js';
let camera, scene, renderer;
init();
function init() {
camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.01, 10);
camera.position.z = 1;
scene = new THREE.Scene();
const textureLoader = new THREE.TextureLoader();
const texture = textureLoader.load('https://threejs.org/examples/textures/2294472375_24a3b8ef46_o.jpg');
texture.mapping = THREE.EquirectangularReflectionMapping;
scene.background = texture;
renderer = new THREE.WebGLRenderer();
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.setAnimationLoop(animation);
document.body.appendChild(renderer.domElement);
}
function animation(time) {
renderer.render(scene, camera);
console.log( renderer.info.memory );
}