@tsparticles/canvas-utils 4.0.0-alpha.14 → 4.0.0-alpha.8
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/README.md +4 -4
- package/browser/Utils.js +0 -6
- package/cjs/Utils.js +0 -6
- package/esm/Utils.js +0 -6
- package/package.json +5 -5
- package/report.html +2 -2
- package/tsparticles.path.utils.js +132 -0
- package/tsparticles.path.utils.min.js +2 -0
- package/tsparticles.path.utils.min.js.LICENSE.txt +1 -0
- package/types/Utils.d.ts +1 -2
- package/umd/Utils.js +0 -7
- package/tsparticles.canvas.utils.js +0 -132
- package/tsparticles.canvas.utils.min.js +0 -1
package/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
[](https://particles.js.org)
|
|
2
2
|
|
|
3
|
-
# tsParticles
|
|
3
|
+
# tsParticles Path Utils Library
|
|
4
4
|
|
|
5
5
|
[](https://www.jsdelivr.com/package/npm/@tsparticles/canvas-utils)
|
|
6
6
|
[](https://www.npmjs.com/package/@tsparticles/canvas-utils)
|
|
7
7
|
[](https://www.npmjs.com/package/@tsparticles/canvas-utils) [](https://github.com/sponsors/matteobruni)
|
|
8
8
|
|
|
9
|
-
[tsParticles](https://github.com/tsparticles/tsparticles)
|
|
9
|
+
[tsParticles](https://github.com/tsparticles/tsparticles) path plugin for path utils movement.
|
|
10
10
|
|
|
11
11
|
## How to use it
|
|
12
12
|
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
The CDN/Vanilla version JS has one required file in vanilla configuration:
|
|
16
16
|
|
|
17
|
-
Including the `tsparticles.
|
|
17
|
+
Including the `tsparticles.path.utils.min.js` file will export the function to load the path plugin:
|
|
18
18
|
|
|
19
19
|
```text
|
|
20
20
|
loadCanvasUtilsPath
|
|
@@ -22,7 +22,7 @@ loadCanvasUtilsPath
|
|
|
22
22
|
|
|
23
23
|
### Usage
|
|
24
24
|
|
|
25
|
-
Once the scripts are loaded you can set up `tsParticles` and the
|
|
25
|
+
Once the scripts are loaded you can set up `tsParticles` and the path plugin like this:
|
|
26
26
|
|
|
27
27
|
```javascript
|
|
28
28
|
(async () => {
|
package/browser/Utils.js
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import { defaultAlpha, defaultRgbMin, isNumber, originPoint, safeDocument, } from "@tsparticles/engine";
|
|
2
2
|
const defaultWidth = 0;
|
|
3
|
-
export function drawLine(context, begin, end) {
|
|
4
|
-
context.beginPath();
|
|
5
|
-
context.moveTo(begin.x, begin.y);
|
|
6
|
-
context.lineTo(end.x, end.y);
|
|
7
|
-
context.closePath();
|
|
8
|
-
}
|
|
9
3
|
export function getCanvasImageData(ctx, size, offset, clear = true) {
|
|
10
4
|
const imageData = ctx.getImageData(originPoint.x, originPoint.y, size.width, size.height).data;
|
|
11
5
|
if (clear) {
|
package/cjs/Utils.js
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import { defaultAlpha, defaultRgbMin, isNumber, originPoint, safeDocument, } from "@tsparticles/engine";
|
|
2
2
|
const defaultWidth = 0;
|
|
3
|
-
export function drawLine(context, begin, end) {
|
|
4
|
-
context.beginPath();
|
|
5
|
-
context.moveTo(begin.x, begin.y);
|
|
6
|
-
context.lineTo(end.x, end.y);
|
|
7
|
-
context.closePath();
|
|
8
|
-
}
|
|
9
3
|
export function getCanvasImageData(ctx, size, offset, clear = true) {
|
|
10
4
|
const imageData = ctx.getImageData(originPoint.x, originPoint.y, size.width, size.height).data;
|
|
11
5
|
if (clear) {
|
package/esm/Utils.js
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import { defaultAlpha, defaultRgbMin, isNumber, originPoint, safeDocument, } from "@tsparticles/engine";
|
|
2
2
|
const defaultWidth = 0;
|
|
3
|
-
export function drawLine(context, begin, end) {
|
|
4
|
-
context.beginPath();
|
|
5
|
-
context.moveTo(begin.x, begin.y);
|
|
6
|
-
context.lineTo(end.x, end.y);
|
|
7
|
-
context.closePath();
|
|
8
|
-
}
|
|
9
3
|
export function getCanvasImageData(ctx, size, offset, clear = true) {
|
|
10
4
|
const imageData = ctx.getImageData(originPoint.x, originPoint.y, size.width, size.height).data;
|
|
11
5
|
if (clear) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/canvas-utils",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
4
|
-
"description": "tsParticles
|
|
3
|
+
"version": "4.0.0-alpha.8",
|
|
4
|
+
"description": "tsParticles path utils library",
|
|
5
5
|
"homepage": "https://particles.js.org",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -85,8 +85,8 @@
|
|
|
85
85
|
}
|
|
86
86
|
],
|
|
87
87
|
"sideEffects": false,
|
|
88
|
-
"jsdelivr": "tsparticles.
|
|
89
|
-
"unpkg": "tsparticles.
|
|
88
|
+
"jsdelivr": "tsparticles.path.utils.min.js",
|
|
89
|
+
"unpkg": "tsparticles.path.utils.min.js",
|
|
90
90
|
"browser": "browser/index.js",
|
|
91
91
|
"main": "cjs/index.js",
|
|
92
92
|
"module": "esm/index.js",
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
"./package.json": "./package.json"
|
|
104
104
|
},
|
|
105
105
|
"dependencies": {
|
|
106
|
-
"@tsparticles/engine": "4.0.0-alpha.
|
|
106
|
+
"@tsparticles/engine": "4.0.0-alpha.8"
|
|
107
107
|
},
|
|
108
108
|
"type": "module"
|
|
109
109
|
}
|
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/canvas-utils [
|
|
6
|
+
<title>@tsparticles/canvas-utils [26 Jan 2026 at 18:32]</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>
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
<div id="app"></div>
|
|
33
33
|
<script>
|
|
34
34
|
window.chartData = [];
|
|
35
|
-
window.entrypoints = ["tsparticles.
|
|
35
|
+
window.entrypoints = ["tsparticles.path.utils.min"];
|
|
36
36
|
window.defaultSizes = "parsed";
|
|
37
37
|
window.compressionAlgorithm = "gzip";
|
|
38
38
|
</script>
|
|
@@ -0,0 +1,132 @@
|
|
|
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
|
+
* v4.0.0-alpha.8
|
|
8
|
+
*/
|
|
9
|
+
/*
|
|
10
|
+
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
|
11
|
+
* This devtool is neither made for production nor for readable output files.
|
|
12
|
+
* It uses "eval()" calls to create a separate source file in the browser devtools.
|
|
13
|
+
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
|
|
14
|
+
* or disable the default devtool with "devtool: false".
|
|
15
|
+
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
|
|
16
|
+
*/
|
|
17
|
+
(function webpackUniversalModuleDefinition(root, factory) {
|
|
18
|
+
if(typeof exports === 'object' && typeof module === 'object')
|
|
19
|
+
module.exports = factory(require("@tsparticles/engine"));
|
|
20
|
+
else if(typeof define === 'function' && define.amd)
|
|
21
|
+
define(["@tsparticles/engine"], factory);
|
|
22
|
+
else {
|
|
23
|
+
var a = typeof exports === 'object' ? factory(require("@tsparticles/engine")) : factory(root["window"]);
|
|
24
|
+
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
|
|
25
|
+
}
|
|
26
|
+
})(this, (__WEBPACK_EXTERNAL_MODULE__tsparticles_engine__) => {
|
|
27
|
+
return /******/ (() => { // webpackBootstrap
|
|
28
|
+
/******/ "use strict";
|
|
29
|
+
/******/ var __webpack_modules__ = ({
|
|
30
|
+
|
|
31
|
+
/***/ "./dist/browser/Utils.js"
|
|
32
|
+
/*!*******************************!*\
|
|
33
|
+
!*** ./dist/browser/Utils.js ***!
|
|
34
|
+
\*******************************/
|
|
35
|
+
(__unused_webpack___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 */ getCanvasImageData: () => (/* binding */ getCanvasImageData),\n/* harmony export */ getImageData: () => (/* binding */ getImageData),\n/* harmony export */ getTextData: () => (/* binding */ getTextData),\n/* harmony export */ loadFont: () => (/* binding */ loadFont)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nconst defaultWidth = 0;\nfunction getCanvasImageData(ctx, size, offset, clear = true) {\n const imageData = ctx.getImageData(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.originPoint.x, _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.originPoint.y, size.width, size.height).data;\n if (clear) {\n ctx.clearRect(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.originPoint.x, _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.originPoint.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 pixels[pos.y] ??= [];\n const indexesOffset = {\n r: 0,\n g: 1,\n b: 2,\n a: 3\n },\n alphaFactor = 255,\n row = pixels[pos.y];\n if (!row) {\n continue;\n }\n row[pos.x] = {\n r: imageData[i + indexesOffset.r] ?? _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.defaultRgbMin,\n g: imageData[i + indexesOffset.g] ?? _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.defaultRgbMin,\n b: imageData[i + indexesOffset.b] ?? _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.defaultRgbMin,\n a: (imageData[i + indexesOffset.a] ?? _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.defaultAlpha) / 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, canvasSettings) {\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 = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.safeDocument)().createElement(\"canvas\");\n canvas.width = image.width;\n canvas.height = image.height;\n const context = canvas.getContext(\"2d\", canvasSettings);\n if (!context) {\n reject(new Error(\"Could not get canvas context\"));\n return;\n }\n context.drawImage(image, _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.originPoint.x, _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.originPoint.y, image.width, image.height, _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.originPoint.x, _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.originPoint.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, canvasSettings) {\n const canvas = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.safeDocument)().createElement(\"canvas\"),\n context = canvas.getContext(\"2d\", canvasSettings),\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.toString()}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 if (fill) {\n context.fillStyle = color;\n context.fillText(line.text, _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.originPoint.x, currentHeight + line.measure.actualBoundingBoxAscent);\n } else {\n context.strokeStyle = color;\n context.strokeText(line.text, _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.originPoint.x, currentHeight + line.measure.actualBoundingBoxAscent);\n }\n currentHeight += line.height + linesOptions.spacing;\n }\n return getCanvasImageData(context, canvas, offset);\n}\nasync function loadFont(font, weight) {\n try {\n await (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.safeDocument)().fonts.load(`${weight ?? \"400\"} 36px '${font ?? \"Verdana\"}'`);\n } catch {}\n}\n\n//# sourceURL=webpack://@tsparticles/canvas-utils/./dist/browser/Utils.js?\n}");
|
|
38
|
+
|
|
39
|
+
/***/ },
|
|
40
|
+
|
|
41
|
+
/***/ "./dist/browser/index.js"
|
|
42
|
+
/*!*******************************!*\
|
|
43
|
+
!*** ./dist/browser/index.js ***!
|
|
44
|
+
\*******************************/
|
|
45
|
+
(__unused_webpack___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 */ getCanvasImageData: () => (/* reexport safe */ _Utils_js__WEBPACK_IMPORTED_MODULE_0__.getCanvasImageData),\n/* harmony export */ getImageData: () => (/* reexport safe */ _Utils_js__WEBPACK_IMPORTED_MODULE_0__.getImageData),\n/* harmony export */ getTextData: () => (/* reexport safe */ _Utils_js__WEBPACK_IMPORTED_MODULE_0__.getTextData),\n/* harmony export */ loadFont: () => (/* reexport safe */ _Utils_js__WEBPACK_IMPORTED_MODULE_0__.loadFont)\n/* harmony export */ });\n/* harmony import */ var _Utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Utils.js */ \"./dist/browser/Utils.js\");\n\n\n//# sourceURL=webpack://@tsparticles/canvas-utils/./dist/browser/index.js?\n}");
|
|
48
|
+
|
|
49
|
+
/***/ },
|
|
50
|
+
|
|
51
|
+
/***/ "@tsparticles/engine"
|
|
52
|
+
/*!*********************************************************************************************************************************!*\
|
|
53
|
+
!*** external {"commonjs":"@tsparticles/engine","commonjs2":"@tsparticles/engine","amd":"@tsparticles/engine","root":"window"} ***!
|
|
54
|
+
\*********************************************************************************************************************************/
|
|
55
|
+
(module) {
|
|
56
|
+
|
|
57
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
|
|
58
|
+
|
|
59
|
+
/***/ }
|
|
60
|
+
|
|
61
|
+
/******/ });
|
|
62
|
+
/************************************************************************/
|
|
63
|
+
/******/ // The module cache
|
|
64
|
+
/******/ var __webpack_module_cache__ = {};
|
|
65
|
+
/******/
|
|
66
|
+
/******/ // The require function
|
|
67
|
+
/******/ function __webpack_require__(moduleId) {
|
|
68
|
+
/******/ // Check if module is in cache
|
|
69
|
+
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
70
|
+
/******/ if (cachedModule !== undefined) {
|
|
71
|
+
/******/ return cachedModule.exports;
|
|
72
|
+
/******/ }
|
|
73
|
+
/******/ // Check if module exists (development only)
|
|
74
|
+
/******/ if (__webpack_modules__[moduleId] === undefined) {
|
|
75
|
+
/******/ var e = new Error("Cannot find module '" + moduleId + "'");
|
|
76
|
+
/******/ e.code = 'MODULE_NOT_FOUND';
|
|
77
|
+
/******/ throw e;
|
|
78
|
+
/******/ }
|
|
79
|
+
/******/ // Create a new module (and put it into the cache)
|
|
80
|
+
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
81
|
+
/******/ // no module.id needed
|
|
82
|
+
/******/ // no module.loaded needed
|
|
83
|
+
/******/ exports: {}
|
|
84
|
+
/******/ };
|
|
85
|
+
/******/
|
|
86
|
+
/******/ // Execute the module function
|
|
87
|
+
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
88
|
+
/******/
|
|
89
|
+
/******/ // Return the exports of the module
|
|
90
|
+
/******/ return module.exports;
|
|
91
|
+
/******/ }
|
|
92
|
+
/******/
|
|
93
|
+
/************************************************************************/
|
|
94
|
+
/******/ /* webpack/runtime/define property getters */
|
|
95
|
+
/******/ (() => {
|
|
96
|
+
/******/ // define getter functions for harmony exports
|
|
97
|
+
/******/ __webpack_require__.d = (exports, definition) => {
|
|
98
|
+
/******/ for(var key in definition) {
|
|
99
|
+
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
100
|
+
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
101
|
+
/******/ }
|
|
102
|
+
/******/ }
|
|
103
|
+
/******/ };
|
|
104
|
+
/******/ })();
|
|
105
|
+
/******/
|
|
106
|
+
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
107
|
+
/******/ (() => {
|
|
108
|
+
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
109
|
+
/******/ })();
|
|
110
|
+
/******/
|
|
111
|
+
/******/ /* webpack/runtime/make namespace object */
|
|
112
|
+
/******/ (() => {
|
|
113
|
+
/******/ // define __esModule on exports
|
|
114
|
+
/******/ __webpack_require__.r = (exports) => {
|
|
115
|
+
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
116
|
+
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
117
|
+
/******/ }
|
|
118
|
+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
119
|
+
/******/ };
|
|
120
|
+
/******/ })();
|
|
121
|
+
/******/
|
|
122
|
+
/************************************************************************/
|
|
123
|
+
/******/
|
|
124
|
+
/******/ // startup
|
|
125
|
+
/******/ // Load entry module and return exports
|
|
126
|
+
/******/ // This entry module can't be inlined because the eval devtool is used.
|
|
127
|
+
/******/ var __webpack_exports__ = __webpack_require__("./dist/browser/index.js");
|
|
128
|
+
/******/
|
|
129
|
+
/******/ return __webpack_exports__;
|
|
130
|
+
/******/ })()
|
|
131
|
+
;
|
|
132
|
+
});
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! For license information please see tsparticles.path.utils.min.js.LICENSE.txt */
|
|
2
|
+
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],e);else{var n="object"==typeof exports?e(require("@tsparticles/engine")):e(t.window);for(var o in n)("object"==typeof exports?exports:t)[o]=n[o]}}(this,(t=>(()=>{var e={303(e){e.exports=t}},n={};function o(t){var i=n[t];if(void 0!==i)return i.exports;var r=n[t]={exports:{}};return e[t](r,r.exports,o),r.exports}o.d=(t,e)=>{for(var n in e)o.o(e,n)&&!o.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},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 i={};o.r(i),o.d(i,{getCanvasImageData:()=>s,getImageData:()=>c,getTextData:()=>g,loadFont:()=>l});var r=o(303);const a=0;function s(t,e,n,o=!0){const i=t.getImageData(r.originPoint.x,r.originPoint.y,e.width,e.height).data;o&&t.clearRect(r.originPoint.x,r.originPoint.y,e.width,e.height);const a=[];for(let t=0;t<i.length;t+=n){const o=t/n,s={x:o%e.width,y:Math.floor(o/e.width)};a[s.y]??=[];const c={r:0,g:1,b:2,a:3},g=255,l=a[s.y];l&&(l[s.x]={r:i[t+c.r]??r.defaultRgbMin,g:i[t+c.g]??r.defaultRgbMin,b:i[t+c.b]??r.defaultRgbMin,a:(i[t+c.a]??r.defaultAlpha)/g})}return{pixels:a,width:Math.min(...a.map((t=>t.length))),height:a.length}}function c(t,e,n){const o=new Image;o.crossOrigin="Anonymous";const i=new Promise(((t,i)=>{o.onerror=i,o.onload=()=>{const a=(0,r.safeDocument)().createElement("canvas");a.width=o.width,a.height=o.height;const c=a.getContext("2d",n);c?(c.drawImage(o,r.originPoint.x,r.originPoint.y,o.width,o.height,r.originPoint.x,r.originPoint.y,a.width,a.height),t(s(c,a,e))):i(new Error("Could not get canvas context"))}}));return o.src=t,i}function g(t,e,n,o){const i=(0,r.safeDocument)().createElement("canvas"),c=i.getContext("2d",o),{font:g,text:l,lines:h,color:d}=t;if(!l||!c)return;const f=l.split(h.separator),u=(0,r.isNumber)(g.size)?`${g.size.toString()}px`:g.size,x=[];let p=0,y=0;for(const t of f){c.font=`${g.style||""} ${g.variant||""} ${g.weight||""} ${u} ${g.family}`;const e=c.measureText(t),n={measure:e,text:t,height:e.actualBoundingBoxAscent+e.actualBoundingBoxDescent,width:e.width};p=Math.max(p||a,n.width),y+=n.height+h.spacing,x.push(n)}i.width=p,i.height=y;let m=0;for(const t of x)c.font=`${g.style||""} ${g.variant||""} ${g.weight||""} ${u} ${g.family}`,n?(c.fillStyle=d,c.fillText(t.text,r.originPoint.x,m+t.measure.actualBoundingBoxAscent)):(c.strokeStyle=d,c.strokeText(t.text,r.originPoint.x,m+t.measure.actualBoundingBoxAscent)),m+=t.height+h.spacing;return s(c,i,e)}async function l(t,e){try{await(0,r.safeDocument)().fonts.load(`${e??"400"} 36px '${t??"Verdana"}'`)}catch{}}return i})()));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! tsParticles Path Utils v4.0.0-alpha.8 by Matteo Bruni */
|
package/types/Utils.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { CanvasPixelData, ITextDataOptions } from "./types.js";
|
|
2
|
-
import { type
|
|
3
|
-
export declare function drawLine(context: CanvasRenderingContext2D, begin: ICoordinates, end: ICoordinates): void;
|
|
2
|
+
import { type IDimension } from "@tsparticles/engine";
|
|
4
3
|
export declare function getCanvasImageData(ctx: CanvasRenderingContext2D, size: IDimension, offset: number, clear?: boolean): CanvasPixelData;
|
|
5
4
|
export declare function getImageData(src: string, offset: number, canvasSettings?: CanvasRenderingContext2DSettings): Promise<CanvasPixelData>;
|
|
6
5
|
export declare function getTextData(textOptions: ITextDataOptions, offset: number, fill: boolean, canvasSettings?: CanvasRenderingContext2DSettings): CanvasPixelData | undefined;
|
package/umd/Utils.js
CHANGED
|
@@ -9,19 +9,12 @@
|
|
|
9
9
|
})(function (require, exports) {
|
|
10
10
|
"use strict";
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.drawLine = drawLine;
|
|
13
12
|
exports.getCanvasImageData = getCanvasImageData;
|
|
14
13
|
exports.getImageData = getImageData;
|
|
15
14
|
exports.getTextData = getTextData;
|
|
16
15
|
exports.loadFont = loadFont;
|
|
17
16
|
const engine_1 = require("@tsparticles/engine");
|
|
18
17
|
const defaultWidth = 0;
|
|
19
|
-
function drawLine(context, begin, end) {
|
|
20
|
-
context.beginPath();
|
|
21
|
-
context.moveTo(begin.x, begin.y);
|
|
22
|
-
context.lineTo(end.x, end.y);
|
|
23
|
-
context.closePath();
|
|
24
|
-
}
|
|
25
18
|
function getCanvasImageData(ctx, size, offset, clear = true) {
|
|
26
19
|
const imageData = ctx.getImageData(engine_1.originPoint.x, engine_1.originPoint.y, size.width, size.height).data;
|
|
27
20
|
if (clear) {
|
|
@@ -1,132 +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
|
-
* v4.0.0-alpha.14
|
|
8
|
-
*/
|
|
9
|
-
/*
|
|
10
|
-
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
|
11
|
-
* This devtool is neither made for production nor for readable output files.
|
|
12
|
-
* It uses "eval()" calls to create a separate source file in the browser devtools.
|
|
13
|
-
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
|
|
14
|
-
* or disable the default devtool with "devtool: false".
|
|
15
|
-
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
|
|
16
|
-
*/
|
|
17
|
-
(function webpackUniversalModuleDefinition(root, factory) {
|
|
18
|
-
if(typeof exports === 'object' && typeof module === 'object')
|
|
19
|
-
module.exports = factory(require("@tsparticles/engine"));
|
|
20
|
-
else if(typeof define === 'function' && define.amd)
|
|
21
|
-
define(["@tsparticles/engine"], factory);
|
|
22
|
-
else {
|
|
23
|
-
var a = typeof exports === 'object' ? factory(require("@tsparticles/engine")) : factory(root["window"]);
|
|
24
|
-
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
|
|
25
|
-
}
|
|
26
|
-
})(this, (__WEBPACK_EXTERNAL_MODULE__tsparticles_engine__) => {
|
|
27
|
-
return /******/ (() => { // webpackBootstrap
|
|
28
|
-
/******/ "use strict";
|
|
29
|
-
/******/ var __webpack_modules__ = ({
|
|
30
|
-
|
|
31
|
-
/***/ "./dist/browser/Utils.js"
|
|
32
|
-
/*!*******************************!*\
|
|
33
|
-
!*** ./dist/browser/Utils.js ***!
|
|
34
|
-
\*******************************/
|
|
35
|
-
(__unused_webpack___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 */ drawLine: () => (/* binding */ drawLine),\n/* harmony export */ getCanvasImageData: () => (/* binding */ getCanvasImageData),\n/* harmony export */ getImageData: () => (/* binding */ getImageData),\n/* harmony export */ getTextData: () => (/* binding */ getTextData),\n/* harmony export */ loadFont: () => (/* binding */ loadFont)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nconst defaultWidth = 0;\nfunction drawLine(context, begin, end) {\n context.beginPath();\n context.moveTo(begin.x, begin.y);\n context.lineTo(end.x, end.y);\n context.closePath();\n}\nfunction getCanvasImageData(ctx, size, offset, clear = true) {\n const imageData = ctx.getImageData(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.originPoint.x, _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.originPoint.y, size.width, size.height).data;\n if (clear) {\n ctx.clearRect(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.originPoint.x, _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.originPoint.y, size.width, size.height);\n }\n const pixels = [];\n for(let i = 0; i < imageData.length; i += offset){\n const idx = i / offset, pos = {\n x: idx % size.width,\n y: Math.floor(idx / size.width)\n };\n pixels[pos.y] ??= [];\n const indexesOffset = {\n r: 0,\n g: 1,\n b: 2,\n a: 3\n }, alphaFactor = 255, row = pixels[pos.y];\n if (!row) {\n continue;\n }\n row[pos.x] = {\n r: imageData[i + indexesOffset.r] ?? _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.defaultRgbMin,\n g: imageData[i + indexesOffset.g] ?? _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.defaultRgbMin,\n b: imageData[i + indexesOffset.b] ?? _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.defaultRgbMin,\n a: (imageData[i + indexesOffset.a] ?? _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.defaultAlpha) / 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, canvasSettings) {\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 = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.safeDocument)().createElement(\"canvas\");\n canvas.width = image.width;\n canvas.height = image.height;\n const context = canvas.getContext(\"2d\", canvasSettings);\n if (!context) {\n reject(new Error(\"Could not get canvas context\"));\n return;\n }\n context.drawImage(image, _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.originPoint.x, _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.originPoint.y, image.width, image.height, _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.originPoint.x, _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.originPoint.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, canvasSettings) {\n const canvas = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.safeDocument)().createElement(\"canvas\"), context = canvas.getContext(\"2d\", canvasSettings), { font, text, lines: linesOptions, color } = textOptions;\n if (!text || !context) {\n return;\n }\n const lines = text.split(linesOptions.separator), fontSize = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNumber)(font.size) ? `${font.size.toString()}px` : font.size, linesData = [];\n let maxWidth = 0, 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), 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 if (fill) {\n context.fillStyle = color;\n context.fillText(line.text, _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.originPoint.x, currentHeight + line.measure.actualBoundingBoxAscent);\n } else {\n context.strokeStyle = color;\n context.strokeText(line.text, _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.originPoint.x, currentHeight + line.measure.actualBoundingBoxAscent);\n }\n currentHeight += line.height + linesOptions.spacing;\n }\n return getCanvasImageData(context, canvas, offset);\n}\nasync function loadFont(font, weight) {\n try {\n await (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.safeDocument)().fonts.load(`${weight ?? \"400\"} 36px '${font ?? \"Verdana\"}'`);\n } catch {}\n}\n\n\n//# sourceURL=webpack://@tsparticles/canvas-utils/./dist/browser/Utils.js?\n}");
|
|
38
|
-
|
|
39
|
-
/***/ },
|
|
40
|
-
|
|
41
|
-
/***/ "./dist/browser/index.js"
|
|
42
|
-
/*!*******************************!*\
|
|
43
|
-
!*** ./dist/browser/index.js ***!
|
|
44
|
-
\*******************************/
|
|
45
|
-
(__unused_webpack___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 */ drawLine: () => (/* reexport safe */ _Utils_js__WEBPACK_IMPORTED_MODULE_0__.drawLine),\n/* harmony export */ getCanvasImageData: () => (/* reexport safe */ _Utils_js__WEBPACK_IMPORTED_MODULE_0__.getCanvasImageData),\n/* harmony export */ getImageData: () => (/* reexport safe */ _Utils_js__WEBPACK_IMPORTED_MODULE_0__.getImageData),\n/* harmony export */ getTextData: () => (/* reexport safe */ _Utils_js__WEBPACK_IMPORTED_MODULE_0__.getTextData),\n/* harmony export */ loadFont: () => (/* reexport safe */ _Utils_js__WEBPACK_IMPORTED_MODULE_0__.loadFont)\n/* harmony export */ });\n/* harmony import */ var _Utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Utils.js */ \"./dist/browser/Utils.js\");\n\n\n\n//# sourceURL=webpack://@tsparticles/canvas-utils/./dist/browser/index.js?\n}");
|
|
48
|
-
|
|
49
|
-
/***/ },
|
|
50
|
-
|
|
51
|
-
/***/ "@tsparticles/engine"
|
|
52
|
-
/*!*********************************************************************************************************************************!*\
|
|
53
|
-
!*** external {"commonjs":"@tsparticles/engine","commonjs2":"@tsparticles/engine","amd":"@tsparticles/engine","root":"window"} ***!
|
|
54
|
-
\*********************************************************************************************************************************/
|
|
55
|
-
(module) {
|
|
56
|
-
|
|
57
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
|
|
58
|
-
|
|
59
|
-
/***/ }
|
|
60
|
-
|
|
61
|
-
/******/ });
|
|
62
|
-
/************************************************************************/
|
|
63
|
-
/******/ // The module cache
|
|
64
|
-
/******/ var __webpack_module_cache__ = {};
|
|
65
|
-
/******/
|
|
66
|
-
/******/ // The require function
|
|
67
|
-
/******/ function __webpack_require__(moduleId) {
|
|
68
|
-
/******/ // Check if module is in cache
|
|
69
|
-
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
70
|
-
/******/ if (cachedModule !== undefined) {
|
|
71
|
-
/******/ return cachedModule.exports;
|
|
72
|
-
/******/ }
|
|
73
|
-
/******/ // Check if module exists (development only)
|
|
74
|
-
/******/ if (__webpack_modules__[moduleId] === undefined) {
|
|
75
|
-
/******/ var e = new Error("Cannot find module '" + moduleId + "'");
|
|
76
|
-
/******/ e.code = 'MODULE_NOT_FOUND';
|
|
77
|
-
/******/ throw e;
|
|
78
|
-
/******/ }
|
|
79
|
-
/******/ // Create a new module (and put it into the cache)
|
|
80
|
-
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
81
|
-
/******/ // no module.id needed
|
|
82
|
-
/******/ // no module.loaded needed
|
|
83
|
-
/******/ exports: {}
|
|
84
|
-
/******/ };
|
|
85
|
-
/******/
|
|
86
|
-
/******/ // Execute the module function
|
|
87
|
-
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
88
|
-
/******/
|
|
89
|
-
/******/ // Return the exports of the module
|
|
90
|
-
/******/ return module.exports;
|
|
91
|
-
/******/ }
|
|
92
|
-
/******/
|
|
93
|
-
/************************************************************************/
|
|
94
|
-
/******/ /* webpack/runtime/define property getters */
|
|
95
|
-
/******/ (() => {
|
|
96
|
-
/******/ // define getter functions for harmony exports
|
|
97
|
-
/******/ __webpack_require__.d = (exports, definition) => {
|
|
98
|
-
/******/ for(var key in definition) {
|
|
99
|
-
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
100
|
-
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
101
|
-
/******/ }
|
|
102
|
-
/******/ }
|
|
103
|
-
/******/ };
|
|
104
|
-
/******/ })();
|
|
105
|
-
/******/
|
|
106
|
-
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
107
|
-
/******/ (() => {
|
|
108
|
-
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
109
|
-
/******/ })();
|
|
110
|
-
/******/
|
|
111
|
-
/******/ /* webpack/runtime/make namespace object */
|
|
112
|
-
/******/ (() => {
|
|
113
|
-
/******/ // define __esModule on exports
|
|
114
|
-
/******/ __webpack_require__.r = (exports) => {
|
|
115
|
-
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
116
|
-
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
117
|
-
/******/ }
|
|
118
|
-
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
119
|
-
/******/ };
|
|
120
|
-
/******/ })();
|
|
121
|
-
/******/
|
|
122
|
-
/************************************************************************/
|
|
123
|
-
/******/
|
|
124
|
-
/******/ // startup
|
|
125
|
-
/******/ // Load entry module and return exports
|
|
126
|
-
/******/ // This entry module can't be inlined because the eval devtool is used.
|
|
127
|
-
/******/ var __webpack_exports__ = __webpack_require__("./dist/browser/index.js");
|
|
128
|
-
/******/
|
|
129
|
-
/******/ return __webpack_exports__;
|
|
130
|
-
/******/ })()
|
|
131
|
-
;
|
|
132
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
!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 n in i)("object"==typeof exports?exports:t)[n]=i[n]}}(this,t=>(()=>{"use strict";var e={303(e){e.exports=t}},i={};function n(t){var o=i[t];if(void 0!==o)return o.exports;var r=i[t]={exports:{}};return e[t](r,r.exports,n),r.exports}n.d=(t,e)=>{for(var i in e)n.o(e,i)&&!n.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var o={};n.r(o),n.d(o,{drawLine:()=>a,getCanvasImageData:()=>l,getImageData:()=>g,getTextData:()=>s,loadFont:()=>h});var r=n(303);function a(t,e,i){t.beginPath(),t.moveTo(e.x,e.y),t.lineTo(i.x,i.y),t.closePath()}function l(t,e,i,n=!0){let o=t.getImageData(r.originPoint.x,r.originPoint.y,e.width,e.height).data;n&&t.clearRect(r.originPoint.x,r.originPoint.y,e.width,e.height);let a=[];for(let t=0;t<o.length;t+=i){let n=t/i,l={x:n%e.width,y:Math.floor(n/e.width)};a[l.y]??=[];let g=a[l.y];g&&(g[l.x]={r:o[t+0]??r.defaultRgbMin,g:o[t+1]??r.defaultRgbMin,b:o[t+2]??r.defaultRgbMin,a:(o[t+3]??r.defaultAlpha)/255})}return{pixels:a,width:Math.min(...a.map(t=>t.length)),height:a.length}}function g(t,e,i){let n=new Image;n.crossOrigin="Anonymous";let o=new Promise((t,o)=>{n.onerror=o,n.onload=()=>{let a=(0,r.safeDocument)().createElement("canvas");a.width=n.width,a.height=n.height;let g=a.getContext("2d",i);g?(g.drawImage(n,r.originPoint.x,r.originPoint.y,n.width,n.height,r.originPoint.x,r.originPoint.y,a.width,a.height),t(l(g,a,e))):o(Error("Could not get canvas context"))}});return n.src=t,o}function s(t,e,i,n){let o=(0,r.safeDocument)().createElement("canvas"),a=o.getContext("2d",n),{font:g,text:s,lines:h,color:c}=t;if(!s||!a)return;let u=s.split(h.separator),d=(0,r.isNumber)(g.size)?`${g.size.toString()}px`:g.size,f=[],x=0,p=0;for(let t of u){a.font=`${g.style||""} ${g.variant||""} ${g.weight||""} ${d} ${g.family}`;let e=a.measureText(t),i={measure:e,text:t,height:e.actualBoundingBoxAscent+e.actualBoundingBoxDescent,width:e.width};x=Math.max(x||0,i.width),p+=i.height+h.spacing,f.push(i)}o.width=x,o.height=p;let y=0;for(let t of f)a.font=`${g.style||""} ${g.variant||""} ${g.weight||""} ${d} ${g.family}`,i?(a.fillStyle=c,a.fillText(t.text,r.originPoint.x,y+t.measure.actualBoundingBoxAscent)):(a.strokeStyle=c,a.strokeText(t.text,r.originPoint.x,y+t.measure.actualBoundingBoxAscent)),y+=t.height+h.spacing;return l(a,o,e)}async function h(t,e){try{await (0,r.safeDocument)().fonts.load(`${e??"400"} 36px '${t??"Verdana"}'`)}catch{}}return o})());
|