1.0.9 • Published 2 years ago

react-three-fbx-for-pyt v1.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

react-three-fbx-viewer

fbx viewer with three.js for react

Only render a fbx files

Install

npm install --save react-three-fbx-for-pyt

Usage

import React, { Component } from 'react';
import ReactThreeFbxViewer from 'react-three-fbx-for-pyt';

let fbxUrl = require('./asd.fbx');

export default class App extends Component {
  onLoad(e) {
    console.log(e);
  }

  onError(e) {
    console.log(e);
  }
  render () {
    let cameraPosition = {
      x:150,
      y:300,
      z:350
    }
    return (
      <div>
        <ReactThreeFbxViewer cameraPosition={cameraPosition} url={fbxUrl} onLoading={this.onLoad} onError={this.onError}/>
      </div>
    );
  }
}

Properties

inputs

paramdescriptiontypedefault
urlurl fbx to loadString"" 
backgroundColorcolor in hex 如果设置了alpha为true的话该值会失效Hex0x000000
alpha是否设置背景透明booleanfalse
width设置画布宽度number当前window的宽度
height设置画布高度number当前window的高度
angleangle of perspective camera in scenenumber45
nearnear of perspective camera in scenenumber1
farfar of perspective camera in scenenumber2000
cameraPositioncamera position in sceneObject{x: 2, y: 0, z: 10}
controlsPositioncontrol position in sceneObject{x: 0, y: 0, z: 0}

In a future, you will can choice the lights (HemisphereLight,HemisphereLight,AmbientLight, ...)

inputs

eventdescriptionreturn
onErrorreturn an errorobject error
onLoadingreturn an object with fbx is loadingobject onloading

特别鸣谢

原作者@ https://github.com/kappys1/react-three-fbx-viewer

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago