JSFiddle - React, Tailwind, and code Playground

by muzihuoyubai

HTML

<!DOCTYPE html>
<html lang="en">
<head>
  <script type="importmap">
        {
            "imports": {
                "three": "https://muzihuoyubai.github.io/threejs/node_modules/three/build/three.module.js",
                "OrbitControls": "https://muzihuoyubai.github.io/threejs/node_modules/three/examples/jsm/controls/OrbitControls.js",
                "OBJLoader": "https://muzihuoyubai.github.io/threejs/node_modules/three/examples/jsm/loaders/OBJLoader.js",
                "OBJExporter": "https://muzihuoyubai.github.io/threejs/node_modules/three/examples/jsm/exporters/OBJExporter.js"
            }
        }


  </script>
  <meta charset="utf-8">
  <style>
    body {
      margin: 0;
    }
  </style>
</head>
<body>
<script type="module">
  import * as THREE from 'three';
  import {OrbitControls} from 'OrbitControls';
  import {OBJLoader} from 'OBJLoader';

  let textureLoader = new THREE.TextureLoader();
  const renderer = new THREE.WebGLRenderer({antialias: true});
  const scene = new THREE.Scene();
  const camera = new THREE.PerspectiveCamera(10, window.innerWidth / window.innerHeight);
  camera.position.set(6, 0, 0)
  camera.lookAt(new THREE.Vector3(0, 0, 1,))
  scene.background = new THREE.Color("#ffffff");

  renderer.setSize(window.innerWidth, window.innerHeight);
  renderer.setPixelRatio(window.devicePixelRatio);
  renderer.outputEncoding = THREE.sRGBEncoding;
  document.body.appendChild(renderer.domElement);

  const point = new THREE.PointLight(0xffffff, 0.5);
  point.position.set(300, 400, 200);
  scene.add(point);
  const ambient = new THREE.AmbientLight(0xffffff, 0.4);
  ambient.position.set(200, 300, 200);
  scene.add(ambient);

  const controls = new OrbitControls(camera, renderer.domElement);
  controls.addEventListener('change', render);

  controls.enableZoom = true;

  controls.minDistance = 2;

  controls.maxDistance = 10;

  controls.enablePan = true;
  controls.target.set(0, 0, 0);
  controls.update();

  const loader = new...