The 2D layer · function

screenToNdc

The affine for CSS pixels with a top-left origin — the convention InsetRect and fillPanel already use, and the one a caller laying out an overlay already has.

Explained in Sprites and tilemaps.

function screenToNdc(viewportWidth: number, viewportHeight: number, out: Affine2D): Affine2D
import { screenToNdc } from '@driftengine/ui2d';

Parameters

ParameterTypeDescription
viewportWidthnumber
viewportHeightnumber
outAffine2D