PIXI.NineSlicePlane
class NineSlicePlane extends PIXI.SimplePlane
The NineSlicePlane allows you to stretch a texture using 9-slice scaling. The corners will remain unscaled (useful for buttons with rounded corners for example) and the other areas will be scaled horizontally and or vertically
let Plane9 = new PIXI.NineSlicePlane(PIXI.Texture.from('BoxWithRoundedCorners.png'), 15, 15, 15, 15);
A B
+---+----------------------+---+
C | 1 | 2 | 3 |
+---+----------------------+---+
| | | |
| 4 | 5 | 6 |
| | | |
+---+----------------------+---+
D | 7 | 8 | 9 |
+---+----------------------+---+
When changing this objects width and/or height:
areas 1 3 7 and 9 will remain unscaled.
areas 2 and 8 will be stretched horizontally
areas 4 and 6 will be stretched vertically
area 5 will be stretched both horizontally and vertically
Constructor
new PIXI.NineSlicePlane(texture: PIXI.Texture, leftWidth: number, topHeight: number, rightWidth: number, bottomHeight: number) → {}
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
| texture | PIXI.Texture |
The texture to use on the NineSlicePlane. |
||
| leftWidth | number |
<optional> |
10 |
size of the left vertical bar (A) |
| topHeight | number |
<optional> |
10 |
size of the top horizontal bar (C) |
| rightWidth | number |
<optional> |
10 |
size of the right vertical bar (B) |
| bottomHeight | number |
<optional> |
10 |
size of the bottom horizontal bar (D) |
Summary
Properties from NineSlicePlane
|
The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane. |
|
|
The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane. |
|
| number |
The height of the bottom row. |
| number |
The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane. |
| number |
The width of the left column. |
| number |
The width of the right column. |
| number |
The height of the top row. |
| number |
The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane. |
| number |
|
| HTMLCanvasElement |
|
Methods from NineSlicePlane
| void |
Updates the horizontal vertices. |
| void |
Updates the vertical vertices. |
Properties inherited from SimplePlane
| boolean |
The geometry is automatically updated when the texture size changes. |
Properties inherited from Mesh
| PIXI.BLEND_MODES |
|
| PIXI.DRAW_MODES |
The way the Mesh should be drawn, can be any of the PIXI.DRAW_MODES constants. |
| PIXI.Geometry |
|
| T |
Alias for PIXI.Mesh#shader. |
| boolean |
|
| PIXI.Shader | PIXI.MeshMaterial |
|
| number |
|
| number |
|
| PIXI.State |
|
| PIXI.Texture |
The texture that the Mesh uses. Null for non-MeshMaterial shaders |
| number |
|
| PIXI.Buffer |
|
| PIXI.Buffer |
|
| PIXI.Texture |
|
Properties inherited from Container
| T[] |
|
| boolean |
|
| boolean |
|
| boolean |
Should children be sorted by zIndex at the next updateTransform call. |
Properties inherited from DisplayObject
Methods inherited from SimplePlane
| void |
|
Methods inherited from Mesh
| void |
Updates uv field based on from geometry uv's or batchUvs. |
| void |
Updates vertexData field based on transform and vertices. |
| boolean |
|
| void |
|
| void |
|
| void |
|
| void |
|
Methods inherited from Container
Methods inherited from DisplayObject
Inherited Events from Container
Inherited Events from DisplayObject
|
|
|
|
|
|
|
|
|
|
Capture phase equivalent of |
|
|
|
|
|
|
|
|
Capture phase equivalent of |
|
|
Fired when the mouse pointer is moved over a DisplayObject and its descendant's hit testing boundaries. |
|
|
Capture phase equivalent of |
|
|
Fired when the mouse pointer exits a DisplayObject and its descendants. |
|
|
Capture phase equivalent of |
|
|
|
|
|
Capture phase equivalent of |
|
|
|
|
|
Capture phase equivalent of |
|
|
|
|
|
Capture phase equivalent of |
|
|
|
|
|
Capture phase equivalent of |
|
|
|
|
|
Capture phase equivalent of |
|
|
|
|
|
Capture phase equivalent of |
|
|
|
|
|
Capture phase equivalent of |
|
|
Fired when the pointer is moved over a DisplayObject and its descendant's hit testing boundaries. |
|
|
Capture phase equivalent of |
|
|
Fired when the pointer leaves the hit testing boundaries of a DisplayObject and its descendants. |
|
|
Capture phase equivalent of |
|
|
|
|
|
Capture phase equivalent of |
|
|
|
|
|
Capture phase equivalent of |
|
|
|
|
|
Capture phase equivalent of |
|
|
|
|
|
Capture phase equivalent of |
|
|
|
|
|
Capture phase equivalent of |
|
|
|
|
|
Capture phase equivalent of |
|
|
|
|
|
|
|
|
Capture phase equivalent of |
|
|
|
|
|
Capture phase equivalent of |
|
|
|
|
|
Capture phase equivalent of |
|
|
|
|
|
Capture phase equivalent of |
|
|
|
|
|
Capture phase equivalent of |
|
|
|
|
|
Capture phase equivalent of |
|
|
|
|
|
Capture phase equivalent of |
|
|
|
|
|
Capture phase equivalent of |
|
|
|
|
|
Capture phase equivalent of |
|
|
|
|
|
Capture phase equivalent of |
|
| PIXI.FederatedWheelEvent |
Fired when a the user scrolls with the mouse cursor over a DisplayObject. |
| PIXI.FederatedWheelEvent |
Capture phase equivalent of |
Public Properties
_height
The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane.
_width
The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane.
height: number
The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane.
width: number
The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane.
Protected Properties
protected _cachedTint: number = 16777215
Cached tint value so we can tell when the tint is changed.
protected _tintedCanvas: HTMLCanvasElement = undefined
Cached tinted texture.
Public Methods
updateHorizontalVertices() → {void}
Updates the horizontal vertices.
| Type | Description |
|---|---|
| void |
updateVerticalVertices() → {void}
Updates the vertical vertices.
| Type | Description |
|---|---|
| void |