rotate()

2Dベクトルを角度だけ回転させます。ただし、その大きさは変更しません。

慣例により、正のx軸の角度は0とされています。角度は時計回りに増加します。

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

rotate()の静的バージョン(例:p5.Vector.rotate(v, PI))は、 新しいp5.Vectorオブジェクトを返し、 元のオブジェクトは変更しません。

実例

シンタックス

rotate(angle)
rotate(v, angle, [target])

パラメーター

angle
Number:

回転角度。

v
p5.Vector:
target
p5.Vector:

結果を受け取るベクトル

Notice any errors or typos? Please let us know. Please feel free to edit src/math/p5.Vector.js and open a pull request!

関連するリファレンス