Reference bezierVertex()

bezierVertex()

Adds a Bézier curve segment to a custom shape.

bezierVertex() adds a curved segment to custom shapes. The Bézier curves it creates are defined like those made by the bezier() function. bezierVertex() must be called between the beginShape() and endShape() functions. Bézier need a starting point. Building a shape only with Bézier curves needs one initial call to bezierVertex(), before a number of bezierVertex() calls that is a multiple of the parameter set by bezierOrder(...) (default 3). But shapes can mix different types of vertices, so if there are some previous vertices, then the initial anchor is not needed, only the multiples of 3 (or the Bézier order) calls to bezierVertex for each curve.

Each curve of order 3 requires three calls to bezierVertex, so 2 curves would need 7 calls to bezierVertex(): (1 one initial anchor point, two sets of 3 curves describing the curves) With bezierOrder(2), two curves would need 5 calls: 1 + 2 + 2.

Bézier curves can also be drawn in 3D using WebGL mode.

Note: bezierVertex() won’t work when an argument is passed to beginShape().

Examples

Syntax

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

Parameters

x
Number: x-coordinate of the first control point.
y
Number: y-coordinate of the first control point.
u
Number:
v
Number:
z
Number:
Notice any errors or typos? Please let us know. Please feel free to edit src/shape/vertex.js and open a pull request!

Related References