scene-template

1.0.9 • Public • Published

scene-template

A threejs scene template based on work by @mattdesl. Used to quickly generate a scene for demos or other.

Usage

var createApp = require('scene-template');

can be orbit, first-person, or fly controls. with the corresponding options

Pass in options for the renderer, controls and any initial objects.

opts = {
  // pass in options to the webgl renderer
  renderer: {
    antialias: true
  },
  width: 500, // dimensions of the renderer, defaults to window size
  height: 500,
  // controls. Can be 'fly' or 'first-person' controls as well 
  controls: {
    type: 'orbit', 
    theta: 50 * Math.PI / 180,
    phi: -50 * Math.PI / 180,
    distance: 60
  },
  domElement: document.body,
  // add any initial objects to the scene
  objects: [
    mesh1,
    light
  ]
}

You can retrieve a reference to the scene objects from the create method

const {
  renderer,
  camera,
  scene,
  updateControls 
= createApp(opts, THREE);

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.91latest

Version History

VersionDownloads (Last 7 Days)Published
1.0.91
1.0.70
1.0.60
1.0.50
1.0.40
1.0.30
1.0.20
1.0.10
1.0.00

Package Sidebar

Install

npm i scene-template

Weekly Downloads

1

Version

1.0.9

License

ISC

Last publish

Collaborators

  • nascherman