angleMode

概要

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

[p5.js] angleMode

サンプル

def draw
  background(204)
  angleMode(DEGREES)        # Change the mode to DEGREES
  a = atan2(mouseY - height / 2, mouseX - width / 2)
  translate(width / 2, height / 2)
  push do
    rotate(a)
    rect(-20, -5, 40, 10)   # Larger rectangle is rotating in degrees
  end
  angleMode(RADIANS)        # Change the mode to RADIANS
  rotate(a)                 # variable a stays the same
  rect(-40, -5, 20, 10)     # Smaller rectangle is rotating in radians
end

構文

戻値