Documentation / spryte / spriteOptions
Function: spriteOptions()
spriteOptions(
o?):FullSpriteDrawOptions
Defined in: draw.ts:56
Options for draw.sprite with every field present, undefined where o leaves one out (the default). Build each options object with it and they all share one shape, which keeps draw.sprite fast: V8 caches property lookups for up to four object shapes, and a game passing { rotation } here, { tint } there and {} elsewhere goes past that. Eight shapes made draw.sprite about twice as slow as the same eight built here (200k calls, Node 22). A game that only ever passes one or two shapes doesn't need it: there it costs a little. Make them once and change fields in place; creating one per call allocates.
ts
const ship = spriteOptions({ rotation: 0 });
ship.rotation = angle;
draw.sprite(img, x, y, ship);Parameters
o?
SpriteDrawOptions = {}