3.1.1 • Published 2 years ago

cameras v3.1.1

Weekly downloads
3
License
MIT
Repository
github
Last release
2 years ago

cameras

npm version stability-stable npm minzipped size dependencies types Conventional Commits styled with prettier linted with eslint license

Cameras for 3D rendering.

paypal coinbase twitter

npm.io

Installation

npm install cameras

Usage

See the demo and its source.

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.

3.1.1

2 years ago

3.1.0

3 years ago

3.0.3

3 years ago

3.0.2

3 years ago

3.0.1

3 years ago

3.0.0

3 years ago

2.0.0

4 years ago

1.1.0

4 years ago

1.0.0

4 years ago