import * as THREE from 'three' ; import * as orbitControlsCreator from 'three-orbit-controls' ; const OrbitControls = orbitControlsCreator ( THREE ) ; param domElement export const createOrbitControls = ( camera , domElement ? ) => { const orbit = new OrbitControls ( camera , domElement ) ; orbit . enableKeys = true ; orbit . enableZoom = true ; return orbit ; } ; param color export const createLights = ( color = 0xffffff ) : THREE . Light [ ] => { const ambientLight = new THREE . AmbientLight ( color ) ; const lights = [ ] ; lights [ 0 ] = new THREE . PointLight ( color , 1 , 0 ) ; lights [ 1 ] = new THREE . PointLight ( color , 1 , 0 ) ; lights [ 2 ] = new THREE . PointLight ( color , 1 , 0 ) ; lights [ 0 ] . position . set ( 0 , 200 , 0 ) ; lights [ 1 ] . position . set ( 100 , 200 , 100 ) ; lights [ 2 ] . position . set ( - 100 , - 200 , - 100 ) ; return [ ambientLight , lights [ 0 ] , lights [ 1 ] , lights [ 2 ] ] ; } ; param canvas export const createRenderer = ( canvas ) : THREE . WebGLRenderer => { const renderer = new THREE . WebGLRenderer ( { canvas : canvas , antialias : true , alpha : true } ) ; renderer . setClearColor ( 0x0 ) ; renderer . setClearAlpha ( 0 ) ; renderer . setPixelRatio ( window . devicePixelRatio ) ; renderer . setSize ( window . innerWidth , window . innerHeight ) ; return renderer ; } ; param initDistance export const createCamera = ( initDistance = 80 ) => { const camera = new THREE . PerspectiveCamera ( 70 , window . innerWidth / window . innerHeight , 0.1 , 1000 ) ; camera . position . z = initDistance ; return camera ; } ; /**
 * Creates a clock object
 */ export const createClock = ( ) => new THREE . Clock ( ) ; /**
 * Creates a scene object
 */ export const createScene = ( ) => new THREE . Scene ( ) ;