source: node_modules/d3-interpolate/src/transform/parse.js@ e4c61dd

Last change on this file since e4c61dd was e4c61dd, checked in by istevanoska <ilinastevanoska@…>, 6 months ago

Prototype 1.1

  • Property mode set to 100644
File size: 681 bytes
Line 
1import decompose, {identity} from "./decompose.js";
2
3var svgNode;
4
5/* eslint-disable no-undef */
6export function parseCss(value) {
7 const m = new (typeof DOMMatrix === "function" ? DOMMatrix : WebKitCSSMatrix)(value + "");
8 return m.isIdentity ? identity : decompose(m.a, m.b, m.c, m.d, m.e, m.f);
9}
10
11export function parseSvg(value) {
12 if (value == null) return identity;
13 if (!svgNode) svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g");
14 svgNode.setAttribute("transform", value);
15 if (!(value = svgNode.transform.baseVal.consolidate())) return identity;
16 value = value.matrix;
17 return decompose(value.a, value.b, value.c, value.d, value.e, value.f);
18}
Note: See TracBrowser for help on using the repository browser.