Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
camera-2d-simple
Advanced tools
Simple camera built on top of gl-matrix for 2D scenes. Heavily inspired by Mikola's Orbit Camera.
Also see:
npm install camera-2d-simple
import createCamera from 'camera-2d-simple';
const camera = createCamera(target = [0, 0], distance = 1)
Creates a 2d camera looking at target
from a certain distance
.
target
is the 2d vector the camera is looking at.distance
is the distance between the target and the camera.Returns A new 2d camera object
camera.lookAt(target = [0, 0], distance = 1)
Move the camera to look at the new position.
camera.pan(translation)
Moves the center of the camera by translation
. Note that translation must be an array of length 2.
camera.zoom(delta)
Zooms in or out by some amount. I.e., the new distance is defined as distance * delta
.
camera.view([out])
Returns the current view matrix associated to the camera.
camera.position
Is an array of length 3 comprised of the target (x, y) and distance (z) of the camera.
camera.transformation
Is the current transformation mat3
associated to the camera.
v1.1.0
camera.rotate()
for rotations along the z axis.camera.reset()
to reset the view to its original target, distance, and rotation.FAQs
2D camera for WebGL
The npm package camera-2d-simple receives a total of 705 weekly downloads. As such, camera-2d-simple popularity was classified as not popular.
We found that camera-2d-simple demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.