https://github.com/stackgl/lookat-camera
Simple "lookat" camera abstraction built on top of gl-matrix
https://github.com/stackgl/lookat-camera
Last synced: 12 months ago
JSON representation
Simple "lookat" camera abstraction built on top of gl-matrix
- Host: GitHub
- URL: https://github.com/stackgl/lookat-camera
- Owner: stackgl
- License: other
- Created: 2015-06-16T17:34:15.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2015-06-16T17:34:22.000Z (about 11 years ago)
- Last Synced: 2025-06-03T02:05:45.757Z (about 1 year ago)
- Language: JavaScript
- Homepage: http://stack.gl/lookat-camera/
- Size: 207 KB
- Stars: 10
- Watchers: 16
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# lookat-camera
[](http://github.com/badges/stability-badges)
Simple "lookat" camera abstraction built on top of
[gl-matrix](http://github.com/toji/gl-matrix).
## Usage
[](https://nodei.co/npm/lookat-camera/)
See [demo.js](./demo.js) for a usage example.
### `camera = require('lookat-camera')()`
Creates a new camera instance.
### `view = camera.view([view])`
Updates the view matrix based on the camera's current configuration and
returns the result. Optionally, you may pass in your own `view` array to
modify directly.
### `camera.position`
`[x, y, z]` vector that determines the position of the camera in world space.
### `camera.target`
`[x, y, z]` vector that determines the target of the camera in world space.
### `camera.up`
Normalized `[x, y, z]` vector that determines the up direction of the camera.
Generally you'll want this to be `[1, 0, 0]`, `[0, 1, 0]` or `[0, 0, 1]`.
## Contributing
See [stackgl/contributing](https://github.com/stackgl/contributing) for details.
## License
MIT. See [LICENSE.md](http://github.com/stackgl/lookat-camera/blob/master/LICENSE.md) for details.