Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mikolalysenko/arcball
A simple library-agnostic arcball camera in Javascript
https://github.com/mikolalysenko/arcball
Last synced: about 2 months ago
JSON representation
A simple library-agnostic arcball camera in Javascript
- Host: GitHub
- URL: https://github.com/mikolalysenko/arcball
- Owner: mikolalysenko
- License: mit
- Created: 2013-01-07T14:54:54.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2013-05-14T00:11:00.000Z (over 11 years ago)
- Last Synced: 2024-10-20T14:26:51.543Z (2 months ago)
- Language: JavaScript
- Size: 109 KB
- Stars: 7
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Arcball
=======A simple library-agnostic arcball camera in Javascript
Installation
============npm install arcball
Example
=======var ArcballCamera = require('arcball').ArcballCamera;
var camera = new ArcballCamera();// ... in mouse event handler
camera.update(mouse_x, mouse_y, {
rotate: mouse_left_clicked,
pan: mouse_right_clicked,
zoom: mouse_middle_clicked
});
// ... in rendering loop
var camera_matrix = camera.matrix();API
===## `ArcballCamera()`
The main camera object
### `ArcballCamera.update(mouse_x, mouse_y, flags)`
Updates the camera state using the mouse input. `mouse_x` and `mouse_y` are the x/y coordinates of the mouse, `flags` is an object containing the boolean flags `rotate`, `pan`, and `zoom` which determine how to rotate the camera.
### `ArcballCamera.matrix()`
Returns a 4x4 homogeneous transformation matrix representing the position of the object relative to the arcball camera.
Acknowledgements
================(c) 2013 Mikola Lysenko ([email protected]). MIT License