Fabric.js invertTransform() Method

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"> // Calling invertTransform() function over // some array transform 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"> // Specifying some arrays var array1 = [5, 10, 15, 20]; var array2 = [1, 3, 5, 7, 9, 11]; // Calling invertTransform() function // over the above array transform 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]
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!



