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.
Examples
Syntax
heading()
heading()
heading(v)
Parameters
Returns
Related References
textToContours
Returns an array of arrays of points outlining a string of text written using the font.
textToModel
Converts text into a 3D model that can be rendered in WebGL mode.
textToPaths
Returns a flat array of path commands that describe the outlines of a string of text.
textToPoints
Returns an array of points outlining a string of text written using the font.