JSFiddle - React, Tailwind, and code Playground

by jehangir001

HTML

<script src="https://threejs.org/build/three.min.js"></script>
<script src="https://threejs.org/examples/js/controls/OrbitControls.js"></script>

CSS

body {
	background-color: #000;
	margin: 0px;
	overflow: hidden;
}

JavaScript

// Simple three.js example

var mesh, renderer, scene, camera, controls;

init();
animate();

function init() {

    // renderer
    renderer = new THREE.WebGLRenderer();
    renderer.setSize( window.innerWidth, window.innerHeight );
    document.body.appendChild( renderer.domElement );

    // scene
    scene = new THREE.Scene();
    
    // camera
    camera = new THREE.PerspectiveCamera( 40, window.innerWidth / window.innerHeight, 1, 10000 );
    camera.position.set( 20, 20, 20 );

    // controls
    controls = new THREE.OrbitControls( camera, renderer.domElement );
    
    // ambient
    scene.add( new THREE.AmbientLight( 0x222222 ) );
    
    // light
    var light = new THREE.DirectionalLight( 0xffffff, 1 );
    light.position.set( 20, 20, 0 );
    scene.add( light );
        function Light3D() {
      const color = 0xffffff;
      const intensity = 0.6;
      const lightDirec = new THREE.DirectionalLight(color, intensity);
      lightDirec.position.set(0, 15, 60);
      lightDirec.target.position.set(0, 7, 5);
      lightDirec.target.updateMatrixWorld();
      lightDirec.castShadow = true;
      //point light
      const pointlight = new THREE.PointLight(color, 1.2);
      pointlight.position.set(0, 10, -25);
      pointlight.castShadow = true;

      // directionallight helper
      const helperDirecLight = new THREE.DirectionalLightHelper(lightDirec);

      // point light helper
      const helperPointLight = new THREE.PointLightHelper(pointlight);
      //add light to scene
      scene.add(
        lightDirec,
        lightDirec.target,
        helperDirecLight,
        pointlight,
        helperPointLight
      );
    }
    Light3D();
    // axes
    scene.add( new THREE.AxesHelper( 20 ) );
    
    var texture = new THREE.TextureLoader().load('https://i.postimg.cc/ZRBzwkjV/0ac4182b-c922-41c7-84a9-5c7006ed9b7e.png');

    // geometry
    var geometry = new THREE.BoxGeometry( 12, 12, 12 );
    
    // material
    var material = new...