Reference vertex()

vertex()

Adds a vertex to a custom shape.

vertex() sets the coordinates of vertices drawn between the beginShape() and endShape() functions.

The first two parameters, x and y, set the x- and y-coordinates of the vertex.

The third parameter, z, is optional. It sets the z-coordinate of the vertex in WebGL mode. By default, z is 0.

The fourth and fifth parameters, u and v, are also optional. They set the u- and v-coordinates for the vertex’s texture when used with endShape(). By default, u and v are both 0.

Examples

Syntax

vertex(x, y)
vertex(x, y, [z])
vertex(x, y, [z], [u], [v])

Parameters

x
Number:

x-coordinate of the vertex.

y
Number:

y-coordinate of the vertex.

z
Number:

z-coordinate of the vertex. Defaults to 0.

u
Number:

u-coordinate of the vertex's texture. Defaults to 0.

v
Number:

v-coordinate of the vertex's texture. Defaults to 0.

Notice any errors or typos? Please let us know. Please feel free to edit src/core/shape/vertex.js and open a pull request!

Related References