Skip to main content

Interface: NineSliceOptions

Defined in: rendering/nine-slice-options.ts:18

Configures nine-slice ("9-patch") scaling for a sprite: the sprite's texture is cut into a 3x3 grid by an inset from each edge, and the four corner regions are drawn at a fixed size while the four edge regions and the center region stretch or tile to fill the sprite's current width/height. This keeps corner artwork (e.g. a rounded panel border) from distorting when the sprite is resized.

Properties

bottom

bottom: number

Defined in: rendering/nine-slice-options.ts:41

The height, in the same world units as the sprite's height, of the bottom border inset.


centerMode?

optional centerMode?: SliceScaleMode

Defined in: rendering/nine-slice-options.ts:53

How the center region scales to fill the sprite. Defaults to 'stretch'.


edgeMode?

optional edgeMode?: SliceScaleMode

Defined in: rendering/nine-slice-options.ts:47

How the four edge regions (top, bottom, left, right) scale to fill their stretch axis. Defaults to 'stretch'.


left

left: number

Defined in: rendering/nine-slice-options.ts:23

The width, in the same world units as the sprite's width, of the left border inset.


nativeHeight?

optional nativeHeight?: number

Defined in: rendering/nine-slice-options.ts:73

The sprite's original (not-yet-resized) height. Anchors the border insets to the correct texture UV fractions regardless of the sprite's current height, and works out how many times an edge/center region repeats when its mode is 'tile'. Defaults to the sprite's current height, so a sprite that's never resized after being sliced tiles as a single, unrepeated region.


nativeWidth?

optional nativeWidth?: number

Defined in: rendering/nine-slice-options.ts:63

The sprite's original (not-yet-resized) width. Anchors the border insets to the correct texture UV fractions regardless of the sprite's current width, and works out how many times an edge/center region repeats when its mode is 'tile'. Defaults to the sprite's current width, so a sprite that's never resized after being sliced tiles as a single, unrepeated region.


right: number

Defined in: rendering/nine-slice-options.ts:29

The width, in the same world units as the sprite's width, of the right border inset.


top

top: number

Defined in: rendering/nine-slice-options.ts:35

The height, in the same world units as the sprite's height, of the top border inset.