JSFiddle - React, Tailwind, and code Playground

by neo_

CSS

body {
  overflow: hidden;
  margin: 0;
}

JavaScript

import * as THREE from 'https://cdn.skypack.dev/three@0.136.0/build/three.module.js';
import { OrbitControls } from 'https://cdn.skypack.dev/three@0.136.0/examples/jsm/controls/OrbitControls.js';
import { GUI } from 'https://cdn.skypack.dev/three@0.136.0/examples/jsm/libs/lil-gui.module.min.js';
import Stats from 'https://cdn.skypack.dev/three@0.136.0/examples/jsm/libs/stats.module.js';

// *********** CHANGING VERSION TO ANYTHING ABOVE 136 WILL RESULT IN ERROR *********** //
//import * as THREE from 'https://cdn.skypack.dev/three@0.139.2/build/three.module.js';
//import { OrbitControls } from 'https://cdn.skypack.dev/three@0.139.2/examples/jsm/controls/OrbitControls.js';
//import { GUI } from 'https://cdn.skypack.dev/three@0.139.2/examples/jsm/libs/lil-gui.module.min.js';
//import Stats from 'https://cdn.skypack.dev/three@0.139.2/examples/jsm/libs/stats.module.js';

let scene, renderer, camera, stats, params; 

init();

function init() {

    scene = new THREE.Scene();
    scene.background = new THREE.Color(0x526949);

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

    renderer = new THREE.WebGLRenderer({ antialias: true });
    renderer.setPixelRatio(window.devicePixelRatio);
    renderer.setSize(window.innerWidth, window.innerHeight);
    document.body.appendChild(renderer.domElement);

    camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 10);
    camera.position.set(2, 2, 2);

    const controls = new OrbitControls(camera, renderer.domElement);

    stats = new Stats();
    document.body.appendChild(stats.dom);

    makeGui();
    animate();

    window.addEventListener('resize', onWindowResize);
}

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

function onWindowResize() {
    camera.aspect = window.innerWidth /...