1.0.2 • Published 6 years ago

quick-three v1.0.2

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

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 instance
  • camera - camera instance
  • renderer - renderer instance
  • controls - controls instance
  • stats - stats instance
  • tween - tween action
  • ureLoader - THREE.TextureLoader instance
  • clock - THREE.Clock instance

Method

  • addAction (function) - add function to requestAnimationFrame action
  • removeAction (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

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago