Fabric.js qrDecompose() Method
Last Updated :
22 Jan, 2021
The qrDecompose() method is used to decompose the specified standard 2×3 matrix into transform components
Syntax:
qrDecompose( mat )
Parameters: This method accepts a parameter as mentioned above and described below:
- mat: This parameter holds the specified array of transform matrix.
Return Value: This method returns the components of transform.
Example 1:
Javascript
<!DOCTYPE html>
<html>
<head>
<!-- Adding the FabricJS library -->
<script src=
</script>
</head>
<body>
<script type= "text/javascript" >
console.log(fabric.util
.qrDecompose([1, 2, 3, 4, 5, 6]));
</script>
</body>
</html>
|
Output:
{"angle":63.434948822922,"scaleX":2.23606797749979,"scaleY":-0.8944271909999159,
"skewX":65.55604521958347,"skewY":0,"translateX":5,"translateY":6}
Example 2:
Javascript
<!DOCTYPE html>
<html>
<head>
<!-- Adding the FabricJS library -->
<script src=
</script>
</head>
<body>
<script type= "text/javascript" >
var a1 = [1, 2, 3];
var a2 = [0, 6, 7, 8, 0, 0];
console.log(fabric.util.qrDecompose(a1));
console.log(fabric.util.qrDecompose(a2));
</script>
</body>
</html>
|
Output:
{"angle":63.434948822922,"scaleX":2.23606797749979,"scaleY":null,"skewX":null,"skewY":0}
{"angle":90,"scaleX":6,"scaleY":-7,"skewX":53.13010235415598,"skewY":0,
"translateX":0,"translateY":0}
Share your thoughts in the comments
Please Login to comment...