lesca-glb-loader
v1.0.3
Published
load glb file simplified.
Downloads
21
Readme
Why use it?
load glb file simplified.
Live Demo
Installation
npm install lesca-glb-loader --save
Usage
import GlbLoader from 'lesca-glb-loader';
import Avatar from './Athlete.glb';
GlbLoader(Avatar).then((e) => {
const { model, mixer, gltf } = e;
const scale = 80;
model.scale.set(scale, scale, scale);
scene.add(model);
// animation clip update
enterframe.add(() => {
// => same requestAnimationFrame
const delta = clock.getDelta();
mixer[0].update(delta);
});
});
Development
Parameters
GlbLoader(url, options).then((e) => {
// get module here
});
| Parameters | description | default | | :------------------- | :----------------: | ------------------: | | url:string | glb file url | | | options:object | options for loader | options |
Options
| key | description | default | | :-------------------------- | :-------------------: | --------------------: | | onProcess:function | on process handler | | | loop:boolean | animation clip loop? | true | | castShadow:boolean | model cast shadow? | true | | receiveShadow:boolean | model receive shadow? | false | | material:object | Materials | Material |
material
| key | description | default | | :------------------------------ | :---------: | ------: | | metalness:number | Materials | 0 | | roughness:number | Materials | 1 | | clearcoat:number | Materials | 0 | | clearcoatRoughness:number | Materials | 0.5 |
Features
- Code Linting (eslint)
- maintain if necessary