Web Dev Solutions

Catalin Mititiuc

aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/utils.js')
-rw-r--r--src/modules/utils.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/modules/utils.js b/src/modules/utils.js
new file mode 100644
index 0000000..e7f5c55
--- /dev/null
+++ b/src/modules/utils.js
@@ -0,0 +1,8 @@
+const digits = /-?\d+\.?\d*/g;
+
+export default function getComputedTransformMatrix(el) {
+ const matrixSequence = getComputedStyle(el).transform.match(digits),
+ identityMatrix = '';
+
+ return new DOMMatrix(matrixSequence || identityMatrix);
+}