The 2D layer · interface

Camera2D

A 2D camera: where it is, how far in, and which way up.

Explained in Sprites and tilemaps.

interface Camera2D
import type { Camera2D } from '@driftengine/ui2d';

Properties

NameTypeDescription
xreadonlynumberWorld units. The point that lands on the middle of the viewport.
yreadonlynumber
zoomreadonlynumberPixels per world unit, and it is the same on both axes on purpose.
More

A separate x and y zoom is a non-uniform scale, which turns a circle into an ellipse and a square tile into a rectangle — the caller who wants that has asked for a stretched picture and can say so in the sprite's own size, where it is visible.

rotationreadonlyoptionalnumberRadians, anticlockwise. The world turns the other way; see worldToNdc.