The javascriptatan2 () method returns an angle between the x axis and the point (x, y. This function has two parameters: the first parameter specifies the X coordinate of the vertex, and the second parameter specifies the Y coordinate of the vertex. Note that the parameter order of this function is passed before the X coordinate. This article describes the basic syntax and examples of the atan2 function. For more information about the coders, see. The atan2 method returns the angle (in radians) from the X axis to the (y, x) Point ).
Basic Syntax:
Math.atan2(y, x)
Parameter Introduction
| Parameters |
Description |
| X |
Required. A numeric expression that describes the coordinates of flute x. |
| Y |
Required. The numeric expression that describes the y coordinate of the flute. |
Return Value
The returned value is between-pi and pi, indicating the angle of the provided (y, x) Point.
Note:
- The Parameter order of this function. The Y coordinate is transmitted before the X coordinate.
- If the value of a parameter in the function is not a number, the function returns NaN
Instance