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
