Fabric.js invertTransform() Method
Last Updated :
02 Mar, 2021
The invertTransform() method is used to return the inverted form of the specified array transform. This function computes the bit-wise Inversion of an array element.
Syntax:
invertTransform(t)
Parameters: This method accepts a parameter as mentioned above and described below:
- t: This parameter holds the specified array transform.
Return Value: This method returns the inverted form of the specified array 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
.invertTransform([1, 2, 3]));
console.log(fabric.util
.invertTransform([1, 2, 3, 4]));
console.log(fabric.util
.invertTransform([1, 2, 3, 4, 5]));
console.log(fabric.util
.invertTransform([1, 2, 3, 4, 5, 6]));
</script>
</body>
</html>
|
Output:
[null,null,null,null,null,null]
[-2,1,1.5,-0.5,null,null]
[-2,1,1.5,-0.5,null,null]
[-2,1,1.5,-0.5,1,-2]
Example 2:
Javascript
<!DOCTYPE html>
<html>
<head>
<!-- Adding the FabricJS library -->
<script src=
</script>
</head>
<body>
<script type= "text/javascript" >
var array1 = [5, 10, 15, 20];
var array2 = [1, 3, 5, 7, 9, 11];
console.log(fabric.util.invertTransform(array1));
console.log(fabric.util.invertTransform(array2));
</script>
</body>
</html>
|
Output:
[-0.4,0.2,0.3,-0.1,null,null]
[-0.875,0.375,0.625,-0.125,1,-2]
Share your thoughts in the comments
Please Login to comment...