NineSliceVertex
Represents a single vertex within a NineSlice Game Object.
A NineSlice Game Object is divided into a 3x3 grid of regions, each defined by a mesh of vertices. This class stores all the data needed for one vertex: its normalized position (x, y inherited from Vector2), its projected screen-space position (vx, vy), and its UV texture coordinates (u, v) used during rendering.
You do not typically create NineSliceVertex instances directly. They are created and managed internally by the NineSlice Game Object.
Constructor
new NineSliceVertex(x, y, u, v)
Parameters
| name | type | optional | description |
|---|---|---|---|
| x | number | No | The x position of the vertex. |
| y | number | No | The y position of the vertex. |
| u | number | No | The UV u coordinate of the vertex. |
| v | number | No | The UV v coordinate of the vertex. |
Scope: static
Extends
Source: src/gameobjects/nineslice/NineSliceVertex.js#L10
Since: 4.0.0
Inherited Members
From Phaser.Math.Vector2:
Public Members
u
u: number
Description:
UV u coordinate of this vertex.
Source: src/gameobjects/nineslice/NineSliceVertex.js#L61
Since: 4.0.0
v
v: number
Description:
UV v coordinate of this vertex.
Source: src/gameobjects/nineslice/NineSliceVertex.js#L70
Since: 4.0.0
vx
vx: number
Description:
The projected x coordinate of this vertex.
Source: src/gameobjects/nineslice/NineSliceVertex.js#L43
Since: 4.0.0
vy
vy: number
Description:
The projected y coordinate of this vertex.
Source: src/gameobjects/nineslice/NineSliceVertex.js#L52
Since: 4.0.0
Inherited Methods
From Phaser.Math.Vector2:
- add
- angle
- ceil
- clone
- copy
- cross
- distance
- distanceSq
- divide
- dot
- equals
- floor
- fuzzyEquals
- invert
- length
- lengthSq
- lerp
- limit
- mirror
- multiply
- negate
- normalize
- normalizeLeftHand
- normalizeRightHand
- project
- projectUnit
- reflect
- reset
- rotate
- scale
- set
- setAngle
- setFromObject
- setLength
- setTo
- setToPolar
- subtract
- transformMat3
- transformMat4
Public Methods
resize
<instance> resize(x, y, width, height, originX, originY)
Description:
Updates this vertex's position and calculates its projected screen-space coordinates.
Sets the normalized x and y position, then scales them by the parent object's width and height to produce the projected vx and vy values. The origin offset of the parent object is then factored in, shifting vx and vy so that the mesh is correctly aligned relative to the object's origin point.
Parameters:
| name | type | optional | description |
|---|---|---|---|
| x | number | No | The x position of the vertex. |
| y | number | No | The y position of the vertex. |
| width | number | No | The width of the parent object. |
| height | number | No | The height of the parent object. |
| originX | number | No | The originX of the parent object. |
| originY | number | No | The originY of the parent object. |
Returns: Phaser.GameObjects.NineSliceVertex - This Vertex.
Source: src/gameobjects/nineslice/NineSliceVertex.js#L99
Since: 4.0.0
setUVs
<instance> setUVs(u, v)
Description:
Sets the UV texture coordinates of this vertex.
Parameters:
| name | type | optional | description |
|---|---|---|---|
| u | number | No | The UV u coordinate of the vertex. |
| v | number | No | The UV v coordinate of the vertex. |
Returns: Phaser.GameObjects.NineSliceVertex - This Vertex.
Source: src/gameobjects/nineslice/NineSliceVertex.js#L80
Since: 4.0.0