(p5.Element).position

def setup
  background(220)

  b1 = createButton('button 1')
  b2 = createButton('button 2')
  b3 = createButton('button 3')

  b1.position(10, 10)  
  b2.position(20, 40)  
  b3.position(30, 70)
end

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

[p5.js] (p5.Element).position

概要

要素の表示位置を設定または取得します。

書式

r = position
position([x], [y], [positionType])

引数

引数名内容備考オプションデフォルト値
x要素の左上 x座標未詳
y要素の左上 y座標未詳
positionTypeタイプ'static'
'fixed'
'relative'
'sticky'
'initial'
'inherit'
'relative'

戻値

r : ハッシュ {x: x座標, y: y座標}

備考

関連