atan2(y, x)

Calculates the angle (in radians) from a specified point to the coordinate origin as measured from the positive x-axis. Values are returned as a float in the range from PI to -PI. The atan2() function is most often used for orienting geometry to the position of the cursor. Note: The y-coordinate of the point is the first parameter and the x-coordinate is the second due the the structure of calculating the tangent.

Type: function

Parameter(s):

  • y {Number}:

    The y coordinate.

  • x {Number}:

    The x coordinate.

Returns:

  • {Number}:

    The atan2 value.