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, [u], [v])
vertex(x, y, z, [u], [v])
Parameters
x
Number: x-coordinate of the vertex.
y
Number: y-coordinate of the vertex.
u
Number: u-coordinate of the vertex's texture.
v
Number: v-coordinate of the vertex's texture.
z
Number:
Notice any errors or typos? Please let us know. Please feel free to edit src/shape/custom_shapes.js and open a pull request!