Code viewer for World: animation key frames
//import from threejs examples
//https://threejs.org/examples/#webgl_animation_keyframes
//https://github.com/mrdoob/three.js/blob/master/examples/webgl_animation_keyframes.html






	AB.loadCSS ( '/uploads/threeport/main.css' ); 
	            AB.newDiv ('container');
	//import libarys needed
	
            import * as THREE from '/api/threemodule/libs/three.module.js';

 //           import Stats from '/uploads/threeport/stats.module.js';

			import { OrbitControls } from '/uploads/threejs/OrbitControls.js';
			import { RoomEnvironment } from '/uploads/threejs/RoomEnvironment.js';

			import { GLTFLoader } from '/uploads/threejs/GLTFLoader.js';
			import { DRACOLoader } from '/uploads/threejs/DRACOLoader.js';

			let mixer;

			const clock = new THREE.Clock();
			const container = document.getElementById( 'container' );

//			const stats = new Stats();
//			container.appendChild( stats.dom );

			const renderer = new THREE.WebGLRenderer( { antialias: true } );
			renderer.setPixelRatio( window.devicePixelRatio );
			renderer.setSize( window.innerWidth, window.innerHeight );
			renderer.outputEncoding = THREE.sRGBEncoding;
			container.appendChild( renderer.domElement );

			const pmremGenerator = new THREE.PMREMGenerator( renderer );

			const scene = new THREE.Scene();
			scene.background = new THREE.Color( 0xbfe3dd );
			scene.environment = pmremGenerator.fromScene( new RoomEnvironment(), 0.04 ).texture;

			const camera = new THREE.PerspectiveCamera( 40, window.innerWidth / window.innerHeight, 1, 100 );
			camera.position.set( 5, 2, 8 );

			const controls = new OrbitControls( camera, renderer.domElement );
			controls.target.set( 0, 0.5, 0 );
			controls.update();
			controls.enablePan = false;
			controls.enableDamping = true;

			const dracoLoader = new DRACOLoader();
			dracoLoader.setDecoderPath( 'uploads/threejs/' );

			const loader = new GLTFLoader();
			loader.setDRACOLoader( dracoLoader );
			loader.load( 'uploads/threejs/LittlestTokyo.glb', function ( gltf ) {

				const model = gltf.scene;
				model.position.set( 1, 1, 0 );
				model.scale.set( 0.01, 0.01, 0.01 );
				scene.add( model );

				mixer = new THREE.AnimationMixer( model );
				mixer.clipAction( gltf.animations[ 0 ] ).play();

				animate();

			}, undefined, function ( e ) {

				console.error( e );

			} );


			window.onresize = function () {

				camera.aspect = window.innerWidth / window.innerHeight;
				camera.updateProjectionMatrix();

				renderer.setSize( window.innerWidth, window.innerHeight );

			};


			function animate() {

				requestAnimationFrame( animate );

				const delta = clock.getDelta();

				mixer.update( delta );

				controls.update();

//				stats.update();

				renderer.render( scene, camera );

			}