@tsparticles/plugin-canvas-mask 3.3.0 → 3.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/CanvasMaskPlugin.js +3 -3
- package/browser/index.js +1 -1
- package/browser/utils.js +1 -1
- package/cjs/CanvasMaskPlugin.js +3 -3
- package/cjs/index.js +3 -4
- package/cjs/utils.js +5 -6
- package/esm/CanvasMaskPlugin.js +3 -3
- package/esm/index.js +1 -1
- package/esm/utils.js +1 -1
- package/package.json +2 -2
- package/report.html +1 -1
- package/tsparticles.plugin.canvas-mask.js +102 -200
- package/tsparticles.plugin.canvas-mask.min.js +1 -1
- package/tsparticles.plugin.canvas-mask.min.js.LICENSE.txt +1 -1
- package/types/CanvasMaskPlugin.d.ts +1 -1
- package/umd/CanvasMaskPlugin.js +4 -28
- package/umd/index.js +4 -29
- package/umd/utils.js +5 -6
- package/437.min.js +0 -2
- package/437.min.js.LICENSE.txt +0 -1
- package/871.min.js +0 -2
- package/871.min.js.LICENSE.txt +0 -1
- package/dist_browser_CanvasMaskInstance_js.js +0 -40
- package/dist_browser_CanvasMaskPlugin_js.js +0 -100
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { CanvasMask } from "./Options/Classes/CanvasMask.js";
|
|
2
|
+
import { CanvasMaskInstance } from "./CanvasMaskInstance.js";
|
|
2
3
|
export class CanvasMaskPlugin {
|
|
3
4
|
constructor() {
|
|
4
5
|
this.id = "canvasMask";
|
|
5
6
|
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
return new CanvasMaskInstance(container);
|
|
7
|
+
getPlugin(container) {
|
|
8
|
+
return Promise.resolve(new CanvasMaskInstance(container));
|
|
9
9
|
}
|
|
10
10
|
loadOptions(options, source) {
|
|
11
11
|
if (!this.needsPlugin(options) && !this.needsPlugin(source)) {
|
package/browser/index.js
CHANGED
package/browser/utils.js
CHANGED
package/cjs/CanvasMaskPlugin.js
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CanvasMaskPlugin = void 0;
|
|
4
4
|
const CanvasMask_js_1 = require("./Options/Classes/CanvasMask.js");
|
|
5
|
+
const CanvasMaskInstance_js_1 = require("./CanvasMaskInstance.js");
|
|
5
6
|
class CanvasMaskPlugin {
|
|
6
7
|
constructor() {
|
|
7
8
|
this.id = "canvasMask";
|
|
8
9
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return new CanvasMaskInstance(container);
|
|
10
|
+
getPlugin(container) {
|
|
11
|
+
return Promise.resolve(new CanvasMaskInstance_js_1.CanvasMaskInstance(container));
|
|
12
12
|
}
|
|
13
13
|
loadOptions(options, source) {
|
|
14
14
|
if (!this.needsPlugin(options) && !this.needsPlugin(source)) {
|
package/cjs/index.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.loadCanvasMaskPlugin =
|
|
3
|
+
exports.loadCanvasMaskPlugin = loadCanvasMaskPlugin;
|
|
4
|
+
const CanvasMaskPlugin_js_1 = require("./CanvasMaskPlugin.js");
|
|
4
5
|
async function loadCanvasMaskPlugin(engine, refresh = true) {
|
|
5
|
-
|
|
6
|
-
await engine.addPlugin(new CanvasMaskPlugin(), refresh);
|
|
6
|
+
await engine.addPlugin(new CanvasMaskPlugin_js_1.CanvasMaskPlugin(), refresh);
|
|
7
7
|
}
|
|
8
|
-
exports.loadCanvasMaskPlugin = loadCanvasMaskPlugin;
|
package/cjs/utils.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.addParticlesFromCanvasPixels = addParticlesFromCanvasPixels;
|
|
4
|
+
exports.getCanvasImageData = getCanvasImageData;
|
|
5
|
+
exports.getImageData = getImageData;
|
|
6
|
+
exports.getTextData = getTextData;
|
|
4
7
|
const engine_1 = require("@tsparticles/engine");
|
|
5
8
|
const half = 0.5, origin = {
|
|
6
9
|
x: 0,
|
|
@@ -39,7 +42,6 @@ function addParticlesFromCanvasPixels(container, data, position, scale, override
|
|
|
39
42
|
selectedPixels++;
|
|
40
43
|
}
|
|
41
44
|
}
|
|
42
|
-
exports.addParticlesFromCanvasPixels = addParticlesFromCanvasPixels;
|
|
43
45
|
function getCanvasImageData(ctx, size, offset, clear = true) {
|
|
44
46
|
const imageData = ctx.getImageData(origin.x, origin.y, size.width, size.height).data;
|
|
45
47
|
if (clear) {
|
|
@@ -69,11 +71,10 @@ function getCanvasImageData(ctx, size, offset, clear = true) {
|
|
|
69
71
|
}
|
|
70
72
|
return {
|
|
71
73
|
pixels,
|
|
72
|
-
width: Math.min(...pixels.map(
|
|
74
|
+
width: Math.min(...pixels.map(row => row.length)),
|
|
73
75
|
height: pixels.length,
|
|
74
76
|
};
|
|
75
77
|
}
|
|
76
|
-
exports.getCanvasImageData = getCanvasImageData;
|
|
77
78
|
function getImageData(src, offset) {
|
|
78
79
|
const image = new Image();
|
|
79
80
|
image.crossOrigin = "Anonymous";
|
|
@@ -94,7 +95,6 @@ function getImageData(src, offset) {
|
|
|
94
95
|
image.src = src;
|
|
95
96
|
return p;
|
|
96
97
|
}
|
|
97
|
-
exports.getImageData = getImageData;
|
|
98
98
|
function getTextData(textOptions, offset) {
|
|
99
99
|
const canvas = document.createElement("canvas"), context = canvas.getContext("2d"), { font, text, lines: linesOptions, color } = textOptions;
|
|
100
100
|
if (!text || !context) {
|
|
@@ -125,7 +125,6 @@ function getTextData(textOptions, offset) {
|
|
|
125
125
|
}
|
|
126
126
|
return getCanvasImageData(context, canvas, offset);
|
|
127
127
|
}
|
|
128
|
-
exports.getTextData = getTextData;
|
|
129
128
|
function shuffle(array) {
|
|
130
129
|
const lengthOffset = 1, minIndex = 0;
|
|
131
130
|
for (let currentIndex = array.length - lengthOffset; currentIndex >= minIndex; currentIndex--) {
|
package/esm/CanvasMaskPlugin.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { CanvasMask } from "./Options/Classes/CanvasMask.js";
|
|
2
|
+
import { CanvasMaskInstance } from "./CanvasMaskInstance.js";
|
|
2
3
|
export class CanvasMaskPlugin {
|
|
3
4
|
constructor() {
|
|
4
5
|
this.id = "canvasMask";
|
|
5
6
|
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
return new CanvasMaskInstance(container);
|
|
7
|
+
getPlugin(container) {
|
|
8
|
+
return Promise.resolve(new CanvasMaskInstance(container));
|
|
9
9
|
}
|
|
10
10
|
loadOptions(options, source) {
|
|
11
11
|
if (!this.needsPlugin(options) && !this.needsPlugin(source)) {
|
package/esm/index.js
CHANGED
package/esm/utils.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/plugin-canvas-mask",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.0",
|
|
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.
|
|
89
|
+
"@tsparticles/engine": "^3.5.0"
|
|
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 [1 Jul 2024 at 09:18]</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.
|
|
7
|
+
* v3.5.0
|
|
8
8
|
*/
|
|
9
9
|
/*
|
|
10
10
|
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
|
@@ -28,13 +28,113 @@ return /******/ (() => { // webpackBootstrap
|
|
|
28
28
|
/******/ "use strict";
|
|
29
29
|
/******/ var __webpack_modules__ = ({
|
|
30
30
|
|
|
31
|
+
/***/ "./dist/browser/CanvasMaskInstance.js":
|
|
32
|
+
/*!********************************************!*\
|
|
33
|
+
!*** ./dist/browser/CanvasMaskInstance.js ***!
|
|
34
|
+
\********************************************/
|
|
35
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
36
|
+
|
|
37
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CanvasMaskInstance: () => (/* binding */ CanvasMaskInstance)\n/* harmony export */ });\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils.js */ \"./dist/browser/utils.js\");\n\nclass CanvasMaskInstance {\n constructor(container) {\n this._container = container;\n }\n async init() {\n const container = this._container,\n options = container.actualOptions.canvasMask;\n if (!options?.enable) {\n return;\n }\n let pixelData = {\n pixels: [],\n height: 0,\n width: 0\n };\n const offset = options.pixels.offset;\n if (options.image) {\n const url = options.image.src;\n if (!url) {\n return;\n }\n pixelData = await (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.getImageData)(url, offset);\n } else if (options.text) {\n const textOptions = options.text;\n const data = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.getTextData)(textOptions, offset);\n if (!data) {\n return;\n }\n pixelData = data;\n } else if (options.element ?? options.selector) {\n const canvas = options.element ?? (options.selector && document.querySelector(options.selector));\n if (!canvas) {\n return;\n }\n const context = canvas.getContext(\"2d\");\n if (!context) {\n return;\n }\n pixelData = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.getCanvasImageData)(context, canvas, offset);\n }\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.addParticlesFromCanvasPixels)(container, pixelData, options.position, options.scale, options.override, options.pixels.filter);\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-canvas-mask/./dist/browser/CanvasMaskInstance.js?");
|
|
38
|
+
|
|
39
|
+
/***/ }),
|
|
40
|
+
|
|
41
|
+
/***/ "./dist/browser/CanvasMaskPlugin.js":
|
|
42
|
+
/*!******************************************!*\
|
|
43
|
+
!*** ./dist/browser/CanvasMaskPlugin.js ***!
|
|
44
|
+
\******************************************/
|
|
45
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
46
|
+
|
|
47
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CanvasMaskPlugin: () => (/* binding */ CanvasMaskPlugin)\n/* harmony export */ });\n/* harmony import */ var _Options_Classes_CanvasMask_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Options/Classes/CanvasMask.js */ \"./dist/browser/Options/Classes/CanvasMask.js\");\n/* harmony import */ var _CanvasMaskInstance_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./CanvasMaskInstance.js */ \"./dist/browser/CanvasMaskInstance.js\");\n\n\nclass CanvasMaskPlugin {\n constructor() {\n this.id = \"canvasMask\";\n }\n getPlugin(container) {\n return Promise.resolve(new _CanvasMaskInstance_js__WEBPACK_IMPORTED_MODULE_0__.CanvasMaskInstance(container));\n }\n loadOptions(options, source) {\n if (!this.needsPlugin(options) && !this.needsPlugin(source)) {\n return;\n }\n let canvasMaskOptions = options.canvasMask;\n if (canvasMaskOptions?.load === undefined) {\n options.canvasMask = canvasMaskOptions = new _Options_Classes_CanvasMask_js__WEBPACK_IMPORTED_MODULE_1__.CanvasMask();\n }\n canvasMaskOptions.load(source?.canvasMask);\n }\n needsPlugin(options) {\n return options?.canvasMask?.enable ?? false;\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-canvas-mask/./dist/browser/CanvasMaskPlugin.js?");
|
|
48
|
+
|
|
49
|
+
/***/ }),
|
|
50
|
+
|
|
51
|
+
/***/ "./dist/browser/Options/Classes/CanvasMask.js":
|
|
52
|
+
/*!****************************************************!*\
|
|
53
|
+
!*** ./dist/browser/Options/Classes/CanvasMask.js ***!
|
|
54
|
+
\****************************************************/
|
|
55
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
56
|
+
|
|
57
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CanvasMask: () => (/* binding */ CanvasMask)\n/* harmony export */ });\n/* harmony import */ var _CanvasMaskOverride_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./CanvasMaskOverride.js */ \"./dist/browser/Options/Classes/CanvasMaskOverride.js\");\n/* harmony import */ var _CanvasMaskPixels_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./CanvasMaskPixels.js */ \"./dist/browser/Options/Classes/CanvasMaskPixels.js\");\n/* harmony import */ var _ImageMask_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ImageMask.js */ \"./dist/browser/Options/Classes/ImageMask.js\");\n/* harmony import */ var _TextMask_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./TextMask.js */ \"./dist/browser/Options/Classes/TextMask.js\");\n\n\n\n\nclass CanvasMask {\n constructor() {\n this.enable = false;\n this.override = new _CanvasMaskOverride_js__WEBPACK_IMPORTED_MODULE_0__.CanvasMaskOverride();\n this.pixels = new _CanvasMaskPixels_js__WEBPACK_IMPORTED_MODULE_1__.CanvasMaskPixels();\n this.position = {\n x: 50,\n y: 50\n };\n this.scale = 1;\n }\n load(data) {\n if (!data) {\n return;\n }\n if (data.element !== undefined && data.element instanceof HTMLCanvasElement) {\n this.element = data.element;\n }\n if (data.enable !== undefined) {\n this.enable = data.enable;\n }\n if (data.image) {\n if (!this.image) {\n this.image = new _ImageMask_js__WEBPACK_IMPORTED_MODULE_2__.ImageMask();\n }\n this.image.load(data.image);\n }\n this.pixels.load(data.pixels);\n if (data.position) {\n this.position = {\n x: data.position.x ?? this.position.x,\n y: data.position.y ?? this.position.y\n };\n }\n this.override.load(data.override);\n if (data.scale !== undefined) {\n this.scale = data.scale;\n }\n if (data.selector !== undefined) {\n this.selector = data.selector;\n }\n if (data.text) {\n if (!this.text) {\n this.text = new _TextMask_js__WEBPACK_IMPORTED_MODULE_3__.TextMask();\n }\n this.text.load(data.text);\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-canvas-mask/./dist/browser/Options/Classes/CanvasMask.js?");
|
|
58
|
+
|
|
59
|
+
/***/ }),
|
|
60
|
+
|
|
61
|
+
/***/ "./dist/browser/Options/Classes/CanvasMaskOverride.js":
|
|
62
|
+
/*!************************************************************!*\
|
|
63
|
+
!*** ./dist/browser/Options/Classes/CanvasMaskOverride.js ***!
|
|
64
|
+
\************************************************************/
|
|
65
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
66
|
+
|
|
67
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CanvasMaskOverride: () => (/* binding */ CanvasMaskOverride)\n/* harmony export */ });\nclass CanvasMaskOverride {\n constructor() {\n this.color = true;\n this.opacity = false;\n }\n load(data) {\n if (!data) {\n return;\n }\n if (data.color !== undefined) {\n this.color = data.color;\n }\n if (data.opacity !== undefined) {\n this.opacity = data.opacity;\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-canvas-mask/./dist/browser/Options/Classes/CanvasMaskOverride.js?");
|
|
68
|
+
|
|
69
|
+
/***/ }),
|
|
70
|
+
|
|
71
|
+
/***/ "./dist/browser/Options/Classes/CanvasMaskPixels.js":
|
|
72
|
+
/*!**********************************************************!*\
|
|
73
|
+
!*** ./dist/browser/Options/Classes/CanvasMaskPixels.js ***!
|
|
74
|
+
\**********************************************************/
|
|
75
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
76
|
+
|
|
77
|
+
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/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n\nconst minAlpha = 0;\nclass CanvasMaskPixels {\n constructor() {\n this.filter = pixel => pixel.a > minAlpha;\n this.offset = 4;\n }\n load(data) {\n if (!data) {\n return;\n }\n if (data.filter !== undefined) {\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isString)(data.filter)) {\n if (Object.hasOwn(window, data.filter)) {\n const filter = window[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//# sourceURL=webpack://@tsparticles/plugin-canvas-mask/./dist/browser/Options/Classes/CanvasMaskPixels.js?");
|
|
78
|
+
|
|
79
|
+
/***/ }),
|
|
80
|
+
|
|
81
|
+
/***/ "./dist/browser/Options/Classes/FontTextMask.js":
|
|
82
|
+
/*!******************************************************!*\
|
|
83
|
+
!*** ./dist/browser/Options/Classes/FontTextMask.js ***!
|
|
84
|
+
\******************************************************/
|
|
85
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
86
|
+
|
|
87
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ FontTextMask: () => (/* binding */ FontTextMask)\n/* harmony export */ });\nclass FontTextMask {\n constructor() {\n this.family = \"sans-serif\";\n this.size = 100;\n }\n load(data) {\n if (!data) {\n return;\n }\n if (data.family !== undefined) {\n this.family = data.family;\n }\n if (data.size !== undefined) {\n this.size = data.size;\n }\n if (data.style !== undefined) {\n this.style = data.style;\n }\n if (data.variant !== undefined) {\n this.variant = data.variant;\n }\n if (data.weight !== undefined) {\n this.weight = data.weight;\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-canvas-mask/./dist/browser/Options/Classes/FontTextMask.js?");
|
|
88
|
+
|
|
89
|
+
/***/ }),
|
|
90
|
+
|
|
91
|
+
/***/ "./dist/browser/Options/Classes/ImageMask.js":
|
|
92
|
+
/*!***************************************************!*\
|
|
93
|
+
!*** ./dist/browser/Options/Classes/ImageMask.js ***!
|
|
94
|
+
\***************************************************/
|
|
95
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
96
|
+
|
|
97
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ImageMask: () => (/* binding */ ImageMask)\n/* harmony export */ });\nclass ImageMask {\n constructor() {\n this.src = \"\";\n }\n load(data) {\n if (!data) {\n return;\n }\n if (data.src !== undefined) {\n this.src = data.src;\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-canvas-mask/./dist/browser/Options/Classes/ImageMask.js?");
|
|
98
|
+
|
|
99
|
+
/***/ }),
|
|
100
|
+
|
|
101
|
+
/***/ "./dist/browser/Options/Classes/TextMask.js":
|
|
102
|
+
/*!**************************************************!*\
|
|
103
|
+
!*** ./dist/browser/Options/Classes/TextMask.js ***!
|
|
104
|
+
\**************************************************/
|
|
105
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
106
|
+
|
|
107
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ TextMask: () => (/* binding */ TextMask)\n/* harmony export */ });\n/* harmony import */ var _FontTextMask_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./FontTextMask.js */ \"./dist/browser/Options/Classes/FontTextMask.js\");\n/* harmony import */ var _TextMaskLine_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./TextMaskLine.js */ \"./dist/browser/Options/Classes/TextMaskLine.js\");\n\n\nclass TextMask {\n constructor() {\n this.color = \"#000000\";\n this.font = new _FontTextMask_js__WEBPACK_IMPORTED_MODULE_0__.FontTextMask();\n this.lines = new _TextMaskLine_js__WEBPACK_IMPORTED_MODULE_1__.TextMaskLine();\n this.text = \"\";\n }\n load(data) {\n if (!data) {\n return;\n }\n if (data.color !== undefined) {\n this.color = data.color;\n }\n this.font.load(data.font);\n this.lines.load(data.lines);\n if (data.text !== undefined) {\n this.text = data.text;\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-canvas-mask/./dist/browser/Options/Classes/TextMask.js?");
|
|
108
|
+
|
|
109
|
+
/***/ }),
|
|
110
|
+
|
|
111
|
+
/***/ "./dist/browser/Options/Classes/TextMaskLine.js":
|
|
112
|
+
/*!******************************************************!*\
|
|
113
|
+
!*** ./dist/browser/Options/Classes/TextMaskLine.js ***!
|
|
114
|
+
\******************************************************/
|
|
115
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
116
|
+
|
|
117
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ TextMaskLine: () => (/* binding */ TextMaskLine)\n/* harmony export */ });\nclass TextMaskLine {\n constructor() {\n this.separator = \"\\n\";\n this.spacing = 10;\n }\n load(data) {\n if (!data) {\n return;\n }\n if (data.separator !== undefined) {\n this.separator = data.separator;\n }\n if (data.spacing !== undefined) {\n this.spacing = data.spacing;\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-canvas-mask/./dist/browser/Options/Classes/TextMaskLine.js?");
|
|
118
|
+
|
|
119
|
+
/***/ }),
|
|
120
|
+
|
|
31
121
|
/***/ "./dist/browser/index.js":
|
|
32
122
|
/*!*******************************!*\
|
|
33
123
|
!*** ./dist/browser/index.js ***!
|
|
34
124
|
\*******************************/
|
|
35
125
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
36
126
|
|
|
37
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ loadCanvasMaskPlugin: () => (/* binding */ loadCanvasMaskPlugin)\n/* harmony export */ });\
|
|
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 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?");
|
|
128
|
+
|
|
129
|
+
/***/ }),
|
|
130
|
+
|
|
131
|
+
/***/ "./dist/browser/utils.js":
|
|
132
|
+
/*!*******************************!*\
|
|
133
|
+
!*** ./dist/browser/utils.js ***!
|
|
134
|
+
\*******************************/
|
|
135
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
136
|
+
|
|
137
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ addParticlesFromCanvasPixels: () => (/* binding */ addParticlesFromCanvasPixels),\n/* harmony export */ getCanvasImageData: () => (/* binding */ getCanvasImageData),\n/* harmony export */ getImageData: () => (/* binding */ getImageData),\n/* harmony export */ getTextData: () => (/* binding */ getTextData)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n\nconst half = 0.5,\n origin = {\n x: 0,\n y: 0\n },\n defaultWidth = 0;\nfunction addParticlesFromCanvasPixels(container, data, position, scale, override, filter) {\n const {\n height,\n width\n } = data,\n numPixels = height * width,\n indexArray = shuffle(range(numPixels)),\n maxParticles = Math.min(numPixels, container.actualOptions.particles.number.value),\n 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 * half,\n y: canvasSize.height * position.y / _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.percentDenominator - height * scale * half\n };\n while (selectedPixels < maxParticles && indexArray.length) {\n const defaultIndex = 0,\n nextIndex = indexArray.pop() ?? defaultIndex,\n pixelPos = {\n x: nextIndex % width,\n y: Math.floor(nextIndex / width)\n },\n pixel = data.pixels[pixelPos.y][pixelPos.x],\n 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 },\n pOptions = {};\n if (override.color) {\n pOptions.color = {\n value: pixel\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 getCanvasImageData(ctx, size, offset, clear = true) {\n const imageData = ctx.getImageData(origin.x, origin.y, size.width, size.height).data;\n if (clear) {\n ctx.clearRect(origin.x, origin.y, size.width, size.height);\n }\n const pixels = [];\n for (let i = 0; i < imageData.length; i += offset) {\n const idx = i / offset,\n pos = {\n x: idx % size.width,\n y: Math.floor(idx / size.width)\n };\n if (!pixels[pos.y]) {\n pixels[pos.y] = [];\n }\n const indexesOffset = {\n r: 0,\n g: 1,\n b: 2,\n a: 3\n },\n alphaFactor = 255;\n pixels[pos.y][pos.x] = {\n r: imageData[i + indexesOffset.r],\n g: imageData[i + indexesOffset.g],\n b: imageData[i + indexesOffset.b],\n a: imageData[i + indexesOffset.a] / alphaFactor\n };\n }\n return {\n pixels,\n width: Math.min(...pixels.map(row => row.length)),\n height: pixels.length\n };\n}\nfunction getImageData(src, offset) {\n const image = new Image();\n image.crossOrigin = \"Anonymous\";\n const p = new Promise((resolve, reject) => {\n image.onerror = reject;\n image.onload = () => {\n const canvas = document.createElement(\"canvas\");\n canvas.width = image.width;\n canvas.height = image.height;\n const context = canvas.getContext(\"2d\");\n if (!context) {\n return reject(new Error(`${_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.errorPrefix} Could not get canvas context`));\n }\n context.drawImage(image, origin.x, origin.y, image.width, image.height, origin.x, origin.y, canvas.width, canvas.height);\n resolve(getCanvasImageData(context, canvas, offset));\n };\n });\n image.src = src;\n return p;\n}\nfunction getTextData(textOptions, offset) {\n const canvas = document.createElement(\"canvas\"),\n context = canvas.getContext(\"2d\"),\n {\n font,\n text,\n lines: linesOptions,\n color\n } = textOptions;\n if (!text || !context) {\n return;\n }\n const lines = text.split(linesOptions.separator),\n fontSize = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNumber)(font.size) ? `${font.size}px` : font.size,\n linesData = [];\n let maxWidth = 0,\n totalHeight = 0;\n for (const line of lines) {\n context.font = `${font.style ?? \"\"} ${font.variant ?? \"\"} ${font.weight ?? \"\"} ${fontSize} ${font.family}`;\n const measure = context.measureText(line),\n lineData = {\n measure,\n text: line,\n height: measure.actualBoundingBoxAscent + measure.actualBoundingBoxDescent,\n width: measure.width\n };\n maxWidth = Math.max(maxWidth || defaultWidth, lineData.width);\n totalHeight += lineData.height + linesOptions.spacing;\n linesData.push(lineData);\n }\n canvas.width = maxWidth;\n canvas.height = totalHeight;\n let currentHeight = 0;\n for (const line of linesData) {\n context.font = `${font.style ?? \"\"} ${font.variant ?? \"\"} ${font.weight ?? \"\"} ${fontSize} ${font.family}`;\n context.fillStyle = color;\n context.fillText(line.text, origin.x, currentHeight + line.measure.actualBoundingBoxAscent);\n currentHeight += line.height + linesOptions.spacing;\n }\n return getCanvasImageData(context, canvas, offset);\n}\nfunction shuffle(array) {\n const lengthOffset = 1,\n 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);\n [array[currentIndex], array[randomIndex]] = [array[randomIndex], array[currentIndex]];\n }\n return array;\n}\nconst range = n => [...Array(n).keys()];\n\n//# sourceURL=webpack://@tsparticles/plugin-canvas-mask/./dist/browser/utils.js?");
|
|
38
138
|
|
|
39
139
|
/***/ }),
|
|
40
140
|
|
|
@@ -74,9 +174,6 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
|
|
|
74
174
|
/******/ return module.exports;
|
|
75
175
|
/******/ }
|
|
76
176
|
/******/
|
|
77
|
-
/******/ // expose the modules object (__webpack_modules__)
|
|
78
|
-
/******/ __webpack_require__.m = __webpack_modules__;
|
|
79
|
-
/******/
|
|
80
177
|
/************************************************************************/
|
|
81
178
|
/******/ /* webpack/runtime/compat get default export */
|
|
82
179
|
/******/ (() => {
|
|
@@ -102,91 +199,11 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
|
|
|
102
199
|
/******/ };
|
|
103
200
|
/******/ })();
|
|
104
201
|
/******/
|
|
105
|
-
/******/ /* webpack/runtime/ensure chunk */
|
|
106
|
-
/******/ (() => {
|
|
107
|
-
/******/ __webpack_require__.f = {};
|
|
108
|
-
/******/ // This file contains only the entry chunk.
|
|
109
|
-
/******/ // The chunk loading function for additional chunks
|
|
110
|
-
/******/ __webpack_require__.e = (chunkId) => {
|
|
111
|
-
/******/ return Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {
|
|
112
|
-
/******/ __webpack_require__.f[key](chunkId, promises);
|
|
113
|
-
/******/ return promises;
|
|
114
|
-
/******/ }, []));
|
|
115
|
-
/******/ };
|
|
116
|
-
/******/ })();
|
|
117
|
-
/******/
|
|
118
|
-
/******/ /* webpack/runtime/get javascript chunk filename */
|
|
119
|
-
/******/ (() => {
|
|
120
|
-
/******/ // This function allow to reference async chunks
|
|
121
|
-
/******/ __webpack_require__.u = (chunkId) => {
|
|
122
|
-
/******/ // return url for filenames based on template
|
|
123
|
-
/******/ return "" + chunkId + ".js";
|
|
124
|
-
/******/ };
|
|
125
|
-
/******/ })();
|
|
126
|
-
/******/
|
|
127
|
-
/******/ /* webpack/runtime/global */
|
|
128
|
-
/******/ (() => {
|
|
129
|
-
/******/ __webpack_require__.g = (function() {
|
|
130
|
-
/******/ if (typeof globalThis === 'object') return globalThis;
|
|
131
|
-
/******/ try {
|
|
132
|
-
/******/ return this || new Function('return this')();
|
|
133
|
-
/******/ } catch (e) {
|
|
134
|
-
/******/ if (typeof window === 'object') return window;
|
|
135
|
-
/******/ }
|
|
136
|
-
/******/ })();
|
|
137
|
-
/******/ })();
|
|
138
|
-
/******/
|
|
139
202
|
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
140
203
|
/******/ (() => {
|
|
141
204
|
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
142
205
|
/******/ })();
|
|
143
206
|
/******/
|
|
144
|
-
/******/ /* webpack/runtime/load script */
|
|
145
|
-
/******/ (() => {
|
|
146
|
-
/******/ var inProgress = {};
|
|
147
|
-
/******/ var dataWebpackPrefix = "@tsparticles/plugin-canvas-mask:";
|
|
148
|
-
/******/ // loadScript function to load a script via script tag
|
|
149
|
-
/******/ __webpack_require__.l = (url, done, key, chunkId) => {
|
|
150
|
-
/******/ if(inProgress[url]) { inProgress[url].push(done); return; }
|
|
151
|
-
/******/ var script, needAttach;
|
|
152
|
-
/******/ if(key !== undefined) {
|
|
153
|
-
/******/ var scripts = document.getElementsByTagName("script");
|
|
154
|
-
/******/ for(var i = 0; i < scripts.length; i++) {
|
|
155
|
-
/******/ var s = scripts[i];
|
|
156
|
-
/******/ if(s.getAttribute("src") == url || s.getAttribute("data-webpack") == dataWebpackPrefix + key) { script = s; break; }
|
|
157
|
-
/******/ }
|
|
158
|
-
/******/ }
|
|
159
|
-
/******/ if(!script) {
|
|
160
|
-
/******/ needAttach = true;
|
|
161
|
-
/******/ script = document.createElement('script');
|
|
162
|
-
/******/
|
|
163
|
-
/******/ script.charset = 'utf-8';
|
|
164
|
-
/******/ script.timeout = 120;
|
|
165
|
-
/******/ if (__webpack_require__.nc) {
|
|
166
|
-
/******/ script.setAttribute("nonce", __webpack_require__.nc);
|
|
167
|
-
/******/ }
|
|
168
|
-
/******/ script.setAttribute("data-webpack", dataWebpackPrefix + key);
|
|
169
|
-
/******/
|
|
170
|
-
/******/ script.src = url;
|
|
171
|
-
/******/ }
|
|
172
|
-
/******/ inProgress[url] = [done];
|
|
173
|
-
/******/ var onScriptComplete = (prev, event) => {
|
|
174
|
-
/******/ // avoid mem leaks in IE.
|
|
175
|
-
/******/ script.onerror = script.onload = null;
|
|
176
|
-
/******/ clearTimeout(timeout);
|
|
177
|
-
/******/ var doneFns = inProgress[url];
|
|
178
|
-
/******/ delete inProgress[url];
|
|
179
|
-
/******/ script.parentNode && script.parentNode.removeChild(script);
|
|
180
|
-
/******/ doneFns && doneFns.forEach((fn) => (fn(event)));
|
|
181
|
-
/******/ if(prev) return prev(event);
|
|
182
|
-
/******/ }
|
|
183
|
-
/******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
|
|
184
|
-
/******/ script.onerror = onScriptComplete.bind(null, script.onerror);
|
|
185
|
-
/******/ script.onload = onScriptComplete.bind(null, script.onload);
|
|
186
|
-
/******/ needAttach && document.head.appendChild(script);
|
|
187
|
-
/******/ };
|
|
188
|
-
/******/ })();
|
|
189
|
-
/******/
|
|
190
207
|
/******/ /* webpack/runtime/make namespace object */
|
|
191
208
|
/******/ (() => {
|
|
192
209
|
/******/ // define __esModule on exports
|
|
@@ -198,121 +215,6 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
|
|
|
198
215
|
/******/ };
|
|
199
216
|
/******/ })();
|
|
200
217
|
/******/
|
|
201
|
-
/******/ /* webpack/runtime/publicPath */
|
|
202
|
-
/******/ (() => {
|
|
203
|
-
/******/ var scriptUrl;
|
|
204
|
-
/******/ if (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + "";
|
|
205
|
-
/******/ var document = __webpack_require__.g.document;
|
|
206
|
-
/******/ if (!scriptUrl && document) {
|
|
207
|
-
/******/ if (document.currentScript)
|
|
208
|
-
/******/ scriptUrl = document.currentScript.src;
|
|
209
|
-
/******/ if (!scriptUrl) {
|
|
210
|
-
/******/ var scripts = document.getElementsByTagName("script");
|
|
211
|
-
/******/ if(scripts.length) {
|
|
212
|
-
/******/ var i = scripts.length - 1;
|
|
213
|
-
/******/ while (i > -1 && (!scriptUrl || !/^http(s?):/.test(scriptUrl))) scriptUrl = scripts[i--].src;
|
|
214
|
-
/******/ }
|
|
215
|
-
/******/ }
|
|
216
|
-
/******/ }
|
|
217
|
-
/******/ // When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration
|
|
218
|
-
/******/ // or pass an empty string ("") and set the __webpack_public_path__ variable from your code to use your own logic.
|
|
219
|
-
/******/ if (!scriptUrl) throw new Error("Automatic publicPath is not supported in this browser");
|
|
220
|
-
/******/ scriptUrl = scriptUrl.replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/");
|
|
221
|
-
/******/ __webpack_require__.p = scriptUrl;
|
|
222
|
-
/******/ })();
|
|
223
|
-
/******/
|
|
224
|
-
/******/ /* webpack/runtime/jsonp chunk loading */
|
|
225
|
-
/******/ (() => {
|
|
226
|
-
/******/ // no baseURI
|
|
227
|
-
/******/
|
|
228
|
-
/******/ // object to store loaded and loading chunks
|
|
229
|
-
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
|
|
230
|
-
/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
|
|
231
|
-
/******/ var installedChunks = {
|
|
232
|
-
/******/ "tsparticles.plugin.canvas-mask": 0
|
|
233
|
-
/******/ };
|
|
234
|
-
/******/
|
|
235
|
-
/******/ __webpack_require__.f.j = (chunkId, promises) => {
|
|
236
|
-
/******/ // JSONP chunk loading for javascript
|
|
237
|
-
/******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
|
|
238
|
-
/******/ if(installedChunkData !== 0) { // 0 means "already installed".
|
|
239
|
-
/******/
|
|
240
|
-
/******/ // a Promise means "currently loading".
|
|
241
|
-
/******/ if(installedChunkData) {
|
|
242
|
-
/******/ promises.push(installedChunkData[2]);
|
|
243
|
-
/******/ } else {
|
|
244
|
-
/******/ if(true) { // all chunks have JS
|
|
245
|
-
/******/ // setup Promise in chunk cache
|
|
246
|
-
/******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));
|
|
247
|
-
/******/ promises.push(installedChunkData[2] = promise);
|
|
248
|
-
/******/
|
|
249
|
-
/******/ // start chunk loading
|
|
250
|
-
/******/ var url = __webpack_require__.p + __webpack_require__.u(chunkId);
|
|
251
|
-
/******/ // create error before stack unwound to get useful stacktrace later
|
|
252
|
-
/******/ var error = new Error();
|
|
253
|
-
/******/ var loadingEnded = (event) => {
|
|
254
|
-
/******/ if(__webpack_require__.o(installedChunks, chunkId)) {
|
|
255
|
-
/******/ installedChunkData = installedChunks[chunkId];
|
|
256
|
-
/******/ if(installedChunkData !== 0) installedChunks[chunkId] = undefined;
|
|
257
|
-
/******/ if(installedChunkData) {
|
|
258
|
-
/******/ var errorType = event && (event.type === 'load' ? 'missing' : event.type);
|
|
259
|
-
/******/ var realSrc = event && event.target && event.target.src;
|
|
260
|
-
/******/ error.message = 'Loading chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')';
|
|
261
|
-
/******/ error.name = 'ChunkLoadError';
|
|
262
|
-
/******/ error.type = errorType;
|
|
263
|
-
/******/ error.request = realSrc;
|
|
264
|
-
/******/ installedChunkData[1](error);
|
|
265
|
-
/******/ }
|
|
266
|
-
/******/ }
|
|
267
|
-
/******/ };
|
|
268
|
-
/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId);
|
|
269
|
-
/******/ }
|
|
270
|
-
/******/ }
|
|
271
|
-
/******/ }
|
|
272
|
-
/******/ };
|
|
273
|
-
/******/
|
|
274
|
-
/******/ // no prefetching
|
|
275
|
-
/******/
|
|
276
|
-
/******/ // no preloaded
|
|
277
|
-
/******/
|
|
278
|
-
/******/ // no HMR
|
|
279
|
-
/******/
|
|
280
|
-
/******/ // no HMR manifest
|
|
281
|
-
/******/
|
|
282
|
-
/******/ // no on chunks loaded
|
|
283
|
-
/******/
|
|
284
|
-
/******/ // install a JSONP callback for chunk loading
|
|
285
|
-
/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
|
|
286
|
-
/******/ var chunkIds = data[0];
|
|
287
|
-
/******/ var moreModules = data[1];
|
|
288
|
-
/******/ var runtime = data[2];
|
|
289
|
-
/******/ // add "moreModules" to the modules object,
|
|
290
|
-
/******/ // then flag all "chunkIds" as loaded and fire callback
|
|
291
|
-
/******/ var moduleId, chunkId, i = 0;
|
|
292
|
-
/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
|
|
293
|
-
/******/ for(moduleId in moreModules) {
|
|
294
|
-
/******/ if(__webpack_require__.o(moreModules, moduleId)) {
|
|
295
|
-
/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
|
|
296
|
-
/******/ }
|
|
297
|
-
/******/ }
|
|
298
|
-
/******/ if(runtime) var result = runtime(__webpack_require__);
|
|
299
|
-
/******/ }
|
|
300
|
-
/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
|
|
301
|
-
/******/ for(;i < chunkIds.length; i++) {
|
|
302
|
-
/******/ chunkId = chunkIds[i];
|
|
303
|
-
/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
|
|
304
|
-
/******/ installedChunks[chunkId][0]();
|
|
305
|
-
/******/ }
|
|
306
|
-
/******/ installedChunks[chunkId] = 0;
|
|
307
|
-
/******/ }
|
|
308
|
-
/******/
|
|
309
|
-
/******/ }
|
|
310
|
-
/******/
|
|
311
|
-
/******/ var chunkLoadingGlobal = this["webpackChunk_tsparticles_plugin_canvas_mask"] = this["webpackChunk_tsparticles_plugin_canvas_mask"] || [];
|
|
312
|
-
/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
|
|
313
|
-
/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
|
|
314
|
-
/******/ })();
|
|
315
|
-
/******/
|
|
316
218
|
/************************************************************************/
|
|
317
219
|
/******/
|
|
318
220
|
/******/ // startup
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see tsparticles.plugin.canvas-mask.min.js.LICENSE.txt */
|
|
2
|
-
!function(e
|
|
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:()=>m});class n{constructor(){this.color=!0,this.opacity=!1}load(t){t&&(void 0!==t.color&&(this.color=t.color),void 0!==t.opacity&&(this.opacity=t.opacity))}}var r=o(303);class a{constructor(){this.filter=t=>t.a>0,this.offset=4}load(t){if(t){if(void 0!==t.filter)if((0,r.isString)(t.filter)){if(Object.hasOwn(window,t.filter)){const e=window[t.filter];(0,r.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){t&&void 0!==t.src&&(this.src=t.src)}}class c{constructor(){this.family="sans-serif",this.size=100}load(t){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){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){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 n,this.pixels=new a,this.position={x:50,y:50},this.scale=1}load(t){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={x:0,y:0};function p(t,e,i,o,s,n){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,r.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/r.percentDenominator-l*o*.5,g=f.height*i.y/r.percentDenominator-a*o*.5;for(;u<d&&h.length;){const i=0,r=h.pop()??i,a={x:r%l,y:Math.floor(r/l)},c=e.pixels[a.y][a.x];if(!n(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 g(t,e,i,o=!0){const s=t.getImageData(u.x,u.y,e.width,e.height).data;o&&t.clearRect(u.x,u.y,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 n=s.getContext("2d");if(!n)return o(new Error(`${r.errorPrefix} Could not get canvas context`));n.drawImage(i,u.x,u.y,i.width,i.height,u.x,u.y,s.width,s.height),t(g(n,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:n,lines:a,color:l}=t;if(!n||!o)return;const c=n.split(a.separator),h=(0,r.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 x=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.x,x+t.measure.actualBoundingBoxAscent),x+=t.height+a.spacing;return g(o,i,e)}(e.text,o);if(!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=g(s,t,o)}p(t,i,e.position,e.scale,e.override,e.pixels.filter)}}class v{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 m(t,e=!0){await t.addPlugin(new v,e)}return s})()));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
/*! tsParticles Canvas Mask Plugin v3.
|
|
1
|
+
/*! tsParticles Canvas Mask Plugin v3.5.0 by Matteo Bruni */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CanvasMaskOptions, ICanvasMaskOptions } from "./types.js";
|
|
2
2
|
import { type Container, type IPlugin, type RecursivePartial } from "@tsparticles/engine";
|
|
3
|
-
import
|
|
3
|
+
import { CanvasMaskInstance } from "./CanvasMaskInstance.js";
|
|
4
4
|
export declare class CanvasMaskPlugin implements IPlugin {
|
|
5
5
|
readonly id: string;
|
|
6
6
|
constructor();
|
package/umd/CanvasMaskPlugin.js
CHANGED
|
@@ -1,47 +1,23 @@
|
|
|
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 (mod) {
|
|
18
|
-
if (mod && mod.__esModule) return mod;
|
|
19
|
-
var result = {};
|
|
20
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
21
|
-
__setModuleDefault(result, mod);
|
|
22
|
-
return result;
|
|
23
|
-
};
|
|
24
1
|
(function (factory) {
|
|
25
2
|
if (typeof module === "object" && typeof module.exports === "object") {
|
|
26
3
|
var v = factory(require, exports);
|
|
27
4
|
if (v !== undefined) module.exports = v;
|
|
28
5
|
}
|
|
29
6
|
else if (typeof define === "function" && define.amd) {
|
|
30
|
-
define(["require", "exports", "./Options/Classes/CanvasMask.js"], factory);
|
|
7
|
+
define(["require", "exports", "./Options/Classes/CanvasMask.js", "./CanvasMaskInstance.js"], factory);
|
|
31
8
|
}
|
|
32
9
|
})(function (require, exports) {
|
|
33
10
|
"use strict";
|
|
34
|
-
var __syncRequire = typeof module === "object" && typeof module.exports === "object";
|
|
35
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
12
|
exports.CanvasMaskPlugin = void 0;
|
|
37
13
|
const CanvasMask_js_1 = require("./Options/Classes/CanvasMask.js");
|
|
14
|
+
const CanvasMaskInstance_js_1 = require("./CanvasMaskInstance.js");
|
|
38
15
|
class CanvasMaskPlugin {
|
|
39
16
|
constructor() {
|
|
40
17
|
this.id = "canvasMask";
|
|
41
18
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return new CanvasMaskInstance(container);
|
|
19
|
+
getPlugin(container) {
|
|
20
|
+
return Promise.resolve(new CanvasMaskInstance_js_1.CanvasMaskInstance(container));
|
|
45
21
|
}
|
|
46
22
|
loadOptions(options, source) {
|
|
47
23
|
if (!this.needsPlugin(options) && !this.needsPlugin(source)) {
|
package/umd/index.js
CHANGED
|
@@ -1,42 +1,17 @@
|
|
|
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 (mod) {
|
|
18
|
-
if (mod && mod.__esModule) return mod;
|
|
19
|
-
var result = {};
|
|
20
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
21
|
-
__setModuleDefault(result, mod);
|
|
22
|
-
return result;
|
|
23
|
-
};
|
|
24
1
|
(function (factory) {
|
|
25
2
|
if (typeof module === "object" && typeof module.exports === "object") {
|
|
26
3
|
var v = factory(require, exports);
|
|
27
4
|
if (v !== undefined) module.exports = v;
|
|
28
5
|
}
|
|
29
6
|
else if (typeof define === "function" && define.amd) {
|
|
30
|
-
define(["require", "exports"], factory);
|
|
7
|
+
define(["require", "exports", "./CanvasMaskPlugin.js"], factory);
|
|
31
8
|
}
|
|
32
9
|
})(function (require, exports) {
|
|
33
10
|
"use strict";
|
|
34
|
-
var __syncRequire = typeof module === "object" && typeof module.exports === "object";
|
|
35
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.loadCanvasMaskPlugin =
|
|
12
|
+
exports.loadCanvasMaskPlugin = loadCanvasMaskPlugin;
|
|
13
|
+
const CanvasMaskPlugin_js_1 = require("./CanvasMaskPlugin.js");
|
|
37
14
|
async function loadCanvasMaskPlugin(engine, refresh = true) {
|
|
38
|
-
|
|
39
|
-
await engine.addPlugin(new CanvasMaskPlugin(), refresh);
|
|
15
|
+
await engine.addPlugin(new CanvasMaskPlugin_js_1.CanvasMaskPlugin(), refresh);
|
|
40
16
|
}
|
|
41
|
-
exports.loadCanvasMaskPlugin = loadCanvasMaskPlugin;
|
|
42
17
|
});
|
package/umd/utils.js
CHANGED
|
@@ -9,7 +9,10 @@
|
|
|
9
9
|
})(function (require, exports) {
|
|
10
10
|
"use strict";
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
12
|
+
exports.addParticlesFromCanvasPixels = addParticlesFromCanvasPixels;
|
|
13
|
+
exports.getCanvasImageData = getCanvasImageData;
|
|
14
|
+
exports.getImageData = getImageData;
|
|
15
|
+
exports.getTextData = getTextData;
|
|
13
16
|
const engine_1 = require("@tsparticles/engine");
|
|
14
17
|
const half = 0.5, origin = {
|
|
15
18
|
x: 0,
|
|
@@ -48,7 +51,6 @@
|
|
|
48
51
|
selectedPixels++;
|
|
49
52
|
}
|
|
50
53
|
}
|
|
51
|
-
exports.addParticlesFromCanvasPixels = addParticlesFromCanvasPixels;
|
|
52
54
|
function getCanvasImageData(ctx, size, offset, clear = true) {
|
|
53
55
|
const imageData = ctx.getImageData(origin.x, origin.y, size.width, size.height).data;
|
|
54
56
|
if (clear) {
|
|
@@ -78,11 +80,10 @@
|
|
|
78
80
|
}
|
|
79
81
|
return {
|
|
80
82
|
pixels,
|
|
81
|
-
width: Math.min(...pixels.map(
|
|
83
|
+
width: Math.min(...pixels.map(row => row.length)),
|
|
82
84
|
height: pixels.length,
|
|
83
85
|
};
|
|
84
86
|
}
|
|
85
|
-
exports.getCanvasImageData = getCanvasImageData;
|
|
86
87
|
function getImageData(src, offset) {
|
|
87
88
|
const image = new Image();
|
|
88
89
|
image.crossOrigin = "Anonymous";
|
|
@@ -103,7 +104,6 @@
|
|
|
103
104
|
image.src = src;
|
|
104
105
|
return p;
|
|
105
106
|
}
|
|
106
|
-
exports.getImageData = getImageData;
|
|
107
107
|
function getTextData(textOptions, offset) {
|
|
108
108
|
const canvas = document.createElement("canvas"), context = canvas.getContext("2d"), { font, text, lines: linesOptions, color } = textOptions;
|
|
109
109
|
if (!text || !context) {
|
|
@@ -134,7 +134,6 @@
|
|
|
134
134
|
}
|
|
135
135
|
return getCanvasImageData(context, canvas, offset);
|
|
136
136
|
}
|
|
137
|
-
exports.getTextData = getTextData;
|
|
138
137
|
function shuffle(array) {
|
|
139
138
|
const lengthOffset = 1, minIndex = 0;
|
|
140
139
|
for (let currentIndex = array.length - lengthOffset; currentIndex >= minIndex; currentIndex--) {
|
package/437.min.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/*! For license information please see 437.min.js.LICENSE.txt */
|
|
2
|
-
(this.webpackChunk_tsparticles_plugin_canvas_mask=this.webpackChunk_tsparticles_plugin_canvas_mask||[]).push([[437],{437:(t,e,n)=>{n.d(e,{CanvasMaskInstance:()=>c});var i=n(303);const o={x:0,y:0};function a(t,e,n,o,a,s){const{height:c,width:h}=e,l=c*h,u=function(t){const e=1,n=0;for(let o=t.length-e;o>=n;o--){const e=Math.floor((0,i.getRandom)()*o);[t[o],t[e]]=[t[e],t[o]]}return t}(r(l)),g=Math.min(l,t.actualOptions.particles.number.value),f=t.canvas.size;let x=0;const d=f.width*n.x/i.percentDenominator-h*o*.5,m=f.height*n.y/i.percentDenominator-c*o*.5;for(;x<g&&u.length;){const n=0,i=u.pop()??n,r={x:i%h,y:Math.floor(i/h)},c=e.pixels[r.y][r.x];if(!s(c))continue;const l={x:r.x*o+d,y:r.y*o+m},g={};a.color&&(g.color={value:c}),a.opacity&&(g.opacity={value:c.a}),t.particles.addParticle(l,g),x++}}function s(t,e,n,i=!0){const a=t.getImageData(o.x,o.y,e.width,e.height).data;i&&t.clearRect(o.x,o.y,e.width,e.height);const s=[];for(let t=0;t<a.length;t+=n){const i=t/n,o={x:i%e.width,y:Math.floor(i/e.width)};s[o.y]||(s[o.y]=[]);const r={r:0,g:1,b:2,a:3},c=255;s[o.y][o.x]={r:a[t+r.r],g:a[t+r.g],b:a[t+r.b],a:a[t+r.a]/c}}return{pixels:s,width:Math.min(...s.map((t=>t.length))),height:s.length}}const r=t=>[...Array(t).keys()];class c{constructor(t){this._container=t}async init(){const t=this._container,e=t.actualOptions.canvasMask;if(!e?.enable)return;let n={pixels:[],height:0,width:0};const r=e.pixels.offset;if(e.image){const t=e.image.src;if(!t)return;n=await function(t,e){const n=new Image;n.crossOrigin="Anonymous";const a=new Promise(((t,a)=>{n.onerror=a,n.onload=()=>{const r=document.createElement("canvas");r.width=n.width,r.height=n.height;const c=r.getContext("2d");if(!c)return a(new Error(`${i.errorPrefix} Could not get canvas context`));c.drawImage(n,o.x,o.y,n.width,n.height,o.x,o.y,r.width,r.height),t(s(c,r,e))}}));return n.src=t,a}(t,r)}else if(e.text){const t=function(t,e){const n=document.createElement("canvas"),a=n.getContext("2d"),{font:r,text:c,lines:h,color:l}=t;if(!c||!a)return;const u=c.split(h.separator),g=(0,i.isNumber)(r.size)?`${r.size}px`:r.size,f=[];let x=0,d=0;for(const t of u){a.font=`${r.style??""} ${r.variant??""} ${r.weight??""} ${g} ${r.family}`;const e=a.measureText(t),n={measure:e,text:t,height:e.actualBoundingBoxAscent+e.actualBoundingBoxDescent,width:e.width};x=Math.max(x||0,n.width),d+=n.height+h.spacing,f.push(n)}n.width=x,n.height=d;let m=0;for(const t of f)a.font=`${r.style??""} ${r.variant??""} ${r.weight??""} ${g} ${r.family}`,a.fillStyle=l,a.fillText(t.text,o.x,m+t.measure.actualBoundingBoxAscent),m+=t.height+h.spacing;return s(a,n,e)}(e.text,r);if(!t)return;n=t}else if(e.element??e.selector){const t=e.element??(e.selector&&document.querySelector(e.selector));if(!t)return;const i=t.getContext("2d");if(!i)return;n=s(i,t,r)}a(t,n,e.position,e.scale,e.override,e.pixels.filter)}}}}]);
|
package/437.min.js.LICENSE.txt
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/*! tsParticles Canvas Mask Plugin v3.3.0 by Matteo Bruni */
|
package/871.min.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/*! For license information please see 871.min.js.LICENSE.txt */
|
|
2
|
-
(this.webpackChunk_tsparticles_plugin_canvas_mask=this.webpackChunk_tsparticles_plugin_canvas_mask||[]).push([[871],{871:(s,i,t)=>{t.d(i,{CanvasMaskPlugin:()=>d});class e{constructor(){this.color=!0,this.opacity=!1}load(s){s&&(void 0!==s.color&&(this.color=s.color),void 0!==s.opacity&&(this.opacity=s.opacity))}}var o=t(303);class a{constructor(){this.filter=s=>s.a>0,this.offset=4}load(s){if(s){if(void 0!==s.filter)if((0,o.isString)(s.filter)){if(Object.hasOwn(window,s.filter)){const i=window[s.filter];(0,o.isFunction)(i)&&(this.filter=i)}}else this.filter=s.filter;void 0!==s.offset&&(this.offset=s.offset)}}}class n{constructor(){this.src=""}load(s){s&&void 0!==s.src&&(this.src=s.src)}}class l{constructor(){this.family="sans-serif",this.size=100}load(s){s&&(void 0!==s.family&&(this.family=s.family),void 0!==s.size&&(this.size=s.size),void 0!==s.style&&(this.style=s.style),void 0!==s.variant&&(this.variant=s.variant),void 0!==s.weight&&(this.weight=s.weight))}}class c{constructor(){this.separator="\n",this.spacing=10}load(s){s&&(void 0!==s.separator&&(this.separator=s.separator),void 0!==s.spacing&&(this.spacing=s.spacing))}}class r{constructor(){this.color="#000000",this.font=new l,this.lines=new c,this.text=""}load(s){s&&(void 0!==s.color&&(this.color=s.color),this.font.load(s.font),this.lines.load(s.lines),void 0!==s.text&&(this.text=s.text))}}class h{constructor(){this.enable=!1,this.override=new e,this.pixels=new a,this.position={x:50,y:50},this.scale=1}load(s){s&&(void 0!==s.element&&s.element instanceof HTMLCanvasElement&&(this.element=s.element),void 0!==s.enable&&(this.enable=s.enable),s.image&&(this.image||(this.image=new n),this.image.load(s.image)),this.pixels.load(s.pixels),s.position&&(this.position={x:s.position.x??this.position.x,y:s.position.y??this.position.y}),this.override.load(s.override),void 0!==s.scale&&(this.scale=s.scale),void 0!==s.selector&&(this.selector=s.selector),s.text&&(this.text||(this.text=new r),this.text.load(s.text)))}}class d{constructor(){this.id="canvasMask"}async getPlugin(s){const{CanvasMaskInstance:i}=await t.e(437).then(t.bind(t,437));return new i(s)}loadOptions(s,i){if(!this.needsPlugin(s)&&!this.needsPlugin(i))return;let t=s.canvasMask;void 0===t?.load&&(s.canvasMask=t=new h),t.load(i?.canvasMask)}needsPlugin(s){return s?.canvasMask?.enable??!1}}}}]);
|
package/871.min.js.LICENSE.txt
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/*! tsParticles Canvas Mask Plugin v3.3.0 by Matteo Bruni */
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Author : Matteo Bruni
|
|
3
|
-
* MIT license: https://opensource.org/licenses/MIT
|
|
4
|
-
* Demo / Generator : https://particles.js.org/
|
|
5
|
-
* GitHub : https://www.github.com/matteobruni/tsparticles
|
|
6
|
-
* How to use? : Check the GitHub README
|
|
7
|
-
* v3.3.0
|
|
8
|
-
*/
|
|
9
|
-
"use strict";
|
|
10
|
-
/*
|
|
11
|
-
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
|
12
|
-
* This devtool is neither made for production nor for readable output files.
|
|
13
|
-
* It uses "eval()" calls to create a separate source file in the browser devtools.
|
|
14
|
-
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
|
|
15
|
-
* or disable the default devtool with "devtool: false".
|
|
16
|
-
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
|
|
17
|
-
*/
|
|
18
|
-
(this["webpackChunk_tsparticles_plugin_canvas_mask"] = this["webpackChunk_tsparticles_plugin_canvas_mask"] || []).push([["dist_browser_CanvasMaskInstance_js"],{
|
|
19
|
-
|
|
20
|
-
/***/ "./dist/browser/CanvasMaskInstance.js":
|
|
21
|
-
/*!********************************************!*\
|
|
22
|
-
!*** ./dist/browser/CanvasMaskInstance.js ***!
|
|
23
|
-
\********************************************/
|
|
24
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
25
|
-
|
|
26
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CanvasMaskInstance: () => (/* binding */ CanvasMaskInstance)\n/* harmony export */ });\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils.js */ \"./dist/browser/utils.js\");\n\nclass CanvasMaskInstance {\n constructor(container) {\n this._container = container;\n }\n async init() {\n const container = this._container,\n options = container.actualOptions.canvasMask;\n if (!options?.enable) {\n return;\n }\n let pixelData = {\n pixels: [],\n height: 0,\n width: 0\n };\n const offset = options.pixels.offset;\n if (options.image) {\n const url = options.image.src;\n if (!url) {\n return;\n }\n pixelData = await (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.getImageData)(url, offset);\n } else if (options.text) {\n const textOptions = options.text;\n const data = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.getTextData)(textOptions, offset);\n if (!data) {\n return;\n }\n pixelData = data;\n } else if (options.element ?? options.selector) {\n const canvas = options.element ?? (options.selector && document.querySelector(options.selector));\n if (!canvas) {\n return;\n }\n const context = canvas.getContext(\"2d\");\n if (!context) {\n return;\n }\n pixelData = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.getCanvasImageData)(context, canvas, offset);\n }\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.addParticlesFromCanvasPixels)(container, pixelData, options.position, options.scale, options.override, options.pixels.filter);\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-canvas-mask/./dist/browser/CanvasMaskInstance.js?");
|
|
27
|
-
|
|
28
|
-
/***/ }),
|
|
29
|
-
|
|
30
|
-
/***/ "./dist/browser/utils.js":
|
|
31
|
-
/*!*******************************!*\
|
|
32
|
-
!*** ./dist/browser/utils.js ***!
|
|
33
|
-
\*******************************/
|
|
34
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
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 */ getCanvasImageData: () => (/* binding */ getCanvasImageData),\n/* harmony export */ getImageData: () => (/* binding */ getImageData),\n/* harmony export */ getTextData: () => (/* binding */ getTextData)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n\nconst half = 0.5,\n origin = {\n x: 0,\n y: 0\n },\n defaultWidth = 0;\nfunction addParticlesFromCanvasPixels(container, data, position, scale, override, filter) {\n const {\n height,\n width\n } = data,\n numPixels = height * width,\n indexArray = shuffle(range(numPixels)),\n maxParticles = Math.min(numPixels, container.actualOptions.particles.number.value),\n 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 * half,\n y: canvasSize.height * position.y / _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.percentDenominator - height * scale * half\n };\n while (selectedPixels < maxParticles && indexArray.length) {\n const defaultIndex = 0,\n nextIndex = indexArray.pop() ?? defaultIndex,\n pixelPos = {\n x: nextIndex % width,\n y: Math.floor(nextIndex / width)\n },\n pixel = data.pixels[pixelPos.y][pixelPos.x],\n 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 },\n pOptions = {};\n if (override.color) {\n pOptions.color = {\n value: pixel\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 getCanvasImageData(ctx, size, offset, clear = true) {\n const imageData = ctx.getImageData(origin.x, origin.y, size.width, size.height).data;\n if (clear) {\n ctx.clearRect(origin.x, origin.y, size.width, size.height);\n }\n const pixels = [];\n for (let i = 0; i < imageData.length; i += offset) {\n const idx = i / offset,\n pos = {\n x: idx % size.width,\n y: Math.floor(idx / size.width)\n };\n if (!pixels[pos.y]) {\n pixels[pos.y] = [];\n }\n const indexesOffset = {\n r: 0,\n g: 1,\n b: 2,\n a: 3\n },\n alphaFactor = 255;\n pixels[pos.y][pos.x] = {\n r: imageData[i + indexesOffset.r],\n g: imageData[i + indexesOffset.g],\n b: imageData[i + indexesOffset.b],\n a: imageData[i + indexesOffset.a] / alphaFactor\n };\n }\n return {\n pixels,\n width: Math.min(...pixels.map(row => row.length)),\n height: pixels.length\n };\n}\nfunction getImageData(src, offset) {\n const image = new Image();\n image.crossOrigin = \"Anonymous\";\n const p = new Promise((resolve, reject) => {\n image.onerror = reject;\n image.onload = () => {\n const canvas = document.createElement(\"canvas\");\n canvas.width = image.width;\n canvas.height = image.height;\n const context = canvas.getContext(\"2d\");\n if (!context) {\n return reject(new Error(`${_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.errorPrefix} Could not get canvas context`));\n }\n context.drawImage(image, origin.x, origin.y, image.width, image.height, origin.x, origin.y, canvas.width, canvas.height);\n resolve(getCanvasImageData(context, canvas, offset));\n };\n });\n image.src = src;\n return p;\n}\nfunction getTextData(textOptions, offset) {\n const canvas = document.createElement(\"canvas\"),\n context = canvas.getContext(\"2d\"),\n {\n font,\n text,\n lines: linesOptions,\n color\n } = textOptions;\n if (!text || !context) {\n return;\n }\n const lines = text.split(linesOptions.separator),\n fontSize = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNumber)(font.size) ? `${font.size}px` : font.size,\n linesData = [];\n let maxWidth = 0,\n totalHeight = 0;\n for (const line of lines) {\n context.font = `${font.style ?? \"\"} ${font.variant ?? \"\"} ${font.weight ?? \"\"} ${fontSize} ${font.family}`;\n const measure = context.measureText(line),\n lineData = {\n measure,\n text: line,\n height: measure.actualBoundingBoxAscent + measure.actualBoundingBoxDescent,\n width: measure.width\n };\n maxWidth = Math.max(maxWidth || defaultWidth, lineData.width);\n totalHeight += lineData.height + linesOptions.spacing;\n linesData.push(lineData);\n }\n canvas.width = maxWidth;\n canvas.height = totalHeight;\n let currentHeight = 0;\n for (const line of linesData) {\n context.font = `${font.style ?? \"\"} ${font.variant ?? \"\"} ${font.weight ?? \"\"} ${fontSize} ${font.family}`;\n context.fillStyle = color;\n context.fillText(line.text, origin.x, currentHeight + line.measure.actualBoundingBoxAscent);\n currentHeight += line.height + linesOptions.spacing;\n }\n return getCanvasImageData(context, canvas, offset);\n}\nfunction shuffle(array) {\n const lengthOffset = 1,\n 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);\n [array[currentIndex], array[randomIndex]] = [array[randomIndex], array[currentIndex]];\n }\n return array;\n}\nconst range = n => [...Array(n).keys()];\n\n//# sourceURL=webpack://@tsparticles/plugin-canvas-mask/./dist/browser/utils.js?");
|
|
37
|
-
|
|
38
|
-
/***/ })
|
|
39
|
-
|
|
40
|
-
}]);
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Author : Matteo Bruni
|
|
3
|
-
* MIT license: https://opensource.org/licenses/MIT
|
|
4
|
-
* Demo / Generator : https://particles.js.org/
|
|
5
|
-
* GitHub : https://www.github.com/matteobruni/tsparticles
|
|
6
|
-
* How to use? : Check the GitHub README
|
|
7
|
-
* v3.3.0
|
|
8
|
-
*/
|
|
9
|
-
"use strict";
|
|
10
|
-
/*
|
|
11
|
-
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
|
12
|
-
* This devtool is neither made for production nor for readable output files.
|
|
13
|
-
* It uses "eval()" calls to create a separate source file in the browser devtools.
|
|
14
|
-
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
|
|
15
|
-
* or disable the default devtool with "devtool: false".
|
|
16
|
-
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
|
|
17
|
-
*/
|
|
18
|
-
(this["webpackChunk_tsparticles_plugin_canvas_mask"] = this["webpackChunk_tsparticles_plugin_canvas_mask"] || []).push([["dist_browser_CanvasMaskPlugin_js"],{
|
|
19
|
-
|
|
20
|
-
/***/ "./dist/browser/CanvasMaskPlugin.js":
|
|
21
|
-
/*!******************************************!*\
|
|
22
|
-
!*** ./dist/browser/CanvasMaskPlugin.js ***!
|
|
23
|
-
\******************************************/
|
|
24
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
25
|
-
|
|
26
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CanvasMaskPlugin: () => (/* binding */ CanvasMaskPlugin)\n/* harmony export */ });\n/* harmony import */ var _Options_Classes_CanvasMask_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Options/Classes/CanvasMask.js */ \"./dist/browser/Options/Classes/CanvasMask.js\");\n\nclass CanvasMaskPlugin {\n constructor() {\n this.id = \"canvasMask\";\n }\n async getPlugin(container) {\n const {\n CanvasMaskInstance\n } = await __webpack_require__.e(/*! import() */ \"dist_browser_CanvasMaskInstance_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./CanvasMaskInstance.js */ \"./dist/browser/CanvasMaskInstance.js\"));\n return new CanvasMaskInstance(container);\n }\n loadOptions(options, source) {\n if (!this.needsPlugin(options) && !this.needsPlugin(source)) {\n return;\n }\n let canvasMaskOptions = options.canvasMask;\n if (canvasMaskOptions?.load === undefined) {\n options.canvasMask = canvasMaskOptions = new _Options_Classes_CanvasMask_js__WEBPACK_IMPORTED_MODULE_0__.CanvasMask();\n }\n canvasMaskOptions.load(source?.canvasMask);\n }\n needsPlugin(options) {\n return options?.canvasMask?.enable ?? false;\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-canvas-mask/./dist/browser/CanvasMaskPlugin.js?");
|
|
27
|
-
|
|
28
|
-
/***/ }),
|
|
29
|
-
|
|
30
|
-
/***/ "./dist/browser/Options/Classes/CanvasMask.js":
|
|
31
|
-
/*!****************************************************!*\
|
|
32
|
-
!*** ./dist/browser/Options/Classes/CanvasMask.js ***!
|
|
33
|
-
\****************************************************/
|
|
34
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
35
|
-
|
|
36
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CanvasMask: () => (/* binding */ CanvasMask)\n/* harmony export */ });\n/* harmony import */ var _CanvasMaskOverride_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./CanvasMaskOverride.js */ \"./dist/browser/Options/Classes/CanvasMaskOverride.js\");\n/* harmony import */ var _CanvasMaskPixels_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./CanvasMaskPixels.js */ \"./dist/browser/Options/Classes/CanvasMaskPixels.js\");\n/* harmony import */ var _ImageMask_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ImageMask.js */ \"./dist/browser/Options/Classes/ImageMask.js\");\n/* harmony import */ var _TextMask_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./TextMask.js */ \"./dist/browser/Options/Classes/TextMask.js\");\n\n\n\n\nclass CanvasMask {\n constructor() {\n this.enable = false;\n this.override = new _CanvasMaskOverride_js__WEBPACK_IMPORTED_MODULE_0__.CanvasMaskOverride();\n this.pixels = new _CanvasMaskPixels_js__WEBPACK_IMPORTED_MODULE_1__.CanvasMaskPixels();\n this.position = {\n x: 50,\n y: 50\n };\n this.scale = 1;\n }\n load(data) {\n if (!data) {\n return;\n }\n if (data.element !== undefined && data.element instanceof HTMLCanvasElement) {\n this.element = data.element;\n }\n if (data.enable !== undefined) {\n this.enable = data.enable;\n }\n if (data.image) {\n if (!this.image) {\n this.image = new _ImageMask_js__WEBPACK_IMPORTED_MODULE_2__.ImageMask();\n }\n this.image.load(data.image);\n }\n this.pixels.load(data.pixels);\n if (data.position) {\n this.position = {\n x: data.position.x ?? this.position.x,\n y: data.position.y ?? this.position.y\n };\n }\n this.override.load(data.override);\n if (data.scale !== undefined) {\n this.scale = data.scale;\n }\n if (data.selector !== undefined) {\n this.selector = data.selector;\n }\n if (data.text) {\n if (!this.text) {\n this.text = new _TextMask_js__WEBPACK_IMPORTED_MODULE_3__.TextMask();\n }\n this.text.load(data.text);\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-canvas-mask/./dist/browser/Options/Classes/CanvasMask.js?");
|
|
37
|
-
|
|
38
|
-
/***/ }),
|
|
39
|
-
|
|
40
|
-
/***/ "./dist/browser/Options/Classes/CanvasMaskOverride.js":
|
|
41
|
-
/*!************************************************************!*\
|
|
42
|
-
!*** ./dist/browser/Options/Classes/CanvasMaskOverride.js ***!
|
|
43
|
-
\************************************************************/
|
|
44
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
45
|
-
|
|
46
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CanvasMaskOverride: () => (/* binding */ CanvasMaskOverride)\n/* harmony export */ });\nclass CanvasMaskOverride {\n constructor() {\n this.color = true;\n this.opacity = false;\n }\n load(data) {\n if (!data) {\n return;\n }\n if (data.color !== undefined) {\n this.color = data.color;\n }\n if (data.opacity !== undefined) {\n this.opacity = data.opacity;\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-canvas-mask/./dist/browser/Options/Classes/CanvasMaskOverride.js?");
|
|
47
|
-
|
|
48
|
-
/***/ }),
|
|
49
|
-
|
|
50
|
-
/***/ "./dist/browser/Options/Classes/CanvasMaskPixels.js":
|
|
51
|
-
/*!**********************************************************!*\
|
|
52
|
-
!*** ./dist/browser/Options/Classes/CanvasMaskPixels.js ***!
|
|
53
|
-
\**********************************************************/
|
|
54
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
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/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n\nconst minAlpha = 0;\nclass CanvasMaskPixels {\n constructor() {\n this.filter = pixel => pixel.a > minAlpha;\n this.offset = 4;\n }\n load(data) {\n if (!data) {\n return;\n }\n if (data.filter !== undefined) {\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isString)(data.filter)) {\n if (Object.hasOwn(window, data.filter)) {\n const filter = window[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//# sourceURL=webpack://@tsparticles/plugin-canvas-mask/./dist/browser/Options/Classes/CanvasMaskPixels.js?");
|
|
57
|
-
|
|
58
|
-
/***/ }),
|
|
59
|
-
|
|
60
|
-
/***/ "./dist/browser/Options/Classes/FontTextMask.js":
|
|
61
|
-
/*!******************************************************!*\
|
|
62
|
-
!*** ./dist/browser/Options/Classes/FontTextMask.js ***!
|
|
63
|
-
\******************************************************/
|
|
64
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
65
|
-
|
|
66
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ FontTextMask: () => (/* binding */ FontTextMask)\n/* harmony export */ });\nclass FontTextMask {\n constructor() {\n this.family = \"sans-serif\";\n this.size = 100;\n }\n load(data) {\n if (!data) {\n return;\n }\n if (data.family !== undefined) {\n this.family = data.family;\n }\n if (data.size !== undefined) {\n this.size = data.size;\n }\n if (data.style !== undefined) {\n this.style = data.style;\n }\n if (data.variant !== undefined) {\n this.variant = data.variant;\n }\n if (data.weight !== undefined) {\n this.weight = data.weight;\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-canvas-mask/./dist/browser/Options/Classes/FontTextMask.js?");
|
|
67
|
-
|
|
68
|
-
/***/ }),
|
|
69
|
-
|
|
70
|
-
/***/ "./dist/browser/Options/Classes/ImageMask.js":
|
|
71
|
-
/*!***************************************************!*\
|
|
72
|
-
!*** ./dist/browser/Options/Classes/ImageMask.js ***!
|
|
73
|
-
\***************************************************/
|
|
74
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
75
|
-
|
|
76
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ImageMask: () => (/* binding */ ImageMask)\n/* harmony export */ });\nclass ImageMask {\n constructor() {\n this.src = \"\";\n }\n load(data) {\n if (!data) {\n return;\n }\n if (data.src !== undefined) {\n this.src = data.src;\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-canvas-mask/./dist/browser/Options/Classes/ImageMask.js?");
|
|
77
|
-
|
|
78
|
-
/***/ }),
|
|
79
|
-
|
|
80
|
-
/***/ "./dist/browser/Options/Classes/TextMask.js":
|
|
81
|
-
/*!**************************************************!*\
|
|
82
|
-
!*** ./dist/browser/Options/Classes/TextMask.js ***!
|
|
83
|
-
\**************************************************/
|
|
84
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
85
|
-
|
|
86
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ TextMask: () => (/* binding */ TextMask)\n/* harmony export */ });\n/* harmony import */ var _FontTextMask_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./FontTextMask.js */ \"./dist/browser/Options/Classes/FontTextMask.js\");\n/* harmony import */ var _TextMaskLine_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./TextMaskLine.js */ \"./dist/browser/Options/Classes/TextMaskLine.js\");\n\n\nclass TextMask {\n constructor() {\n this.color = \"#000000\";\n this.font = new _FontTextMask_js__WEBPACK_IMPORTED_MODULE_0__.FontTextMask();\n this.lines = new _TextMaskLine_js__WEBPACK_IMPORTED_MODULE_1__.TextMaskLine();\n this.text = \"\";\n }\n load(data) {\n if (!data) {\n return;\n }\n if (data.color !== undefined) {\n this.color = data.color;\n }\n this.font.load(data.font);\n this.lines.load(data.lines);\n if (data.text !== undefined) {\n this.text = data.text;\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-canvas-mask/./dist/browser/Options/Classes/TextMask.js?");
|
|
87
|
-
|
|
88
|
-
/***/ }),
|
|
89
|
-
|
|
90
|
-
/***/ "./dist/browser/Options/Classes/TextMaskLine.js":
|
|
91
|
-
/*!******************************************************!*\
|
|
92
|
-
!*** ./dist/browser/Options/Classes/TextMaskLine.js ***!
|
|
93
|
-
\******************************************************/
|
|
94
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
95
|
-
|
|
96
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ TextMaskLine: () => (/* binding */ TextMaskLine)\n/* harmony export */ });\nclass TextMaskLine {\n constructor() {\n this.separator = \"\\n\";\n this.spacing = 10;\n }\n load(data) {\n if (!data) {\n return;\n }\n if (data.separator !== undefined) {\n this.separator = data.separator;\n }\n if (data.spacing !== undefined) {\n this.spacing = data.spacing;\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-canvas-mask/./dist/browser/Options/Classes/TextMaskLine.js?");
|
|
97
|
-
|
|
98
|
-
/***/ })
|
|
99
|
-
|
|
100
|
-
}]);
|