Fabric.js degreesToRadians() Method

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
Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, zambiatek Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button