The 2D layer · function
gridSheet
A sheet cut into equal cells, row-major: left to right, then down.
Explained in Sprites and tilemaps.
function gridSheet(texture: number, width: number, height: number, cellWidth: number, cellHeight: number): SpriteSheetimport { gridSheet } from '@driftengine/ui2d';Parameters
| Parameter | Type | Description |
|---|---|---|
texture | number | |
width | number | |
height | number | |
cellWidth | number | |
cellHeight | number |
In depth
A cell that would run off the edge is not emitted. A sheet 70 texels wide cut into sixteens has four whole cells and six texels of margin, and a fifth cell reading into that margin is a frame with a stripe of nothing down one side — which reads as a rendering bug rather than as a badly measured atlas.
Frames are named "0", "1" and so on, so frameOf works on a grid too.