JSFiddle - React, Tailwind, and code Playground

by ps111

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/99/three.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

JavaScript

var container,
            stats,
            mixer,
            ptmixer,
            camera,
            scene,
            obj,
            mat,
            point_indices,
            points,
            pt_mts,
            ptmat,
            geo,
            ptgeo = new THREE.Geometry(),
            renderer,
            mouseX = 0,
            mouseY = 0;

        var windowHalfX = window.innerWidth / 2,
            windowHalfY = window.innerHeight / 2;

        init();
        animate();

        function init() {

            container = document.createElement('div');
            document.body.appendChild(container);

            camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 2000);
            camera.position.z = 4;

            scene = new THREE.Scene();

            var ambient = new THREE.AmbientLight( 0x444444 );
            scene.add( ambient );

            var directionalLight = new THREE.DirectionalLight( 0xffeedd );
            directionalLight.position.set(0,0,10000).normalize();
            scene.add( directionalLight );

            var directionalLight = new THREE.DirectionalLight( 0xffeedd );
            directionalLight.position.set(0,10000,0).normalize();
            scene.add( directionalLight );

            var directionalLight = new THREE.DirectionalLight( 0xffeedd );
            directionalLight.position.set(10000,0,0).normalize();
            scene.add( directionalLight );

            geo = new THREE.BoxGeometry( 4,5,3 );
            mat = new THREE.MeshNormalMaterial({
                morphTargets: true
            });

            ptgeo = new THREE.Geometry();
            ptgeo.vertices.push( new THREE.Vector3(2, 2.5, 3) );
            ptgeo.vertices.push( new THREE.Vector3(1, 2.5, 3) );
            ptgeo.vertices.push( new THREE.Vector3(0, 2.5, 3) );

            ptmat = new THREE.PointsMaterial({
                morphTargets: true,
                color: 0xff0000
            });

           ...