参考 heading()

heading()

Calculates the angle a 2D vector makes with the positive x-axis.

By convention, the positive x-axis has an angle of 0. Angles increase in the clockwise direction.

If the vector was created with createVector(), heading() returns angles in the units of the current angleMode().

The static version of heading(), as in p5.Vector.heading(v), works the same way.

示例

语法

heading()
heading(v)

参数

v
p5.Vector:

the vector to find the angle of

返回值

Number: angle of rotation.
This page is generated from the comments in src/math/p5.Vector.js . Please feel free to edit it and submit a pull request!

相关参考