Skip to content

anim-format (runtime format) / nineSliceMesh

Function: nineSliceMesh() ​

ts
function nineSliceMesh(
   b, 
   cuts, 
   sx, 
   sy
): 
  | {
  drawn: number[];
  rest: number[];
  tris: number[];
}
  | null;

The 9-slice mesh of art with local bounds b, cut at cuts, drawn with scale (sx, sy): rest + drawn points of a 4 × 4 grid and its triangles. null when the art has no area.

Parameters ​

ParameterType
b{ maxX: number; maxY: number; minX: number; minY: number; }
b.maxXnumber
b.maxYnumber
b.minXnumber
b.minYnumber
cutsScale9
sxnumber
synumber

Returns ​

| { drawn: number[]; rest: number[]; tris: number[]; } | null

HereSplash — 2D animation for the web