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): Affine2Dimport { screenToNdc } from '@driftengine/ui2d';Parameters
| Parameter | Type | Description |
|---|---|---|
viewportWidth | number | |
viewportHeight | number | |
out | Affine2D |