Skip to content

OrthographicCamera

A camera using an orthographic (parallel) projection.

Orthographic projection has no perspective foreshortening, so object size is independent of distance from the camera. This is the camera to use for 2D image viewing, where it pairs naturally with PanZoomControls. The initial frame is given in world coordinates; zoom and pan are applied as scale and translation on top of that frame.

Extends Camera and inherits all public properties and methods.

Constructor

Creates an orthographic camera framing the given world-space rectangle.

ts
new OrthographicCamera(props): OrthographicCamera;
ParameterTypeDescription
propsOrthographicCameraPropsThe view frame edges in world units, near/far clipping plane distances (default -1e6 and 1e6), and the slice orientation the camera faces (default "XY").

Accessors

viewportSize [number, number]

ts
get viewportSize(): [number, number];

type CameraType overrides

ts
get type(): CameraType;

orientation SliceOrientation

ts
get orientation(): SliceOrientation;

Methods

setAspectRatio() void overrides

ts
setAspectRatio(aspectRatio): void;
ParameterType
aspectRationumber

setFrame() void

ts
setFrame(__namedParameters): void;
ParameterType
__namedParametersOrthographicCameraFrame

setOrientation() void

Changes the slice orientation the camera faces. The current frame and zoom carry over numerically to the new plane axes. Call setFrame to reframe the view for the new plane.

ts
setOrientation(orientation): void;
ParameterType
orientationSliceOrientation

zoom() void overrides

ts
zoom(factor): void;
ParameterType
factornumber

getWorldViewRect() Box2

ts
getWorldViewRect(): Box2;

updateProjectionMatrix() void overrides

ts
protected updateProjectionMatrix(): void;

Released under the MIT License