Package Exports
- canvas-orbit-camera
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (canvas-orbit-camera) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
canvas-orbit-camera 
An alternative wrapper for orbit-camera that works independently of game-shell.
Controls are as follows:
- Rotate - Left click
- Pan - Right click or Control + Left click
- Zoom - Scroll or Shift + Left click
Based heavily on game-shell-orbit-camera.
Usage
camera = createCamera(canvas[, options])
Attaches a modified orbit-camera
instance to the canvas
– attaching the
required event listeners for interaction.
The following options are available:
rotate
: disable rotation interactions by passingfalse
.scale
: disable scaling interactions by passingfalse
.pan
: disable panning interactions by passingfalse
.
See the orbit-camera documentation for a full list of available methods.
camera.tick()
Call this at the beginning of each frame to update the current position of the camera.
camera.view([out])
Returns the current view matrix associated by the camera: a 16-element (4x4)
Float32Array
instance. Optionally, you can pass in your own array out
here
too.
Example
var canvas = document.body.appendChild(document.createElement('canvas'))
var createCamera = require('canvas-orbit-camera')
var raf = require('raf')
var camera = createCamera(canvas)
update()
function update() {
raf(update)
// Returns your view matrix for you
var view = camera.view()
camera.tick()
}
License
MIT. See LICENSE.md for details.