JSFiddle - React, Tailwind, and code Playground

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: 0;
}

JavaScript

import * as THREE from 'three';
import { GLTFLoader } from 'https://unpkg.com/three/examples/jsm/loaders/GLTFLoader.js';

	import { OrbitControls } from 'https://unpkg.com/three/examples/jsm/controls/OrbitControls.js';

			
var scene, sceneRed,sceneBlue,sceneGreen, camera, renderer, clock;
var controls;
var redBox,blueBox,greenBox,tunnelBoxRed,tunnelBoxRed2,tunnelBoxBlue,tunnelBoxBlue2,tunnelBoxGreen,tunnelBoxGreen2
var planes=[]
init();
animate();

function init() {

  var tunnelGeometry, tunnelMaterial,tunnelMaterialRed,tunnelMaterialGreen,tunnelMaterialBlue;
  var sphereGeometry, redMaterial;
  var greenMaterial;
  var  blueMaterial;


  scene = new THREE.Scene();
  sceneRed = new THREE.Scene();
  sceneGreen = new THREE.Scene();
  sceneBlue = new THREE.Scene();

  clock = new THREE.Clock();

  camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 1, 10000);
  camera.position.z = 10;


  tunnelGeometry = new THREE.BoxGeometry(2, 2,2);


  // invisible tunnels
  tunnelMaterialRed = new THREE.MeshBasicMaterial({
    color: 0xff0000,
    colorWrite: true,  
    depthWrite: true,
    transparent:true,
    opacity:0.1

      });



  tunnelMaterialGreen = new THREE.MeshBasicMaterial({
    color: 0x00ff00,
    colorWrite: true,  
    depthWrite: true,
    transparent:true,
    opacity:0.1
    
  });


  tunnelMaterialBlue = new THREE.MeshBasicMaterial({
    color: 0x0000ff,
    colorWrite: true,  
    depthWrite: true,
    transparent:true,
    opacity:0.1,
    
    

  });


  tunnelBoxRed = new THREE.Mesh(tunnelGeometry, tunnelMaterialRed);
  tunnelBoxRed2 = new THREE.Mesh(tunnelGeometry, tunnelMaterialRed);
  tunnelBoxRed.position.x=-3
  tunnelBoxRed2.position.x=-9
  tunnelBoxGreen = new THREE.Mesh(tunnelGeometry, tunnelMaterialGreen);
  tunnelBoxGreen2 = new THREE.Mesh(tunnelGeometry, tunnelMaterialGreen);
  tunnelBoxGreen2.position.x=6
  
  tunnelBoxBlue = new THREE.Mesh(tunnelGeometry, tunnelMaterialBlue);
  tunnelBoxBlue2 = new...