Skip to content

Documentation / spryte / nineSlice

Function: nineSlice() ​

nineSlice(draw, frame, x, y, w, h, insets, o?): void

Defined in: panels.ts:37

Stretch a frame over a w × h box at x, y (top-left) without stretching its corners: the classic UI panel. insets are the corner sizes in source pixels, one number or [left, top, right, bottom]. Edges stretch, the centre fills, and corners shrink evenly if the box is smaller than they are. Nine quads, any backend.

ts
import { nineSlice } from "spryte";
nineSlice(draw, panel, 8, 8, 120, 48, 6);

Parameters ​

draw ​

Draw

frame ​

TextureSource | Frame

x ​

number

y ​

number

w ​

number

h ​

number

insets ​

number | readonly [number, number, number, number]

o? ​

PanelDrawOptions = NONE

Returns ​

void