The radiansToDegrees() method is used to transform the specified radians value to its corresponding degrees value.
Syntax:
radiansToDegrees( radians )
Parameters: This method accepts a parameter as mentioned above and described below:
- radians: This parameter holds the specified radian values.
Return Value: This method returns the converted degree values.
Example 1:
HTML
<!DOCTYPE html> < html > < head > <!-- Adding the FabricJS library --> < script src = </ script > </ head > < body > < script type = "text/javascript" > // Calling radiansToDegrees() function over // some specified radian values console.log(fabric.util.radiansToDegrees(1)); console.log(fabric.util.radiansToDegrees(5)); console.log(fabric.util.radiansToDegrees(8)); </ script > </ body > </ html > |
Output:
57.29577951308232 286.4788975654116 458.3662361046586
Example 2:
HTML
<!DOCTYPE html> < html > < head > <!-- Adding the FabricJS library --> < script src = </ script > </ head > < body > < script type = "text/javascript" > // Specifying some radian values var a = 1.2; var b = 0.45; // Calling radiansToDegrees() function over // the above specified radian values console.log(fabric.util.radiansToDegrees(a)); console.log(fabric.util.radiansToDegrees(b)); </ script > </ body > </ html > |
Output:
68.75493541569878 25.783100780887047