向自定义形状添加一个顶点。
vertex() 设置在 beginShape() 和 endShape() 函数之间绘制的顶点的坐标。
前两个参数 x 和 y 设置顶点的 x 和 y 坐标。
第三个参数 z 是可选的。在 WebGL 模式下,它设置顶点的 z 坐标。默认情况下,z 为 0。
第四和第五个参数 u 和 v 也是可选的。它们在与 endShape() 配合使用时,设置顶点的纹理的 u 和 v 坐标。 默认情况下,u 和 v 都为 0。
示例
语法
vertex(x, y)
vertex(x, y, [z])
vertex(x, y, [z], [u], [v])
参数
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.
This page is generated from the comments in src/core/shape/vertex.js . Please feel free to edit it and submit a pull request!