Skip to main content
Version: Phaser v4.0.0

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

nametypeoptionaldescription
xnumberNoThe x position of the vertex.
ynumberNoThe y position of the vertex.
unumberNoThe UV u coordinate of the vertex.
vnumberNoThe UV v coordinate of the vertex.

Scope: static

Extends

Phaser.Math.Vector2

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:


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:

nametypeoptionaldescription
xnumberNoThe x position of the vertex.
ynumberNoThe y position of the vertex.
widthnumberNoThe width of the parent object.
heightnumberNoThe height of the parent object.
originXnumberNoThe originX of the parent object.
originYnumberNoThe 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:

nametypeoptionaldescription
unumberNoThe UV u coordinate of the vertex.
vnumberNoThe UV v coordinate of the vertex.

Returns: Phaser.GameObjects.NineSliceVertex - This Vertex.

Source: src/gameobjects/nineslice/NineSliceVertex.js#L80
Since: 4.0.0