The degreesToRadians() method is used to transform the value of the specified degree to its corresponding radians value.
Syntax:
degreesToRadians( degrees )
Parameters: This method accepts a parameter as mentioned above and described below:
- degrees: This parameter holds the specified degree values.
Return Value: This method returns the converted radian values.
Example 1:
HTML
<!DOCTYPE html> < html > < head > <!-- Adding the FabricJS library --> < script src = </ script > </ head > < body > < script type = "text/javascript" > // Calling degreesToRadians() function over // some specified degree values console.log(fabric.util.degreesToRadians(30)); console.log(fabric.util.degreesToRadians(45)); console.log(fabric.util.degreesToRadians(90)); </ script > </ body > </ html > |
Output:
0.5235987755982988 0.7853981633974483 1.5707963267948966
Example 2:
HTML
<!DOCTYPE html> < html > < head > <!-- Adding the FabricJS library --> < script src = </ script > </ head > < body > < script type = "text/javascript" > // Specifying some degree values var a = 0; var b = 10; // Calling degreesToRadians() function over // above specified degree value console.log(fabric.util.degreesToRadians(a)); console.log(fabric.util.degreesToRadians(b)); </ script > </ body > </ html > |
Output:
0 0.17453292519943295