UNPKG

macaw-threejs

Version:

Macaw Three.js is ready to use library to connect Three.js with your project.<br/> Under the hood is a fully optimized, clean Three.js set up to make it easy to implement effects for images (future text, etc.). With effects out of the box, you don't even

2 lines (1 loc) 908 B
import*as s from"three";import{SCENE_TYPE as t,SCENE_SETTINGS_DEFAULTS as e}from"../../constants.js";import{initScene as i,initCamera as n,initRenderer as o,initRaycaster as r}from"../../inits.js";class c{constructor(s){const{core:c,settings:h,container:a}=s;this._core=c;const{position:g}=window.getComputedStyle(a),d=Object.keys(t).includes(g)?g:t.absolute;this.settings=Object.assign(Object.assign({type:d},e),h),this.dimensions={width:a.offsetWidth,height:a.offsetHeight},this.container=a,this.scene=i({settings:this.settings}),this.camera=n({dimensions:this.dimensions}),this.renderer=o({container:this.container,settings:this.settings}),this.raycaster=r()}setSettings(t){this._core.controllers.render.isManualShouldRender=!1,this.scene.background=new s.Color(t.color),this.settings=Object.assign(Object.assign({},this.settings),t),this._core.controllers.render.manualRender()}}export{c as MacawScene};