當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Processing bezierVertex()用法及代碼示例

Processing, bezierVertex()用法介紹。

用法

  • bezierVertex(x2, y2, x3, y3, x4, y4)
  • bezierVertex(x2, y2, z2, x3, y3, z3, x4, y4, z4)

參數

  • x2 (float) 第一個控製點的 x 坐標
  • y2 (float) 第一個控製點的 y 坐標
  • z2 (float) 第一個控製點的 z 坐標
  • x3 (float) 第二個控製點的 x 坐標
  • y3 (float) 第二個控製點的 y 坐標
  • z3 (float) 第二個控製點的 z 坐標
  • x4 (float) 錨點的 x 坐標
  • y4 (float) 錨點的 y 坐標
  • z4 (float) 錨點的 z 坐標

返回

  • void

說明

指定貝塞爾曲線的頂點坐標。每次調用bezierVertex() 都會定義貝塞爾曲線的兩個控製點和一個錨點的位置,從而為線條或形狀添加新線段。第一次在 beginShape() 調用中使用 bezierVertex() 時,必須以調用 vertex() 來設置第一個錨點。此函數必須在 beginShape()endShape() 之間使用,並且僅在沒有為 beginShape() 指定 MODE 參數時使用。使用 3D 版本需要使用 P3D 進行渲染(有關更多信息,請參閱環境參考)。

例子

size(400,400);
noFill();
beginShape();
vertex(120, 80);
bezierVertex(320, 0, 320, 300, 120, 300);
endShape();
Image output for example 1
size(400,400);
beginShape();
vertex(120, 80);
bezierVertex(320, 0, 320, 300, 90, 300);
bezierVertex(200, 320, 240, 100, 120, 80);
endShape();
Image output for example 2

相關用法


注:本文由純淨天空篩選整理自processing.org大神的英文原創作品 bezierVertex()。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。