quick-three
v1.0.2
Published
wrapper Three.js to create a 3d world quickly
Downloads
2
Readme
quick-three
wrapper Three.js to create a 3d world quickly
Installation
you can install with npm install quick-three
/* in ES 5 */
let Quick3d = require('quick-three');
/* in ES 6 */
import Quick3d from 'quick-three';
or
<script src="three.min.js"></script>
<script src="Quick3D.js"></script>
Usage
var option = {
// camera instance, Quick3d will add camera to scene, default is THREE.PerspectiveCamera instance
camera: null,
// renderer instance or renderer class, default is THREE.WebGLRenderer
renderer: null,
// controls class, default is THREE.TrackballControls
controls: null,
// renderer dom element container, default is document.body
domContainer: document.body
}
var quick3d = new Quick3D(option);
var mesh = new THREE.Mesh(
new THREE.PlaneGeometry(5, 5),
new THREE.MeshBasicMaterial({
color: 'red'
}))
quick3d.scene.add(mesh)
Properties
scene
- scene instancecamera
- camera instancerenderer
- renderer instancecontrols
- controls instancestats
- stats instancetween
- tween actiontextureLoader
- THREE.TextureLoader instanceclock
- THREE.Clock instance
Method
addAction
(function) - add function to requestAnimationFrame actionremoveAction
(function) - remove function from requestAnimationFrame action
renderer.render
, controls.update
, TWEEN.update
, stats.update
are added, if available.
// if you want to remove the action
quick3d.removeAction(quick3d.renderer.action)
quick3d.removeAction(quick3d.controls.action)
quick3d.removeAction(quick3d.tween.action)
quick3d.removeAction(quick3d.stats.action)
License
MIT licensed
Copyright (c) 2017 jinrui