line

def setup
  background(220)
  line(30, 20, 85, 75)
end
def setup
  background(220)
  line(30, 20, 85, 20)
  stroke(126)
  line(85, 20, 85, 75)
  stroke(255)
  line(85, 75, 30, 75)
end

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

[p5.js] line

概要

直線を描画します。

書式

line(x1, y1, x2, y2)
line(x1, y1, z1, x2, y2, z2)

引数

引数名内容備考オプションデフォルト値
x1基点の x座標
y1基点の y座標
x2終点の x座標
y2終点の y座標
z1基点の z座標WEBGLモードのキャンバスでのみ有効
z2終点の z座標WEBGLモードのキャンバスでのみ有効

戻値

なし

備考

関連

stroke
strokeWeight