You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Harsh Singh edited this page Nov 29, 2021
·
6 revisions
Camera is a simple implementation of a 2D Game Camera using the Canvas API.
Params
ctx - CanvasRenderingContext2D
x - initial point to look at (x)
y - initial point to look at (y)
dx - offset from screen center (x)
dy - offset from screen center (y)
Example
constcamera=newCamera(ctx);// -- following code goes in update()camera.update(dt);camera.lookAt(0,0);// -- following code goes in render()camera.attach();// draw stuff herecamera.detach();