The 2D layer · interface

SpritePlacement

Where a sprite goes, in whatever space the batch is being drawn in.

Explained in Sprites and tilemaps.

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

Properties

NameTypeDescription
xreadonlynumberThe corner the sprite grows from, and which corner depends on the affine.
More

In screen space y counts down, so this is the top-left; in a 2D world y counts up, so it is the bottom-left. The batch does not know which it is in and does not need to: it is the same arithmetic either way, and camera2d.ts is where the two conventions are written down.

yreadonlynumber
wreadonlynumber
hreadonlynumber
rotationreadonlyoptionalnumberRadians, anticlockwise in the mathematical sense — which reads as clockwise on screen, where y counts down. Defaults to none.
pivotXreadonlyoptionalnumberThe point rotation turns about, as a fraction of the sprite. Defaults to its centre.
pivotYreadonlyoptionalnumber