Package Exports
- cameras
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 (cameras) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
cameras
Cameras for 3D rendering.
Installation
npm install cameras
Usage
import { PerspectiveCamera } from "cameras";
const perspectiveCamera = new PerspectiveCamera({
fov: Math.PI / 2,
near: 1,
far: 1000,
position: [3, 3, 3],
target: [0, 1, 0],
});
// Create controls
const perspectiveCameraControls = new Controls({
element: regl._gl.canvas,
camera: perspectiveCamera,
});
// Update controls and set camera with controls position/target
perspectiveCameraControls.update();
perspectiveCamera.position = perspectiveCameraControls.position;
perspectiveCamera.target = perspectiveCameraControls.target;
// Update view matrices (call when changing position/target/up)
perspectiveCamera.update();
// Update projection matrix (call when changing near/far/view and other camera type specific options)
perspectiveCamera.updateProjectionMatrix();
API
See the documentation and Typescript types.
License
MIT. See license file.