0.1.2 • Published 4 years ago

vue-three-box v0.1.2

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

vue-three-box

install

npm install vue-three-box

global use

// src/main.js
import VueThreeBox from 'vue-three-box'
Vue.use(VueThreeBox)

local use

import { ThreeScene, ThreeCamera, ThreeLight, ThreeFbxModel } from '../packages/index.js'

export default {
  components: { ThreeScene, ThreeCamera, ThreeLight, ThreeFbxModel }
}

Object3Dmixin

mixin, not a component

Props

nametypedefaultother
positionArray[0,0,0]---
rotationArray[0,0,0]in 'XYZ' order
scaleArray[1,1,1]---
invisibleBooleanfalse---

Usage

<three-fbx-model src="path/to/modelfile"
  :position=[0,100,0]
  :rotation=[0,90,0]
  :scale=[1,1,1]
  invisible></three-fbx-model>

ThreeScene

base container put other components in it

Props

nametypedefaultother
widthNumber500
heightNumber500
backgroundNumber0xffffffuse hexadecimal

Events

namedescription
onLoadtriggered on load finish
onProgresstriggered during loading
onErrortriggerd when error happend

Usage

<three-scene
  :width=500 :height=500
  :background=0xaabbcc></three-scene>

ThreeCamera

PerspectiveCamera component

Props

nametypedefaultother
fovNumber45
nearNumber1
farNumber2000

Usage

<three-scene>
  <three-camera :fov=50
    :near=10 :far=1000></three-camera>
</three-scene>

ThreeLight

Light component

Props

nametypedefaultother
typeStringrequired
colorNumber0xffffffuse hexadecimal
intensityNumber1

Types

typeLightType
ambientAmbientLight
directionalDirectionalLight
hemisphereHemisphereLight
pointPointLight
spotSpotLight

Usage

<three-scene>
  <!-- add ambient light to the scene -->
  <three-light type="ambient"
    :color="0xaabbcc" :intensity="0.2"></three-light>

  <three-camera :fov=50
    :near=10 :far=1000>

    <!-- add two directional light to camera -->
    <three-light type="directional" :position="[270, 250, 280]" :intensity="1"></three-light>
    <three-light type="directional" :position="[-114, 290, -62]" :intensity="0.4"></three-light>

  </three-camera>
</three-scene>

ThreeFbxModel

Model component for .fbx file

Props

nametypedefaultother
srcStringrequired
animatedBooleanfalse

Usage

<three-scene>
   <!-- add fbx model to the scene and set to animated -->
    <three-fbx-model
      :position="[0,0,100]"
      src="/path/to/fbxFile"
      animated></three-fbx-model>
</three-scene>
0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago