Camera
An orthographic viewport to a scene that can be panned and zoomed.
Constructor Summary
Public Constructor | ||
public |
constructor(w: number, h: number, options: Object) Initializes the camera. |
Member Summary
Public Members | ||
public |
Bounds for |
|
public get |
center: * Gets the center. |
|
public set |
Center focus. |
|
public |
Height of viewport. |
|
public |
Maximum zoom. |
|
public |
Minimum zoom. |
|
public |
Speed of camera pan. |
|
public |
Rectangle representing the viewport. |
|
public |
Width of viewport. |
|
public |
Current zoom. |
|
public |
Factor to scale by when zoomed. |
Method Summary
Public Methods | ||
public |
Apply transformations to the supplied context. |
|
public |
black() Black out the whole screen. |
|
public |
clear() Clear screen. |
|
public |
Draw object on screen. |
|
public |
drawLayer(img: Image) Draw fixed layer image with transformations applied. |
|
public |
end() Reset transformations applied to context. |
|
public |
Pans the view. |
|
public |
screenToWorld(v: Vec): Vec Translate a point from screen space to world space. |
|
public |
Zooms the view. |
Public Constructors
Public Members
Public Methods
public begin(ctx: CanvasRenderingContext2D) source
Apply transformations to the supplied context. Usually called at the beginning of every render cycle.
Params:
Name | Type | Attribute | Description |
ctx | CanvasRenderingContext2D | Render context |
public draw(drawable: Drawable, p: Vec) source
Draw object on screen. Culls if the object is out of view.
public drawLayer(img: Image) source
Draw fixed layer image with transformations applied.
Params:
Name | Type | Attribute | Description |
img | Image | Fixed layer image |