@tsparticles/path-svg 3.0.3 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/794.min.js +2 -0
- package/794.min.js.LICENSE.txt +1 -0
- package/browser/SVGPathGenerator.js +36 -37
- package/browser/index.js +1 -1
- package/cjs/SVGPathGenerator.js +35 -36
- package/cjs/index.js +25 -2
- package/dist_browser_SVGPathGenerator_js.js +30 -0
- package/esm/SVGPathGenerator.js +36 -37
- package/esm/index.js +1 -1
- package/package.json +2 -2
- package/report.html +3 -3
- package/tsparticles.path.svg.js +241 -178
- package/tsparticles.path.svg.min.js +1 -1
- package/tsparticles.path.svg.min.js.LICENSE.txt +1 -1
- package/types/SVGPathGenerator.d.ts +2 -7
- package/umd/SVGPathGenerator.js +35 -36
- package/umd/index.js +27 -3
package/tsparticles.path.svg.js
CHANGED
|
@@ -4,7 +4,15 @@
|
|
|
4
4
|
* Demo / Generator : https://particles.js.org/
|
|
5
5
|
* GitHub : https://www.github.com/matteobruni/tsparticles
|
|
6
6
|
* How to use? : Check the GitHub README
|
|
7
|
-
* v3.0
|
|
7
|
+
* v3.2.0
|
|
8
|
+
*/
|
|
9
|
+
/*
|
|
10
|
+
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
|
11
|
+
* This devtool is neither made for production nor for readable output files.
|
|
12
|
+
* It uses "eval()" calls to create a separate source file in the browser devtools.
|
|
13
|
+
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
|
|
14
|
+
* or disable the default devtool with "devtool: false".
|
|
15
|
+
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
|
|
8
16
|
*/
|
|
9
17
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
10
18
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
@@ -15,15 +23,28 @@
|
|
|
15
23
|
var a = typeof exports === 'object' ? factory(require("@tsparticles/engine")) : factory(root["window"]);
|
|
16
24
|
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
|
|
17
25
|
}
|
|
18
|
-
})(this, (
|
|
26
|
+
})(this, (__WEBPACK_EXTERNAL_MODULE__tsparticles_engine__) => {
|
|
19
27
|
return /******/ (() => { // webpackBootstrap
|
|
20
28
|
/******/ "use strict";
|
|
21
29
|
/******/ var __webpack_modules__ = ({
|
|
22
30
|
|
|
23
|
-
/***/
|
|
31
|
+
/***/ "./dist/browser/index.js":
|
|
32
|
+
/*!*******************************!*\
|
|
33
|
+
!*** ./dist/browser/index.js ***!
|
|
34
|
+
\*******************************/
|
|
35
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
36
|
+
|
|
37
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ loadSVGPath: () => (/* binding */ loadSVGPath),\n/* harmony export */ svgPathName: () => (/* binding */ svgPathName)\n/* harmony export */ });\nconst svgPathName = \"svgPathGenerator\";\nasync function loadSVGPath(engine, refresh = true) {\n const {\n SVGPathGenerator\n } = await __webpack_require__.e(/*! import() */ \"dist_browser_SVGPathGenerator_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./SVGPathGenerator.js */ \"./dist/browser/SVGPathGenerator.js\"));\n await engine.addPathGenerator(svgPathName, new SVGPathGenerator(), refresh);\n}\n\n//# sourceURL=webpack://@tsparticles/path-svg/./dist/browser/index.js?");
|
|
38
|
+
|
|
39
|
+
/***/ }),
|
|
40
|
+
|
|
41
|
+
/***/ "@tsparticles/engine":
|
|
42
|
+
/*!*********************************************************************************************************************************!*\
|
|
43
|
+
!*** external {"commonjs":"@tsparticles/engine","commonjs2":"@tsparticles/engine","amd":"@tsparticles/engine","root":"window"} ***!
|
|
44
|
+
\*********************************************************************************************************************************/
|
|
24
45
|
/***/ ((module) => {
|
|
25
46
|
|
|
26
|
-
module.exports =
|
|
47
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
|
|
27
48
|
|
|
28
49
|
/***/ })
|
|
29
50
|
|
|
@@ -53,7 +74,22 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__533__;
|
|
|
53
74
|
/******/ return module.exports;
|
|
54
75
|
/******/ }
|
|
55
76
|
/******/
|
|
77
|
+
/******/ // expose the modules object (__webpack_modules__)
|
|
78
|
+
/******/ __webpack_require__.m = __webpack_modules__;
|
|
79
|
+
/******/
|
|
56
80
|
/************************************************************************/
|
|
81
|
+
/******/ /* webpack/runtime/compat get default export */
|
|
82
|
+
/******/ (() => {
|
|
83
|
+
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
84
|
+
/******/ __webpack_require__.n = (module) => {
|
|
85
|
+
/******/ var getter = module && module.__esModule ?
|
|
86
|
+
/******/ () => (module['default']) :
|
|
87
|
+
/******/ () => (module);
|
|
88
|
+
/******/ __webpack_require__.d(getter, { a: getter });
|
|
89
|
+
/******/ return getter;
|
|
90
|
+
/******/ };
|
|
91
|
+
/******/ })();
|
|
92
|
+
/******/
|
|
57
93
|
/******/ /* webpack/runtime/define property getters */
|
|
58
94
|
/******/ (() => {
|
|
59
95
|
/******/ // define getter functions for harmony exports
|
|
@@ -66,11 +102,91 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__533__;
|
|
|
66
102
|
/******/ };
|
|
67
103
|
/******/ })();
|
|
68
104
|
/******/
|
|
105
|
+
/******/ /* webpack/runtime/ensure chunk */
|
|
106
|
+
/******/ (() => {
|
|
107
|
+
/******/ __webpack_require__.f = {};
|
|
108
|
+
/******/ // This file contains only the entry chunk.
|
|
109
|
+
/******/ // The chunk loading function for additional chunks
|
|
110
|
+
/******/ __webpack_require__.e = (chunkId) => {
|
|
111
|
+
/******/ return Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {
|
|
112
|
+
/******/ __webpack_require__.f[key](chunkId, promises);
|
|
113
|
+
/******/ return promises;
|
|
114
|
+
/******/ }, []));
|
|
115
|
+
/******/ };
|
|
116
|
+
/******/ })();
|
|
117
|
+
/******/
|
|
118
|
+
/******/ /* webpack/runtime/get javascript chunk filename */
|
|
119
|
+
/******/ (() => {
|
|
120
|
+
/******/ // This function allow to reference async chunks
|
|
121
|
+
/******/ __webpack_require__.u = (chunkId) => {
|
|
122
|
+
/******/ // return url for filenames based on template
|
|
123
|
+
/******/ return "" + chunkId + ".js";
|
|
124
|
+
/******/ };
|
|
125
|
+
/******/ })();
|
|
126
|
+
/******/
|
|
127
|
+
/******/ /* webpack/runtime/global */
|
|
128
|
+
/******/ (() => {
|
|
129
|
+
/******/ __webpack_require__.g = (function() {
|
|
130
|
+
/******/ if (typeof globalThis === 'object') return globalThis;
|
|
131
|
+
/******/ try {
|
|
132
|
+
/******/ return this || new Function('return this')();
|
|
133
|
+
/******/ } catch (e) {
|
|
134
|
+
/******/ if (typeof window === 'object') return window;
|
|
135
|
+
/******/ }
|
|
136
|
+
/******/ })();
|
|
137
|
+
/******/ })();
|
|
138
|
+
/******/
|
|
69
139
|
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
70
140
|
/******/ (() => {
|
|
71
141
|
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
72
142
|
/******/ })();
|
|
73
143
|
/******/
|
|
144
|
+
/******/ /* webpack/runtime/load script */
|
|
145
|
+
/******/ (() => {
|
|
146
|
+
/******/ var inProgress = {};
|
|
147
|
+
/******/ var dataWebpackPrefix = "@tsparticles/path-svg:";
|
|
148
|
+
/******/ // loadScript function to load a script via script tag
|
|
149
|
+
/******/ __webpack_require__.l = (url, done, key, chunkId) => {
|
|
150
|
+
/******/ if(inProgress[url]) { inProgress[url].push(done); return; }
|
|
151
|
+
/******/ var script, needAttach;
|
|
152
|
+
/******/ if(key !== undefined) {
|
|
153
|
+
/******/ var scripts = document.getElementsByTagName("script");
|
|
154
|
+
/******/ for(var i = 0; i < scripts.length; i++) {
|
|
155
|
+
/******/ var s = scripts[i];
|
|
156
|
+
/******/ if(s.getAttribute("src") == url || s.getAttribute("data-webpack") == dataWebpackPrefix + key) { script = s; break; }
|
|
157
|
+
/******/ }
|
|
158
|
+
/******/ }
|
|
159
|
+
/******/ if(!script) {
|
|
160
|
+
/******/ needAttach = true;
|
|
161
|
+
/******/ script = document.createElement('script');
|
|
162
|
+
/******/
|
|
163
|
+
/******/ script.charset = 'utf-8';
|
|
164
|
+
/******/ script.timeout = 120;
|
|
165
|
+
/******/ if (__webpack_require__.nc) {
|
|
166
|
+
/******/ script.setAttribute("nonce", __webpack_require__.nc);
|
|
167
|
+
/******/ }
|
|
168
|
+
/******/ script.setAttribute("data-webpack", dataWebpackPrefix + key);
|
|
169
|
+
/******/
|
|
170
|
+
/******/ script.src = url;
|
|
171
|
+
/******/ }
|
|
172
|
+
/******/ inProgress[url] = [done];
|
|
173
|
+
/******/ var onScriptComplete = (prev, event) => {
|
|
174
|
+
/******/ // avoid mem leaks in IE.
|
|
175
|
+
/******/ script.onerror = script.onload = null;
|
|
176
|
+
/******/ clearTimeout(timeout);
|
|
177
|
+
/******/ var doneFns = inProgress[url];
|
|
178
|
+
/******/ delete inProgress[url];
|
|
179
|
+
/******/ script.parentNode && script.parentNode.removeChild(script);
|
|
180
|
+
/******/ doneFns && doneFns.forEach((fn) => (fn(event)));
|
|
181
|
+
/******/ if(prev) return prev(event);
|
|
182
|
+
/******/ }
|
|
183
|
+
/******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
|
|
184
|
+
/******/ script.onerror = onScriptComplete.bind(null, script.onerror);
|
|
185
|
+
/******/ script.onload = onScriptComplete.bind(null, script.onload);
|
|
186
|
+
/******/ needAttach && document.head.appendChild(script);
|
|
187
|
+
/******/ };
|
|
188
|
+
/******/ })();
|
|
189
|
+
/******/
|
|
74
190
|
/******/ /* webpack/runtime/make namespace object */
|
|
75
191
|
/******/ (() => {
|
|
76
192
|
/******/ // define __esModule on exports
|
|
@@ -82,181 +198,128 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__533__;
|
|
|
82
198
|
/******/ };
|
|
83
199
|
/******/ })();
|
|
84
200
|
/******/
|
|
201
|
+
/******/ /* webpack/runtime/publicPath */
|
|
202
|
+
/******/ (() => {
|
|
203
|
+
/******/ var scriptUrl;
|
|
204
|
+
/******/ if (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + "";
|
|
205
|
+
/******/ var document = __webpack_require__.g.document;
|
|
206
|
+
/******/ if (!scriptUrl && document) {
|
|
207
|
+
/******/ if (document.currentScript)
|
|
208
|
+
/******/ scriptUrl = document.currentScript.src;
|
|
209
|
+
/******/ if (!scriptUrl) {
|
|
210
|
+
/******/ var scripts = document.getElementsByTagName("script");
|
|
211
|
+
/******/ if(scripts.length) {
|
|
212
|
+
/******/ var i = scripts.length - 1;
|
|
213
|
+
/******/ while (i > -1 && !scriptUrl) scriptUrl = scripts[i--].src;
|
|
214
|
+
/******/ }
|
|
215
|
+
/******/ }
|
|
216
|
+
/******/ }
|
|
217
|
+
/******/ // When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration
|
|
218
|
+
/******/ // or pass an empty string ("") and set the __webpack_public_path__ variable from your code to use your own logic.
|
|
219
|
+
/******/ if (!scriptUrl) throw new Error("Automatic publicPath is not supported in this browser");
|
|
220
|
+
/******/ scriptUrl = scriptUrl.replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/");
|
|
221
|
+
/******/ __webpack_require__.p = scriptUrl;
|
|
222
|
+
/******/ })();
|
|
223
|
+
/******/
|
|
224
|
+
/******/ /* webpack/runtime/jsonp chunk loading */
|
|
225
|
+
/******/ (() => {
|
|
226
|
+
/******/ // no baseURI
|
|
227
|
+
/******/
|
|
228
|
+
/******/ // object to store loaded and loading chunks
|
|
229
|
+
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
|
|
230
|
+
/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
|
|
231
|
+
/******/ var installedChunks = {
|
|
232
|
+
/******/ "tsparticles.path.svg": 0
|
|
233
|
+
/******/ };
|
|
234
|
+
/******/
|
|
235
|
+
/******/ __webpack_require__.f.j = (chunkId, promises) => {
|
|
236
|
+
/******/ // JSONP chunk loading for javascript
|
|
237
|
+
/******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
|
|
238
|
+
/******/ if(installedChunkData !== 0) { // 0 means "already installed".
|
|
239
|
+
/******/
|
|
240
|
+
/******/ // a Promise means "currently loading".
|
|
241
|
+
/******/ if(installedChunkData) {
|
|
242
|
+
/******/ promises.push(installedChunkData[2]);
|
|
243
|
+
/******/ } else {
|
|
244
|
+
/******/ if(true) { // all chunks have JS
|
|
245
|
+
/******/ // setup Promise in chunk cache
|
|
246
|
+
/******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));
|
|
247
|
+
/******/ promises.push(installedChunkData[2] = promise);
|
|
248
|
+
/******/
|
|
249
|
+
/******/ // start chunk loading
|
|
250
|
+
/******/ var url = __webpack_require__.p + __webpack_require__.u(chunkId);
|
|
251
|
+
/******/ // create error before stack unwound to get useful stacktrace later
|
|
252
|
+
/******/ var error = new Error();
|
|
253
|
+
/******/ var loadingEnded = (event) => {
|
|
254
|
+
/******/ if(__webpack_require__.o(installedChunks, chunkId)) {
|
|
255
|
+
/******/ installedChunkData = installedChunks[chunkId];
|
|
256
|
+
/******/ if(installedChunkData !== 0) installedChunks[chunkId] = undefined;
|
|
257
|
+
/******/ if(installedChunkData) {
|
|
258
|
+
/******/ var errorType = event && (event.type === 'load' ? 'missing' : event.type);
|
|
259
|
+
/******/ var realSrc = event && event.target && event.target.src;
|
|
260
|
+
/******/ error.message = 'Loading chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')';
|
|
261
|
+
/******/ error.name = 'ChunkLoadError';
|
|
262
|
+
/******/ error.type = errorType;
|
|
263
|
+
/******/ error.request = realSrc;
|
|
264
|
+
/******/ installedChunkData[1](error);
|
|
265
|
+
/******/ }
|
|
266
|
+
/******/ }
|
|
267
|
+
/******/ };
|
|
268
|
+
/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId);
|
|
269
|
+
/******/ }
|
|
270
|
+
/******/ }
|
|
271
|
+
/******/ }
|
|
272
|
+
/******/ };
|
|
273
|
+
/******/
|
|
274
|
+
/******/ // no prefetching
|
|
275
|
+
/******/
|
|
276
|
+
/******/ // no preloaded
|
|
277
|
+
/******/
|
|
278
|
+
/******/ // no HMR
|
|
279
|
+
/******/
|
|
280
|
+
/******/ // no HMR manifest
|
|
281
|
+
/******/
|
|
282
|
+
/******/ // no on chunks loaded
|
|
283
|
+
/******/
|
|
284
|
+
/******/ // install a JSONP callback for chunk loading
|
|
285
|
+
/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
|
|
286
|
+
/******/ var chunkIds = data[0];
|
|
287
|
+
/******/ var moreModules = data[1];
|
|
288
|
+
/******/ var runtime = data[2];
|
|
289
|
+
/******/ // add "moreModules" to the modules object,
|
|
290
|
+
/******/ // then flag all "chunkIds" as loaded and fire callback
|
|
291
|
+
/******/ var moduleId, chunkId, i = 0;
|
|
292
|
+
/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
|
|
293
|
+
/******/ for(moduleId in moreModules) {
|
|
294
|
+
/******/ if(__webpack_require__.o(moreModules, moduleId)) {
|
|
295
|
+
/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
|
|
296
|
+
/******/ }
|
|
297
|
+
/******/ }
|
|
298
|
+
/******/ if(runtime) var result = runtime(__webpack_require__);
|
|
299
|
+
/******/ }
|
|
300
|
+
/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
|
|
301
|
+
/******/ for(;i < chunkIds.length; i++) {
|
|
302
|
+
/******/ chunkId = chunkIds[i];
|
|
303
|
+
/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
|
|
304
|
+
/******/ installedChunks[chunkId][0]();
|
|
305
|
+
/******/ }
|
|
306
|
+
/******/ installedChunks[chunkId] = 0;
|
|
307
|
+
/******/ }
|
|
308
|
+
/******/
|
|
309
|
+
/******/ }
|
|
310
|
+
/******/
|
|
311
|
+
/******/ var chunkLoadingGlobal = this["webpackChunk_tsparticles_path_svg"] = this["webpackChunk_tsparticles_path_svg"] || [];
|
|
312
|
+
/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
|
|
313
|
+
/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
|
|
314
|
+
/******/ })();
|
|
315
|
+
/******/
|
|
85
316
|
/************************************************************************/
|
|
86
|
-
|
|
87
|
-
//
|
|
88
|
-
|
|
89
|
-
//
|
|
90
|
-
__webpack_require__.
|
|
91
|
-
|
|
92
|
-
// EXPORTS
|
|
93
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
94
|
-
loadSVGPath: () => (/* binding */ loadSVGPath),
|
|
95
|
-
svgPathName: () => (/* binding */ svgPathName)
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
// EXTERNAL MODULE: external {"commonjs":"@tsparticles/engine","commonjs2":"@tsparticles/engine","amd":"@tsparticles/engine","root":"window"}
|
|
99
|
-
var engine_root_window_ = __webpack_require__(533);
|
|
100
|
-
;// CONCATENATED MODULE: ./dist/browser/SVGPathGenerator.js
|
|
101
|
-
|
|
102
|
-
class SVGPathGenerator {
|
|
103
|
-
constructor() {
|
|
104
|
-
this._paths = [];
|
|
105
|
-
this._reverse = false;
|
|
106
|
-
this._size = {
|
|
107
|
-
width: 0,
|
|
108
|
-
height: 0
|
|
109
|
-
};
|
|
110
|
-
this._scale = 1;
|
|
111
|
-
this._offset = {
|
|
112
|
-
x: 0,
|
|
113
|
-
y: 0,
|
|
114
|
-
mode: "percent"
|
|
115
|
-
};
|
|
116
|
-
this._width = 0;
|
|
117
|
-
}
|
|
118
|
-
generate(particle, delta) {
|
|
119
|
-
const container = particle.container,
|
|
120
|
-
pxRatio = container.retina.pixelRatio;
|
|
121
|
-
if (particle.svgDirection === undefined) {
|
|
122
|
-
particle.svgDirection = (0,engine_root_window_.getRandom)() > 0.5 ? 0 : 1;
|
|
123
|
-
}
|
|
124
|
-
if (particle.svgPathIndex === undefined) {
|
|
125
|
-
particle.svgPathIndex = Math.floor(Math.random() * this._paths.length);
|
|
126
|
-
}
|
|
127
|
-
if (particle.svgSpeed === undefined) {
|
|
128
|
-
particle.svgSpeed = particle.velocity.mult((particle.retina.moveSpeed ?? 1) / 2).length;
|
|
129
|
-
}
|
|
130
|
-
if (particle.svgStep === undefined) {
|
|
131
|
-
particle.svgStep = (0,engine_root_window_.randomInRange)({
|
|
132
|
-
min: 0,
|
|
133
|
-
max: this._paths[particle.svgPathIndex].length
|
|
134
|
-
}) * pxRatio;
|
|
135
|
-
}
|
|
136
|
-
if (particle.svgOffset === undefined) {
|
|
137
|
-
particle.svgOffset = {
|
|
138
|
-
width: (0,engine_root_window_.randomInRange)({
|
|
139
|
-
min: -this._width / 2,
|
|
140
|
-
max: this._width / 2
|
|
141
|
-
}) * pxRatio,
|
|
142
|
-
height: (0,engine_root_window_.randomInRange)({
|
|
143
|
-
min: -this._width / 2,
|
|
144
|
-
max: this._width / 2
|
|
145
|
-
}) * pxRatio
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
if (particle.svgInitialPosition === undefined) {
|
|
149
|
-
particle.svgInitialPosition = {
|
|
150
|
-
...particle.position
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
particle.velocity.x = 0;
|
|
154
|
-
particle.velocity.y = 0;
|
|
155
|
-
if (particle.svgDirection === 0) {
|
|
156
|
-
particle.svgStep += particle.svgSpeed * delta.factor;
|
|
157
|
-
} else {
|
|
158
|
-
particle.svgStep -= particle.svgSpeed * delta.factor;
|
|
159
|
-
}
|
|
160
|
-
let path = this._paths[particle.svgPathIndex];
|
|
161
|
-
if (path) {
|
|
162
|
-
const pathLength = path.length;
|
|
163
|
-
if (particle.svgStep >= pathLength) {
|
|
164
|
-
particle.svgPathIndex = particle.svgPathIndex + 1;
|
|
165
|
-
if (particle.svgPathIndex >= this._paths.length) {
|
|
166
|
-
if (this._reverse) {
|
|
167
|
-
particle.svgPathIndex = this._paths.length - 1;
|
|
168
|
-
particle.svgDirection = 1;
|
|
169
|
-
} else {
|
|
170
|
-
particle.svgPathIndex = 0;
|
|
171
|
-
particle.svgStep = 0;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
} else if (particle.svgStep <= 0) {
|
|
175
|
-
particle.svgPathIndex = particle.svgPathIndex - 1;
|
|
176
|
-
if (particle.svgPathIndex < 0) {
|
|
177
|
-
if (this._reverse) {
|
|
178
|
-
particle.svgPathIndex = 0;
|
|
179
|
-
particle.svgDirection = 0;
|
|
180
|
-
} else {
|
|
181
|
-
particle.svgPathIndex = this._paths.length - 1;
|
|
182
|
-
path = this._paths[particle.svgPathIndex];
|
|
183
|
-
particle.svgStep = path.length;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
path = this._paths[particle.svgPathIndex];
|
|
188
|
-
}
|
|
189
|
-
if (path) {
|
|
190
|
-
const pathElement = path.element,
|
|
191
|
-
pos = pathElement.getPointAtLength(particle.svgStep),
|
|
192
|
-
canvasSize = particle.container.canvas.size,
|
|
193
|
-
offset = (0,engine_root_window_.getPosition)(this._offset, canvasSize),
|
|
194
|
-
scale = this._scale * pxRatio;
|
|
195
|
-
particle.position.x = (pos.x - this._size.width / 2) * scale + particle.svgInitialPosition.x + offset.x + particle.svgOffset.width;
|
|
196
|
-
particle.position.y = (pos.y - this._size.height / 2) * scale + particle.svgInitialPosition.y + offset.y + particle.svgOffset.height;
|
|
197
|
-
}
|
|
198
|
-
return engine_root_window_.Vector.origin;
|
|
199
|
-
}
|
|
200
|
-
init(container) {
|
|
201
|
-
const options = container.actualOptions.particles.move.path.options,
|
|
202
|
-
position = options.position ?? this._offset;
|
|
203
|
-
this._reverse = options.reverse ?? this._reverse;
|
|
204
|
-
this._scale = options.scale ?? 1;
|
|
205
|
-
this._offset.x = position.x;
|
|
206
|
-
this._offset.y = position.y;
|
|
207
|
-
this._offset.mode = position.mode;
|
|
208
|
-
this._width = options.width ?? 0;
|
|
209
|
-
if (options.url && !options.path) {
|
|
210
|
-
const url = options.url;
|
|
211
|
-
(async () => {
|
|
212
|
-
const response = await fetch(url),
|
|
213
|
-
data = await response.text();
|
|
214
|
-
const parser = new DOMParser(),
|
|
215
|
-
doc = parser.parseFromString(data, "image/svg+xml"),
|
|
216
|
-
svg = doc.getElementsByTagName("svg")[0];
|
|
217
|
-
let svgPaths = svg.getElementsByTagName("path");
|
|
218
|
-
if (!svgPaths.length) {
|
|
219
|
-
svgPaths = doc.getElementsByTagName("path");
|
|
220
|
-
}
|
|
221
|
-
this._paths = [];
|
|
222
|
-
for (let i = 0; i < svgPaths.length; i++) {
|
|
223
|
-
const path = svgPaths.item(i);
|
|
224
|
-
if (path) {
|
|
225
|
-
this._paths.push({
|
|
226
|
-
element: path,
|
|
227
|
-
length: path.getTotalLength()
|
|
228
|
-
});
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
this._size.height = parseFloat(svg.getAttribute("height") ?? "0");
|
|
232
|
-
this._size.width = parseFloat(svg.getAttribute("width") ?? "0");
|
|
233
|
-
})();
|
|
234
|
-
} else if (options.path) {
|
|
235
|
-
const path = options.path;
|
|
236
|
-
this._paths = [];
|
|
237
|
-
for (const item of path.data) {
|
|
238
|
-
const element = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
239
|
-
element.setAttribute("d", item);
|
|
240
|
-
this._paths.push({
|
|
241
|
-
element,
|
|
242
|
-
length: element.getTotalLength()
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
this._size.height = path.size.height;
|
|
246
|
-
this._size.width = path.size.width;
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
reset() {}
|
|
250
|
-
update() {}
|
|
251
|
-
}
|
|
252
|
-
;// CONCATENATED MODULE: ./dist/browser/index.js
|
|
253
|
-
|
|
254
|
-
const svgPathName = "svgPathGenerator";
|
|
255
|
-
async function loadSVGPath(engine, refresh = true) {
|
|
256
|
-
await engine.addPathGenerator(svgPathName, new SVGPathGenerator(), refresh);
|
|
257
|
-
}
|
|
258
|
-
})();
|
|
259
|
-
|
|
317
|
+
/******/
|
|
318
|
+
/******/ // startup
|
|
319
|
+
/******/ // Load entry module and return exports
|
|
320
|
+
/******/ // This entry module can't be inlined because the eval devtool is used.
|
|
321
|
+
/******/ var __webpack_exports__ = __webpack_require__("./dist/browser/index.js");
|
|
322
|
+
/******/
|
|
260
323
|
/******/ return __webpack_exports__;
|
|
261
324
|
/******/ })()
|
|
262
325
|
;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see tsparticles.path.svg.min.js.LICENSE.txt */
|
|
2
|
-
!function(t
|
|
2
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],t);else{var r="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var o in r)("object"==typeof exports?exports:e)[o]=r[o]}}(this,(e=>(()=>{var t,r,o={533:t=>{t.exports=e}},n={};function a(e){var t=n[e];if(void 0!==t)return t.exports;var r=n[e]={exports:{}};return o[e](r,r.exports,a),r.exports}a.m=o,a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},a.d=(e,t)=>{for(var r in t)a.o(t,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},a.f={},a.e=e=>Promise.all(Object.keys(a.f).reduce(((t,r)=>(a.f[r](e,t),t)),[])),a.u=e=>e+".min.js",a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),t={},r="@tsparticles/path-svg:",a.l=(e,o,n,i)=>{if(t[e])t[e].push(o);else{var s,c;if(void 0!==n)for(var l=document.getElementsByTagName("script"),p=0;p<l.length;p++){var u=l[p];if(u.getAttribute("src")==e||u.getAttribute("data-webpack")==r+n){s=u;break}}s||(c=!0,(s=document.createElement("script")).charset="utf-8",s.timeout=120,a.nc&&s.setAttribute("nonce",a.nc),s.setAttribute("data-webpack",r+n),s.src=e),t[e]=[o];var d=(r,o)=>{s.onerror=s.onload=null,clearTimeout(f);var n=t[e];if(delete t[e],s.parentNode&&s.parentNode.removeChild(s),n&&n.forEach((e=>e(o))),r)return r(o)},f=setTimeout(d.bind(null,void 0,{type:"timeout",target:s}),12e4);s.onerror=d.bind(null,s.onerror),s.onload=d.bind(null,s.onload),c&&document.head.appendChild(s)}},a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;a.g.importScripts&&(e=a.g.location+"");var t=a.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var o=r.length-1;o>-1&&!e;)e=r[o--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),a.p=e})(),(()=>{var e={178:0};a.f.j=(t,r)=>{var o=a.o(e,t)?e[t]:void 0;if(0!==o)if(o)r.push(o[2]);else{var n=new Promise(((r,n)=>o=e[t]=[r,n]));r.push(o[2]=n);var i=a.p+a.u(t),s=new Error;a.l(i,(r=>{if(a.o(e,t)&&(0!==(o=e[t])&&(e[t]=void 0),o)){var n=r&&("load"===r.type?"missing":r.type),i=r&&r.target&&r.target.src;s.message="Loading chunk "+t+" failed.\n("+n+": "+i+")",s.name="ChunkLoadError",s.type=n,s.request=i,o[1](s)}}),"chunk-"+t,t)}};var t=(t,r)=>{var o,n,i=r[0],s=r[1],c=r[2],l=0;if(i.some((t=>0!==e[t]))){for(o in s)a.o(s,o)&&(a.m[o]=s[o]);if(c)c(a)}for(t&&t(r);l<i.length;l++)n=i[l],a.o(e,n)&&e[n]&&e[n][0](),e[n]=0},r=this.webpackChunk_tsparticles_path_svg=this.webpackChunk_tsparticles_path_svg||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var i={};return(()=>{a.r(i),a.d(i,{loadSVGPath:()=>t,svgPathName:()=>e});const e="svgPathGenerator";async function t(t,r=!0){const{SVGPathGenerator:o}=await a.e(794).then(a.bind(a,794));await t.addPathGenerator(e,new o,r)}})(),i})()));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
/*! tsParticles SVG Path v3.0
|
|
1
|
+
/*! tsParticles SVG Path v3.2.0 by Matteo Bruni */
|
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
import { type Container, type ICoordinates, type IDelta, type IDimension, type IMovePathGenerator, type Particle, Vector } from "@tsparticles/engine";
|
|
2
|
-
declare global {
|
|
3
|
-
interface Window {
|
|
4
|
-
[key: string]: unknown;
|
|
5
|
-
}
|
|
6
|
-
}
|
|
7
2
|
declare const enum SVGPathDirection {
|
|
8
3
|
normal = 0,
|
|
9
4
|
reverse = 1
|
|
@@ -24,8 +19,8 @@ export declare class SVGPathGenerator implements IMovePathGenerator {
|
|
|
24
19
|
private readonly _size;
|
|
25
20
|
private _width;
|
|
26
21
|
constructor();
|
|
27
|
-
generate(particle: SVGPathParticle, delta: IDelta): Vector
|
|
28
|
-
init(container: Container): void
|
|
22
|
+
generate(particle: SVGPathParticle, delta: IDelta): Promise<Vector>;
|
|
23
|
+
init(container: Container): Promise<void>;
|
|
29
24
|
reset(): void;
|
|
30
25
|
update(): void;
|
|
31
26
|
}
|