@tsparticles/plugin-canvas-mask 3.9.0 → 3.9.1
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/browser/index.js +1 -1
- package/cjs/index.js +1 -1
- package/esm/index.js +1 -1
- package/package.json +2 -2
- package/report.html +1 -1
- package/tsparticles.plugin.canvas-mask.js +2 -2
- package/tsparticles.plugin.canvas-mask.min.js +1 -1
- package/tsparticles.plugin.canvas-mask.min.js.LICENSE.txt +1 -1
- package/umd/index.js +1 -1
package/browser/index.js
CHANGED
package/cjs/index.js
CHANGED
|
@@ -3,6 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.loadCanvasMaskPlugin = loadCanvasMaskPlugin;
|
|
4
4
|
const CanvasMaskPlugin_js_1 = require("./CanvasMaskPlugin.js");
|
|
5
5
|
async function loadCanvasMaskPlugin(engine, refresh = true) {
|
|
6
|
-
engine.checkVersion("3.9.
|
|
6
|
+
engine.checkVersion("3.9.1");
|
|
7
7
|
await engine.addPlugin(new CanvasMaskPlugin_js_1.CanvasMaskPlugin(), refresh);
|
|
8
8
|
}
|
package/esm/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/plugin-canvas-mask",
|
|
3
|
-
"version": "3.9.
|
|
3
|
+
"version": "3.9.1",
|
|
4
4
|
"description": "tsParticles canvas mask plugin",
|
|
5
5
|
"homepage": "https://particles.js.org",
|
|
6
6
|
"repository": {
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"./package.json": "./package.json"
|
|
87
87
|
},
|
|
88
88
|
"dependencies": {
|
|
89
|
-
"@tsparticles/engine": "3.9.
|
|
89
|
+
"@tsparticles/engine": "3.9.1"
|
|
90
90
|
},
|
|
91
91
|
"publishConfig": {
|
|
92
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 [3 Aug 2025 at 23:33]</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
|
-
* v3.9.
|
|
7
|
+
* v3.9.1
|
|
8
8
|
*/
|
|
9
9
|
/*
|
|
10
10
|
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
|
@@ -124,7 +124,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
124
124
|
\*******************************/
|
|
125
125
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
126
126
|
|
|
127
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ loadCanvasMaskPlugin: () => (/* binding */ loadCanvasMaskPlugin)\n/* harmony export */ });\n/* harmony import */ var _CanvasMaskPlugin_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./CanvasMaskPlugin.js */ \"./dist/browser/CanvasMaskPlugin.js\");\n\nasync function loadCanvasMaskPlugin(engine, refresh = true) {\n engine.checkVersion(\"3.9.
|
|
127
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ loadCanvasMaskPlugin: () => (/* binding */ loadCanvasMaskPlugin)\n/* harmony export */ });\n/* harmony import */ var _CanvasMaskPlugin_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./CanvasMaskPlugin.js */ \"./dist/browser/CanvasMaskPlugin.js\");\n\nasync function loadCanvasMaskPlugin(engine, refresh = true) {\n engine.checkVersion(\"3.9.1\");\n await engine.addPlugin(new _CanvasMaskPlugin_js__WEBPACK_IMPORTED_MODULE_0__.CanvasMaskPlugin(), refresh);\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-canvas-mask/./dist/browser/index.js?\n}");
|
|
128
128
|
|
|
129
129
|
/***/ }),
|
|
130
130
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see tsparticles.plugin.canvas-mask.min.js.LICENSE.txt */
|
|
2
|
-
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],e);else{var i="object"==typeof exports?e(require("@tsparticles/engine")):e(t.window);for(var o in i)("object"==typeof exports?exports:t)[o]=i[o]}}(this,(t=>(()=>{var e={303:e=>{e.exports=t}},i={};function o(t){var s=i[t];if(void 0!==s)return s.exports;var n=i[t]={exports:{}};return e[t](n,n.exports,o),n.exports}o.d=(t,e)=>{for(var i in e)o.o(e,i)&&!o.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var s={};o.r(s),o.d(s,{loadCanvasMaskPlugin:()=>w});var n=o(303);class r{constructor(){this.color=!0,this.opacity=!1}load(t){(0,n.isNull)(t)||(void 0!==t.color&&(this.color=t.color),void 0!==t.opacity&&(this.opacity=t.opacity))}}class a{constructor(){this.filter=t=>t.a>0,this.offset=4}load(t){if(!(0,n.isNull)(t)){if(void 0!==t.filter)if((0,n.isString)(t.filter)){if(Object.hasOwn(window,t.filter)){const e=window[t.filter];(0,n.isFunction)(e)&&(this.filter=e)}}else this.filter=t.filter;void 0!==t.offset&&(this.offset=t.offset)}}}class l{constructor(){this.src=""}load(t){(0,n.isNull)(t)||void 0!==t.src&&(this.src=t.src)}}class c{constructor(){this.family="sans-serif",this.size=100}load(t){(0,n.isNull)(t)||(void 0!==t.family&&(this.family=t.family),void 0!==t.size&&(this.size=t.size),void 0!==t.style&&(this.style=t.style),void 0!==t.variant&&(this.variant=t.variant),void 0!==t.weight&&(this.weight=t.weight))}}class h{constructor(){this.separator="\n",this.spacing=10}load(t){(0,n.isNull)(t)||(void 0!==t.separator&&(this.separator=t.separator),void 0!==t.spacing&&(this.spacing=t.spacing))}}class d{constructor(){this.color="#000000",this.font=new c,this.lines=new h,this.text=""}load(t){(0,n.isNull)(t)||(void 0!==t.color&&(this.color=t.color),this.font.load(t.font),this.lines.load(t.lines),void 0!==t.text&&(this.text=t.text))}}class f{constructor(){this.enable=!1,this.override=new r,this.pixels=new a,this.position={x:50,y:50},this.scale=1}load(t){(0,n.isNull)(t)||(void 0!==t.element&&t.element instanceof HTMLCanvasElement&&(this.element=t.element),void 0!==t.enable&&(this.enable=t.enable),t.image&&(this.image||(this.image=new l),this.image.load(t.image)),this.pixels.load(t.pixels),t.position&&(this.position={x:t.position.x??this.position.x,y:t.position.y??this.position.y}),this.override.load(t.override),void 0!==t.scale&&(this.scale=t.scale),void 0!==t.selector&&(this.selector=t.selector),t.text&&(this.text||(this.text=new d),this.text.load(t.text)))}}const u=0,p=0;function g(t,e,i,o,s,r){const{height:a,width:l}=e,c=a*l,h=function(t){const e=1,i=0;for(let o=t.length-e;o>=i;o--){const e=Math.floor((0,n.getRandom)()*o);[t[o],t[e]]=[t[e],t[o]]}return t}(x(c)),d=Math.min(c,t.actualOptions.particles.number.value),f=t.canvas.size;let u=0;const p=f.width*i.x/n.percentDenominator-l*o*.5,g=f.height*i.y/n.percentDenominator-a*o*.5;for(;u<d&&h.length;){const i=0,n=h.pop()??i,a={x:n%l,y:Math.floor(n/l)},c=e.pixels[a.y][a.x];if(!r(c))continue;const d={x:a.x*o+p,y:a.y*o+g},f={};s.color&&(f.color={value:c}),s.opacity&&(f.opacity={value:c.a}),t.particles.addParticle(d,f),u++}}function v(t,e,i,o=!0){const s=t.getImageData(u,p,e.width,e.height).data;o&&t.clearRect(u,p,e.width,e.height);const n=[];for(let t=0;t<s.length;t+=i){const o=t/i,r={x:o%e.width,y:Math.floor(o/e.width)};n[r.y]||(n[r.y]=[]);const a={r:0,g:1,b:2,a:3},l=255;n[r.y][r.x]={r:s[t+a.r],g:s[t+a.g],b:s[t+a.b],a:s[t+a.a]/l}}return{pixels:n,width:Math.min(...n.map((t=>t.length))),height:n.length}}const x=t=>[...Array(t).keys()];class y{constructor(t){this._container=t}async init(){const t=this._container,e=t.actualOptions.canvasMask;if(!e?.enable)return;let i={pixels:[],height:0,width:0};const o=e.pixels.offset;if(e.image){const t=e.image.src;if(!t)return;i=await function(t,e){const i=new Image;i.crossOrigin="Anonymous";const o=new Promise(((t,o)=>{i.onerror=o,i.onload=()=>{const s=document.createElement("canvas");s.width=i.width,s.height=i.height;const r=s.getContext("2d");if(!r)return o(new Error(`${n.errorPrefix} Could not get canvas context`));r.drawImage(i,u,p,i.width,i.height,u,p,s.width,s.height),t(v(r,s,e))}}));return i.src=t,o}(t,o)}else if(e.text){const t=function(t,e){const i=document.createElement("canvas"),o=i.getContext("2d"),{font:s,text:r,lines:a,color:l}=t;if(!r||!o)return;const c=r.split(a.separator),h=(0,n.isNumber)(s.size)?`${s.size}px`:s.size,d=[];let f=0,p=0;for(const t of c){o.font=`${s.style??""} ${s.variant??""} ${s.weight??""} ${h} ${s.family}`;const e=o.measureText(t),i={measure:e,text:t,height:e.actualBoundingBoxAscent+e.actualBoundingBoxDescent,width:e.width};f=Math.max(f||0,i.width),p+=i.height+a.spacing,d.push(i)}i.width=f,i.height=p;let g=0;for(const t of d)o.font=`${s.style??""} ${s.variant??""} ${s.weight??""} ${h} ${s.family}`,o.fillStyle=l,o.fillText(t.text,u,g+t.measure.actualBoundingBoxAscent),g+=t.height+a.spacing;return v(o,i,e)}(e.text,o);if((0,n.isNull)(t))return;i=t}else if(e.element??e.selector){const t=e.element??(e.selector&&document.querySelector(e.selector));if(!t)return;const s=t.getContext("2d");if(!s)return;i=v(s,t,o)}g(t,i,e.position,e.scale,e.override,e.pixels.filter)}}class m{constructor(){this.id="canvasMask"}getPlugin(t){return Promise.resolve(new y(t))}loadOptions(t,e){if(!this.needsPlugin(t)&&!this.needsPlugin(e))return;let i=t.canvasMask;void 0===i?.load&&(t.canvasMask=i=new f),i.load(e?.canvasMask)}needsPlugin(t){return t?.canvasMask?.enable??!1}}async function w(t,e=!0){t.checkVersion("3.9.
|
|
2
|
+
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],e);else{var i="object"==typeof exports?e(require("@tsparticles/engine")):e(t.window);for(var o in i)("object"==typeof exports?exports:t)[o]=i[o]}}(this,(t=>(()=>{var e={303:e=>{e.exports=t}},i={};function o(t){var s=i[t];if(void 0!==s)return s.exports;var n=i[t]={exports:{}};return e[t](n,n.exports,o),n.exports}o.d=(t,e)=>{for(var i in e)o.o(e,i)&&!o.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var s={};o.r(s),o.d(s,{loadCanvasMaskPlugin:()=>w});var n=o(303);class r{constructor(){this.color=!0,this.opacity=!1}load(t){(0,n.isNull)(t)||(void 0!==t.color&&(this.color=t.color),void 0!==t.opacity&&(this.opacity=t.opacity))}}class a{constructor(){this.filter=t=>t.a>0,this.offset=4}load(t){if(!(0,n.isNull)(t)){if(void 0!==t.filter)if((0,n.isString)(t.filter)){if(Object.hasOwn(window,t.filter)){const e=window[t.filter];(0,n.isFunction)(e)&&(this.filter=e)}}else this.filter=t.filter;void 0!==t.offset&&(this.offset=t.offset)}}}class l{constructor(){this.src=""}load(t){(0,n.isNull)(t)||void 0!==t.src&&(this.src=t.src)}}class c{constructor(){this.family="sans-serif",this.size=100}load(t){(0,n.isNull)(t)||(void 0!==t.family&&(this.family=t.family),void 0!==t.size&&(this.size=t.size),void 0!==t.style&&(this.style=t.style),void 0!==t.variant&&(this.variant=t.variant),void 0!==t.weight&&(this.weight=t.weight))}}class h{constructor(){this.separator="\n",this.spacing=10}load(t){(0,n.isNull)(t)||(void 0!==t.separator&&(this.separator=t.separator),void 0!==t.spacing&&(this.spacing=t.spacing))}}class d{constructor(){this.color="#000000",this.font=new c,this.lines=new h,this.text=""}load(t){(0,n.isNull)(t)||(void 0!==t.color&&(this.color=t.color),this.font.load(t.font),this.lines.load(t.lines),void 0!==t.text&&(this.text=t.text))}}class f{constructor(){this.enable=!1,this.override=new r,this.pixels=new a,this.position={x:50,y:50},this.scale=1}load(t){(0,n.isNull)(t)||(void 0!==t.element&&t.element instanceof HTMLCanvasElement&&(this.element=t.element),void 0!==t.enable&&(this.enable=t.enable),t.image&&(this.image||(this.image=new l),this.image.load(t.image)),this.pixels.load(t.pixels),t.position&&(this.position={x:t.position.x??this.position.x,y:t.position.y??this.position.y}),this.override.load(t.override),void 0!==t.scale&&(this.scale=t.scale),void 0!==t.selector&&(this.selector=t.selector),t.text&&(this.text||(this.text=new d),this.text.load(t.text)))}}const u=0,p=0;function g(t,e,i,o,s,r){const{height:a,width:l}=e,c=a*l,h=function(t){const e=1,i=0;for(let o=t.length-e;o>=i;o--){const e=Math.floor((0,n.getRandom)()*o);[t[o],t[e]]=[t[e],t[o]]}return t}(x(c)),d=Math.min(c,t.actualOptions.particles.number.value),f=t.canvas.size;let u=0;const p=f.width*i.x/n.percentDenominator-l*o*.5,g=f.height*i.y/n.percentDenominator-a*o*.5;for(;u<d&&h.length;){const i=0,n=h.pop()??i,a={x:n%l,y:Math.floor(n/l)},c=e.pixels[a.y][a.x];if(!r(c))continue;const d={x:a.x*o+p,y:a.y*o+g},f={};s.color&&(f.color={value:c}),s.opacity&&(f.opacity={value:c.a}),t.particles.addParticle(d,f),u++}}function v(t,e,i,o=!0){const s=t.getImageData(u,p,e.width,e.height).data;o&&t.clearRect(u,p,e.width,e.height);const n=[];for(let t=0;t<s.length;t+=i){const o=t/i,r={x:o%e.width,y:Math.floor(o/e.width)};n[r.y]||(n[r.y]=[]);const a={r:0,g:1,b:2,a:3},l=255;n[r.y][r.x]={r:s[t+a.r],g:s[t+a.g],b:s[t+a.b],a:s[t+a.a]/l}}return{pixels:n,width:Math.min(...n.map((t=>t.length))),height:n.length}}const x=t=>[...Array(t).keys()];class y{constructor(t){this._container=t}async init(){const t=this._container,e=t.actualOptions.canvasMask;if(!e?.enable)return;let i={pixels:[],height:0,width:0};const o=e.pixels.offset;if(e.image){const t=e.image.src;if(!t)return;i=await function(t,e){const i=new Image;i.crossOrigin="Anonymous";const o=new Promise(((t,o)=>{i.onerror=o,i.onload=()=>{const s=document.createElement("canvas");s.width=i.width,s.height=i.height;const r=s.getContext("2d");if(!r)return o(new Error(`${n.errorPrefix} Could not get canvas context`));r.drawImage(i,u,p,i.width,i.height,u,p,s.width,s.height),t(v(r,s,e))}}));return i.src=t,o}(t,o)}else if(e.text){const t=function(t,e){const i=document.createElement("canvas"),o=i.getContext("2d"),{font:s,text:r,lines:a,color:l}=t;if(!r||!o)return;const c=r.split(a.separator),h=(0,n.isNumber)(s.size)?`${s.size}px`:s.size,d=[];let f=0,p=0;for(const t of c){o.font=`${s.style??""} ${s.variant??""} ${s.weight??""} ${h} ${s.family}`;const e=o.measureText(t),i={measure:e,text:t,height:e.actualBoundingBoxAscent+e.actualBoundingBoxDescent,width:e.width};f=Math.max(f||0,i.width),p+=i.height+a.spacing,d.push(i)}i.width=f,i.height=p;let g=0;for(const t of d)o.font=`${s.style??""} ${s.variant??""} ${s.weight??""} ${h} ${s.family}`,o.fillStyle=l,o.fillText(t.text,u,g+t.measure.actualBoundingBoxAscent),g+=t.height+a.spacing;return v(o,i,e)}(e.text,o);if((0,n.isNull)(t))return;i=t}else if(e.element??e.selector){const t=e.element??(e.selector&&document.querySelector(e.selector));if(!t)return;const s=t.getContext("2d");if(!s)return;i=v(s,t,o)}g(t,i,e.position,e.scale,e.override,e.pixels.filter)}}class m{constructor(){this.id="canvasMask"}getPlugin(t){return Promise.resolve(new y(t))}loadOptions(t,e){if(!this.needsPlugin(t)&&!this.needsPlugin(e))return;let i=t.canvasMask;void 0===i?.load&&(t.canvasMask=i=new f),i.load(e?.canvasMask)}needsPlugin(t){return t?.canvasMask?.enable??!1}}async function w(t,e=!0){t.checkVersion("3.9.1"),await t.addPlugin(new m,e)}return s})()));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
/*! tsParticles Canvas Mask Plugin v3.9.
|
|
1
|
+
/*! tsParticles Canvas Mask Plugin v3.9.1 by Matteo Bruni */
|
package/umd/index.js
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
exports.loadCanvasMaskPlugin = loadCanvasMaskPlugin;
|
|
13
13
|
const CanvasMaskPlugin_js_1 = require("./CanvasMaskPlugin.js");
|
|
14
14
|
async function loadCanvasMaskPlugin(engine, refresh = true) {
|
|
15
|
-
engine.checkVersion("3.9.
|
|
15
|
+
engine.checkVersion("3.9.1");
|
|
16
16
|
await engine.addPlugin(new CanvasMaskPlugin_js_1.CanvasMaskPlugin(), refresh);
|
|
17
17
|
}
|
|
18
18
|
});
|