The 2D layer · function
sheetFrame
Read a frame into a rectangle the caller owns. Allocates nothing.
Explained in Sprites and tilemaps.
function sheetFrame(sheet: SpriteSheet, index: number, out: SpriteFrame): UvRectimport { sheetFrame } from '@driftengine/ui2d';Parameters
| Parameter | Type | Description |
|---|---|---|
sheet | SpriteSheet | |
index | number | |
out | SpriteFrame |
In depth
An index this sheet does not have reads as the whole texture rather than throwing, because this is called per sprite per frame and the rule is that nothing throws in the frame loop. What a caller then sees is the entire atlas drawn where one picture should be, which is unmistakable.