Static p5_sys::global::bezierVertex[][src]

pub static bezierVertex: BezierVertexInternalType
Expand description

Specifies vertex coordinates for Bezier curves. Each call to bezierVertex() defines the position of two control points and one anchor point of a Bezier curve, adding a new segment to a line or shape. For WebGL mode bezierVertex() can be used in 2D as well as 3D mode. 2D mode expects 6 parameters, while 3D mode expects 9 parameters (including z coordinates).

The first time bezierVertex() is used within a beginShape() call, it must be prefaced with a call to vertex() to set the first anchor point. This function must be used between beginShape() and endShape() and only when there is no MODE or POINTS parameter specified to beginShape().

Examples

noFill();
beginShape();
vertex(30, 20);
bezierVertex(80, 0, 80, 75, 30, 75);
endShape();
beginShape();
vertex(30, 20);
bezierVertex(80, 0, 80, 75, 30, 75);
bezierVertex(50, 80, 60, 25, 30, 20);
endShape();
function setup() {
  createCanvas(100, 100, WEBGL);
  setAttributes('antialias', true);
}
function draw() {
  orbitControl();
  background(50);
  strokeWeight(4);
  stroke(255);
  point(-25, 30);
  point(25, 30);
  point(25, -30);
  point(-25, -30);

  strokeWeight(1);
  noFill();

  beginShape();
  vertex(-25, 30);
  bezierVertex(25, 30, 25, -30, -25, -30);
  endShape();

  beginShape();
  vertex(-25, 30, 20);
  bezierVertex(25, 30, 20, 25, -30, 20, -25, -30, 20);
  endShape();
}

Overloads

x2 x-coordinate for the first control point

y2 y-coordinate for the first control point

x3 x-coordinate for the second control point

y3 y-coordinate for the second control point

x4 x-coordinate for the anchor point

y4 y-coordinate for the anchor point


x2 x-coordinate for the first control point

y2 y-coordinate for the first control point

z2 z-coordinate for the first control point (for WebGL mode)

x3 x-coordinate for the second control point

y3 y-coordinate for the second control point

z3 z-coordinate for the second control point (for WebGL mode)

x4 x-coordinate for the anchor point

y4 y-coordinate for the anchor point

z4 z-coordinate for the anchor point (for WebGL mode)