@tsparticles/plugin-emitters-shape-canvas 3.2.2 → 3.4.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/EmittersCanvasShape.js +4 -4
- package/browser/index.js +2 -1
- package/browser/utils.js +1 -1
- package/cjs/EmittersCanvasShape.js +4 -4
- package/cjs/index.js +3 -25
- package/cjs/utils.js +1 -1
- package/esm/EmittersCanvasShape.js +4 -4
- package/esm/index.js +2 -1
- package/esm/utils.js +1 -1
- package/package.json +3 -3
- package/report.html +1 -1
- package/tsparticles.plugin.emitters.shape.canvas.js +82 -200
- package/tsparticles.plugin.emitters.shape.canvas.min.js +1 -1
- package/tsparticles.plugin.emitters.shape.canvas.min.js.LICENSE.txt +1 -1
- package/types/EmittersCanvasShape.d.ts +1 -1
- package/umd/EmittersCanvasShape.js +4 -4
- package/umd/index.js +4 -27
- package/umd/utils.js +1 -1
- package/720.min.js +0 -2
- package/720.min.js.LICENSE.txt +0 -1
- package/dist_browser_EmittersCanvasShapeGenerator_js.js +0 -100
|
@@ -61,7 +61,7 @@ export class EmittersCanvasShape extends EmitterShapeBase {
|
|
|
61
61
|
}
|
|
62
62
|
this.pixelData = pixelData;
|
|
63
63
|
}
|
|
64
|
-
|
|
64
|
+
randomPosition() {
|
|
65
65
|
const { height, width } = this.pixelData, data = this.pixelData, position = this.position, scale = this.scale, positionOffset = {
|
|
66
66
|
x: position.x - width * scale * half,
|
|
67
67
|
y: position.y - height * scale * half,
|
|
@@ -74,16 +74,16 @@ export class EmittersCanvasShape extends EmitterShapeBase {
|
|
|
74
74
|
if (!shouldCreateParticle) {
|
|
75
75
|
continue;
|
|
76
76
|
}
|
|
77
|
-
return
|
|
77
|
+
return {
|
|
78
78
|
position: {
|
|
79
79
|
x: pixelPos.x * scale + positionOffset.x,
|
|
80
80
|
y: pixelPos.y * scale + positionOffset.y,
|
|
81
81
|
},
|
|
82
82
|
color: { ...pixel },
|
|
83
83
|
opacity: pixel.a,
|
|
84
|
-
}
|
|
84
|
+
};
|
|
85
85
|
}
|
|
86
|
-
return
|
|
86
|
+
return null;
|
|
87
87
|
}
|
|
88
88
|
resize(position, size) {
|
|
89
89
|
super.resize(position, size);
|
package/browser/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { EmittersCanvasShapeGenerator } from "./EmittersCanvasShapeGenerator.js";
|
|
1
2
|
export async function loadEmittersShapeCanvas(engine, refresh = true) {
|
|
2
|
-
const emittersEngine = engine
|
|
3
|
+
const emittersEngine = engine;
|
|
3
4
|
emittersEngine.addEmitterShapeGenerator?.("canvas", new EmittersCanvasShapeGenerator());
|
|
4
5
|
await emittersEngine.refresh(refresh);
|
|
5
6
|
}
|
package/browser/utils.js
CHANGED
|
@@ -64,7 +64,7 @@ class EmittersCanvasShape extends plugin_emitters_1.EmitterShapeBase {
|
|
|
64
64
|
}
|
|
65
65
|
this.pixelData = pixelData;
|
|
66
66
|
}
|
|
67
|
-
|
|
67
|
+
randomPosition() {
|
|
68
68
|
const { height, width } = this.pixelData, data = this.pixelData, position = this.position, scale = this.scale, positionOffset = {
|
|
69
69
|
x: position.x - width * scale * half,
|
|
70
70
|
y: position.y - height * scale * half,
|
|
@@ -77,16 +77,16 @@ class EmittersCanvasShape extends plugin_emitters_1.EmitterShapeBase {
|
|
|
77
77
|
if (!shouldCreateParticle) {
|
|
78
78
|
continue;
|
|
79
79
|
}
|
|
80
|
-
return
|
|
80
|
+
return {
|
|
81
81
|
position: {
|
|
82
82
|
x: pixelPos.x * scale + positionOffset.x,
|
|
83
83
|
y: pixelPos.y * scale + positionOffset.y,
|
|
84
84
|
},
|
|
85
85
|
color: { ...pixel },
|
|
86
86
|
opacity: pixel.a,
|
|
87
|
-
}
|
|
87
|
+
};
|
|
88
88
|
}
|
|
89
|
-
return
|
|
89
|
+
return null;
|
|
90
90
|
}
|
|
91
91
|
resize(position, size) {
|
|
92
92
|
super.resize(position, size);
|
package/cjs/index.js
CHANGED
|
@@ -1,32 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
3
|
exports.loadEmittersShapeCanvas = void 0;
|
|
4
|
+
const EmittersCanvasShapeGenerator_js_1 = require("./EmittersCanvasShapeGenerator.js");
|
|
27
5
|
async function loadEmittersShapeCanvas(engine, refresh = true) {
|
|
28
|
-
const emittersEngine = engine
|
|
29
|
-
emittersEngine.addEmitterShapeGenerator?.("canvas", new EmittersCanvasShapeGenerator());
|
|
6
|
+
const emittersEngine = engine;
|
|
7
|
+
emittersEngine.addEmitterShapeGenerator?.("canvas", new EmittersCanvasShapeGenerator_js_1.EmittersCanvasShapeGenerator());
|
|
30
8
|
await emittersEngine.refresh(refresh);
|
|
31
9
|
}
|
|
32
10
|
exports.loadEmittersShapeCanvas = loadEmittersShapeCanvas;
|
package/cjs/utils.js
CHANGED
|
@@ -61,7 +61,7 @@ export class EmittersCanvasShape extends EmitterShapeBase {
|
|
|
61
61
|
}
|
|
62
62
|
this.pixelData = pixelData;
|
|
63
63
|
}
|
|
64
|
-
|
|
64
|
+
randomPosition() {
|
|
65
65
|
const { height, width } = this.pixelData, data = this.pixelData, position = this.position, scale = this.scale, positionOffset = {
|
|
66
66
|
x: position.x - width * scale * half,
|
|
67
67
|
y: position.y - height * scale * half,
|
|
@@ -74,16 +74,16 @@ export class EmittersCanvasShape extends EmitterShapeBase {
|
|
|
74
74
|
if (!shouldCreateParticle) {
|
|
75
75
|
continue;
|
|
76
76
|
}
|
|
77
|
-
return
|
|
77
|
+
return {
|
|
78
78
|
position: {
|
|
79
79
|
x: pixelPos.x * scale + positionOffset.x,
|
|
80
80
|
y: pixelPos.y * scale + positionOffset.y,
|
|
81
81
|
},
|
|
82
82
|
color: { ...pixel },
|
|
83
83
|
opacity: pixel.a,
|
|
84
|
-
}
|
|
84
|
+
};
|
|
85
85
|
}
|
|
86
|
-
return
|
|
86
|
+
return null;
|
|
87
87
|
}
|
|
88
88
|
resize(position, size) {
|
|
89
89
|
super.resize(position, size);
|
package/esm/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { EmittersCanvasShapeGenerator } from "./EmittersCanvasShapeGenerator.js";
|
|
1
2
|
export async function loadEmittersShapeCanvas(engine, refresh = true) {
|
|
2
|
-
const emittersEngine = engine
|
|
3
|
+
const emittersEngine = engine;
|
|
3
4
|
emittersEngine.addEmitterShapeGenerator?.("canvas", new EmittersCanvasShapeGenerator());
|
|
4
5
|
await emittersEngine.refresh(refresh);
|
|
5
6
|
}
|
package/esm/utils.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/plugin-emitters-shape-canvas",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.4.0",
|
|
4
4
|
"description": "tsParticles emitters shape canvas plugin",
|
|
5
5
|
"homepage": "https://particles.js.org",
|
|
6
6
|
"repository": {
|
|
@@ -100,8 +100,8 @@
|
|
|
100
100
|
"./package.json": "./package.json"
|
|
101
101
|
},
|
|
102
102
|
"dependencies": {
|
|
103
|
-
"@tsparticles/engine": "^3.
|
|
104
|
-
"@tsparticles/plugin-emitters": "^3.
|
|
103
|
+
"@tsparticles/engine": "^3.4.0",
|
|
104
|
+
"@tsparticles/plugin-emitters": "^3.4.0"
|
|
105
105
|
},
|
|
106
106
|
"publishConfig": {
|
|
107
107
|
"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-emitters-shape-canvas [
|
|
6
|
+
<title>@tsparticles/plugin-emitters-shape-canvas [13 May 2024 at 00:16]</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.4.0
|
|
8
8
|
*/
|
|
9
9
|
/*
|
|
10
10
|
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
|
@@ -28,13 +28,93 @@ return /******/ (() => { // webpackBootstrap
|
|
|
28
28
|
/******/ "use strict";
|
|
29
29
|
/******/ var __webpack_modules__ = ({
|
|
30
30
|
|
|
31
|
+
/***/ "./dist/browser/EmittersCanvasShape.js":
|
|
32
|
+
/*!*********************************************!*\
|
|
33
|
+
!*** ./dist/browser/EmittersCanvasShape.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 */ EmittersCanvasShape: () => (/* binding */ EmittersCanvasShape)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_plugin_emitters__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/plugin-emitters */ \"@tsparticles/plugin-emitters\");\n/* harmony import */ var _tsparticles_plugin_emitters__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_plugin_emitters__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils.js */ \"./dist/browser/utils.js\");\n\n\n\nconst maxRetries = 100,\n half = 0.5;\nclass EmittersCanvasShape extends _tsparticles_plugin_emitters__WEBPACK_IMPORTED_MODULE_0__.EmitterShapeBase {\n constructor(position, size, fill, options) {\n super(position, size, fill, options);\n const filter = options.filter,\n minAlpha = 0;\n let filterFunc = pixel => pixel.a > minAlpha;\n if (filter !== undefined) {\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.isString)(filter)) {\n if (Object.hasOwn(window, filter)) {\n const wndFilter = window[filter];\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.isFunction)(wndFilter)) {\n filterFunc = wndFilter;\n }\n }\n } else {\n filterFunc = filter;\n }\n }\n this.filter = filterFunc;\n this.scale = options.scale;\n this.pixelData = {\n pixels: [],\n height: 0,\n width: 0\n };\n }\n async init() {\n let pixelData;\n const options = this.options,\n selector = options.selector,\n pixels = options.pixels,\n image = options.image,\n element = options.element,\n text = options.text,\n offset = pixels.offset;\n if (image) {\n const url = image.src;\n if (!url) {\n return;\n }\n pixelData = await (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.getImageData)(url, offset);\n } else if (text) {\n const data = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.getTextData)(text, offset, this.fill);\n if (!data) {\n return;\n }\n pixelData = data;\n } else if (element ?? selector) {\n const canvas = element ?? (selector && document.querySelector(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_2__.getCanvasImageData)(context, canvas, offset);\n }\n if (!pixelData) {\n return;\n }\n this.pixelData = pixelData;\n }\n randomPosition() {\n const {\n height,\n width\n } = this.pixelData,\n data = this.pixelData,\n position = this.position,\n scale = this.scale,\n positionOffset = {\n x: position.x - width * scale * half,\n y: position.y - height * scale * half\n };\n for (let i = 0; i < maxRetries; i++) {\n const nextIndex = Math.floor((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.getRandom)() * width * height),\n pixelPos = {\n x: nextIndex % width,\n y: Math.floor(nextIndex / width)\n },\n pixel = data.pixels[pixelPos.y][pixelPos.x],\n shouldCreateParticle = this.filter(pixel);\n if (!shouldCreateParticle) {\n continue;\n }\n return {\n position: {\n x: pixelPos.x * scale + positionOffset.x,\n y: pixelPos.y * scale + positionOffset.y\n },\n color: {\n ...pixel\n },\n opacity: pixel.a\n };\n }\n return null;\n }\n resize(position, size) {\n super.resize(position, size);\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-emitters-shape-canvas/./dist/browser/EmittersCanvasShape.js?");
|
|
38
|
+
|
|
39
|
+
/***/ }),
|
|
40
|
+
|
|
41
|
+
/***/ "./dist/browser/EmittersCanvasShapeGenerator.js":
|
|
42
|
+
/*!******************************************************!*\
|
|
43
|
+
!*** ./dist/browser/EmittersCanvasShapeGenerator.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 */ EmittersCanvasShapeGenerator: () => (/* binding */ EmittersCanvasShapeGenerator)\n/* harmony export */ });\n/* harmony import */ var _EmittersCanvasShape_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./EmittersCanvasShape.js */ \"./dist/browser/EmittersCanvasShape.js\");\n/* harmony import */ var _Options_Classes_EmittersCanvasShapeOptions_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Options/Classes/EmittersCanvasShapeOptions.js */ \"./dist/browser/Options/Classes/EmittersCanvasShapeOptions.js\");\n\n\nclass EmittersCanvasShapeGenerator {\n generate(position, size, fill, options) {\n const shapeOptions = new _Options_Classes_EmittersCanvasShapeOptions_js__WEBPACK_IMPORTED_MODULE_0__.EmittersCanvasShapeOptions();\n shapeOptions.load(options);\n return new _EmittersCanvasShape_js__WEBPACK_IMPORTED_MODULE_1__.EmittersCanvasShape(position, size, fill, shapeOptions);\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-emitters-shape-canvas/./dist/browser/EmittersCanvasShapeGenerator.js?");
|
|
48
|
+
|
|
49
|
+
/***/ }),
|
|
50
|
+
|
|
51
|
+
/***/ "./dist/browser/Options/Classes/EmittersCanvasShapeOptions.js":
|
|
52
|
+
/*!********************************************************************!*\
|
|
53
|
+
!*** ./dist/browser/Options/Classes/EmittersCanvasShapeOptions.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 */ EmittersCanvasShapeOptions: () => (/* binding */ EmittersCanvasShapeOptions)\n/* harmony export */ });\n/* harmony import */ var _PixelsOptions_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./PixelsOptions.js */ \"./dist/browser/Options/Classes/PixelsOptions.js\");\n/* harmony import */ var _TextOptions_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./TextOptions.js */ \"./dist/browser/Options/Classes/TextOptions.js\");\n\n\nconst minAlpha = 0;\nclass EmittersCanvasShapeOptions {\n constructor() {\n this.filter = pixel => pixel.a > minAlpha;\n this.pixels = new _PixelsOptions_js__WEBPACK_IMPORTED_MODULE_0__.PixelsOptions();\n this.scale = 1;\n this.selector = \"\";\n this.text = new _TextOptions_js__WEBPACK_IMPORTED_MODULE_1__.TextOptions();\n }\n load(data) {\n if (!data) {\n return;\n }\n if (data.element !== undefined) {\n this.element = data.element;\n }\n if (data.filter !== undefined) {\n this.filter = data.filter;\n }\n this.pixels.load(data.pixels);\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.image !== undefined) {\n this.image = data.image;\n }\n this.text.load(data.text);\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-emitters-shape-canvas/./dist/browser/Options/Classes/EmittersCanvasShapeOptions.js?");
|
|
58
|
+
|
|
59
|
+
/***/ }),
|
|
60
|
+
|
|
61
|
+
/***/ "./dist/browser/Options/Classes/PixelsOptions.js":
|
|
62
|
+
/*!*******************************************************!*\
|
|
63
|
+
!*** ./dist/browser/Options/Classes/PixelsOptions.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 */ PixelsOptions: () => (/* binding */ PixelsOptions)\n/* harmony export */ });\nclass PixelsOptions {\n constructor() {\n this.offset = 4;\n }\n load(data) {\n if (!data) {\n return;\n }\n if (data.offset !== undefined) {\n this.offset = data.offset;\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-emitters-shape-canvas/./dist/browser/Options/Classes/PixelsOptions.js?");
|
|
68
|
+
|
|
69
|
+
/***/ }),
|
|
70
|
+
|
|
71
|
+
/***/ "./dist/browser/Options/Classes/TextFontOptions.js":
|
|
72
|
+
/*!*********************************************************!*\
|
|
73
|
+
!*** ./dist/browser/Options/Classes/TextFontOptions.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 */ TextFontOptions: () => (/* binding */ TextFontOptions)\n/* harmony export */ });\nclass TextFontOptions {\n constructor() {\n this.family = \"Verdana\";\n this.size = 32;\n this.style = \"\";\n this.variant = \"\";\n this.weight = \"\";\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-emitters-shape-canvas/./dist/browser/Options/Classes/TextFontOptions.js?");
|
|
78
|
+
|
|
79
|
+
/***/ }),
|
|
80
|
+
|
|
81
|
+
/***/ "./dist/browser/Options/Classes/TextLinesOptions.js":
|
|
82
|
+
/*!**********************************************************!*\
|
|
83
|
+
!*** ./dist/browser/Options/Classes/TextLinesOptions.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 */ TextLinesOptions: () => (/* binding */ TextLinesOptions)\n/* harmony export */ });\nclass TextLinesOptions {\n constructor() {\n this.separator = \"\\n\";\n this.spacing = 0;\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-emitters-shape-canvas/./dist/browser/Options/Classes/TextLinesOptions.js?");
|
|
88
|
+
|
|
89
|
+
/***/ }),
|
|
90
|
+
|
|
91
|
+
/***/ "./dist/browser/Options/Classes/TextOptions.js":
|
|
92
|
+
/*!*****************************************************!*\
|
|
93
|
+
!*** ./dist/browser/Options/Classes/TextOptions.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 */ TextOptions: () => (/* binding */ TextOptions)\n/* harmony export */ });\n/* harmony import */ var _TextFontOptions_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./TextFontOptions.js */ \"./dist/browser/Options/Classes/TextFontOptions.js\");\n/* harmony import */ var _TextLinesOptions_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./TextLinesOptions.js */ \"./dist/browser/Options/Classes/TextLinesOptions.js\");\n\n\nclass TextOptions {\n constructor() {\n this.color = \"#000000\";\n this.font = new _TextFontOptions_js__WEBPACK_IMPORTED_MODULE_0__.TextFontOptions();\n this.lines = new _TextLinesOptions_js__WEBPACK_IMPORTED_MODULE_1__.TextLinesOptions();\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-emitters-shape-canvas/./dist/browser/Options/Classes/TextOptions.js?");
|
|
98
|
+
|
|
99
|
+
/***/ }),
|
|
100
|
+
|
|
31
101
|
/***/ "./dist/browser/index.js":
|
|
32
102
|
/*!*******************************!*\
|
|
33
103
|
!*** ./dist/browser/index.js ***!
|
|
34
104
|
\*******************************/
|
|
35
105
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
36
106
|
|
|
37
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ loadEmittersShapeCanvas: () => (/* binding */ loadEmittersShapeCanvas)\n/* harmony export */ });\
|
|
107
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ loadEmittersShapeCanvas: () => (/* binding */ loadEmittersShapeCanvas)\n/* harmony export */ });\n/* harmony import */ var _EmittersCanvasShapeGenerator_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./EmittersCanvasShapeGenerator.js */ \"./dist/browser/EmittersCanvasShapeGenerator.js\");\n\nasync function loadEmittersShapeCanvas(engine, refresh = true) {\n const emittersEngine = engine;\n emittersEngine.addEmitterShapeGenerator?.(\"canvas\", new _EmittersCanvasShapeGenerator_js__WEBPACK_IMPORTED_MODULE_0__.EmittersCanvasShapeGenerator());\n await emittersEngine.refresh(refresh);\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-emitters-shape-canvas/./dist/browser/index.js?");
|
|
108
|
+
|
|
109
|
+
/***/ }),
|
|
110
|
+
|
|
111
|
+
/***/ "./dist/browser/utils.js":
|
|
112
|
+
/*!*******************************!*\
|
|
113
|
+
!*** ./dist/browser/utils.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 */ 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 origin = {\n x: 0,\n y: 0\n },\n minWidth = 0;\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, fill) {\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 || minWidth, 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 if (fill) {\n context.fillStyle = color;\n context.fillText(line.text, origin.x, currentHeight + line.measure.actualBoundingBoxAscent);\n } else {\n context.strokeStyle = color;\n context.strokeText(line.text, origin.x, currentHeight + line.measure.actualBoundingBoxAscent);\n }\n currentHeight += line.height + linesOptions.spacing;\n }\n return getCanvasImageData(context, canvas, offset);\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-emitters-shape-canvas/./dist/browser/utils.js?");
|
|
38
118
|
|
|
39
119
|
/***/ }),
|
|
40
120
|
|
|
@@ -84,9 +164,6 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_plugin_emitters__;
|
|
|
84
164
|
/******/ return module.exports;
|
|
85
165
|
/******/ }
|
|
86
166
|
/******/
|
|
87
|
-
/******/ // expose the modules object (__webpack_modules__)
|
|
88
|
-
/******/ __webpack_require__.m = __webpack_modules__;
|
|
89
|
-
/******/
|
|
90
167
|
/************************************************************************/
|
|
91
168
|
/******/ /* webpack/runtime/compat get default export */
|
|
92
169
|
/******/ (() => {
|
|
@@ -112,91 +189,11 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_plugin_emitters__;
|
|
|
112
189
|
/******/ };
|
|
113
190
|
/******/ })();
|
|
114
191
|
/******/
|
|
115
|
-
/******/ /* webpack/runtime/ensure chunk */
|
|
116
|
-
/******/ (() => {
|
|
117
|
-
/******/ __webpack_require__.f = {};
|
|
118
|
-
/******/ // This file contains only the entry chunk.
|
|
119
|
-
/******/ // The chunk loading function for additional chunks
|
|
120
|
-
/******/ __webpack_require__.e = (chunkId) => {
|
|
121
|
-
/******/ return Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {
|
|
122
|
-
/******/ __webpack_require__.f[key](chunkId, promises);
|
|
123
|
-
/******/ return promises;
|
|
124
|
-
/******/ }, []));
|
|
125
|
-
/******/ };
|
|
126
|
-
/******/ })();
|
|
127
|
-
/******/
|
|
128
|
-
/******/ /* webpack/runtime/get javascript chunk filename */
|
|
129
|
-
/******/ (() => {
|
|
130
|
-
/******/ // This function allow to reference async chunks
|
|
131
|
-
/******/ __webpack_require__.u = (chunkId) => {
|
|
132
|
-
/******/ // return url for filenames based on template
|
|
133
|
-
/******/ return "" + chunkId + ".js";
|
|
134
|
-
/******/ };
|
|
135
|
-
/******/ })();
|
|
136
|
-
/******/
|
|
137
|
-
/******/ /* webpack/runtime/global */
|
|
138
|
-
/******/ (() => {
|
|
139
|
-
/******/ __webpack_require__.g = (function() {
|
|
140
|
-
/******/ if (typeof globalThis === 'object') return globalThis;
|
|
141
|
-
/******/ try {
|
|
142
|
-
/******/ return this || new Function('return this')();
|
|
143
|
-
/******/ } catch (e) {
|
|
144
|
-
/******/ if (typeof window === 'object') return window;
|
|
145
|
-
/******/ }
|
|
146
|
-
/******/ })();
|
|
147
|
-
/******/ })();
|
|
148
|
-
/******/
|
|
149
192
|
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
150
193
|
/******/ (() => {
|
|
151
194
|
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
152
195
|
/******/ })();
|
|
153
196
|
/******/
|
|
154
|
-
/******/ /* webpack/runtime/load script */
|
|
155
|
-
/******/ (() => {
|
|
156
|
-
/******/ var inProgress = {};
|
|
157
|
-
/******/ var dataWebpackPrefix = "@tsparticles/plugin-emitters-shape-canvas:";
|
|
158
|
-
/******/ // loadScript function to load a script via script tag
|
|
159
|
-
/******/ __webpack_require__.l = (url, done, key, chunkId) => {
|
|
160
|
-
/******/ if(inProgress[url]) { inProgress[url].push(done); return; }
|
|
161
|
-
/******/ var script, needAttach;
|
|
162
|
-
/******/ if(key !== undefined) {
|
|
163
|
-
/******/ var scripts = document.getElementsByTagName("script");
|
|
164
|
-
/******/ for(var i = 0; i < scripts.length; i++) {
|
|
165
|
-
/******/ var s = scripts[i];
|
|
166
|
-
/******/ if(s.getAttribute("src") == url || s.getAttribute("data-webpack") == dataWebpackPrefix + key) { script = s; break; }
|
|
167
|
-
/******/ }
|
|
168
|
-
/******/ }
|
|
169
|
-
/******/ if(!script) {
|
|
170
|
-
/******/ needAttach = true;
|
|
171
|
-
/******/ script = document.createElement('script');
|
|
172
|
-
/******/
|
|
173
|
-
/******/ script.charset = 'utf-8';
|
|
174
|
-
/******/ script.timeout = 120;
|
|
175
|
-
/******/ if (__webpack_require__.nc) {
|
|
176
|
-
/******/ script.setAttribute("nonce", __webpack_require__.nc);
|
|
177
|
-
/******/ }
|
|
178
|
-
/******/ script.setAttribute("data-webpack", dataWebpackPrefix + key);
|
|
179
|
-
/******/
|
|
180
|
-
/******/ script.src = url;
|
|
181
|
-
/******/ }
|
|
182
|
-
/******/ inProgress[url] = [done];
|
|
183
|
-
/******/ var onScriptComplete = (prev, event) => {
|
|
184
|
-
/******/ // avoid mem leaks in IE.
|
|
185
|
-
/******/ script.onerror = script.onload = null;
|
|
186
|
-
/******/ clearTimeout(timeout);
|
|
187
|
-
/******/ var doneFns = inProgress[url];
|
|
188
|
-
/******/ delete inProgress[url];
|
|
189
|
-
/******/ script.parentNode && script.parentNode.removeChild(script);
|
|
190
|
-
/******/ doneFns && doneFns.forEach((fn) => (fn(event)));
|
|
191
|
-
/******/ if(prev) return prev(event);
|
|
192
|
-
/******/ }
|
|
193
|
-
/******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
|
|
194
|
-
/******/ script.onerror = onScriptComplete.bind(null, script.onerror);
|
|
195
|
-
/******/ script.onload = onScriptComplete.bind(null, script.onload);
|
|
196
|
-
/******/ needAttach && document.head.appendChild(script);
|
|
197
|
-
/******/ };
|
|
198
|
-
/******/ })();
|
|
199
|
-
/******/
|
|
200
197
|
/******/ /* webpack/runtime/make namespace object */
|
|
201
198
|
/******/ (() => {
|
|
202
199
|
/******/ // define __esModule on exports
|
|
@@ -208,121 +205,6 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_plugin_emitters__;
|
|
|
208
205
|
/******/ };
|
|
209
206
|
/******/ })();
|
|
210
207
|
/******/
|
|
211
|
-
/******/ /* webpack/runtime/publicPath */
|
|
212
|
-
/******/ (() => {
|
|
213
|
-
/******/ var scriptUrl;
|
|
214
|
-
/******/ if (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + "";
|
|
215
|
-
/******/ var document = __webpack_require__.g.document;
|
|
216
|
-
/******/ if (!scriptUrl && document) {
|
|
217
|
-
/******/ if (document.currentScript)
|
|
218
|
-
/******/ scriptUrl = document.currentScript.src;
|
|
219
|
-
/******/ if (!scriptUrl) {
|
|
220
|
-
/******/ var scripts = document.getElementsByTagName("script");
|
|
221
|
-
/******/ if(scripts.length) {
|
|
222
|
-
/******/ var i = scripts.length - 1;
|
|
223
|
-
/******/ while (i > -1 && !scriptUrl) scriptUrl = scripts[i--].src;
|
|
224
|
-
/******/ }
|
|
225
|
-
/******/ }
|
|
226
|
-
/******/ }
|
|
227
|
-
/******/ // When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration
|
|
228
|
-
/******/ // or pass an empty string ("") and set the __webpack_public_path__ variable from your code to use your own logic.
|
|
229
|
-
/******/ if (!scriptUrl) throw new Error("Automatic publicPath is not supported in this browser");
|
|
230
|
-
/******/ scriptUrl = scriptUrl.replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/");
|
|
231
|
-
/******/ __webpack_require__.p = scriptUrl;
|
|
232
|
-
/******/ })();
|
|
233
|
-
/******/
|
|
234
|
-
/******/ /* webpack/runtime/jsonp chunk loading */
|
|
235
|
-
/******/ (() => {
|
|
236
|
-
/******/ // no baseURI
|
|
237
|
-
/******/
|
|
238
|
-
/******/ // object to store loaded and loading chunks
|
|
239
|
-
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
|
|
240
|
-
/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
|
|
241
|
-
/******/ var installedChunks = {
|
|
242
|
-
/******/ "tsparticles.plugin.emitters.shape.canvas": 0
|
|
243
|
-
/******/ };
|
|
244
|
-
/******/
|
|
245
|
-
/******/ __webpack_require__.f.j = (chunkId, promises) => {
|
|
246
|
-
/******/ // JSONP chunk loading for javascript
|
|
247
|
-
/******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
|
|
248
|
-
/******/ if(installedChunkData !== 0) { // 0 means "already installed".
|
|
249
|
-
/******/
|
|
250
|
-
/******/ // a Promise means "currently loading".
|
|
251
|
-
/******/ if(installedChunkData) {
|
|
252
|
-
/******/ promises.push(installedChunkData[2]);
|
|
253
|
-
/******/ } else {
|
|
254
|
-
/******/ if(true) { // all chunks have JS
|
|
255
|
-
/******/ // setup Promise in chunk cache
|
|
256
|
-
/******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));
|
|
257
|
-
/******/ promises.push(installedChunkData[2] = promise);
|
|
258
|
-
/******/
|
|
259
|
-
/******/ // start chunk loading
|
|
260
|
-
/******/ var url = __webpack_require__.p + __webpack_require__.u(chunkId);
|
|
261
|
-
/******/ // create error before stack unwound to get useful stacktrace later
|
|
262
|
-
/******/ var error = new Error();
|
|
263
|
-
/******/ var loadingEnded = (event) => {
|
|
264
|
-
/******/ if(__webpack_require__.o(installedChunks, chunkId)) {
|
|
265
|
-
/******/ installedChunkData = installedChunks[chunkId];
|
|
266
|
-
/******/ if(installedChunkData !== 0) installedChunks[chunkId] = undefined;
|
|
267
|
-
/******/ if(installedChunkData) {
|
|
268
|
-
/******/ var errorType = event && (event.type === 'load' ? 'missing' : event.type);
|
|
269
|
-
/******/ var realSrc = event && event.target && event.target.src;
|
|
270
|
-
/******/ error.message = 'Loading chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')';
|
|
271
|
-
/******/ error.name = 'ChunkLoadError';
|
|
272
|
-
/******/ error.type = errorType;
|
|
273
|
-
/******/ error.request = realSrc;
|
|
274
|
-
/******/ installedChunkData[1](error);
|
|
275
|
-
/******/ }
|
|
276
|
-
/******/ }
|
|
277
|
-
/******/ };
|
|
278
|
-
/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId);
|
|
279
|
-
/******/ }
|
|
280
|
-
/******/ }
|
|
281
|
-
/******/ }
|
|
282
|
-
/******/ };
|
|
283
|
-
/******/
|
|
284
|
-
/******/ // no prefetching
|
|
285
|
-
/******/
|
|
286
|
-
/******/ // no preloaded
|
|
287
|
-
/******/
|
|
288
|
-
/******/ // no HMR
|
|
289
|
-
/******/
|
|
290
|
-
/******/ // no HMR manifest
|
|
291
|
-
/******/
|
|
292
|
-
/******/ // no on chunks loaded
|
|
293
|
-
/******/
|
|
294
|
-
/******/ // install a JSONP callback for chunk loading
|
|
295
|
-
/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
|
|
296
|
-
/******/ var chunkIds = data[0];
|
|
297
|
-
/******/ var moreModules = data[1];
|
|
298
|
-
/******/ var runtime = data[2];
|
|
299
|
-
/******/ // add "moreModules" to the modules object,
|
|
300
|
-
/******/ // then flag all "chunkIds" as loaded and fire callback
|
|
301
|
-
/******/ var moduleId, chunkId, i = 0;
|
|
302
|
-
/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
|
|
303
|
-
/******/ for(moduleId in moreModules) {
|
|
304
|
-
/******/ if(__webpack_require__.o(moreModules, moduleId)) {
|
|
305
|
-
/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
|
|
306
|
-
/******/ }
|
|
307
|
-
/******/ }
|
|
308
|
-
/******/ if(runtime) var result = runtime(__webpack_require__);
|
|
309
|
-
/******/ }
|
|
310
|
-
/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
|
|
311
|
-
/******/ for(;i < chunkIds.length; i++) {
|
|
312
|
-
/******/ chunkId = chunkIds[i];
|
|
313
|
-
/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
|
|
314
|
-
/******/ installedChunks[chunkId][0]();
|
|
315
|
-
/******/ }
|
|
316
|
-
/******/ installedChunks[chunkId] = 0;
|
|
317
|
-
/******/ }
|
|
318
|
-
/******/
|
|
319
|
-
/******/ }
|
|
320
|
-
/******/
|
|
321
|
-
/******/ var chunkLoadingGlobal = this["webpackChunk_tsparticles_plugin_emitters_shape_canvas"] = this["webpackChunk_tsparticles_plugin_emitters_shape_canvas"] || [];
|
|
322
|
-
/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
|
|
323
|
-
/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
|
|
324
|
-
/******/ })();
|
|
325
|
-
/******/
|
|
326
208
|
/************************************************************************/
|
|
327
209
|
/******/
|
|
328
210
|
/******/ // startup
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see tsparticles.plugin.emitters.shape.canvas.min.js.LICENSE.txt */
|
|
2
|
-
!function(e
|
|
2
|
+
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("@tsparticles/plugin-emitters"),require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/plugin-emitters","@tsparticles/engine"],e);else{var i="object"==typeof exports?e(require("@tsparticles/plugin-emitters"),require("@tsparticles/engine")):e(t.window,t.window);for(var s in i)("object"==typeof exports?exports:t)[s]=i[s]}}(this,((t,e)=>(()=>{var i={303:t=>{t.exports=e},526:e=>{e.exports=t}},s={};function o(t){var e=s[t];if(void 0!==e)return e.exports;var r=s[t]={exports:{}};return i[t](r,r.exports,o),r.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 r={};return(()=>{o.r(r),o.d(r,{loadEmittersShapeCanvas:()=>p});var t=o(526),e=o(303);const i={x:0,y:0};function s(t,e,s,o=!0){const r=t.getImageData(i.x,i.y,e.width,e.height).data;o&&t.clearRect(i.x,i.y,e.width,e.height);const n=[];for(let t=0;t<r.length;t+=s){const i=t/s,o={x:i%e.width,y:Math.floor(i/e.width)};n[o.y]||(n[o.y]=[]);const a={r:0,g:1,b:2,a:3},l=255;n[o.y][o.x]={r:r[t+a.r],g:r[t+a.g],b:r[t+a.b],a:r[t+a.a]/l}}return{pixels:n,width:Math.min(...n.map((t=>t.length))),height:n.length}}class n extends t.EmitterShapeBase{constructor(t,i,s,o){super(t,i,s,o);const r=o.filter;let n=t=>t.a>0;if(void 0!==r)if((0,e.isString)(r)){if(Object.hasOwn(window,r)){const t=window[r];(0,e.isFunction)(t)&&(n=t)}}else n=r;this.filter=n,this.scale=o.scale,this.pixelData={pixels:[],height:0,width:0}}async init(){let t;const o=this.options,r=o.selector,n=o.pixels,a=o.image,l=o.element,c=o.text,h=n.offset;if(a){const o=a.src;if(!o)return;t=await function(t,o){const r=new Image;r.crossOrigin="Anonymous";const n=new Promise(((t,n)=>{r.onerror=n,r.onload=()=>{const a=document.createElement("canvas");a.width=r.width,a.height=r.height;const l=a.getContext("2d");if(!l)return n(new Error(`${e.errorPrefix} Could not get canvas context`));l.drawImage(r,i.x,i.y,r.width,r.height,i.x,i.y,a.width,a.height),t(s(l,a,o))}}));return r.src=t,n}(o,h)}else if(c){const o=function(t,o,r){const n=document.createElement("canvas"),a=n.getContext("2d"),{font:l,text:c,lines:h,color:d}=t;if(!c||!a)return;const f=c.split(h.separator),p=(0,e.isNumber)(l.size)?`${l.size}px`:l.size,u=[];let x=0,g=0;for(const t of f){a.font=`${l.style||""} ${l.variant||""} ${l.weight||""} ${p} ${l.family}`;const e=a.measureText(t),i={measure:e,text:t,height:e.actualBoundingBoxAscent+e.actualBoundingBoxDescent,width:e.width};x=Math.max(x||0,i.width),g+=i.height+h.spacing,u.push(i)}n.width=x,n.height=g;let m=0;for(const t of u)a.font=`${l.style||""} ${l.variant||""} ${l.weight||""} ${p} ${l.family}`,r?(a.fillStyle=d,a.fillText(t.text,i.x,m+t.measure.actualBoundingBoxAscent)):(a.strokeStyle=d,a.strokeText(t.text,i.x,m+t.measure.actualBoundingBoxAscent)),m+=t.height+h.spacing;return s(a,n,o)}(c,h,this.fill);if(!o)return;t=o}else if(l??r){const e=l??(r&&document.querySelector(r));if(!e)return;const i=e.getContext("2d");if(!i)return;t=s(i,e,h)}t&&(this.pixelData=t)}randomPosition(){const{height:t,width:i}=this.pixelData,s=this.pixelData,o=this.position,r=this.scale,n=o.x-i*r*.5,a=o.y-t*r*.5;for(let o=0;o<100;o++){const o=Math.floor((0,e.getRandom)()*i*t),l={x:o%i,y:Math.floor(o/i)},c=s.pixels[l.y][l.x];if(this.filter(c))return{position:{x:l.x*r+n,y:l.y*r+a},color:{...c},opacity:c.a}}return null}resize(t,e){super.resize(t,e)}}class a{constructor(){this.offset=4}load(t){t&&void 0!==t.offset&&(this.offset=t.offset)}}class l{constructor(){this.family="Verdana",this.size=32,this.style="",this.variant="",this.weight=""}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 c{constructor(){this.separator="\n",this.spacing=0}load(t){t&&(void 0!==t.separator&&(this.separator=t.separator),void 0!==t.spacing&&(this.spacing=t.spacing))}}class h{constructor(){this.color="#000000",this.font=new l,this.lines=new c,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 d{constructor(){this.filter=t=>t.a>0,this.pixels=new a,this.scale=1,this.selector="",this.text=new h}load(t){t&&(void 0!==t.element&&(this.element=t.element),void 0!==t.filter&&(this.filter=t.filter),this.pixels.load(t.pixels),void 0!==t.scale&&(this.scale=t.scale),void 0!==t.selector&&(this.selector=t.selector),void 0!==t.image&&(this.image=t.image),this.text.load(t.text))}}class f{generate(t,e,i,s){const o=new d;return o.load(s),new n(t,e,i,o)}}async function p(t,e=!0){const i=t;i.addEmitterShapeGenerator?.("canvas",new f),await i.refresh(e)}})(),r})()));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
/*! tsParticles Emitters Shape Canvas Plugin v3.
|
|
1
|
+
/*! tsParticles Emitters Shape Canvas Plugin v3.4.0 by Matteo Bruni */
|
|
@@ -8,6 +8,6 @@ export declare class EmittersCanvasShape extends EmitterShapeBase<EmittersCanvas
|
|
|
8
8
|
scale: number;
|
|
9
9
|
constructor(position: ICoordinates, size: IDimension, fill: boolean, options: EmittersCanvasShapeOptions);
|
|
10
10
|
init(): Promise<void>;
|
|
11
|
-
randomPosition():
|
|
11
|
+
randomPosition(): IRandomPositionData | null;
|
|
12
12
|
resize(position: ICoordinates, size: IDimension): void;
|
|
13
13
|
}
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
}
|
|
74
74
|
this.pixelData = pixelData;
|
|
75
75
|
}
|
|
76
|
-
|
|
76
|
+
randomPosition() {
|
|
77
77
|
const { height, width } = this.pixelData, data = this.pixelData, position = this.position, scale = this.scale, positionOffset = {
|
|
78
78
|
x: position.x - width * scale * half,
|
|
79
79
|
y: position.y - height * scale * half,
|
|
@@ -86,16 +86,16 @@
|
|
|
86
86
|
if (!shouldCreateParticle) {
|
|
87
87
|
continue;
|
|
88
88
|
}
|
|
89
|
-
return
|
|
89
|
+
return {
|
|
90
90
|
position: {
|
|
91
91
|
x: pixelPos.x * scale + positionOffset.x,
|
|
92
92
|
y: pixelPos.y * scale + positionOffset.y,
|
|
93
93
|
},
|
|
94
94
|
color: { ...pixel },
|
|
95
95
|
opacity: pixel.a,
|
|
96
|
-
}
|
|
96
|
+
};
|
|
97
97
|
}
|
|
98
|
-
return
|
|
98
|
+
return null;
|
|
99
99
|
}
|
|
100
100
|
resize(position, size) {
|
|
101
101
|
super.resize(position, size);
|
package/umd/index.js
CHANGED
|
@@ -1,42 +1,19 @@
|
|
|
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", "./EmittersCanvasShapeGenerator.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.loadEmittersShapeCanvas = void 0;
|
|
13
|
+
const EmittersCanvasShapeGenerator_js_1 = require("./EmittersCanvasShapeGenerator.js");
|
|
37
14
|
async function loadEmittersShapeCanvas(engine, refresh = true) {
|
|
38
|
-
const emittersEngine = engine
|
|
39
|
-
emittersEngine.addEmitterShapeGenerator?.("canvas", new EmittersCanvasShapeGenerator());
|
|
15
|
+
const emittersEngine = engine;
|
|
16
|
+
emittersEngine.addEmitterShapeGenerator?.("canvas", new EmittersCanvasShapeGenerator_js_1.EmittersCanvasShapeGenerator());
|
|
40
17
|
await emittersEngine.refresh(refresh);
|
|
41
18
|
}
|
|
42
19
|
exports.loadEmittersShapeCanvas = loadEmittersShapeCanvas;
|
package/umd/utils.js
CHANGED
package/720.min.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/*! For license information please see 720.min.js.LICENSE.txt */
|
|
2
|
-
(this.webpackChunk_tsparticles_plugin_emitters_shape_canvas=this.webpackChunk_tsparticles_plugin_emitters_shape_canvas||[]).push([[720],{720:(t,e,i)=>{i.d(e,{EmittersCanvasShapeGenerator:()=>g});var s=i(68),o=i(533);const n={x:0,y:0};function a(t,e,i,s=!0){const o=t.getImageData(n.x,n.y,e.width,e.height).data;s&&t.clearRect(n.x,n.y,e.width,e.height);const a=[];for(let t=0;t<o.length;t+=i){const s=t/i,n={x:s%e.width,y:Math.floor(s/e.width)};a[n.y]||(a[n.y]=[]);const r={r:0,g:1,b:2,a:3},l=255;a[n.y][n.x]={r:o[t+r.r],g:o[t+r.g],b:o[t+r.b],a:o[t+r.a]/l}}return{pixels:a,width:Math.min(...a.map((t=>t.length))),height:a.length}}class r extends s.EmitterShapeBase{constructor(t,e,i,s){super(t,e,i,s);const n=s.filter;let a=t=>t.a>0;if(void 0!==n)if((0,o.isString)(n)){if(Object.hasOwn(window,n)){const t=window[n];(0,o.isFunction)(t)&&(a=t)}}else a=n;this.filter=a,this.scale=s.scale,this.pixelData={pixels:[],height:0,width:0}}async init(){let t;const e=this.options,i=e.selector,s=e.pixels,r=e.image,l=e.element,h=e.text,c=s.offset;if(r){const e=r.src;if(!e)return;t=await function(t,e){const i=new Image;i.crossOrigin="Anonymous";const s=new Promise(((t,s)=>{i.onerror=s,i.onload=()=>{const r=document.createElement("canvas");r.width=i.width,r.height=i.height;const l=r.getContext("2d");if(!l)return s(new Error(`${o.errorPrefix} Could not get canvas context`));l.drawImage(i,n.x,n.y,i.width,i.height,n.x,n.y,r.width,r.height),t(a(l,r,e))}}));return i.src=t,s}(e,c)}else if(h){const e=function(t,e,i){const s=document.createElement("canvas"),r=s.getContext("2d"),{font:l,text:h,lines:c,color:d}=t;if(!h||!r)return;const f=h.split(c.separator),g=(0,o.isNumber)(l.size)?`${l.size}px`:l.size,x=[];let u=0,p=0;for(const t of f){r.font=`${l.style||""} ${l.variant||""} ${l.weight||""} ${g} ${l.family}`;const e=r.measureText(t),i={measure:e,text:t,height:e.actualBoundingBoxAscent+e.actualBoundingBoxDescent,width:e.width};u=Math.max(u||0,i.width),p+=i.height+c.spacing,x.push(i)}s.width=u,s.height=p;let m=0;for(const t of x)r.font=`${l.style||""} ${l.variant||""} ${l.weight||""} ${g} ${l.family}`,i?(r.fillStyle=d,r.fillText(t.text,n.x,m+t.measure.actualBoundingBoxAscent)):(r.strokeStyle=d,r.strokeText(t.text,n.x,m+t.measure.actualBoundingBoxAscent)),m+=t.height+c.spacing;return a(r,s,e)}(h,c,this.fill);if(!e)return;t=e}else if(l??i){const e=l??(i&&document.querySelector(i));if(!e)return;const s=e.getContext("2d");if(!s)return;t=a(s,e,c)}t&&(this.pixelData=t)}async randomPosition(){const{height:t,width:e}=this.pixelData,i=this.pixelData,s=this.position,n=this.scale,a=s.x-e*n*.5,r=s.y-t*n*.5;for(let s=0;s<100;s++){const s=Math.floor((0,o.getRandom)()*e*t),l={x:s%e,y:Math.floor(s/e)},h=i.pixels[l.y][l.x];if(this.filter(h))return Promise.resolve({position:{x:l.x*n+a,y:l.y*n+r},color:{...h},opacity:h.a})}return Promise.resolve(null)}resize(t,e){super.resize(t,e)}}class l{constructor(){this.offset=4}load(t){t&&void 0!==t.offset&&(this.offset=t.offset)}}class h{constructor(){this.family="Verdana",this.size=32,this.style="",this.variant="",this.weight=""}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 c{constructor(){this.separator="\n",this.spacing=0}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 h,this.lines=new c,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.filter=t=>t.a>0,this.pixels=new l,this.scale=1,this.selector="",this.text=new d}load(t){t&&(void 0!==t.element&&(this.element=t.element),void 0!==t.filter&&(this.filter=t.filter),this.pixels.load(t.pixels),void 0!==t.scale&&(this.scale=t.scale),void 0!==t.selector&&(this.selector=t.selector),void 0!==t.image&&(this.image=t.image),this.text.load(t.text))}}class g{generate(t,e,i,s){const o=new f;return o.load(s),new r(t,e,i,o)}}}}]);
|
package/720.min.js.LICENSE.txt
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/*! tsParticles Emitters Shape Canvas Plugin v3.2.2 by Matteo Bruni */
|
|
@@ -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.2.2
|
|
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_emitters_shape_canvas"] = this["webpackChunk_tsparticles_plugin_emitters_shape_canvas"] || []).push([["dist_browser_EmittersCanvasShapeGenerator_js"],{
|
|
19
|
-
|
|
20
|
-
/***/ "./dist/browser/EmittersCanvasShape.js":
|
|
21
|
-
/*!*********************************************!*\
|
|
22
|
-
!*** ./dist/browser/EmittersCanvasShape.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 */ EmittersCanvasShape: () => (/* binding */ EmittersCanvasShape)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_plugin_emitters__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/plugin-emitters */ \"@tsparticles/plugin-emitters\");\n/* harmony import */ var _tsparticles_plugin_emitters__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_plugin_emitters__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils.js */ \"./dist/browser/utils.js\");\n\n\n\nconst maxRetries = 100,\n half = 0.5;\nclass EmittersCanvasShape extends _tsparticles_plugin_emitters__WEBPACK_IMPORTED_MODULE_0__.EmitterShapeBase {\n constructor(position, size, fill, options) {\n super(position, size, fill, options);\n const filter = options.filter,\n minAlpha = 0;\n let filterFunc = pixel => pixel.a > minAlpha;\n if (filter !== undefined) {\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.isString)(filter)) {\n if (Object.hasOwn(window, filter)) {\n const wndFilter = window[filter];\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.isFunction)(wndFilter)) {\n filterFunc = wndFilter;\n }\n }\n } else {\n filterFunc = filter;\n }\n }\n this.filter = filterFunc;\n this.scale = options.scale;\n this.pixelData = {\n pixels: [],\n height: 0,\n width: 0\n };\n }\n async init() {\n let pixelData;\n const options = this.options,\n selector = options.selector,\n pixels = options.pixels,\n image = options.image,\n element = options.element,\n text = options.text,\n offset = pixels.offset;\n if (image) {\n const url = image.src;\n if (!url) {\n return;\n }\n pixelData = await (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.getImageData)(url, offset);\n } else if (text) {\n const data = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.getTextData)(text, offset, this.fill);\n if (!data) {\n return;\n }\n pixelData = data;\n } else if (element ?? selector) {\n const canvas = element ?? (selector && document.querySelector(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_2__.getCanvasImageData)(context, canvas, offset);\n }\n if (!pixelData) {\n return;\n }\n this.pixelData = pixelData;\n }\n async randomPosition() {\n const {\n height,\n width\n } = this.pixelData,\n data = this.pixelData,\n position = this.position,\n scale = this.scale,\n positionOffset = {\n x: position.x - width * scale * half,\n y: position.y - height * scale * half\n };\n for (let i = 0; i < maxRetries; i++) {\n const nextIndex = Math.floor((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.getRandom)() * width * height),\n pixelPos = {\n x: nextIndex % width,\n y: Math.floor(nextIndex / width)\n },\n pixel = data.pixels[pixelPos.y][pixelPos.x],\n shouldCreateParticle = this.filter(pixel);\n if (!shouldCreateParticle) {\n continue;\n }\n return Promise.resolve({\n position: {\n x: pixelPos.x * scale + positionOffset.x,\n y: pixelPos.y * scale + positionOffset.y\n },\n color: {\n ...pixel\n },\n opacity: pixel.a\n });\n }\n return Promise.resolve(null);\n }\n resize(position, size) {\n super.resize(position, size);\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-emitters-shape-canvas/./dist/browser/EmittersCanvasShape.js?");
|
|
27
|
-
|
|
28
|
-
/***/ }),
|
|
29
|
-
|
|
30
|
-
/***/ "./dist/browser/EmittersCanvasShapeGenerator.js":
|
|
31
|
-
/*!******************************************************!*\
|
|
32
|
-
!*** ./dist/browser/EmittersCanvasShapeGenerator.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 */ EmittersCanvasShapeGenerator: () => (/* binding */ EmittersCanvasShapeGenerator)\n/* harmony export */ });\n/* harmony import */ var _EmittersCanvasShape_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./EmittersCanvasShape.js */ \"./dist/browser/EmittersCanvasShape.js\");\n/* harmony import */ var _Options_Classes_EmittersCanvasShapeOptions_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Options/Classes/EmittersCanvasShapeOptions.js */ \"./dist/browser/Options/Classes/EmittersCanvasShapeOptions.js\");\n\n\nclass EmittersCanvasShapeGenerator {\n generate(position, size, fill, options) {\n const shapeOptions = new _Options_Classes_EmittersCanvasShapeOptions_js__WEBPACK_IMPORTED_MODULE_0__.EmittersCanvasShapeOptions();\n shapeOptions.load(options);\n return new _EmittersCanvasShape_js__WEBPACK_IMPORTED_MODULE_1__.EmittersCanvasShape(position, size, fill, shapeOptions);\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-emitters-shape-canvas/./dist/browser/EmittersCanvasShapeGenerator.js?");
|
|
37
|
-
|
|
38
|
-
/***/ }),
|
|
39
|
-
|
|
40
|
-
/***/ "./dist/browser/Options/Classes/EmittersCanvasShapeOptions.js":
|
|
41
|
-
/*!********************************************************************!*\
|
|
42
|
-
!*** ./dist/browser/Options/Classes/EmittersCanvasShapeOptions.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 */ EmittersCanvasShapeOptions: () => (/* binding */ EmittersCanvasShapeOptions)\n/* harmony export */ });\n/* harmony import */ var _PixelsOptions_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./PixelsOptions.js */ \"./dist/browser/Options/Classes/PixelsOptions.js\");\n/* harmony import */ var _TextOptions_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./TextOptions.js */ \"./dist/browser/Options/Classes/TextOptions.js\");\n\n\nconst minAlpha = 0;\nclass EmittersCanvasShapeOptions {\n constructor() {\n this.filter = pixel => pixel.a > minAlpha;\n this.pixels = new _PixelsOptions_js__WEBPACK_IMPORTED_MODULE_0__.PixelsOptions();\n this.scale = 1;\n this.selector = \"\";\n this.text = new _TextOptions_js__WEBPACK_IMPORTED_MODULE_1__.TextOptions();\n }\n load(data) {\n if (!data) {\n return;\n }\n if (data.element !== undefined) {\n this.element = data.element;\n }\n if (data.filter !== undefined) {\n this.filter = data.filter;\n }\n this.pixels.load(data.pixels);\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.image !== undefined) {\n this.image = data.image;\n }\n this.text.load(data.text);\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-emitters-shape-canvas/./dist/browser/Options/Classes/EmittersCanvasShapeOptions.js?");
|
|
47
|
-
|
|
48
|
-
/***/ }),
|
|
49
|
-
|
|
50
|
-
/***/ "./dist/browser/Options/Classes/PixelsOptions.js":
|
|
51
|
-
/*!*******************************************************!*\
|
|
52
|
-
!*** ./dist/browser/Options/Classes/PixelsOptions.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 */ PixelsOptions: () => (/* binding */ PixelsOptions)\n/* harmony export */ });\nclass PixelsOptions {\n constructor() {\n this.offset = 4;\n }\n load(data) {\n if (!data) {\n return;\n }\n if (data.offset !== undefined) {\n this.offset = data.offset;\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-emitters-shape-canvas/./dist/browser/Options/Classes/PixelsOptions.js?");
|
|
57
|
-
|
|
58
|
-
/***/ }),
|
|
59
|
-
|
|
60
|
-
/***/ "./dist/browser/Options/Classes/TextFontOptions.js":
|
|
61
|
-
/*!*********************************************************!*\
|
|
62
|
-
!*** ./dist/browser/Options/Classes/TextFontOptions.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 */ TextFontOptions: () => (/* binding */ TextFontOptions)\n/* harmony export */ });\nclass TextFontOptions {\n constructor() {\n this.family = \"Verdana\";\n this.size = 32;\n this.style = \"\";\n this.variant = \"\";\n this.weight = \"\";\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-emitters-shape-canvas/./dist/browser/Options/Classes/TextFontOptions.js?");
|
|
67
|
-
|
|
68
|
-
/***/ }),
|
|
69
|
-
|
|
70
|
-
/***/ "./dist/browser/Options/Classes/TextLinesOptions.js":
|
|
71
|
-
/*!**********************************************************!*\
|
|
72
|
-
!*** ./dist/browser/Options/Classes/TextLinesOptions.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 */ TextLinesOptions: () => (/* binding */ TextLinesOptions)\n/* harmony export */ });\nclass TextLinesOptions {\n constructor() {\n this.separator = \"\\n\";\n this.spacing = 0;\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-emitters-shape-canvas/./dist/browser/Options/Classes/TextLinesOptions.js?");
|
|
77
|
-
|
|
78
|
-
/***/ }),
|
|
79
|
-
|
|
80
|
-
/***/ "./dist/browser/Options/Classes/TextOptions.js":
|
|
81
|
-
/*!*****************************************************!*\
|
|
82
|
-
!*** ./dist/browser/Options/Classes/TextOptions.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 */ TextOptions: () => (/* binding */ TextOptions)\n/* harmony export */ });\n/* harmony import */ var _TextFontOptions_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./TextFontOptions.js */ \"./dist/browser/Options/Classes/TextFontOptions.js\");\n/* harmony import */ var _TextLinesOptions_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./TextLinesOptions.js */ \"./dist/browser/Options/Classes/TextLinesOptions.js\");\n\n\nclass TextOptions {\n constructor() {\n this.color = \"#000000\";\n this.font = new _TextFontOptions_js__WEBPACK_IMPORTED_MODULE_0__.TextFontOptions();\n this.lines = new _TextLinesOptions_js__WEBPACK_IMPORTED_MODULE_1__.TextLinesOptions();\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-emitters-shape-canvas/./dist/browser/Options/Classes/TextOptions.js?");
|
|
87
|
-
|
|
88
|
-
/***/ }),
|
|
89
|
-
|
|
90
|
-
/***/ "./dist/browser/utils.js":
|
|
91
|
-
/*!*******************************!*\
|
|
92
|
-
!*** ./dist/browser/utils.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 */ 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 origin = {\n x: 0,\n y: 0\n },\n minWidth = 0;\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, fill) {\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 || minWidth, 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 if (fill) {\n context.fillStyle = color;\n context.fillText(line.text, origin.x, currentHeight + line.measure.actualBoundingBoxAscent);\n } else {\n context.strokeStyle = color;\n context.strokeText(line.text, origin.x, currentHeight + line.measure.actualBoundingBoxAscent);\n }\n currentHeight += line.height + linesOptions.spacing;\n }\n return getCanvasImageData(context, canvas, offset);\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-emitters-shape-canvas/./dist/browser/utils.js?");
|
|
97
|
-
|
|
98
|
-
/***/ })
|
|
99
|
-
|
|
100
|
-
}]);
|