gl-flyCamera

1.0.2 • Public • Published

gl-flyCamera

✈️ controls

Installation

$ npm install gl-flyCamera

Example

controls = new flyCamera({
    domElement: document, // default: document
    movementSpeed: 100, // default: 10
    rollSpeed: Math.PI, // default: Math.PI / 3
    dragToLook: true, // default: false
    autoForward: true, // default: false
    paused: true, //default: false
    position: [1, 2, 5] //default: [0, 0, 0]
});
controls.start();
 
var lastTimeStamp = 0;
function renderLoop(timeStamp){
    var delta = timeStamp - lastTimeStamp;
    lastTimeStamp = timeStamp;
 
    controls.update(delta);
    var currentPosition = controls.position; //current camera position
    var currentOrientation = controls.quaternion; //current camera orientation
    /*
 
        ...doing the actual rendering
 
    */
    window.requestAnimationFrame(renderLoop);
}
window.requestAnimationFrame(renderLoop);
 

Badges

Readme

Keywords

Package Sidebar

Install

npm i gl-flyCamera

Weekly Downloads

1

Version

1.0.2

License

MIT

Last publish

Collaborators

  • ramshackle-jamathon