The 2D layer · interface
Camera2D
A 2D camera: where it is, how far in, and which way up.
Explained in Sprites and tilemaps.
interface Camera2Dimport type { Camera2D } from '@driftengine/ui2d';Properties
| Name | Type | Description |
|---|---|---|
xreadonly | number | World units. The point that lands on the middle of the viewport. |
yreadonly | number | |
zoomreadonly | number | Pixels per world unit, and it is the same on both axes on purpose.MoreA 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. |
rotationreadonlyoptional | number | Radians, anticlockwise. The world turns the other way; see worldToNdc. |