MCPcopy
hub / github.com/greensock/GSAP / _getAlignMatrix

Function _getAlignMatrix

esm/MotionPathPlugin.js:120–151  ·  view source on GitHub ↗
(fromElement, toElement, fromOrigin, toOrigin)

Source from the content-addressed store, hash-verified

118 });
119},
120 _getAlignMatrix = function _getAlignMatrix(fromElement, toElement, fromOrigin, toOrigin) {
121 var parentMatrix = getGlobalMatrix(fromElement.parentNode, true, true),
122 m = parentMatrix.clone().multiply(getGlobalMatrix(toElement)),
123 fromPoint = _originToPoint(fromElement, fromOrigin, parentMatrix),
124 _originToPoint2 = _originToPoint(toElement, toOrigin, parentMatrix),
125 x = _originToPoint2.x,
126 y = _originToPoint2.y,
127 p;
128
129 m.e = m.f = 0;
130
131 if (toOrigin === "auto" && toElement.getTotalLength && toElement.tagName.toLowerCase() === "path") {
132 p = toElement.getAttribute("d").match(_numExp) || [];
133 p = m.apply({
134 x: +p[0],
135 y: +p[1]
136 });
137 x += p.x;
138 y += p.y;
139 } //if (p || (toElement.getBBox && fromElement.getBBox && toElement.ownerSVGElement === fromElement.ownerSVGElement)) {
140
141
142 if (p) {
143 p = m.apply(toElement.getBBox());
144 x -= p.x;
145 y -= p.y;
146 }
147
148 m.e = x - fromPoint.x;
149 m.f = y - fromPoint.y;
150 return m;
151},
152 _align = function _align(rawPath, target, _ref) {
153 var align = _ref.align,
154 matrix = _ref.matrix,

Callers 2

_alignFunction · 0.70

Calls 5

getGlobalMatrixFunction · 0.90
multiplyMethod · 0.80
applyMethod · 0.80
_originToPointFunction · 0.70
cloneMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…