@tsparticles/plugin-canvas-mask 4.0.0-beta.1 → 4.0.0-beta.10
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/{556.min.js → 128.min.js} +2 -2
- package/{201.min.js → 845.min.js} +1 -1
- package/README.md +22 -0
- package/browser/index.js +1 -1
- package/browser/utils.js +6 -4
- package/cjs/index.js +1 -1
- package/cjs/utils.js +6 -4
- package/dist_browser_CanvasMaskPluginInstance_js.js +2 -2
- package/dist_browser_CanvasMaskPlugin_js.js +1 -1
- package/esm/index.js +1 -1
- package/esm/utils.js +6 -4
- package/package.json +5 -6
- package/report.html +1 -1
- package/tsparticles.plugin.canvas-mask.js +2 -2
- package/tsparticles.plugin.canvas-mask.min.js +1 -1
- package/umd/CanvasMaskPlugin.js +0 -69
- package/umd/CanvasMaskPluginInstance.js +0 -61
- package/umd/Options/Classes/CanvasMask.js +0 -73
- package/umd/Options/Classes/CanvasMaskOverride.js +0 -34
- package/umd/Options/Classes/CanvasMaskPixels.js +0 -45
- package/umd/Options/Classes/FontTextMask.js +0 -49
- package/umd/Options/Classes/ImageMask.js +0 -29
- package/umd/Options/Classes/TextMask.js +0 -47
- package/umd/Options/Classes/TextMaskLine.js +0 -34
- package/umd/Options/Interfaces/ICanvasMask.js +0 -12
- package/umd/Options/Interfaces/ICanvasMaskOverride.js +0 -12
- package/umd/Options/Interfaces/ICanvasMaskPixels.js +0 -12
- package/umd/Options/Interfaces/IFontTextMask.js +0 -12
- package/umd/Options/Interfaces/IImageMask.js +0 -12
- package/umd/Options/Interfaces/ITextMask.js +0 -12
- package/umd/Options/Interfaces/ITextMaskLine.js +0 -12
- package/umd/index.js +0 -54
- package/umd/types.js +0 -12
- package/umd/utils.js +0 -74
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";(this.webpackChunk_tsparticles_plugin_canvas_mask=this.webpackChunk_tsparticles_plugin_canvas_mask||[]).push([[
|
|
2
|
-
`,this.spacing=10}load(i){(0,e.isNull)(i)||(void 0!==i.separator&&(this.separator=i.separator),void 0!==i.spacing&&(this.spacing=i.spacing))}}class c{color;fill;font;lines;text;constructor(){this.color="#000000",this.fill=!0,this.font=new n,this.lines=new r,this.text=""}load(i){(0,e.isNull)(i)||(void 0!==i.color&&(this.color=i.color),void 0!==i.fill&&(this.fill=i.fill),this.font.load(i.font),this.lines.load(i.lines),void 0!==i.text&&(this.text=i.text))}}class h{element;enable;image;override;pixels;position;scale;selector;text;constructor(){this.enable=!1,this.override=new l,this.pixels=new o,this.position={x:50,y:50},this.scale=1}load(i){!(0,e.isNull)(i)&&(void 0!==i.element&&i.element instanceof HTMLCanvasElement&&(this.element=i.element),void 0!==i.enable&&(this.enable=i.enable),i.image&&(this.image??=new a,this.image.load(i.image)),this.pixels.load(i.pixels),i.position&&(this.position={x:i.position.x??this.position.x,y:i.position.y??this.position.y}),this.override.load(i.override),void 0!==i.scale&&(this.scale=i.scale),void 0!==i.selector&&(this.selector=i.selector),i.text&&(this.text??=new c,this.text.load(i.text)))}}class d{id="canvas-mask";async getPlugin(i){let{CanvasMaskPluginInstance:s}=await t.e(
|
|
1
|
+
"use strict";(this.webpackChunk_tsparticles_plugin_canvas_mask=this.webpackChunk_tsparticles_plugin_canvas_mask||[]).push([[128],{128(i,s,t){t.d(s,{CanvasMaskPlugin:()=>d});var e=t(303);class l{color;opacity;constructor(){this.color=!0,this.opacity=!1}load(i){(0,e.isNull)(i)||(void 0!==i.color&&(this.color=i.color),void 0!==i.opacity&&(this.opacity=i.opacity))}}class o{filter;offset;constructor(){this.filter=i=>i.a>0,this.offset=4}load(i){if(!(0,e.isNull)(i)){if(void 0!==i.filter)if((0,e.isString)(i.filter)){if(i.filter in globalThis){let s=globalThis[i.filter];(0,e.isFunction)(s)&&(this.filter=s)}}else this.filter=i.filter;void 0!==i.offset&&(this.offset=i.offset)}}}class a{src;constructor(){this.src=""}load(i){(0,e.isNull)(i)||void 0!==i.src&&(this.src=i.src)}}class n{family;size;style;variant;weight;constructor(){this.family="sans-serif",this.size=100,this.style="",this.variant="",this.weight=""}load(i){(0,e.isNull)(i)||(void 0!==i.family&&(this.family=i.family),void 0!==i.size&&(this.size=i.size),void 0!==i.style&&(this.style=i.style),void 0!==i.variant&&(this.variant=i.variant),void 0!==i.weight&&(this.weight=i.weight))}}class r{separator;spacing;constructor(){this.separator=`
|
|
2
|
+
`,this.spacing=10}load(i){(0,e.isNull)(i)||(void 0!==i.separator&&(this.separator=i.separator),void 0!==i.spacing&&(this.spacing=i.spacing))}}class c{color;fill;font;lines;text;constructor(){this.color="#000000",this.fill=!0,this.font=new n,this.lines=new r,this.text=""}load(i){(0,e.isNull)(i)||(void 0!==i.color&&(this.color=i.color),void 0!==i.fill&&(this.fill=i.fill),this.font.load(i.font),this.lines.load(i.lines),void 0!==i.text&&(this.text=i.text))}}class h{element;enable;image;override;pixels;position;scale;selector;text;constructor(){this.enable=!1,this.override=new l,this.pixels=new o,this.position={x:50,y:50},this.scale=1}load(i){!(0,e.isNull)(i)&&(void 0!==i.element&&i.element instanceof HTMLCanvasElement&&(this.element=i.element),void 0!==i.enable&&(this.enable=i.enable),i.image&&(this.image??=new a,this.image.load(i.image)),this.pixels.load(i.pixels),i.position&&(this.position={x:i.position.x??this.position.x,y:i.position.y??this.position.y}),this.override.load(i.override),void 0!==i.scale&&(this.scale=i.scale),void 0!==i.selector&&(this.selector=i.selector),i.text&&(this.text??=new c,this.text.load(i.text)))}}class d{id="canvas-mask";async getPlugin(i){let{CanvasMaskPluginInstance:s}=await t.e(845).then(t.bind(t,845));return new s(i)}loadOptions(i,s,t){if(!this.needsPlugin(s)&&!this.needsPlugin(t))return;let e=s.canvasMask;e?.load===void 0&&(s.canvasMask=e=new h),e.load(t?.canvasMask)}needsPlugin(i){return i?.canvasMask?.enable??!1}}}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(this.webpackChunk_tsparticles_plugin_canvas_mask=this.webpackChunk_tsparticles_plugin_canvas_mask||[]).push([[
|
|
1
|
+
"use strict";(this.webpackChunk_tsparticles_plugin_canvas_mask=this.webpackChunk_tsparticles_plugin_canvas_mask||[]).push([[845],{845(e,t,a){a.d(t,{CanvasMaskPluginInstance:()=>l});var n=a(425),i=a(303);class l{_container;constructor(e){this._container=e}async init(){let e=this._container,t=e.actualOptions.canvasMask;if(!t?.enable)return;let a={pixels:[],height:0,width:0},l=t.pixels.offset;if(t.image){let i=t.image.src;if(!i)return;a=await (0,n.getImageData)(i,l,e.canvas.render.settings)}else if(t.text){let s=t.text,r=(0,n.getTextData)(s,l,s.fill,e.canvas.render.settings);if((0,i.isNull)(r))return;a=r}else if(t.element??t.selector){let s=t.element??(t.selector&&(0,i.safeDocument)().querySelector(t.selector));if(!s)return;let r=s.getContext("2d",e.canvas.render.settings);if(!r)return;a=(0,n.getCanvasImageData)(r,s,l)}!function(e,t,a,n,l,s){let{height:r,width:c}=t,o=r*c,u=function(e){for(let t=e.length-1;t>=0;t--){let a=Math.floor((0,i.getRandom)()*t),n=e[t],l=e[a];l!==n&&void 0!==l&&void 0!==n&&(e[t]=l,e[a]=n)}return e}([...Array(o).keys()]),f=Math.min(o,e.actualOptions.particles.number.value),p=e.canvas.size,h=0,g={x:p.width*a.x/i.percentDenominator-c*n*i.half,y:p.height*a.y/i.percentDenominator-r*n*i.half};for(;h<f&&u.length;){let a=u.pop()??0,i={x:a%c,y:Math.floor(a/c)},r=t.pixels[i.y];if(!r)continue;let o=r[i.x];if(!o||!s(o))continue;let f={x:i.x*n+g.x,y:i.y*n+g.y},p={};l.color&&(p.paint={fill:{color:{value:o},enable:!0}}),l.opacity&&(p.opacity={value:o.a}),e.particles.addParticle(f,p),h++}}(e,a,t.position,t.scale,t.override,t.pixels.filter)}}}}]);
|
package/README.md
CHANGED
|
@@ -8,6 +8,12 @@
|
|
|
8
8
|
|
|
9
9
|
[tsParticles](https://github.com/tsparticles/tsparticles) plugin for particles canvas mask effect.
|
|
10
10
|
|
|
11
|
+
## Quick checklist
|
|
12
|
+
|
|
13
|
+
1. Install `@tsparticles/engine` (or use the CDN bundle below)
|
|
14
|
+
2. Call the package loader function(s) before `tsParticles.load(...)`
|
|
15
|
+
3. Apply the package options in your `tsParticles.load(...)` config
|
|
16
|
+
|
|
11
17
|
## How to use it
|
|
12
18
|
|
|
13
19
|
### CDN / Vanilla JS / jQuery
|
|
@@ -72,3 +78,19 @@ import { loadCanvasMaskPlugin } from "@tsparticles/plugin-canvas-mask";
|
|
|
72
78
|
await loadCanvasMaskPlugin(tsParticles);
|
|
73
79
|
})();
|
|
74
80
|
```
|
|
81
|
+
|
|
82
|
+
## Option mapping
|
|
83
|
+
|
|
84
|
+
- This package primarily extends runtime behavior or rendering and may not expose a single dedicated root options key.
|
|
85
|
+
- Use the usage example in this README and combine with the nearest options section in the docs.
|
|
86
|
+
|
|
87
|
+
## Common pitfalls
|
|
88
|
+
|
|
89
|
+
- Calling `tsParticles.load(...)` before `loadCanvasMaskPlugin(...)`
|
|
90
|
+
- Verify required peer packages before enabling advanced options
|
|
91
|
+
- Change one option group at a time to isolate regressions quickly
|
|
92
|
+
|
|
93
|
+
## Related docs
|
|
94
|
+
|
|
95
|
+
- All packages catalog: <https://github.com/tsparticles/tsparticles>
|
|
96
|
+
- Main docs: <https://particles.js.org/docs/>
|
package/browser/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export async function loadCanvasMaskPlugin(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-beta.
|
|
2
|
+
engine.checkVersion("4.0.0-beta.10");
|
|
3
3
|
await engine.pluginManager.register(async (e) => {
|
|
4
4
|
const { CanvasMaskPlugin } = await import("./CanvasMaskPlugin.js");
|
|
5
5
|
e.pluginManager.addPlugin(new CanvasMaskPlugin());
|
package/browser/utils.js
CHANGED
|
@@ -27,11 +27,13 @@ export function addParticlesFromCanvasPixels(container, data, position, scale, o
|
|
|
27
27
|
y: pixelPos.y * scale + positionOffset.y,
|
|
28
28
|
}, pOptions = {};
|
|
29
29
|
if (override.color) {
|
|
30
|
-
pOptions.
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
pOptions.paint = {
|
|
31
|
+
fill: {
|
|
32
|
+
color: {
|
|
33
|
+
value: pixel,
|
|
34
|
+
},
|
|
35
|
+
enable: true,
|
|
33
36
|
},
|
|
34
|
-
enable: true,
|
|
35
37
|
};
|
|
36
38
|
}
|
|
37
39
|
if (override.opacity) {
|
package/cjs/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export async function loadCanvasMaskPlugin(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-beta.
|
|
2
|
+
engine.checkVersion("4.0.0-beta.10");
|
|
3
3
|
await engine.pluginManager.register(async (e) => {
|
|
4
4
|
const { CanvasMaskPlugin } = await import("./CanvasMaskPlugin.js");
|
|
5
5
|
e.pluginManager.addPlugin(new CanvasMaskPlugin());
|
package/cjs/utils.js
CHANGED
|
@@ -27,11 +27,13 @@ export function addParticlesFromCanvasPixels(container, data, position, scale, o
|
|
|
27
27
|
y: pixelPos.y * scale + positionOffset.y,
|
|
28
28
|
}, pOptions = {};
|
|
29
29
|
if (override.color) {
|
|
30
|
-
pOptions.
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
pOptions.paint = {
|
|
31
|
+
fill: {
|
|
32
|
+
color: {
|
|
33
|
+
value: pixel,
|
|
34
|
+
},
|
|
35
|
+
enable: true,
|
|
33
36
|
},
|
|
34
|
-
enable: true,
|
|
35
37
|
};
|
|
36
38
|
}
|
|
37
39
|
if (override.opacity) {
|
|
@@ -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-beta.
|
|
7
|
+
* v4.0.0-beta.10
|
|
8
8
|
*/
|
|
9
9
|
"use strict";
|
|
10
10
|
/*
|
|
@@ -33,7 +33,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
33
33
|
\*******************************/
|
|
34
34
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
35
35
|
|
|
36
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ addParticlesFromCanvasPixels: () => (/* binding */ addParticlesFromCanvasPixels)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nfunction addParticlesFromCanvasPixels(container, data, position, scale, override, filter) {\n const { height, width } = data, numPixels = height * width, indexArray = shuffle(range(numPixels)), maxParticles = Math.min(numPixels, container.actualOptions.particles.number.value), canvasSize = container.canvas.size;\n let selectedPixels = 0;\n const positionOffset = {\n x: canvasSize.width * position.x / _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.percentDenominator - width * scale * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.half,\n y: canvasSize.height * position.y / _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.percentDenominator - height * scale * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.half\n };\n while(selectedPixels < maxParticles && indexArray.length){\n const defaultIndex = 0, nextIndex = indexArray.pop() ?? defaultIndex, pixelPos = {\n x: nextIndex % width,\n y: Math.floor(nextIndex / width)\n }, row = data.pixels[pixelPos.y];\n if (!row) {\n continue;\n }\n const pixel = row[pixelPos.x];\n if (!pixel) {\n continue;\n }\n const shouldCreateParticle = filter(pixel);\n if (!shouldCreateParticle) {\n continue;\n }\n const pos = {\n x: pixelPos.x * scale + positionOffset.x,\n y: pixelPos.y * scale + positionOffset.y\n }, pOptions = {};\n if (override.color) {\n pOptions.
|
|
36
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ addParticlesFromCanvasPixels: () => (/* binding */ addParticlesFromCanvasPixels)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nfunction addParticlesFromCanvasPixels(container, data, position, scale, override, filter) {\n const { height, width } = data, numPixels = height * width, indexArray = shuffle(range(numPixels)), maxParticles = Math.min(numPixels, container.actualOptions.particles.number.value), canvasSize = container.canvas.size;\n let selectedPixels = 0;\n const positionOffset = {\n x: canvasSize.width * position.x / _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.percentDenominator - width * scale * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.half,\n y: canvasSize.height * position.y / _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.percentDenominator - height * scale * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.half\n };\n while(selectedPixels < maxParticles && indexArray.length){\n const defaultIndex = 0, nextIndex = indexArray.pop() ?? defaultIndex, pixelPos = {\n x: nextIndex % width,\n y: Math.floor(nextIndex / width)\n }, row = data.pixels[pixelPos.y];\n if (!row) {\n continue;\n }\n const pixel = row[pixelPos.x];\n if (!pixel) {\n continue;\n }\n const shouldCreateParticle = filter(pixel);\n if (!shouldCreateParticle) {\n continue;\n }\n const pos = {\n x: pixelPos.x * scale + positionOffset.x,\n y: pixelPos.y * scale + positionOffset.y\n }, pOptions = {};\n if (override.color) {\n pOptions.paint = {\n fill: {\n color: {\n value: pixel\n },\n enable: true\n }\n };\n }\n if (override.opacity) {\n pOptions.opacity = {\n value: pixel.a\n };\n }\n container.particles.addParticle(pos, pOptions);\n selectedPixels++;\n }\n}\nfunction shuffle(array) {\n const lengthOffset = 1, minIndex = 0;\n for(let currentIndex = array.length - lengthOffset; currentIndex >= minIndex; currentIndex--){\n const randomIndex = Math.floor((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRandom)() * currentIndex), currentItem = array[currentIndex], randomItem = array[randomIndex];\n if (randomItem === currentItem) {\n continue;\n }\n if (randomItem === undefined || currentItem === undefined) {\n continue;\n }\n array[currentIndex] = randomItem;\n array[randomIndex] = currentItem;\n }\n return array;\n}\nconst range = (n)=>[\n ...Array(n).keys()\n ];\n\n\n//# sourceURL=webpack://@tsparticles/plugin-canvas-mask/./dist/browser/utils.js?\n}");
|
|
37
37
|
|
|
38
38
|
/***/ }
|
|
39
39
|
|
package/esm/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export async function loadCanvasMaskPlugin(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-beta.
|
|
2
|
+
engine.checkVersion("4.0.0-beta.10");
|
|
3
3
|
await engine.pluginManager.register(async (e) => {
|
|
4
4
|
const { CanvasMaskPlugin } = await import("./CanvasMaskPlugin.js");
|
|
5
5
|
e.pluginManager.addPlugin(new CanvasMaskPlugin());
|
package/esm/utils.js
CHANGED
|
@@ -27,11 +27,13 @@ export function addParticlesFromCanvasPixels(container, data, position, scale, o
|
|
|
27
27
|
y: pixelPos.y * scale + positionOffset.y,
|
|
28
28
|
}, pOptions = {};
|
|
29
29
|
if (override.color) {
|
|
30
|
-
pOptions.
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
pOptions.paint = {
|
|
31
|
+
fill: {
|
|
32
|
+
color: {
|
|
33
|
+
value: pixel,
|
|
34
|
+
},
|
|
35
|
+
enable: true,
|
|
33
36
|
},
|
|
34
|
-
enable: true,
|
|
35
37
|
};
|
|
36
38
|
}
|
|
37
39
|
if (override.opacity) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/plugin-canvas-mask",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.10",
|
|
4
4
|
"description": "tsParticles canvas mask plugin",
|
|
5
5
|
"homepage": "https://particles.js.org",
|
|
6
6
|
"repository": {
|
|
@@ -80,14 +80,13 @@
|
|
|
80
80
|
"browser": "./browser/index.js",
|
|
81
81
|
"import": "./esm/index.js",
|
|
82
82
|
"require": "./cjs/index.js",
|
|
83
|
-
"
|
|
84
|
-
"default": "./cjs/index.js"
|
|
83
|
+
"default": "./esm/index.js"
|
|
85
84
|
},
|
|
86
85
|
"./package.json": "./package.json"
|
|
87
86
|
},
|
|
88
|
-
"
|
|
89
|
-
"@tsparticles/canvas-utils": "4.0.0-beta.
|
|
90
|
-
"@tsparticles/engine": "4.0.0-beta.
|
|
87
|
+
"peerDependencies": {
|
|
88
|
+
"@tsparticles/canvas-utils": "4.0.0-beta.10",
|
|
89
|
+
"@tsparticles/engine": "4.0.0-beta.10"
|
|
91
90
|
},
|
|
92
91
|
"publishConfig": {
|
|
93
92
|
"access": "public"
|
package/report.html
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
-
<title>@tsparticles/plugin-canvas-mask [
|
|
6
|
+
<title>@tsparticles/plugin-canvas-mask [8 Apr 2026 at 15:56]</title>
|
|
7
7
|
<link
|
|
8
8
|
rel="shortcut icon"
|
|
9
9
|
href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAABrVBMVEUAAAD///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////+O1foceMD///+J0/qK1Pr7/v8Xdr/9///W8P4UdL7L7P0Scr2r4Pyj3vwad8D5/f/2/f+55f3E6f34+/2H0/ojfMKpzOd0rNgQcb3F3O/j9f7c8v6g3Pz0/P/w+v/q+P7n9v6T1/uQ1vuE0vqLut/y+v+Z2fvt+f+15Pzv9fuc2/vR7v2V2Pvd6/bg9P7I6/285/2y4/yp3/zp8vk8i8kqgMT7/P31+fyv4vxGkcz6/P6/6P3j7vfS5PNnpNUxhcbO7f7F6v3O4vHK3/DA2u631Ouy0eqXweKJud5wqthfoNMMbLvY8f73+v2dxeR8sNtTmdDx9/zX6PSjyeaCtd1YnNGX2PuQveCGt95Nls42h8dLlM3F4vBtAAAAM3RSTlMAAyOx0/sKBvik8opWGBMOAe3l1snDm2E9LSb06eHcu5JpHbarfHZCN9CBb08zzkdNS0kYaptYAAAFV0lEQVRYw92X51/aYBDHHS2O2qqttVbrqNq9m+TJIAYIShBkWwqIiCgoWvfeq7Z2/s29hyQNyUcR7LveGwVyXy6XH8/9rqxglLfUPLxVduUor3h0rfp2TYvpivk37929TkG037hffoX0+peVtZQc1589rigVUdXS/ABSAyEmGIO/1XfvldSK8vs3OqB6u3m0nxmIrvgB0dj7rr7Y9IbuF68hnfFaiHA/sxqm0wciIG43P60qKv9WXWc1RXGh/mFESFABTSBi0sNAKzqet17eCtOb3kZIDwxEEU0oAIJGYxNBDhBND29e0rtXXbcpuPmED9IhEAAQ/AXEaF8EPmnrrKsv0LvWR3fg5sWDNAFZOgAgaKvZDogHNU9MFwnnYROkc56RD5CjAbQX9Ow4g7upCsvYu55aSI/Nj0H1akgKQEUM94dwK65hYRmFU9MIcH/fqJYOZYcnuJSU/waKDgTOEVaVKhwrTRP5XzgSpAITYzom7UvkhFX5VutmxeNnWDjjswTKTyfgluNDGbUpWissXhF3s7mlSml+czWkg3D0l1nNjGNjz3myOQOa1KM/jOS6ebdbAVTCi4gljHSFrviza7tOgRWcS0MOUX9zdNgag5w7rRqA44Lzw0hr1WqES36dFliSJFlh2rXIae3FFcDDgKdxrUIDePr8jGcSClV1u7A9xeN0ModY/pHMxmR1EzRh8TJiwqsHmKW0l4FCEZI+jHio+JdPPE9qwQtTRxku2D8sIeRL2LnxWSllANCQGOIiqVHAz2ye2JR0DcH+HoxDkaADLjgxjKQ+AwCX/g0+DNgdG0ukYCONAe+dbc2IAc6fwt1ARoDSezNHxV2Cmzwv3O6lDMV55edBGwGK9n1+x2F8EDfAGCxug8MhpsMEcTEAWf3rx2vZhe/LAmtIn/6apE6PN0ULKgywD9mmdxbmFl3OvD5AS5fW5zLbv/YHmcsBTjf/afDz3MaZTVCfAP9z6/Bw6ycv8EUBWJIn9zYcoAWWlW9+OzO3vkTy8H+RANLmdrpOuYWdZYEXpo+TlCJrW5EARb7fF+bWdqf3hhyZI1nWJQHgznErZhbjoEsWqi8dQNoE294aldzFurwSABL2XXMf9+H1VQGke9exw5P/AnA5Pv5ngMul7LOvO922iwACu8WkCwLCafvM4CeWPxfA8lNHcWZSoi8EwMAIciKX2Z4SWCMAa3snCZ/G4EA8D6CMLNFsGQhkkz/gQNEBbPCbWsxGUpYVu3z8IyNAknwJkfPMEhLyrdi5RTyUVACkw4GSFRNWJNEW+fgPGwHD8/JxnRuLabN4CGNRkAE23na2+VmEAUmrYymSGjMAYqH84YUIyzgzs3XC7gNgH36Vcc4zKY9o9fgPBXUAiHHwVboBHGLiX6Zcjp1f2wu4tvzZKo0ecPnDtQYDQvJXaBeNzce45Fp28ZQLrEZVuFqgBwOalArKXnW1UzlnSusQKJqKYNuz4tOnI6sZG4zanpemv+7ySU2jbA9h6uhcgpfy6G2PahirDZ6zvq6zDduMVFTKvzw8wgyEdelwY9in3XkEPs3osJuwRQ4qTkfzifndg9Gfc4pdsu82+tTnHZTBa2EAMrqr2t43pguc8tNm7JQVQ2S0ukj2d22dhXYP0/veWtwKrCkNoNimAN5+Xr/oLrxswKbVJjteWrX7eR63o4j9q0GxnaBdWgGA5VStpanIjQmEhV0/nVt5VOFUvix6awJhPcAaTEShgrG+iGyvb5a0Ndb1YGHFPEwoqAinoaykaID1o1pdPNu7XsnCKQ3R+hwWIIhGvORcJUBYXe3Xa3vq/mF/N9V13ugufMkfXn+KHsRD0B8AAAAASUVORK5CYII="
|
|
@@ -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-beta.
|
|
7
|
+
* v4.0.0-beta.10
|
|
8
8
|
*/
|
|
9
9
|
/*
|
|
10
10
|
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
|
@@ -54,7 +54,7 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
|
|
|
54
54
|
\*******************************/
|
|
55
55
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
56
56
|
|
|
57
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ loadCanvasMaskPlugin: () => (/* binding */ loadCanvasMaskPlugin)\n/* harmony export */ });\nasync function loadCanvasMaskPlugin(engine) {\n engine.checkVersion(\"4.0.0-beta.
|
|
57
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ loadCanvasMaskPlugin: () => (/* binding */ loadCanvasMaskPlugin)\n/* harmony export */ });\nasync function loadCanvasMaskPlugin(engine) {\n engine.checkVersion(\"4.0.0-beta.10\");\n await engine.pluginManager.register(async (e)=>{\n const { CanvasMaskPlugin } = await __webpack_require__.e(/*! import() */ \"dist_browser_CanvasMaskPlugin_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./CanvasMaskPlugin.js */ \"./dist/browser/CanvasMaskPlugin.js\"));\n e.pluginManager.addPlugin(new CanvasMaskPlugin());\n });\n}\n\n\n//# sourceURL=webpack://@tsparticles/plugin-canvas-mask/./dist/browser/index.js?\n}");
|
|
58
58
|
|
|
59
59
|
/***/ }
|
|
60
60
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/canvas-utils"),require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/canvas-utils","@tsparticles/engine"],t);else{var r="object"==typeof exports?t(require("@tsparticles/canvas-utils"),require("@tsparticles/engine")):t(e.window,e.window);for(var i in r)("object"==typeof exports?exports:e)[i]=r[i]}}(this,(e,t)=>(()=>{"use strict";var r,i,n,a={425(t){t.exports=e},303(e){e.exports=t}},o={};function s(e){var t=o[e];if(void 0!==t)return t.exports;var r=o[e]={exports:{}};return a[e](r,r.exports,s),r.exports}s.m=a,s.d=(e,t)=>{for(var r in t)s.o(t,r)&&!s.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},s.f={},s.e=e=>Promise.all(Object.keys(s.f).reduce((t,r)=>(s.f[r](e,t),t),[])),s.u=e=>""+e+".min.js",s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),c={},s.l=(e,t,r,i)=>{if(c[e])return void c[e].push(t);if(void 0!==r)for(var n,a,o=document.getElementsByTagName("script"),l=0;l<o.length;l++){var p=o[l];if(p.getAttribute("src")==e||p.getAttribute("data-webpack")=="@tsparticles/plugin-canvas-mask:"+r){n=p;break}}n||(a=!0,(n=document.createElement("script")).charset="utf-8",s.nc&&n.setAttribute("nonce",s.nc),n.setAttribute("data-webpack","@tsparticles/plugin-canvas-mask:"+r),n.src=e),c[e]=[t];var u=(t,r)=>{n.onerror=n.onload=null,clearTimeout(d);var i=c[e];if(delete c[e],n.parentNode&&n.parentNode.removeChild(n),i&&i.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)},s.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.g.importScripts&&(l=s.g.location+"");var c,l,p=s.g.document;if(!l&&p&&(p.currentScript&&"SCRIPT"===p.currentScript.tagName.toUpperCase()&&(l=p.currentScript.src),!l)){var u=p.getElementsByTagName("script");if(u.length)for(var d=u.length-1;d>-1&&(!l||!/^http(s?):/.test(l));)l=u[d--].src}if(!l)throw Error("Automatic publicPath is not supported in this browser");s.p=l=l.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),r={837:0},s.f.j=(e,t)=>{var i=s.o(r,e)?r[e]:void 0;if(0!==i)if(i)t.push(i[2]);else{var n=new Promise((t,n)=>i=r[e]=[t,n]);t.push(i[2]=n);var a=s.p+s.u(e),o=Error();s.l(a,t=>{if(s.o(r,e)&&(0!==(i=r[e])&&(r[e]=void 0),i)){var n=t&&("load"===t.type?"missing":t.type),a=t&&t.target&&t.target.src;o.message="Loading chunk "+e+` failed.
|
|
2
|
-
(`+n+": "+a+")",o.name="ChunkLoadError",o.type=n,o.request=a,i[1](o)}},"chunk-"+e,e)}},i=(e,t)=>{var i,n,[a,o,c]=t,l=0;if(a.some(e=>0!==r[e])){for(i in o)s.o(o,i)&&(s.m[i]=o[i]);c&&c(s)}for(e&&e(t);l<a.length;l++)n=a[l],s.o(r,n)&&r[n]&&r[n][0](),r[n]=0},(n=this.webpackChunk_tsparticles_plugin_canvas_mask=this.webpackChunk_tsparticles_plugin_canvas_mask||[]).forEach(i.bind(null,0)),n.push=i.bind(null,n.push.bind(n));var f={};async function g(e){e.checkVersion("4.0.0-beta.
|
|
2
|
+
(`+n+": "+a+")",o.name="ChunkLoadError",o.type=n,o.request=a,i[1](o)}},"chunk-"+e,e)}},i=(e,t)=>{var i,n,[a,o,c]=t,l=0;if(a.some(e=>0!==r[e])){for(i in o)s.o(o,i)&&(s.m[i]=o[i]);c&&c(s)}for(e&&e(t);l<a.length;l++)n=a[l],s.o(r,n)&&r[n]&&r[n][0](),r[n]=0},(n=this.webpackChunk_tsparticles_plugin_canvas_mask=this.webpackChunk_tsparticles_plugin_canvas_mask||[]).forEach(i.bind(null,0)),n.push=i.bind(null,n.push.bind(n));var f={};async function g(e){e.checkVersion("4.0.0-beta.10"),await e.pluginManager.register(async e=>{let{CanvasMaskPlugin:t}=await s.e(128).then(s.bind(s,128));e.pluginManager.addPlugin(new t)})}return s.r(f),s.d(f,{loadCanvasMaskPlugin:()=>g}),f})());
|
package/umd/CanvasMaskPlugin.js
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
2
|
-
if (k2 === undefined) k2 = k;
|
|
3
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
4
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
5
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
6
|
-
}
|
|
7
|
-
Object.defineProperty(o, k2, desc);
|
|
8
|
-
}) : (function(o, m, k, k2) {
|
|
9
|
-
if (k2 === undefined) k2 = k;
|
|
10
|
-
o[k2] = m[k];
|
|
11
|
-
}));
|
|
12
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
13
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
14
|
-
}) : function(o, v) {
|
|
15
|
-
o["default"] = v;
|
|
16
|
-
});
|
|
17
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
18
|
-
var ownKeys = function(o) {
|
|
19
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
20
|
-
var ar = [];
|
|
21
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
22
|
-
return ar;
|
|
23
|
-
};
|
|
24
|
-
return ownKeys(o);
|
|
25
|
-
};
|
|
26
|
-
return function (mod) {
|
|
27
|
-
if (mod && mod.__esModule) return mod;
|
|
28
|
-
var result = {};
|
|
29
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
30
|
-
__setModuleDefault(result, mod);
|
|
31
|
-
return result;
|
|
32
|
-
};
|
|
33
|
-
})();
|
|
34
|
-
(function (factory) {
|
|
35
|
-
if (typeof module === "object" && typeof module.exports === "object") {
|
|
36
|
-
var v = factory(require, exports);
|
|
37
|
-
if (v !== undefined) module.exports = v;
|
|
38
|
-
}
|
|
39
|
-
else if (typeof define === "function" && define.amd) {
|
|
40
|
-
define(["require", "exports", "./Options/Classes/CanvasMask.js"], factory);
|
|
41
|
-
}
|
|
42
|
-
})(function (require, exports) {
|
|
43
|
-
"use strict";
|
|
44
|
-
var __syncRequire = typeof module === "object" && typeof module.exports === "object";
|
|
45
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
-
exports.CanvasMaskPlugin = void 0;
|
|
47
|
-
const CanvasMask_js_1 = require("./Options/Classes/CanvasMask.js");
|
|
48
|
-
class CanvasMaskPlugin {
|
|
49
|
-
id = "canvas-mask";
|
|
50
|
-
async getPlugin(container) {
|
|
51
|
-
const { CanvasMaskPluginInstance } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./CanvasMaskPluginInstance.js"))) : new Promise((resolve_1, reject_1) => { require(["./CanvasMaskPluginInstance.js"], resolve_1, reject_1); }).then(__importStar));
|
|
52
|
-
return new CanvasMaskPluginInstance(container);
|
|
53
|
-
}
|
|
54
|
-
loadOptions(_container, options, source) {
|
|
55
|
-
if (!this.needsPlugin(options) && !this.needsPlugin(source)) {
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
let canvasMaskOptions = options.canvasMask;
|
|
59
|
-
if (canvasMaskOptions?.load === undefined) {
|
|
60
|
-
options.canvasMask = canvasMaskOptions = new CanvasMask_js_1.CanvasMask();
|
|
61
|
-
}
|
|
62
|
-
canvasMaskOptions.load(source?.canvasMask);
|
|
63
|
-
}
|
|
64
|
-
needsPlugin(options) {
|
|
65
|
-
return options?.canvasMask?.enable ?? false;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
exports.CanvasMaskPlugin = CanvasMaskPlugin;
|
|
69
|
-
});
|
|
@@ -1,61 +0,0 @@
|
|
|
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/canvas-utils", "@tsparticles/engine", "./utils.js"], factory);
|
|
8
|
-
}
|
|
9
|
-
})(function (require, exports) {
|
|
10
|
-
"use strict";
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.CanvasMaskPluginInstance = void 0;
|
|
13
|
-
const canvas_utils_1 = require("@tsparticles/canvas-utils");
|
|
14
|
-
const engine_1 = require("@tsparticles/engine");
|
|
15
|
-
const utils_js_1 = require("./utils.js");
|
|
16
|
-
class CanvasMaskPluginInstance {
|
|
17
|
-
_container;
|
|
18
|
-
constructor(container) {
|
|
19
|
-
this._container = container;
|
|
20
|
-
}
|
|
21
|
-
async init() {
|
|
22
|
-
const container = this._container, options = container.actualOptions.canvasMask;
|
|
23
|
-
if (!options?.enable) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
let pixelData = {
|
|
27
|
-
pixels: [],
|
|
28
|
-
height: 0,
|
|
29
|
-
width: 0,
|
|
30
|
-
};
|
|
31
|
-
const offset = options.pixels.offset;
|
|
32
|
-
if (options.image) {
|
|
33
|
-
const url = options.image.src;
|
|
34
|
-
if (!url) {
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
pixelData = await (0, canvas_utils_1.getImageData)(url, offset, container.canvas.render.settings);
|
|
38
|
-
}
|
|
39
|
-
else if (options.text) {
|
|
40
|
-
const textOptions = options.text, data = (0, canvas_utils_1.getTextData)(textOptions, offset, textOptions.fill, container.canvas.render.settings);
|
|
41
|
-
if ((0, engine_1.isNull)(data)) {
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
pixelData = data;
|
|
45
|
-
}
|
|
46
|
-
else if (options.element ?? options.selector) {
|
|
47
|
-
const canvas = options.element ?? (options.selector && (0, engine_1.safeDocument)().querySelector(options.selector));
|
|
48
|
-
if (!canvas) {
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
const context = canvas.getContext("2d", container.canvas.render.settings);
|
|
52
|
-
if (!context) {
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
pixelData = (0, canvas_utils_1.getCanvasImageData)(context, canvas, offset);
|
|
56
|
-
}
|
|
57
|
-
(0, utils_js_1.addParticlesFromCanvasPixels)(container, pixelData, options.position, options.scale, options.override, options.pixels.filter);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
exports.CanvasMaskPluginInstance = CanvasMaskPluginInstance;
|
|
61
|
-
});
|
|
@@ -1,73 +0,0 @@
|
|
|
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", "./CanvasMaskOverride.js", "./CanvasMaskPixels.js", "./ImageMask.js", "./TextMask.js"], factory);
|
|
8
|
-
}
|
|
9
|
-
})(function (require, exports) {
|
|
10
|
-
"use strict";
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.CanvasMask = void 0;
|
|
13
|
-
const engine_1 = require("@tsparticles/engine");
|
|
14
|
-
const CanvasMaskOverride_js_1 = require("./CanvasMaskOverride.js");
|
|
15
|
-
const CanvasMaskPixels_js_1 = require("./CanvasMaskPixels.js");
|
|
16
|
-
const ImageMask_js_1 = require("./ImageMask.js");
|
|
17
|
-
const TextMask_js_1 = require("./TextMask.js");
|
|
18
|
-
class CanvasMask {
|
|
19
|
-
element;
|
|
20
|
-
enable;
|
|
21
|
-
image;
|
|
22
|
-
override;
|
|
23
|
-
pixels;
|
|
24
|
-
position;
|
|
25
|
-
scale;
|
|
26
|
-
selector;
|
|
27
|
-
text;
|
|
28
|
-
constructor() {
|
|
29
|
-
this.enable = false;
|
|
30
|
-
this.override = new CanvasMaskOverride_js_1.CanvasMaskOverride();
|
|
31
|
-
this.pixels = new CanvasMaskPixels_js_1.CanvasMaskPixels();
|
|
32
|
-
this.position = {
|
|
33
|
-
x: 50,
|
|
34
|
-
y: 50,
|
|
35
|
-
};
|
|
36
|
-
this.scale = 1;
|
|
37
|
-
}
|
|
38
|
-
load(data) {
|
|
39
|
-
if ((0, engine_1.isNull)(data)) {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
if (data.element !== undefined && data.element instanceof HTMLCanvasElement) {
|
|
43
|
-
this.element = data.element;
|
|
44
|
-
}
|
|
45
|
-
if (data.enable !== undefined) {
|
|
46
|
-
this.enable = data.enable;
|
|
47
|
-
}
|
|
48
|
-
if (data.image) {
|
|
49
|
-
this.image ??= new ImageMask_js_1.ImageMask();
|
|
50
|
-
this.image.load(data.image);
|
|
51
|
-
}
|
|
52
|
-
this.pixels.load(data.pixels);
|
|
53
|
-
if (data.position) {
|
|
54
|
-
this.position = {
|
|
55
|
-
x: data.position.x ?? this.position.x,
|
|
56
|
-
y: data.position.y ?? this.position.y,
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
this.override.load(data.override);
|
|
60
|
-
if (data.scale !== undefined) {
|
|
61
|
-
this.scale = data.scale;
|
|
62
|
-
}
|
|
63
|
-
if (data.selector !== undefined) {
|
|
64
|
-
this.selector = data.selector;
|
|
65
|
-
}
|
|
66
|
-
if (data.text) {
|
|
67
|
-
this.text ??= new TextMask_js_1.TextMask();
|
|
68
|
-
this.text.load(data.text);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
exports.CanvasMask = CanvasMask;
|
|
73
|
-
});
|
|
@@ -1,34 +0,0 @@
|
|
|
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.CanvasMaskOverride = void 0;
|
|
13
|
-
const engine_1 = require("@tsparticles/engine");
|
|
14
|
-
class CanvasMaskOverride {
|
|
15
|
-
color;
|
|
16
|
-
opacity;
|
|
17
|
-
constructor() {
|
|
18
|
-
this.color = true;
|
|
19
|
-
this.opacity = false;
|
|
20
|
-
}
|
|
21
|
-
load(data) {
|
|
22
|
-
if ((0, engine_1.isNull)(data)) {
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
if (data.color !== undefined) {
|
|
26
|
-
this.color = data.color;
|
|
27
|
-
}
|
|
28
|
-
if (data.opacity !== undefined) {
|
|
29
|
-
this.opacity = data.opacity;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
exports.CanvasMaskOverride = CanvasMaskOverride;
|
|
34
|
-
});
|
|
@@ -1,45 +0,0 @@
|
|
|
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.CanvasMaskPixels = void 0;
|
|
13
|
-
const engine_1 = require("@tsparticles/engine");
|
|
14
|
-
const minAlpha = 0;
|
|
15
|
-
class CanvasMaskPixels {
|
|
16
|
-
filter;
|
|
17
|
-
offset;
|
|
18
|
-
constructor() {
|
|
19
|
-
this.filter = (pixel) => pixel.a > minAlpha;
|
|
20
|
-
this.offset = 4;
|
|
21
|
-
}
|
|
22
|
-
load(data) {
|
|
23
|
-
if ((0, engine_1.isNull)(data)) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
if (data.filter !== undefined) {
|
|
27
|
-
if ((0, engine_1.isString)(data.filter)) {
|
|
28
|
-
if (data.filter in globalThis) {
|
|
29
|
-
const filter = globalThis[data.filter];
|
|
30
|
-
if ((0, engine_1.isFunction)(filter)) {
|
|
31
|
-
this.filter = filter;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
this.filter = data.filter;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
if (data.offset !== undefined) {
|
|
40
|
-
this.offset = data.offset;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
exports.CanvasMaskPixels = CanvasMaskPixels;
|
|
45
|
-
});
|
|
@@ -1,49 +0,0 @@
|
|
|
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.FontTextMask = void 0;
|
|
13
|
-
const engine_1 = require("@tsparticles/engine");
|
|
14
|
-
class FontTextMask {
|
|
15
|
-
family;
|
|
16
|
-
size;
|
|
17
|
-
style;
|
|
18
|
-
variant;
|
|
19
|
-
weight;
|
|
20
|
-
constructor() {
|
|
21
|
-
this.family = "sans-serif";
|
|
22
|
-
this.size = 100;
|
|
23
|
-
this.style = "";
|
|
24
|
-
this.variant = "";
|
|
25
|
-
this.weight = "";
|
|
26
|
-
}
|
|
27
|
-
load(data) {
|
|
28
|
-
if ((0, engine_1.isNull)(data)) {
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
if (data.family !== undefined) {
|
|
32
|
-
this.family = data.family;
|
|
33
|
-
}
|
|
34
|
-
if (data.size !== undefined) {
|
|
35
|
-
this.size = data.size;
|
|
36
|
-
}
|
|
37
|
-
if (data.style !== undefined) {
|
|
38
|
-
this.style = data.style;
|
|
39
|
-
}
|
|
40
|
-
if (data.variant !== undefined) {
|
|
41
|
-
this.variant = data.variant;
|
|
42
|
-
}
|
|
43
|
-
if (data.weight !== undefined) {
|
|
44
|
-
this.weight = data.weight;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
exports.FontTextMask = FontTextMask;
|
|
49
|
-
});
|
|
@@ -1,29 +0,0 @@
|
|
|
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.ImageMask = void 0;
|
|
13
|
-
const engine_1 = require("@tsparticles/engine");
|
|
14
|
-
class ImageMask {
|
|
15
|
-
src;
|
|
16
|
-
constructor() {
|
|
17
|
-
this.src = "";
|
|
18
|
-
}
|
|
19
|
-
load(data) {
|
|
20
|
-
if ((0, engine_1.isNull)(data)) {
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
if (data.src !== undefined) {
|
|
24
|
-
this.src = data.src;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
exports.ImageMask = ImageMask;
|
|
29
|
-
});
|
|
@@ -1,47 +0,0 @@
|
|
|
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", "./FontTextMask.js", "./TextMaskLine.js"], factory);
|
|
8
|
-
}
|
|
9
|
-
})(function (require, exports) {
|
|
10
|
-
"use strict";
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.TextMask = void 0;
|
|
13
|
-
const engine_1 = require("@tsparticles/engine");
|
|
14
|
-
const FontTextMask_js_1 = require("./FontTextMask.js");
|
|
15
|
-
const TextMaskLine_js_1 = require("./TextMaskLine.js");
|
|
16
|
-
class TextMask {
|
|
17
|
-
color;
|
|
18
|
-
fill;
|
|
19
|
-
font;
|
|
20
|
-
lines;
|
|
21
|
-
text;
|
|
22
|
-
constructor() {
|
|
23
|
-
this.color = "#000000";
|
|
24
|
-
this.fill = true;
|
|
25
|
-
this.font = new FontTextMask_js_1.FontTextMask();
|
|
26
|
-
this.lines = new TextMaskLine_js_1.TextMaskLine();
|
|
27
|
-
this.text = "";
|
|
28
|
-
}
|
|
29
|
-
load(data) {
|
|
30
|
-
if ((0, engine_1.isNull)(data)) {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
if (data.color !== undefined) {
|
|
34
|
-
this.color = data.color;
|
|
35
|
-
}
|
|
36
|
-
if (data.fill !== undefined) {
|
|
37
|
-
this.fill = data.fill;
|
|
38
|
-
}
|
|
39
|
-
this.font.load(data.font);
|
|
40
|
-
this.lines.load(data.lines);
|
|
41
|
-
if (data.text !== undefined) {
|
|
42
|
-
this.text = data.text;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
exports.TextMask = TextMask;
|
|
47
|
-
});
|
|
@@ -1,34 +0,0 @@
|
|
|
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.TextMaskLine = void 0;
|
|
13
|
-
const engine_1 = require("@tsparticles/engine");
|
|
14
|
-
class TextMaskLine {
|
|
15
|
-
separator;
|
|
16
|
-
spacing;
|
|
17
|
-
constructor() {
|
|
18
|
-
this.separator = "\n";
|
|
19
|
-
this.spacing = 10;
|
|
20
|
-
}
|
|
21
|
-
load(data) {
|
|
22
|
-
if ((0, engine_1.isNull)(data)) {
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
if (data.separator !== undefined) {
|
|
26
|
-
this.separator = data.separator;
|
|
27
|
-
}
|
|
28
|
-
if (data.spacing !== undefined) {
|
|
29
|
-
this.spacing = data.spacing;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
exports.TextMaskLine = TextMaskLine;
|
|
34
|
-
});
|
|
@@ -1,12 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1,12 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1,12 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1,12 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1,12 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1,12 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1,12 +0,0 @@
|
|
|
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/umd/index.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
2
|
-
if (k2 === undefined) k2 = k;
|
|
3
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
4
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
5
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
6
|
-
}
|
|
7
|
-
Object.defineProperty(o, k2, desc);
|
|
8
|
-
}) : (function(o, m, k, k2) {
|
|
9
|
-
if (k2 === undefined) k2 = k;
|
|
10
|
-
o[k2] = m[k];
|
|
11
|
-
}));
|
|
12
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
13
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
14
|
-
}) : function(o, v) {
|
|
15
|
-
o["default"] = v;
|
|
16
|
-
});
|
|
17
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
18
|
-
var ownKeys = function(o) {
|
|
19
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
20
|
-
var ar = [];
|
|
21
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
22
|
-
return ar;
|
|
23
|
-
};
|
|
24
|
-
return ownKeys(o);
|
|
25
|
-
};
|
|
26
|
-
return function (mod) {
|
|
27
|
-
if (mod && mod.__esModule) return mod;
|
|
28
|
-
var result = {};
|
|
29
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
30
|
-
__setModuleDefault(result, mod);
|
|
31
|
-
return result;
|
|
32
|
-
};
|
|
33
|
-
})();
|
|
34
|
-
(function (factory) {
|
|
35
|
-
if (typeof module === "object" && typeof module.exports === "object") {
|
|
36
|
-
var v = factory(require, exports);
|
|
37
|
-
if (v !== undefined) module.exports = v;
|
|
38
|
-
}
|
|
39
|
-
else if (typeof define === "function" && define.amd) {
|
|
40
|
-
define(["require", "exports"], factory);
|
|
41
|
-
}
|
|
42
|
-
})(function (require, exports) {
|
|
43
|
-
"use strict";
|
|
44
|
-
var __syncRequire = typeof module === "object" && typeof module.exports === "object";
|
|
45
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
-
exports.loadCanvasMaskPlugin = loadCanvasMaskPlugin;
|
|
47
|
-
async function loadCanvasMaskPlugin(engine) {
|
|
48
|
-
engine.checkVersion("4.0.0-beta.1");
|
|
49
|
-
await engine.pluginManager.register(async (e) => {
|
|
50
|
-
const { CanvasMaskPlugin } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./CanvasMaskPlugin.js"))) : new Promise((resolve_1, reject_1) => { require(["./CanvasMaskPlugin.js"], resolve_1, reject_1); }).then(__importStar));
|
|
51
|
-
e.pluginManager.addPlugin(new CanvasMaskPlugin());
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
});
|
package/umd/types.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
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/umd/utils.js
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
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.addParticlesFromCanvasPixels = addParticlesFromCanvasPixels;
|
|
13
|
-
const engine_1 = require("@tsparticles/engine");
|
|
14
|
-
function addParticlesFromCanvasPixels(container, data, position, scale, override, filter) {
|
|
15
|
-
const { height, width } = data, numPixels = height * width, indexArray = shuffle(range(numPixels)), maxParticles = Math.min(numPixels, container.actualOptions.particles.number.value), canvasSize = container.canvas.size;
|
|
16
|
-
let selectedPixels = 0;
|
|
17
|
-
const positionOffset = {
|
|
18
|
-
x: (canvasSize.width * position.x) / engine_1.percentDenominator - width * scale * engine_1.half,
|
|
19
|
-
y: (canvasSize.height * position.y) / engine_1.percentDenominator - height * scale * engine_1.half,
|
|
20
|
-
};
|
|
21
|
-
while (selectedPixels < maxParticles && indexArray.length) {
|
|
22
|
-
const defaultIndex = 0, nextIndex = indexArray.pop() ?? defaultIndex, pixelPos = {
|
|
23
|
-
x: nextIndex % width,
|
|
24
|
-
y: Math.floor(nextIndex / width),
|
|
25
|
-
}, row = data.pixels[pixelPos.y];
|
|
26
|
-
if (!row) {
|
|
27
|
-
continue;
|
|
28
|
-
}
|
|
29
|
-
const pixel = row[pixelPos.x];
|
|
30
|
-
if (!pixel) {
|
|
31
|
-
continue;
|
|
32
|
-
}
|
|
33
|
-
const shouldCreateParticle = filter(pixel);
|
|
34
|
-
if (!shouldCreateParticle) {
|
|
35
|
-
continue;
|
|
36
|
-
}
|
|
37
|
-
const pos = {
|
|
38
|
-
x: pixelPos.x * scale + positionOffset.x,
|
|
39
|
-
y: pixelPos.y * scale + positionOffset.y,
|
|
40
|
-
}, pOptions = {};
|
|
41
|
-
if (override.color) {
|
|
42
|
-
pOptions.fill = {
|
|
43
|
-
color: {
|
|
44
|
-
value: pixel,
|
|
45
|
-
},
|
|
46
|
-
enable: true,
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
if (override.opacity) {
|
|
50
|
-
pOptions.opacity = {
|
|
51
|
-
value: pixel.a,
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
container.particles.addParticle(pos, pOptions);
|
|
55
|
-
selectedPixels++;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
function shuffle(array) {
|
|
59
|
-
const lengthOffset = 1, minIndex = 0;
|
|
60
|
-
for (let currentIndex = array.length - lengthOffset; currentIndex >= minIndex; currentIndex--) {
|
|
61
|
-
const randomIndex = Math.floor((0, engine_1.getRandom)() * currentIndex), currentItem = array[currentIndex], randomItem = array[randomIndex];
|
|
62
|
-
if (randomItem === currentItem) {
|
|
63
|
-
continue;
|
|
64
|
-
}
|
|
65
|
-
if (randomItem === undefined || currentItem === undefined) {
|
|
66
|
-
continue;
|
|
67
|
-
}
|
|
68
|
-
array[currentIndex] = randomItem;
|
|
69
|
-
array[randomIndex] = currentItem;
|
|
70
|
-
}
|
|
71
|
-
return array;
|
|
72
|
-
}
|
|
73
|
-
const range = (n) => [...Array(n).keys()];
|
|
74
|
-
});
|