atan2

概要

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

[p5.js] atan2

サンプル

def draw
  background(204)
  translate(width / 2, height / 2)
  a = atan2(mouseY - height / 2, mouseX - width / 2)
  rotate(a)
  rect(-30, -5, 60, 10)
end

構文

戻値