2.2.0 • Published 8 years ago

three-world v2.2.0

Weekly downloads
3
License
ISC
Repository
github
Last release
8 years ago

three-world

Convenience wrapper around Three.js to create a scene, camera and renderer quickly

Simple sample

  var world = require('three-world'),
      geometry = new THREE.CubeGeometry(10, 10, 10),
      material = new THREE.MeshBasicMaterial({ color: 0xff0000 }),
      mesh     = new THREE.Mesh(geometry, material);

  function onRendered() {
    mesh.rotation.y += 0.05;
  }

  world.init({ camDistance: 50, renderCallback: onRendered });
  world.add(mesh);
  world.start();

You can also pause and resume the world, if you so wish:

  world.start();
  ...
  world.pause();
  console.log(world.isPaused());
  world.resume();

In addition you can get the Camera, Scene and Renderer:

  var cam      = world.getCamera(),
      scene    = world.getScene(),
      renderer = world.getRenderer();

Available options

OptionDescriptionDefault
ambientLightColorColor of the ambient light. Optional.0xffffff (white)
camDistancePosition on the z-axis where the camera should initially be. Optional.100
clearColorColor that is used to clear the canvas. Optional.0 (black)
containerElement that the renderer should be appended to. Optional.document.body
farPlaneMaximum distance from the camera that is still rendered. Optional.2000
renderCallbackCallback function that is called right before rendering a new frame. Optionalundefined
2.2.0

8 years ago

2.1.1

9 years ago

2.1.0

9 years ago

2.0.2

9 years ago

2.0.1

9 years ago

2.0.0

9 years ago

1.3.0

9 years ago

1.2.0

9 years ago

1.1.0

9 years ago

1.0.6

9 years ago

1.0.5

9 years ago

1.0.4

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago