JSFiddle - React, Tailwind, and code Playground

by realhunts

HTML

<script src="https://cdn.rawgit.com/mrdoob/three.js/r95/build/three.min.js"></script>
<script src="https://cdn.rawgit.com/mrdoob/three.js/r85/examples/js/controls/OrbitControls.js"></script>
<script src="https://cdn.rawgit.com/mrdoob/three.js/r95/examples/js/loaders/GLTFLoader.js"></script>
<div id="container"></div>

CSS

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

JavaScript

// Simple three.js example

var mesh, renderer, scene, camera, controls;
var mixer;
var clock = new THREE.Clock();
init();
animate();

function init() {

    // renderer
    renderer = new THREE.WebGLRenderer();
    renderer.setClearColor( 0xaaaaaa );
    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 );
    
    // ambient
    scene.add( new THREE.AmbientLight( 0xffffff ) );
    
    // light
    var light = new THREE.DirectionalLight( 0xffffff, 1 );
    light.position.set( 20, 20, 20 );
    scene.add( light );
    
    // axes
    scene.add( new THREE.AxisHelper( 20 ) );

   var manager = new THREE.LoadingManager();
    manager.onProgress = function ( item, loaded, total ) {
        console.log( item, loaded, total );
    };

    var loader = new THREE.GLTFLoader();
    loader.setCrossOrigin( 'anonymous' );

    var scale = 60;
    //var url = "https://raw.githubusercontent.com/lasalvavida/glTF-Sample-Models/2.0/2.0/Avocado/glTF/Avocado.gltf";
    var url = "https://cdn.glitch.com/b099dace-d22a-45a3-9218-04b3f1c930da%2Fscene%20(5).glb?1555979244721";
    loader.load(url, function (data) {
        gltf = data;
        var object;
        if ( gltf.scene !== undefined ) {
            object = gltf.scene; // default scene
        } else if ( gltf.scenes.length > 0 ) {
            object = gltf.scenes[0]; // other scene
        }
        
        console.log(data.scene.children[0].children[0].children[2])
         data.scene.traverse((child) => {
            if (child instanceof THREE.Mesh) {

                //console.log(child.material)
                if (child.material.type = "MeshStandardMaterial") {
                   ...