endShape

def setup
  background(220)
  noFill

  beginShape
  vertex(20, 20)
  vertex(45, 20)
  vertex(45, 80)
  endShape(CLOSE)

  beginShape
  vertex(50, 20)
  vertex(75, 20)
  vertex(75, 80)
  endShape
end

p5.jsリファレンス(参考情報)

[p5.js] endShape

概要

beginShapeメソッドによる頂点座標の記録を終了します。

書式

endShape([mode])

引数

引数名内容備考オプションデフォルト値
modeモードCLOSE : 始点と終点とを結ぶ

戻値

なし

備考

・必ず beginShapeメソッドとペアで使用してください。
・「beginShape ~ endShape」を Rubyライクな構文にした「shape do ~ end」も同じ動作をします。

関連

beginShape
shape