Rotates a 2D vector by an angle without changing its magnitude.
By convention, the positive x-axis has an angle of 0. Angles increase in the clockwise direction.
If the vector was created with createVector(), rotate()
uses the units of the current angleMode().
The static version of rotate()
, as in p5.Vector.rotate(v, PI)
, returns a new p5.Vector object and doesn't change the original.
Examples
Syntax
rotate(angle)
rotate()
rotate(v, angle, [target])
Parameters
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.