(targetOrTween, vars)
| 155 | |
| 156 | export var MotionPathHelper = /*#__PURE__*/function () { |
| 157 | function MotionPathHelper(targetOrTween, vars) { |
| 158 | var _this = this; |
| 159 | |
| 160 | if (vars === void 0) { |
| 161 | vars = {}; |
| 162 | } |
| 163 | |
| 164 | if (!MotionPathPlugin) { |
| 165 | _initCore(vars.gsap, 1); |
| 166 | } |
| 167 | |
| 168 | var copyButton = _createElement("div"), |
| 169 | self = this, |
| 170 | offset = { |
| 171 | x: 0, |
| 172 | y: 0 |
| 173 | }, |
| 174 | target, |
| 175 | path, |
| 176 | isSVG, |
| 177 | startX, |
| 178 | startY, |
| 179 | position, |
| 180 | svg, |
| 181 | animation, |
| 182 | svgNamespace, |
| 183 | temp, |
| 184 | matrix, |
| 185 | refreshPath, |
| 186 | animationToScrub, |
| 187 | createdSVG; |
| 188 | |
| 189 | if (targetOrTween instanceof gsap.core.Tween) { |
| 190 | animation = targetOrTween; |
| 191 | target = animation.targets()[0]; |
| 192 | } else { |
| 193 | target = gsap.utils.toArray(targetOrTween)[0]; |
| 194 | animation = _findMotionPathTween(target); |
| 195 | } |
| 196 | |
| 197 | path = _parsePath(vars.path, target, vars); |
| 198 | this.offset = offset; |
| 199 | position = _getPositionOnPage(target); |
| 200 | startX = parseFloat(gsap.getProperty(target, "x", "px")); |
| 201 | startY = parseFloat(gsap.getProperty(target, "y", "px")); |
| 202 | isSVG = target.getCTM && target.tagName.toLowerCase() !== "svg"; |
| 203 | |
| 204 | if (animation && !path) { |
| 205 | path = _parsePath(animation.vars.motionPath.path || animation.vars.motionPath, target, animation.vars.motionPath); |
| 206 | } |
| 207 | |
| 208 | copyButton.setAttribute("class", "copy-motion-path"); |
| 209 | copyButton.style.cssText = "border-radius:8px; background-color:rgba(85, 85, 85, 0.7); color:#fff; cursor:pointer; padding:6px 12px; font-family:Signika Negative, Arial, sans-serif; position:fixed; left:50%; transform:translate(-50%, 0); font-size:19px; bottom:10px"; |
| 210 | copyButton.innerText = "COPY MOTION PATH"; |
| 211 | copyButton._gsHelper = self; |
| 212 | |
| 213 | (gsap.utils.toArray(vars.container)[0] || _body).appendChild(copyButton); |
| 214 |
nothing calls this directly
no test coverage detected
searching dependent graphs…