Skip to main content

Function: worldToScreenSpace()

worldToScreenSpace(worldPosition, cameraPosition, cameraZoom, canvasCenter, pixelsPerUnit?): Vector2

Defined in: rendering/transforms/world-to-screen-space.ts:14

Converts a position from world space to screen space.

Parameters​

worldPosition​

Vector2

The position in world space.

cameraPosition​

Vector2

The position of the camera in world space.

cameraZoom​

number

The zoom level of the camera.

canvasCenter​

Vector2

The center of the canvas.

pixelsPerUnit?​

number = 1

The number of pixels one world unit occupies (see calculatePixelsPerUnit). Defaults to 1.

Returns​

Vector2

The position in screen space.