@tsparticles/path-svg 4.0.0-alpha.1 → 4.0.0-alpha.14
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/392.min.js +1 -0
- package/browser/SVGPathGenerator.js +23 -41
- package/browser/createSVGPaths.js +12 -0
- package/browser/index.js +7 -5
- package/browser/loadSVGFromString.js +24 -0
- package/browser/types.js +1 -0
- package/cjs/SVGPathGenerator.js +23 -41
- package/cjs/createSVGPaths.js +12 -0
- package/cjs/index.js +7 -5
- package/cjs/loadSVGFromString.js +24 -0
- package/cjs/types.js +1 -0
- package/dist_browser_SVGPathGenerator_js.js +22 -2
- package/esm/SVGPathGenerator.js +23 -41
- package/esm/createSVGPaths.js +12 -0
- package/esm/index.js +7 -5
- package/esm/loadSVGFromString.js +24 -0
- package/esm/types.js +1 -0
- package/package.json +2 -2
- package/report.html +3 -3
- package/tsparticles.path.svg.js +2 -2
- package/tsparticles.path.svg.min.js +2 -2
- package/types/SVGPathGenerator.d.ts +3 -2
- package/types/createSVGPaths.d.ts +2 -0
- package/types/index.d.ts +1 -1
- package/types/loadSVGFromString.d.ts +9 -0
- package/types/types.d.ts +4 -0
- package/umd/SVGPathGenerator.js +23 -41
- package/umd/createSVGPaths.js +25 -0
- package/umd/index.js +7 -5
- package/umd/loadSVGFromString.js +37 -0
- package/umd/types.js +12 -0
- package/747.min.js +0 -2
- package/747.min.js.LICENSE.txt +0 -1
- package/tsparticles.path.svg.min.js.LICENSE.txt +0 -1
package/tsparticles.path.svg.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
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
|
-
* v4.0.0-alpha.
|
|
7
|
+
* v4.0.0-alpha.14
|
|
8
8
|
*/
|
|
9
9
|
/*
|
|
10
10
|
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
|
@@ -34,7 +34,7 @@ return /******/ (() => { // webpackBootstrap
|
|
|
34
34
|
\*******************************/
|
|
35
35
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
36
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\";\
|
|
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) {\n engine.checkVersion(\"4.0.0-alpha.14\");\n await engine.register((e)=>{\n e.addPathGenerator(svgPathName, async (container)=>{\n const { SVGPathGenerator } = await __webpack_require__.e(/*! import() */ \"dist_browser_SVGPathGenerator_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./SVGPathGenerator.js */ \"./dist/browser/SVGPathGenerator.js\"));\n return new SVGPathGenerator(container);\n });\n });\n}\n\n\n//# sourceURL=webpack://@tsparticles/path-svg/./dist/browser/index.js?\n}");
|
|
38
38
|
|
|
39
39
|
/***/ },
|
|
40
40
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
!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=>(()=>{"use strict";var t,r,o,n={303(t){t.exports=e}},a={};function i(e){var t=a[e];if(void 0!==t)return t.exports;var r=a[e]={exports:{}};return n[e](r,r.exports,i),r.exports}i.m=n,i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.f={},i.e=e=>Promise.all(Object.keys(i.f).reduce((t,r)=>(i.f[r](e,t),t),[])),i.u=e=>""+e+".min.js",i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s={},i.l=(e,t,r,o)=>{if(s[e])return void s[e].push(t);if(void 0!==r)for(var n,a,c=document.getElementsByTagName("script"),p=0;p<c.length;p++){var l=c[p];if(l.getAttribute("src")==e||l.getAttribute("data-webpack")=="@tsparticles/path-svg:"+r){n=l;break}}n||(a=!0,(n=document.createElement("script")).charset="utf-8",i.nc&&n.setAttribute("nonce",i.nc),n.setAttribute("data-webpack","@tsparticles/path-svg:"+r),n.src=e),s[e]=[t];var u=(t,r)=>{n.onerror=n.onload=null,clearTimeout(d);var o=s[e];if(delete s[e],n.parentNode&&n.parentNode.removeChild(n),o&&o.forEach(e=>e(r)),t)return t(r)},d=setTimeout(u.bind(null,void 0,{type:"timeout",target:n}),12e4);n.onerror=u.bind(null,n.onerror),n.onload=u.bind(null,n.onload),a&&document.head.appendChild(n)},i.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.g.importScripts&&(c=i.g.location+"");var s,c,p=i.g.document;if(!c&&p&&(p.currentScript&&"SCRIPT"===p.currentScript.tagName.toUpperCase()&&(c=p.currentScript.src),!c)){var l=p.getElementsByTagName("script");if(l.length)for(var u=l.length-1;u>-1&&(!c||!/^http(s?):/.test(c));)c=l[u--].src}if(!c)throw Error("Automatic publicPath is not supported in this browser");i.p=c=c.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),t={258:0},i.f.j=(e,r)=>{var o=i.o(t,e)?t[e]:void 0;if(0!==o)if(o)r.push(o[2]);else{var n=new Promise((r,n)=>o=t[e]=[r,n]);r.push(o[2]=n);var a=i.p+i.u(e),s=Error();i.l(a,r=>{if(i.o(t,e)&&(0!==(o=t[e])&&(t[e]=void 0),o)){var n=r&&("load"===r.type?"missing":r.type),a=r&&r.target&&r.target.src;s.message="Loading chunk "+e+` failed.
|
|
2
|
+
(`+n+": "+a+")",s.name="ChunkLoadError",s.type=n,s.request=a,o[1](s)}},"chunk-"+e,e)}},r=(e,r)=>{var o,n,[a,s,c]=r,p=0;if(a.some(e=>0!==t[e])){for(o in s)i.o(s,o)&&(i.m[o]=s[o]);c&&c(i)}for(e&&e(r);p<a.length;p++)n=a[p],i.o(t,n)&&t[n]&&t[n][0](),t[n]=0},(o=this.webpackChunk_tsparticles_path_svg=this.webpackChunk_tsparticles_path_svg||[]).forEach(r.bind(null,0)),o.push=r.bind(null,o.push.bind(o));var d={};i.r(d),i.d(d,{loadSVGPath:()=>h,svgPathName:()=>f});let f="svgPathGenerator";async function h(e){e.checkVersion("4.0.0-alpha.14"),await e.register(e=>{e.addPathGenerator(f,async e=>{let{SVGPathGenerator:t}=await i.e(392).then(i.bind(i,392));return new t(e)})})}return d})());
|
|
@@ -12,15 +12,16 @@ type SVGPathParticle = Particle & {
|
|
|
12
12
|
svgStep?: number;
|
|
13
13
|
};
|
|
14
14
|
export declare class SVGPathGenerator implements IMovePathGenerator {
|
|
15
|
+
private readonly _container;
|
|
15
16
|
private readonly _offset;
|
|
16
17
|
private _paths;
|
|
17
18
|
private _reverse;
|
|
18
19
|
private _scale;
|
|
19
20
|
private readonly _size;
|
|
20
21
|
private _width;
|
|
21
|
-
constructor();
|
|
22
|
+
constructor(container: Container);
|
|
22
23
|
generate(particle: SVGPathParticle, delta: IDelta): Vector;
|
|
23
|
-
init(
|
|
24
|
+
init(): void;
|
|
24
25
|
reset(): void;
|
|
25
26
|
update(): void;
|
|
26
27
|
}
|
package/types/index.d.ts
CHANGED
package/types/types.d.ts
ADDED
package/umd/SVGPathGenerator.js
CHANGED
|
@@ -4,13 +4,15 @@
|
|
|
4
4
|
if (v !== undefined) module.exports = v;
|
|
5
5
|
}
|
|
6
6
|
else if (typeof define === "function" && define.amd) {
|
|
7
|
-
define(["require", "exports", "@tsparticles/engine"], factory);
|
|
7
|
+
define(["require", "exports", "@tsparticles/engine", "./createSVGPaths.js", "./loadSVGFromString.js"], factory);
|
|
8
8
|
}
|
|
9
9
|
})(function (require, exports) {
|
|
10
10
|
"use strict";
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.SVGPathGenerator = void 0;
|
|
13
13
|
const engine_1 = require("@tsparticles/engine");
|
|
14
|
+
const createSVGPaths_js_1 = require("./createSVGPaths.js");
|
|
15
|
+
const loadSVGFromString_js_1 = require("./loadSVGFromString.js");
|
|
14
16
|
var SVGPathDirection;
|
|
15
17
|
(function (SVGPathDirection) {
|
|
16
18
|
SVGPathDirection[SVGPathDirection["normal"] = 0] = "normal";
|
|
@@ -18,7 +20,15 @@
|
|
|
18
20
|
})(SVGPathDirection || (SVGPathDirection = {}));
|
|
19
21
|
const defaultSpeed = 1, minStep = 0, minIndex = 0, minWidth = 0, minScale = 1;
|
|
20
22
|
class SVGPathGenerator {
|
|
21
|
-
|
|
23
|
+
_container;
|
|
24
|
+
_offset;
|
|
25
|
+
_paths;
|
|
26
|
+
_reverse;
|
|
27
|
+
_scale;
|
|
28
|
+
_size;
|
|
29
|
+
_width;
|
|
30
|
+
constructor(container) {
|
|
31
|
+
this._container = container;
|
|
22
32
|
this._paths = [];
|
|
23
33
|
this._reverse = false;
|
|
24
34
|
this._size = { width: 0, height: 0 };
|
|
@@ -27,7 +37,7 @@
|
|
|
27
37
|
this._width = 0;
|
|
28
38
|
}
|
|
29
39
|
generate(particle, delta) {
|
|
30
|
-
const container =
|
|
40
|
+
const container = this._container, pxRatio = container.retina.pixelRatio;
|
|
31
41
|
particle.svgDirection ??= (0, engine_1.getRandom)() > engine_1.half ? SVGPathDirection.normal : SVGPathDirection.reverse;
|
|
32
42
|
particle.svgPathIndex ??= Math.floor((0, engine_1.getRandom)() * this._paths.length);
|
|
33
43
|
particle.svgSpeed ??= particle.velocity.mult((particle.retina.moveSpeed ?? defaultSpeed) * engine_1.half).length;
|
|
@@ -75,21 +85,15 @@
|
|
|
75
85
|
}
|
|
76
86
|
}
|
|
77
87
|
path = this._paths[particle.svgPathIndex];
|
|
78
|
-
const pathElement = path.element, pos = pathElement.getPointAtLength(particle.svgStep), canvasSize =
|
|
88
|
+
const pathElement = path.element, pos = pathElement.getPointAtLength(particle.svgStep), canvasSize = this._container.canvas.size, offset = (0, engine_1.getPosition)(this._offset, canvasSize), scale = this._scale * pxRatio;
|
|
79
89
|
particle.position.x =
|
|
80
|
-
(pos.x - this._size.width * engine_1.half) * scale +
|
|
81
|
-
particle.svgInitialPosition.x +
|
|
82
|
-
offset.x +
|
|
83
|
-
particle.svgOffset.width;
|
|
90
|
+
(pos.x - this._size.width * engine_1.half) * scale + particle.svgInitialPosition.x + offset.x + particle.svgOffset.width;
|
|
84
91
|
particle.position.y =
|
|
85
|
-
(pos.y - this._size.height * engine_1.half) * scale +
|
|
86
|
-
particle.svgInitialPosition.y +
|
|
87
|
-
offset.y +
|
|
88
|
-
particle.svgOffset.height;
|
|
92
|
+
(pos.y - this._size.height * engine_1.half) * scale + particle.svgInitialPosition.y + offset.y + particle.svgOffset.height;
|
|
89
93
|
return engine_1.Vector.origin;
|
|
90
94
|
}
|
|
91
|
-
init(
|
|
92
|
-
const options =
|
|
95
|
+
init() {
|
|
96
|
+
const options = this._container.actualOptions.particles.move.path.options, position = options.position ?? this._offset;
|
|
93
97
|
this._reverse = options.reverse ?? this._reverse;
|
|
94
98
|
this._scale = options.scale ?? minScale;
|
|
95
99
|
this._offset.x = position.x;
|
|
@@ -99,37 +103,15 @@
|
|
|
99
103
|
if (options.url && !options.path) {
|
|
100
104
|
const url = options.url;
|
|
101
105
|
void (async () => {
|
|
102
|
-
const response = await fetch(url), data = await response.text();
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
svgPaths = doc.getElementsByTagName("path");
|
|
107
|
-
}
|
|
108
|
-
this._paths = [];
|
|
109
|
-
for (let i = 0; i < svgPaths.length; i++) {
|
|
110
|
-
const path = svgPaths.item(i);
|
|
111
|
-
if (path) {
|
|
112
|
-
this._paths.push({
|
|
113
|
-
element: path,
|
|
114
|
-
length: path.getTotalLength(),
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
this._size.height = Number.parseFloat(svg.getAttribute("height") ?? "0");
|
|
119
|
-
this._size.width = Number.parseFloat(svg.getAttribute("width") ?? "0");
|
|
106
|
+
const response = await fetch(url), data = await response.text(), { paths, size } = (0, loadSVGFromString_js_1.loadSVGFromString)(data);
|
|
107
|
+
this._paths = paths;
|
|
108
|
+
this._size.width = size.width;
|
|
109
|
+
this._size.height = size.height;
|
|
120
110
|
})();
|
|
121
111
|
}
|
|
122
112
|
else if (options.path) {
|
|
123
113
|
const path = options.path;
|
|
124
|
-
this._paths =
|
|
125
|
-
for (const item of path.data) {
|
|
126
|
-
const element = (0, engine_1.safeDocument)().createElementNS("http://www.w3.org/2000/svg", "path");
|
|
127
|
-
element.setAttribute("d", item);
|
|
128
|
-
this._paths.push({
|
|
129
|
-
element,
|
|
130
|
-
length: element.getTotalLength(),
|
|
131
|
-
});
|
|
132
|
-
}
|
|
114
|
+
this._paths = (0, createSVGPaths_js_1.createSVGPaths)(options.path.data);
|
|
133
115
|
this._size.height = path.size.height;
|
|
134
116
|
this._size.width = path.size.width;
|
|
135
117
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
(function (factory) {
|
|
2
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
+
var v = factory(require, exports);
|
|
4
|
+
if (v !== undefined) module.exports = v;
|
|
5
|
+
}
|
|
6
|
+
else if (typeof define === "function" && define.amd) {
|
|
7
|
+
define(["require", "exports", "@tsparticles/engine"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.createSVGPaths = createSVGPaths;
|
|
13
|
+
const engine_1 = require("@tsparticles/engine");
|
|
14
|
+
function createSVGPaths(data) {
|
|
15
|
+
const doc = (0, engine_1.safeDocument)();
|
|
16
|
+
return data.map(d => {
|
|
17
|
+
const element = doc.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
18
|
+
element.setAttribute("d", d);
|
|
19
|
+
return {
|
|
20
|
+
element,
|
|
21
|
+
length: element.getTotalLength(),
|
|
22
|
+
};
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
});
|
package/umd/index.js
CHANGED
|
@@ -46,11 +46,13 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
46
46
|
exports.svgPathName = void 0;
|
|
47
47
|
exports.loadSVGPath = loadSVGPath;
|
|
48
48
|
exports.svgPathName = "svgPathGenerator";
|
|
49
|
-
function loadSVGPath(engine) {
|
|
50
|
-
engine.checkVersion("4.0.0-alpha.
|
|
51
|
-
engine.register(
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
async function loadSVGPath(engine) {
|
|
50
|
+
engine.checkVersion("4.0.0-alpha.14");
|
|
51
|
+
await engine.register(e => {
|
|
52
|
+
e.addPathGenerator(exports.svgPathName, async (container) => {
|
|
53
|
+
const { SVGPathGenerator } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./SVGPathGenerator.js"))) : new Promise((resolve_1, reject_1) => { require(["./SVGPathGenerator.js"], resolve_1, reject_1); }).then(__importStar));
|
|
54
|
+
return new SVGPathGenerator(container);
|
|
55
|
+
});
|
|
54
56
|
});
|
|
55
57
|
}
|
|
56
58
|
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
(function (factory) {
|
|
2
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
+
var v = factory(require, exports);
|
|
4
|
+
if (v !== undefined) module.exports = v;
|
|
5
|
+
}
|
|
6
|
+
else if (typeof define === "function" && define.amd) {
|
|
7
|
+
define(["require", "exports"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.loadSVGFromString = loadSVGFromString;
|
|
13
|
+
function loadSVGFromString(svgText) {
|
|
14
|
+
const parser = new DOMParser(), doc = parser.parseFromString(svgText, "image/svg+xml"), svg = doc.querySelector("svg");
|
|
15
|
+
if (!svg) {
|
|
16
|
+
return { paths: [], size: { width: 0, height: 0 } };
|
|
17
|
+
}
|
|
18
|
+
const pathElements = svg.querySelectorAll("path"), paths = [];
|
|
19
|
+
for (const node of pathElements) {
|
|
20
|
+
if (!(node instanceof SVGPathElement)) {
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
paths.push({
|
|
24
|
+
element: node,
|
|
25
|
+
length: node.getTotalLength(),
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
const size = {
|
|
29
|
+
width: Number.parseFloat(svg.getAttribute("width") ?? "0"),
|
|
30
|
+
height: Number.parseFloat(svg.getAttribute("height") ?? "0"),
|
|
31
|
+
};
|
|
32
|
+
return {
|
|
33
|
+
paths,
|
|
34
|
+
size,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
});
|
package/umd/types.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
(function (factory) {
|
|
2
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
+
var v = factory(require, exports);
|
|
4
|
+
if (v !== undefined) module.exports = v;
|
|
5
|
+
}
|
|
6
|
+
else if (typeof define === "function" && define.amd) {
|
|
7
|
+
define(["require", "exports"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
});
|
package/747.min.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/*! For license information please see 747.min.js.LICENSE.txt */
|
|
2
|
-
(this.webpackChunk_tsparticles_path_svg=this.webpackChunk_tsparticles_path_svg||[]).push([[747],{747(t,e,s){s.d(e,{SVGPathGenerator:()=>a});var h,i=s(303);!function(t){t[t.normal=0]="normal",t[t.reverse=1]="reverse"}(h||(h={}));class a{constructor(){this._paths=[],this._reverse=!1,this._size={width:0,height:0},this._scale=1,this._offset={x:0,y:0,mode:i.PixelMode.percent},this._width=0}generate(t,e){const s=t.container.retina.pixelRatio;t.svgDirection??=(0,i.getRandom)()>i.half?h.normal:h.reverse,t.svgPathIndex??=Math.floor((0,i.getRandom)()*this._paths.length),t.svgSpeed??=t.velocity.mult((t.retina.moveSpeed??1)*i.half).length,t.svgStep??=(0,i.randomInRangeValue)({min:0,max:this._paths[t.svgPathIndex].length})*s,t.svgOffset??={width:(0,i.randomInRangeValue)({min:-this._width*i.half,max:this._width*i.half})*s,height:(0,i.randomInRangeValue)({min:-this._width*i.half,max:this._width*i.half})*s},t.svgInitialPosition??=t.position.copy(),t.velocity.x=0,t.velocity.y=0,t.svgDirection===h.normal?t.svgStep+=t.svgSpeed*e.factor:t.svgStep-=t.svgSpeed*e.factor;let a=this._paths[t.svgPathIndex];const n=a.length;t.svgStep>=n?(t.svgPathIndex=t.svgPathIndex+1,t.svgPathIndex>=this._paths.length&&(this._reverse?(t.svgPathIndex=this._paths.length-1,t.svgDirection=h.reverse):(t.svgPathIndex=0,t.svgStep=0))):t.svgStep<=0&&(t.svgPathIndex=t.svgPathIndex-1,t.svgPathIndex<0&&(this._reverse?(t.svgPathIndex=0,t.svgDirection=h.normal):(t.svgPathIndex=this._paths.length-1,a=this._paths[t.svgPathIndex],t.svgStep=a.length))),a=this._paths[t.svgPathIndex];const g=a.element.getPointAtLength(t.svgStep),o=t.container.canvas.size,r=(0,i.getPosition)(this._offset,o),l=this._scale*s;return t.position.x=(g.x-this._size.width*i.half)*l+t.svgInitialPosition.x+r.x+t.svgOffset.width,t.position.y=(g.y-this._size.height*i.half)*l+t.svgInitialPosition.y+r.y+t.svgOffset.height,i.Vector.origin}init(t){const e=t.actualOptions.particles.move.path.options,s=e.position??this._offset;if(this._reverse=e.reverse??this._reverse,this._scale=e.scale??1,this._offset.x=s.x,this._offset.y=s.y,this._offset.mode=s.mode,this._width=e.width??0,e.url&&!e.path){const t=e.url;(async()=>{const e=await fetch(t),s=await e.text(),h=(new DOMParser).parseFromString(s,"image/svg+xml"),i=h.getElementsByTagName("svg")[0];let a=i.getElementsByTagName("path");a.length||(a=h.getElementsByTagName("path")),this._paths=[];for(let t=0;t<a.length;t++){const e=a.item(t);e&&this._paths.push({element:e,length:e.getTotalLength()})}this._size.height=Number.parseFloat(i.getAttribute("height")??"0"),this._size.width=Number.parseFloat(i.getAttribute("width")??"0")})()}else if(e.path){const t=e.path;this._paths=[];for(const e of t.data){const t=(0,i.safeDocument)().createElementNS("http://www.w3.org/2000/svg","path");t.setAttribute("d",e),this._paths.push({element:t,length:t.getTotalLength()})}this._size.height=t.size.height,this._size.width=t.size.width}}reset(){}update(){}}}}]);
|
package/747.min.js.LICENSE.txt
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/*! tsParticles SVG Path v4.0.0-alpha.1 by Matteo Bruni */
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/*! tsParticles SVG Path v4.0.0-alpha.1 by Matteo Bruni */
|