@tsparticles/plugin-canvas-mask 4.0.0-alpha.26 → 4.0.0-alpha.28
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/565.min.js +1 -0
- package/{124.min.js → 597.min.js} +2 -2
- package/browser/Options/Classes/CanvasMaskPixels.js +1 -1
- package/browser/index.js +1 -1
- package/browser/utils.js +5 -2
- package/cjs/Options/Classes/CanvasMaskPixels.js +1 -1
- package/cjs/index.js +1 -1
- package/cjs/utils.js +5 -2
- package/dist_browser_CanvasMaskPluginInstance_js.js +2 -2
- package/dist_browser_CanvasMaskPlugin_js.js +2 -2
- package/esm/Options/Classes/CanvasMaskPixels.js +1 -1
- package/esm/index.js +1 -1
- package/esm/utils.js +5 -2
- package/package.json +3 -3
- package/report.html +1 -1
- package/tsparticles.plugin.canvas-mask.js +8 -8
- package/tsparticles.plugin.canvas-mask.min.js +1 -1
- package/umd/Options/Classes/CanvasMaskPixels.js +1 -1
- package/umd/index.js +1 -1
- package/umd/utils.js +5 -2
- package/49.min.js +0 -1
package/565.min.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(this.webpackChunk_tsparticles_plugin_canvas_mask=this.webpackChunk_tsparticles_plugin_canvas_mask||[]).push([[565],{565(e,t,a){a.d(t,{CanvasMaskPluginInstance:()=>l});var i=a(425),n=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 n=t.image.src;if(!n)return;a=await (0,i.getImageData)(n,l,e.canvas.settings)}else if(t.text){let s=t.text,r=(0,i.getTextData)(s,l,s.fill,e.canvas.settings);if((0,n.isNull)(r))return;a=r}else if(t.element??t.selector){let s=t.element??(t.selector&&(0,n.safeDocument)().querySelector(t.selector));if(!s)return;let r=s.getContext("2d",e.canvas.settings);if(!r)return;a=(0,i.getCanvasImageData)(r,s,l)}!function(e,t,a,i,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,n.getRandom)()*t),i=e[t],l=e[a];l!==i&&void 0!==l&&void 0!==i&&(e[t]=l,e[a]=i)}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/n.percentDenominator-c*i*n.half,y:p.height*a.y/n.percentDenominator-r*i*n.half};for(;h<f&&u.length;){let a=u.pop()??0,n={x:a%c,y:Math.floor(a/c)},r=t.pixels[n.y];if(!r)continue;let o=r[n.x];if(!o||!s(o))continue;let f={x:n.x*i+g.x,y:n.y*i+g.y},p={};l.color&&(p.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)}}}}]);
|
|
@@ -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([[597],{597(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(565).then(t.bind(t,565));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}}}}]);
|
|
@@ -13,7 +13,7 @@ export class CanvasMaskPixels {
|
|
|
13
13
|
}
|
|
14
14
|
if (data.filter !== undefined) {
|
|
15
15
|
if (isString(data.filter)) {
|
|
16
|
-
if (
|
|
16
|
+
if (data.filter in globalThis) {
|
|
17
17
|
const filter = globalThis[data.filter];
|
|
18
18
|
if (isFunction(filter)) {
|
|
19
19
|
this.filter = filter;
|
package/browser/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export async function loadCanvasMaskPlugin(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-alpha.
|
|
2
|
+
engine.checkVersion("4.0.0-alpha.28");
|
|
3
3
|
await engine.register(async (e) => {
|
|
4
4
|
const { CanvasMaskPlugin } = await import("./CanvasMaskPlugin.js");
|
|
5
5
|
e.addPlugin(new CanvasMaskPlugin());
|
package/browser/utils.js
CHANGED
|
@@ -27,8 +27,11 @@ 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
|
-
|
|
30
|
+
pOptions.fill = {
|
|
31
|
+
color: {
|
|
32
|
+
value: pixel,
|
|
33
|
+
},
|
|
34
|
+
enable: true,
|
|
32
35
|
};
|
|
33
36
|
}
|
|
34
37
|
if (override.opacity) {
|
|
@@ -13,7 +13,7 @@ export class CanvasMaskPixels {
|
|
|
13
13
|
}
|
|
14
14
|
if (data.filter !== undefined) {
|
|
15
15
|
if (isString(data.filter)) {
|
|
16
|
-
if (
|
|
16
|
+
if (data.filter in globalThis) {
|
|
17
17
|
const filter = globalThis[data.filter];
|
|
18
18
|
if (isFunction(filter)) {
|
|
19
19
|
this.filter = filter;
|
package/cjs/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export async function loadCanvasMaskPlugin(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-alpha.
|
|
2
|
+
engine.checkVersion("4.0.0-alpha.28");
|
|
3
3
|
await engine.register(async (e) => {
|
|
4
4
|
const { CanvasMaskPlugin } = await import("./CanvasMaskPlugin.js");
|
|
5
5
|
e.addPlugin(new CanvasMaskPlugin());
|
package/cjs/utils.js
CHANGED
|
@@ -27,8 +27,11 @@ 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
|
-
|
|
30
|
+
pOptions.fill = {
|
|
31
|
+
color: {
|
|
32
|
+
value: pixel,
|
|
33
|
+
},
|
|
34
|
+
enable: true,
|
|
32
35
|
};
|
|
33
36
|
}
|
|
34
37
|
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-alpha.
|
|
7
|
+
* v4.0.0-alpha.28
|
|
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.fill = {\n color: {\n value: pixel\n },\n enable: true\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
|
|
|
@@ -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.28
|
|
8
8
|
*/
|
|
9
9
|
"use strict";
|
|
10
10
|
/*
|
|
@@ -53,7 +53,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
53
53
|
\**********************************************************/
|
|
54
54
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
55
55
|
|
|
56
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CanvasMaskPixels: () => (/* binding */ CanvasMaskPixels)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nconst minAlpha = 0;\nclass CanvasMaskPixels {\n filter;\n offset;\n constructor(){\n this.filter = (pixel)=>pixel.a > minAlpha;\n this.offset = 4;\n }\n load(data) {\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNull)(data)) {\n return;\n }\n if (data.filter !== undefined) {\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isString)(data.filter)) {\n if (
|
|
56
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CanvasMaskPixels: () => (/* binding */ CanvasMaskPixels)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nconst minAlpha = 0;\nclass CanvasMaskPixels {\n filter;\n offset;\n constructor(){\n this.filter = (pixel)=>pixel.a > minAlpha;\n this.offset = 4;\n }\n load(data) {\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNull)(data)) {\n return;\n }\n if (data.filter !== undefined) {\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isString)(data.filter)) {\n if (data.filter in globalThis) {\n const filter = globalThis[data.filter];\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isFunction)(filter)) {\n this.filter = filter;\n }\n }\n } else {\n this.filter = data.filter;\n }\n }\n if (data.offset !== undefined) {\n this.offset = data.offset;\n }\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/plugin-canvas-mask/./dist/browser/Options/Classes/CanvasMaskPixels.js?\n}");
|
|
57
57
|
|
|
58
58
|
/***/ },
|
|
59
59
|
|
|
@@ -13,7 +13,7 @@ export class CanvasMaskPixels {
|
|
|
13
13
|
}
|
|
14
14
|
if (data.filter !== undefined) {
|
|
15
15
|
if (isString(data.filter)) {
|
|
16
|
-
if (
|
|
16
|
+
if (data.filter in globalThis) {
|
|
17
17
|
const filter = globalThis[data.filter];
|
|
18
18
|
if (isFunction(filter)) {
|
|
19
19
|
this.filter = filter;
|
package/esm/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export async function loadCanvasMaskPlugin(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-alpha.
|
|
2
|
+
engine.checkVersion("4.0.0-alpha.28");
|
|
3
3
|
await engine.register(async (e) => {
|
|
4
4
|
const { CanvasMaskPlugin } = await import("./CanvasMaskPlugin.js");
|
|
5
5
|
e.addPlugin(new CanvasMaskPlugin());
|
package/esm/utils.js
CHANGED
|
@@ -27,8 +27,11 @@ 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
|
-
|
|
30
|
+
pOptions.fill = {
|
|
31
|
+
color: {
|
|
32
|
+
value: pixel,
|
|
33
|
+
},
|
|
34
|
+
enable: true,
|
|
32
35
|
};
|
|
33
36
|
}
|
|
34
37
|
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-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.28",
|
|
4
4
|
"description": "tsParticles canvas mask plugin",
|
|
5
5
|
"homepage": "https://particles.js.org",
|
|
6
6
|
"repository": {
|
|
@@ -86,8 +86,8 @@
|
|
|
86
86
|
"./package.json": "./package.json"
|
|
87
87
|
},
|
|
88
88
|
"dependencies": {
|
|
89
|
-
"@tsparticles/canvas-utils": "4.0.0-alpha.
|
|
90
|
-
"@tsparticles/engine": "4.0.0-alpha.
|
|
89
|
+
"@tsparticles/canvas-utils": "4.0.0-alpha.28",
|
|
90
|
+
"@tsparticles/engine": "4.0.0-alpha.28"
|
|
91
91
|
},
|
|
92
92
|
"publishConfig": {
|
|
93
93
|
"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 [15 Mar 2026 at 13:49]</title>
|
|
7
7
|
<link rel="shortcut icon" 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=" type="image/x-icon" />
|
|
8
8
|
|
|
9
9
|
<script>
|
|
@@ -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.28
|
|
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-alpha.
|
|
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-alpha.28\");\n await engine.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.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
|
|
|
@@ -70,12 +70,6 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
70
70
|
/******/ if (cachedModule !== undefined) {
|
|
71
71
|
/******/ return cachedModule.exports;
|
|
72
72
|
/******/ }
|
|
73
|
-
/******/ // Check if module exists (development only)
|
|
74
|
-
/******/ if (__webpack_modules__[moduleId] === undefined) {
|
|
75
|
-
/******/ var e = new Error("Cannot find module '" + moduleId + "'");
|
|
76
|
-
/******/ e.code = 'MODULE_NOT_FOUND';
|
|
77
|
-
/******/ throw e;
|
|
78
|
-
/******/ }
|
|
79
73
|
/******/ // Create a new module (and put it into the cache)
|
|
80
74
|
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
81
75
|
/******/ // no module.id needed
|
|
@@ -84,6 +78,12 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
84
78
|
/******/ };
|
|
85
79
|
/******/
|
|
86
80
|
/******/ // Execute the module function
|
|
81
|
+
/******/ if (!(moduleId in __webpack_modules__)) {
|
|
82
|
+
/******/ delete __webpack_module_cache__[moduleId];
|
|
83
|
+
/******/ var e = new Error("Cannot find module '" + moduleId + "'");
|
|
84
|
+
/******/ e.code = 'MODULE_NOT_FOUND';
|
|
85
|
+
/******/ throw e;
|
|
86
|
+
/******/ }
|
|
87
87
|
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
88
88
|
/******/
|
|
89
89
|
/******/ // Return the exports of the module
|
|
@@ -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,o,a={425(t){t.exports=e},303(e){e.exports=t}},n={};function s(e){var t=n[e];if(void 0!==t)return t.exports;var r=n[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 o,a,n=document.getElementsByTagName("script"),l=0;l<n.length;l++){var p=n[l];if(p.getAttribute("src")==e||p.getAttribute("data-webpack")=="@tsparticles/plugin-canvas-mask:"+r){o=p;break}}o||(a=!0,(o=document.createElement("script")).charset="utf-8",s.nc&&o.setAttribute("nonce",s.nc),o.setAttribute("data-webpack","@tsparticles/plugin-canvas-mask:"+r),o.src=e),c[e]=[t];var u=(t,r)=>{o.onerror=o.onload=null,clearTimeout(d);var i=c[e];if(delete c[e],o.parentNode&&o.parentNode.removeChild(o),i&&i.forEach(e=>e(r)),t)return t(r)},d=setTimeout(u.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=u.bind(null,o.onerror),o.onload=u.bind(null,o.onload),a&&document.head.appendChild(o)},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 o=new Promise((t,o)=>i=r[e]=[t,o]);t.push(i[2]=o);var a=s.p+s.u(e),n=Error();s.l(a,t=>{if(s.o(r,e)&&(0!==(i=r[e])&&(r[e]=void 0),i)){var o=t&&("load"===t.type?"missing":t.type),a=t&&t.target&&t.target.src;n.message="Loading chunk "+e+` failed.
|
|
2
|
-
(`+o+": "+a+")",n.name="ChunkLoadError",n.type=o,n.request=a,i[1](n)}},"chunk-"+e,e)}},i=(e,t)=>{var i,o,[a,n,c]=t,l=0;if(a.some(e=>0!==r[e])){for(i in n)s.o(n,i)&&(s.m[i]=n[i]);c&&c(s)}for(e&&e(t);l<a.length;l++)o=a[l],s.o(r,o)&&r[o]&&r[o][0](),r[o]=0},(o=this.webpackChunk_tsparticles_plugin_canvas_mask=this.webpackChunk_tsparticles_plugin_canvas_mask||[]).forEach(i.bind(null,0)),o.push=i.bind(null,o.push.bind(o));var f={};async function g(e){e.checkVersion("4.0.0-alpha.
|
|
2
|
+
(`+o+": "+a+")",n.name="ChunkLoadError",n.type=o,n.request=a,i[1](n)}},"chunk-"+e,e)}},i=(e,t)=>{var i,o,[a,n,c]=t,l=0;if(a.some(e=>0!==r[e])){for(i in n)s.o(n,i)&&(s.m[i]=n[i]);c&&c(s)}for(e&&e(t);l<a.length;l++)o=a[l],s.o(r,o)&&r[o]&&r[o][0](),r[o]=0},(o=this.webpackChunk_tsparticles_plugin_canvas_mask=this.webpackChunk_tsparticles_plugin_canvas_mask||[]).forEach(i.bind(null,0)),o.push=i.bind(null,o.push.bind(o));var f={};async function g(e){e.checkVersion("4.0.0-alpha.28"),await e.register(async e=>{let{CanvasMaskPlugin:t}=await s.e(597).then(s.bind(s,597));e.addPlugin(new t)})}return s.r(f),s.d(f,{loadCanvasMaskPlugin:()=>g}),f})());
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
}
|
|
26
26
|
if (data.filter !== undefined) {
|
|
27
27
|
if ((0, engine_1.isString)(data.filter)) {
|
|
28
|
-
if (
|
|
28
|
+
if (data.filter in globalThis) {
|
|
29
29
|
const filter = globalThis[data.filter];
|
|
30
30
|
if ((0, engine_1.isFunction)(filter)) {
|
|
31
31
|
this.filter = filter;
|
package/umd/index.js
CHANGED
|
@@ -45,7 +45,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
45
45
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
46
|
exports.loadCanvasMaskPlugin = loadCanvasMaskPlugin;
|
|
47
47
|
async function loadCanvasMaskPlugin(engine) {
|
|
48
|
-
engine.checkVersion("4.0.0-alpha.
|
|
48
|
+
engine.checkVersion("4.0.0-alpha.28");
|
|
49
49
|
await engine.register(async (e) => {
|
|
50
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
51
|
e.addPlugin(new CanvasMaskPlugin());
|
package/umd/utils.js
CHANGED
package/49.min.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(this.webpackChunk_tsparticles_plugin_canvas_mask=this.webpackChunk_tsparticles_plugin_canvas_mask||[]).push([[49],{49(e,t,a){a.d(t,{CanvasMaskPluginInstance:()=>s});var i=a(425),n=a(303);class s{_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},s=t.pixels.offset;if(t.image){let n=t.image.src;if(!n)return;a=await (0,i.getImageData)(n,s,e.canvas.settings)}else if(t.text){let l=t.text,r=(0,i.getTextData)(l,s,l.fill,e.canvas.settings);if((0,n.isNull)(r))return;a=r}else if(t.element??t.selector){let l=t.element??(t.selector&&(0,n.safeDocument)().querySelector(t.selector));if(!l)return;let r=l.getContext("2d",e.canvas.settings);if(!r)return;a=(0,i.getCanvasImageData)(r,l,s)}!function(e,t,a,i,s,l){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,n.getRandom)()*t),i=e[t],s=e[a];s!==i&&void 0!==s&&void 0!==i&&(e[t]=s,e[a]=i)}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/n.percentDenominator-c*i*n.half,y:p.height*a.y/n.percentDenominator-r*i*n.half};for(;h<f&&u.length;){let a=u.pop()??0,n={x:a%c,y:Math.floor(a/c)},r=t.pixels[n.y];if(!r)continue;let o=r[n.x];if(!o||!l(o))continue;let f={x:n.x*i+g.x,y:n.y*i+g.y},p={};s.color&&(p.color={value:o}),s.opacity&&(p.opacity={value:o.a}),e.particles.addParticle(f,p),h++}}(e,a,t.position,t.scale,t.override,t.pixels.filter)}}}}]);
|