Skip to content

1681-engine / pixel / spritePixels

Function: spritePixels() ​

ts
function spritePixels(
   img, 
   artScale, 
   live
): PackedPixels;

Defined in: src/pixel/spritePixels.ts:65

The opaque pixels of an image's current frame, one per world pixel (artScale image pixels to one), as offsets from the frame's feet in unscaled, unflipped world pixels. Read straight off the texture's canvas, so it is the frame actually on screen. Atlas frames are shared by every body of one kind and cached (least recently read out first); a texture repainted while in use (a rig body) is read fresh.

Parameters ​

ParameterType
imgImage
artScalenumber
liveboolean

Returns ​

PackedPixels

Released under the MIT License.