heading()

2Dベクトルが正のx軸となす角度を計算します。

慣例により、正のx軸の角度は0です。角度は時計回りに増加します。

ベクトルがcreateVector()で作成された場合、 heading()は現在のangleMode()の 単位で角度を返します。

heading()の静的バージョン、つまりp5.Vector.heading(v)も 同じように動作します。

実例

シンタックス

heading()
heading(v)

パラメーター

v
p5.Vector:

角度を求めるベクトル

リターン

Number: 回転角度。
Notice any errors or typos? Please let us know. Please feel free to edit src/math/p5.Vector.js and open a pull request!

関連するリファレンス