@tsparticles/updater-destroy 4.0.0-alpha.8 → 4.0.0-beta.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/819.min.js +1 -0
- package/browser/DestroyUpdater.js +5 -2
- package/browser/Options/Classes/Destroy.js +3 -0
- package/browser/Options/Classes/DestroyBounds.js +4 -0
- package/browser/Options/Classes/Split.js +34 -10
- package/browser/Utils.js +57 -29
- package/browser/index.js +1 -1
- package/cjs/DestroyUpdater.js +5 -2
- package/cjs/Options/Classes/Destroy.js +3 -0
- package/cjs/Options/Classes/DestroyBounds.js +4 -0
- package/cjs/Options/Classes/Split.js +34 -10
- package/cjs/Utils.js +57 -29
- package/cjs/index.js +1 -1
- package/dist_browser_DestroyUpdater_js.js +9 -9
- package/esm/DestroyUpdater.js +5 -2
- package/esm/Options/Classes/Destroy.js +3 -0
- package/esm/Options/Classes/DestroyBounds.js +4 -0
- package/esm/Options/Classes/Split.js +34 -10
- package/esm/Utils.js +57 -29
- package/esm/index.js +1 -1
- package/package.json +2 -2
- package/report.html +1 -1
- package/tsparticles.updater.destroy.js +31 -19
- package/tsparticles.updater.destroy.min.js +2 -2
- package/types/Options/Classes/Split.d.ts +4 -2
- package/types/Options/Interfaces/ISplit.d.ts +4 -2
- package/types/Types.d.ts +1 -0
- package/umd/DestroyUpdater.js +5 -2
- package/umd/Options/Classes/Destroy.js +3 -0
- package/umd/Options/Classes/DestroyBounds.js +4 -0
- package/umd/Options/Classes/Split.js +34 -10
- package/umd/Utils.js +56 -28
- package/umd/index.js +1 -1
- package/72.min.js +0 -2
- package/72.min.js.LICENSE.txt +0 -1
- package/tsparticles.updater.destroy.min.js.LICENSE.txt +0 -1
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Demo / Generator : https://particles.js.org/
|
|
5
5
|
* GitHub : https://www.github.com/matteobruni/tsparticles
|
|
6
6
|
* How to use? : Check the GitHub README
|
|
7
|
-
* v4.0.0-
|
|
7
|
+
* v4.0.0-beta.0
|
|
8
8
|
*/
|
|
9
9
|
"use strict";
|
|
10
10
|
/*
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
\****************************************/
|
|
24
24
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
25
25
|
|
|
26
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DestroyUpdater: () => (/* binding */ DestroyUpdater)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _Options_Classes_Destroy_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Options/Classes/Destroy.js */ \"./dist/browser/Options/Classes/Destroy.js\");\n/* harmony import */ var _Enums_DestroyMode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Enums/DestroyMode.js */ \"./dist/browser/Enums/DestroyMode.js\");\n/* harmony import */ var _Utils_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Utils.js */ \"./dist/browser/Utils.js\");\n\n\n\n\nclass DestroyUpdater {\n
|
|
26
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DestroyUpdater: () => (/* binding */ DestroyUpdater)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _Options_Classes_Destroy_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Options/Classes/Destroy.js */ \"./dist/browser/Options/Classes/Destroy.js\");\n/* harmony import */ var _Enums_DestroyMode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Enums/DestroyMode.js */ \"./dist/browser/Enums/DestroyMode.js\");\n/* harmony import */ var _Utils_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Utils.js */ \"./dist/browser/Utils.js\");\n\n\n\n\nclass DestroyUpdater {\n container;\n engine;\n constructor(engine, container){\n this.container = container;\n this.engine = engine;\n }\n init(particle) {\n const container = this.container, particlesOptions = particle.options, destroyOptions = particlesOptions.destroy;\n if (!destroyOptions) {\n return;\n }\n particle.splitCount = 0;\n const destroyBoundsOptions = destroyOptions.bounds;\n particle.destroyBounds ??= {};\n const { bottom, left, right, top } = destroyBoundsOptions, { destroyBounds } = particle, canvasSize = container.canvas.size;\n if (bottom) {\n destroyBounds.bottom = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(bottom) * canvasSize.height / _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.percentDenominator;\n }\n if (left) {\n destroyBounds.left = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(left) * canvasSize.width / _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.percentDenominator;\n }\n if (right) {\n destroyBounds.right = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(right) * canvasSize.width / _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.percentDenominator;\n }\n if (top) {\n destroyBounds.top = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(top) * canvasSize.height / _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.percentDenominator;\n }\n }\n isEnabled(particle) {\n return !particle.destroyed;\n }\n loadOptions(options, ...sources) {\n options.destroy ??= new _Options_Classes_Destroy_js__WEBPACK_IMPORTED_MODULE_1__.Destroy();\n for (const source of sources){\n options.destroy.load(source?.destroy);\n }\n }\n particleDestroyed(particle, override) {\n if (override) {\n return;\n }\n const destroyOptions = particle.options.destroy;\n if (destroyOptions?.mode === _Enums_DestroyMode_js__WEBPACK_IMPORTED_MODULE_2__.DestroyMode.split) {\n (0,_Utils_js__WEBPACK_IMPORTED_MODULE_3__.split)(this.engine, this.container, particle);\n }\n }\n update(particle) {\n if (particle.unbreakableUntil !== undefined && performance.now() >= particle.unbreakableUntil) {\n particle.unbreakable = false;\n particle.unbreakableUntil = undefined;\n }\n const position = particle.getPosition(), bounds = particle.destroyBounds;\n if (!bounds) {\n return;\n }\n if (bounds.bottom !== undefined && position.y >= bounds.bottom || bounds.left !== undefined && position.x <= bounds.left || bounds.right !== undefined && position.x >= bounds.right || bounds.top !== undefined && position.y <= bounds.top) {\n particle.destroy();\n }\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/updater-destroy/./dist/browser/DestroyUpdater.js?\n}");
|
|
27
27
|
|
|
28
28
|
/***/ },
|
|
29
29
|
|
|
@@ -33,7 +33,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
33
33
|
\*******************************************/
|
|
34
34
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
35
35
|
|
|
36
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DestroyMode: () => (/* binding */ DestroyMode)\n/* harmony export */ });\nvar DestroyMode;\n(function
|
|
36
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DestroyMode: () => (/* binding */ DestroyMode)\n/* harmony export */ });\nvar DestroyMode;\n(function(DestroyMode) {\n DestroyMode[\"none\"] = \"none\";\n DestroyMode[\"split\"] = \"split\";\n})(DestroyMode || (DestroyMode = {}));\n\n\n//# sourceURL=webpack://@tsparticles/updater-destroy/./dist/browser/Enums/DestroyMode.js?\n}");
|
|
37
37
|
|
|
38
38
|
/***/ },
|
|
39
39
|
|
|
@@ -43,7 +43,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
43
43
|
\*************************************************/
|
|
44
44
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
45
45
|
|
|
46
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Destroy: () => (/* binding */ Destroy)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _DestroyBounds_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./DestroyBounds.js */ \"./dist/browser/Options/Classes/DestroyBounds.js\");\n/* harmony import */ var _Enums_DestroyMode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Enums/DestroyMode.js */ \"./dist/browser/Enums/DestroyMode.js\");\n/* harmony import */ var _Split_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Split.js */ \"./dist/browser/Options/Classes/Split.js\");\n\n\n\n\nclass Destroy {\n
|
|
46
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Destroy: () => (/* binding */ Destroy)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _DestroyBounds_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./DestroyBounds.js */ \"./dist/browser/Options/Classes/DestroyBounds.js\");\n/* harmony import */ var _Enums_DestroyMode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Enums/DestroyMode.js */ \"./dist/browser/Enums/DestroyMode.js\");\n/* harmony import */ var _Split_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Split.js */ \"./dist/browser/Options/Classes/Split.js\");\n\n\n\n\nclass Destroy {\n bounds;\n mode;\n split;\n constructor(){\n this.bounds = new _DestroyBounds_js__WEBPACK_IMPORTED_MODULE_1__.DestroyBounds();\n this.mode = _Enums_DestroyMode_js__WEBPACK_IMPORTED_MODULE_2__.DestroyMode.none;\n this.split = new _Split_js__WEBPACK_IMPORTED_MODULE_3__.Split();\n }\n load(data) {\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNull)(data)) {\n return;\n }\n if (data.mode) {\n this.mode = data.mode;\n }\n if (data.bounds) {\n this.bounds.load(data.bounds);\n }\n this.split.load(data.split);\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/updater-destroy/./dist/browser/Options/Classes/Destroy.js?\n}");
|
|
47
47
|
|
|
48
48
|
/***/ },
|
|
49
49
|
|
|
@@ -53,7 +53,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
53
53
|
\*******************************************************/
|
|
54
54
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
55
55
|
|
|
56
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DestroyBounds: () => (/* binding */ DestroyBounds)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nclass DestroyBounds {\n
|
|
56
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DestroyBounds: () => (/* binding */ DestroyBounds)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nclass DestroyBounds {\n bottom;\n left;\n right;\n top;\n load(data) {\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNull)(data)) {\n return;\n }\n if (data.bottom !== undefined) {\n this.bottom = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.setRangeValue)(data.bottom);\n }\n if (data.left !== undefined) {\n this.left = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.setRangeValue)(data.left);\n }\n if (data.right !== undefined) {\n this.right = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.setRangeValue)(data.right);\n }\n if (data.top !== undefined) {\n this.top = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.setRangeValue)(data.top);\n }\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/updater-destroy/./dist/browser/Options/Classes/DestroyBounds.js?\n}");
|
|
57
57
|
|
|
58
58
|
/***/ },
|
|
59
59
|
|
|
@@ -63,7 +63,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
63
63
|
\***********************************************/
|
|
64
64
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
65
65
|
|
|
66
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Split: () => (/* binding */ Split)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _SplitFactor_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./SplitFactor.js */ \"./dist/browser/Options/Classes/SplitFactor.js\");\n/* harmony import */ var _SplitRate_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./SplitRate.js */ \"./dist/browser/Options/Classes/SplitRate.js\");\n\n\n\nclass Split {\n
|
|
66
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Split: () => (/* binding */ Split)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _SplitFactor_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./SplitFactor.js */ \"./dist/browser/Options/Classes/SplitFactor.js\");\n/* harmony import */ var _SplitRate_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./SplitRate.js */ \"./dist/browser/Options/Classes/SplitRate.js\");\n\n\n\nclass Split {\n count;\n factor;\n fillColor;\n fillColorOffset;\n particles;\n rate;\n sizeOffset;\n strokeColor;\n strokeColorOffset;\n constructor(){\n this.count = 1;\n this.factor = new _SplitFactor_js__WEBPACK_IMPORTED_MODULE_1__.SplitFactor();\n this.rate = new _SplitRate_js__WEBPACK_IMPORTED_MODULE_2__.SplitRate();\n this.sizeOffset = true;\n }\n load(data) {\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNull)(data)) {\n return;\n }\n if (data.fillColor !== undefined) {\n this.fillColor = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.OptionsColor.create(this.fillColor, data.fillColor);\n }\n if (data.strokeColor !== undefined) {\n this.strokeColor = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.OptionsColor.create(this.strokeColor, data.strokeColor);\n }\n if (data.count !== undefined) {\n this.count = data.count;\n }\n this.factor.load(data.factor);\n this.rate.load(data.rate);\n this.particles = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.executeOnSingleOrMultiple)(data.particles, (particles)=>{\n return (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.deepExtend)({}, particles);\n });\n if (data.sizeOffset !== undefined) {\n this.sizeOffset = data.sizeOffset;\n }\n if (data.fillColorOffset) {\n this.fillColorOffset = this.fillColorOffset ?? {};\n if (data.fillColorOffset.h !== undefined) {\n this.fillColorOffset.h = data.fillColorOffset.h;\n }\n if (data.fillColorOffset.s !== undefined) {\n this.fillColorOffset.s = data.fillColorOffset.s;\n }\n if (data.fillColorOffset.l !== undefined) {\n this.fillColorOffset.l = data.fillColorOffset.l;\n }\n }\n if (data.strokeColorOffset) {\n this.strokeColorOffset = this.strokeColorOffset ?? {};\n if (data.strokeColorOffset.h !== undefined) {\n this.strokeColorOffset.h = data.strokeColorOffset.h;\n }\n if (data.strokeColorOffset.s !== undefined) {\n this.strokeColorOffset.s = data.strokeColorOffset.s;\n }\n if (data.strokeColorOffset.l !== undefined) {\n this.strokeColorOffset.l = data.strokeColorOffset.l;\n }\n }\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/updater-destroy/./dist/browser/Options/Classes/Split.js?\n}");
|
|
67
67
|
|
|
68
68
|
/***/ },
|
|
69
69
|
|
|
@@ -73,7 +73,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
73
73
|
\*****************************************************/
|
|
74
74
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
75
75
|
|
|
76
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ SplitFactor: () => (/* binding */ SplitFactor)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nclass SplitFactor extends _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.ValueWithRandom {\n
|
|
76
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ SplitFactor: () => (/* binding */ SplitFactor)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nclass SplitFactor extends _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.ValueWithRandom {\n constructor(){\n super();\n this.value = 3;\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/updater-destroy/./dist/browser/Options/Classes/SplitFactor.js?\n}");
|
|
77
77
|
|
|
78
78
|
/***/ },
|
|
79
79
|
|
|
@@ -83,7 +83,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
83
83
|
\***************************************************/
|
|
84
84
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
85
85
|
|
|
86
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ SplitRate: () => (/* binding */ SplitRate)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nclass SplitRate extends _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.ValueWithRandom {\n
|
|
86
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ SplitRate: () => (/* binding */ SplitRate)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nclass SplitRate extends _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.ValueWithRandom {\n constructor(){\n super();\n this.value = {\n min: 4,\n max: 9\n };\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/updater-destroy/./dist/browser/Options/Classes/SplitRate.js?\n}");
|
|
87
87
|
|
|
88
88
|
/***/ },
|
|
89
89
|
|
|
@@ -93,7 +93,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
93
93
|
\*******************************/
|
|
94
94
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
95
95
|
|
|
96
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ split: () => (/* binding */ split)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nconst defaultOffset = 0
|
|
96
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ split: () => (/* binding */ split)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nconst defaultOffset = 0, minDestroySize = 0.5, defaultSplitCount = 0, increment = 1, unbreakableTime = 500, minSplitCount = 0;\nfunction addSplitParticle(engine, container, parent, splitParticlesOptions) {\n const destroyOptions = parent.options.destroy;\n if (!destroyOptions) {\n return;\n }\n const splitOptions = destroyOptions.split, options = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.loadParticlesOptions)(engine, container, parent.options), fillOptions = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.itemFromSingleOrMultiple)(options.fill), strokeOptions = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.itemFromSingleOrMultiple)(options.stroke);\n if (fillOptions?.enable) {\n const fillColor = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.AnimatableColor.create(undefined, fillOptions.color), parentFillColor = parent.getFillColor();\n if (fillColor.value) {\n fillColor.load(splitOptions.fillColor);\n } else if (splitOptions.fillColorOffset && parentFillColor) {\n fillColor.load({\n value: {\n hsl: {\n h: parentFillColor.h + (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(splitOptions.fillColorOffset.h ?? defaultOffset),\n s: parentFillColor.s + (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(splitOptions.fillColorOffset.s ?? defaultOffset),\n l: parentFillColor.l + (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(splitOptions.fillColorOffset.l ?? defaultOffset)\n }\n }\n });\n } else {\n fillColor.load({\n value: {\n hsl: parent.getFillColor()\n }\n });\n }\n }\n if (strokeOptions?.width) {\n const strokeColor = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.AnimatableColor.create(undefined, strokeOptions.color), parentStrokeColor = parent.getStrokeColor();\n if (strokeColor.value) {\n strokeColor.load(splitOptions.strokeColor);\n } else if (splitOptions.strokeColorOffset && parentStrokeColor) {\n strokeColor.load({\n value: {\n hsl: {\n h: parentStrokeColor.h + (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(splitOptions.strokeColorOffset.h ?? defaultOffset),\n s: parentStrokeColor.s + (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(splitOptions.strokeColorOffset.s ?? defaultOffset),\n l: parentStrokeColor.l + (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(splitOptions.strokeColorOffset.l ?? defaultOffset)\n }\n }\n });\n } else {\n strokeColor.load({\n value: {\n hsl: parent.getStrokeColor()\n }\n });\n }\n }\n options.move.load({\n center: {\n x: parent.position.x,\n y: parent.position.y,\n mode: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.PixelMode.precise\n }\n });\n const factor = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.identity / (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(splitOptions.factor.value);\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNumber)(options.size.value)) {\n options.size.value *= factor;\n } else {\n options.size.value.min *= factor;\n options.size.value.max *= factor;\n }\n options.load(splitParticlesOptions);\n const offset = splitOptions.sizeOffset ? (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.setRangeValue)(-parent.size.value, parent.size.value) : defaultOffset, position = {\n x: parent.position.x + (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.randomInRangeValue)(offset),\n y: parent.position.y + (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.randomInRangeValue)(offset)\n };\n return container.particles.addParticle(position, options, parent.group, (particle)=>{\n if (particle.size.value < minDestroySize) {\n return false;\n }\n particle.velocity.length = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.randomInRangeValue)((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.setRangeValue)(parent.velocity.length, particle.velocity.length));\n particle.splitCount = (parent.splitCount ?? defaultSplitCount) + increment;\n particle.unbreakable = true;\n particle.unbreakableUntil = performance.now() + unbreakableTime;\n return true;\n });\n}\nfunction split(engine, container, particle) {\n const destroyOptions = particle.options.destroy;\n if (!destroyOptions) {\n return;\n }\n const splitOptions = destroyOptions.split;\n if (splitOptions.count >= minSplitCount) {\n if (particle.splitCount === undefined || particle.splitCount > splitOptions.count) {\n return;\n }\n particle.splitCount++;\n }\n const rate = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(splitOptions.rate.value), particlesSplitOptions = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.itemFromSingleOrMultiple)(splitOptions.particles);\n for(let i = 0; i < rate; i++){\n addSplitParticle(engine, container, particle, particlesSplitOptions);\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/updater-destroy/./dist/browser/Utils.js?\n}");
|
|
97
97
|
|
|
98
98
|
/***/ }
|
|
99
99
|
|
package/esm/DestroyUpdater.js
CHANGED
|
@@ -3,6 +3,8 @@ import { Destroy } from "./Options/Classes/Destroy.js";
|
|
|
3
3
|
import { DestroyMode } from "./Enums/DestroyMode.js";
|
|
4
4
|
import { split } from "./Utils.js";
|
|
5
5
|
export class DestroyUpdater {
|
|
6
|
+
container;
|
|
7
|
+
engine;
|
|
6
8
|
constructor(engine, container) {
|
|
7
9
|
this.container = container;
|
|
8
10
|
this.engine = engine;
|
|
@@ -48,8 +50,9 @@ export class DestroyUpdater {
|
|
|
48
50
|
}
|
|
49
51
|
}
|
|
50
52
|
update(particle) {
|
|
51
|
-
if (
|
|
52
|
-
|
|
53
|
+
if (particle.unbreakableUntil !== undefined && performance.now() >= particle.unbreakableUntil) {
|
|
54
|
+
particle.unbreakable = false;
|
|
55
|
+
particle.unbreakableUntil = undefined;
|
|
53
56
|
}
|
|
54
57
|
const position = particle.getPosition(), bounds = particle.destroyBounds;
|
|
55
58
|
if (!bounds) {
|
|
@@ -3,6 +3,9 @@ import { DestroyBounds } from "./DestroyBounds.js";
|
|
|
3
3
|
import { DestroyMode } from "../../Enums/DestroyMode.js";
|
|
4
4
|
import { Split } from "./Split.js";
|
|
5
5
|
export class Destroy {
|
|
6
|
+
bounds;
|
|
7
|
+
mode;
|
|
8
|
+
split;
|
|
6
9
|
constructor() {
|
|
7
10
|
this.bounds = new DestroyBounds();
|
|
8
11
|
this.mode = DestroyMode.none;
|
|
@@ -2,6 +2,15 @@ import { OptionsColor, deepExtend, executeOnSingleOrMultiple, isNull, } from "@t
|
|
|
2
2
|
import { SplitFactor } from "./SplitFactor.js";
|
|
3
3
|
import { SplitRate } from "./SplitRate.js";
|
|
4
4
|
export class Split {
|
|
5
|
+
count;
|
|
6
|
+
factor;
|
|
7
|
+
fillColor;
|
|
8
|
+
fillColorOffset;
|
|
9
|
+
particles;
|
|
10
|
+
rate;
|
|
11
|
+
sizeOffset;
|
|
12
|
+
strokeColor;
|
|
13
|
+
strokeColorOffset;
|
|
5
14
|
constructor() {
|
|
6
15
|
this.count = 1;
|
|
7
16
|
this.factor = new SplitFactor();
|
|
@@ -12,8 +21,11 @@ export class Split {
|
|
|
12
21
|
if (isNull(data)) {
|
|
13
22
|
return;
|
|
14
23
|
}
|
|
15
|
-
if (data.
|
|
16
|
-
this.
|
|
24
|
+
if (data.fillColor !== undefined) {
|
|
25
|
+
this.fillColor = OptionsColor.create(this.fillColor, data.fillColor);
|
|
26
|
+
}
|
|
27
|
+
if (data.strokeColor !== undefined) {
|
|
28
|
+
this.strokeColor = OptionsColor.create(this.strokeColor, data.strokeColor);
|
|
17
29
|
}
|
|
18
30
|
if (data.count !== undefined) {
|
|
19
31
|
this.count = data.count;
|
|
@@ -26,16 +38,28 @@ export class Split {
|
|
|
26
38
|
if (data.sizeOffset !== undefined) {
|
|
27
39
|
this.sizeOffset = data.sizeOffset;
|
|
28
40
|
}
|
|
29
|
-
if (data.
|
|
30
|
-
this.
|
|
31
|
-
if (data.
|
|
32
|
-
this.
|
|
41
|
+
if (data.fillColorOffset) {
|
|
42
|
+
this.fillColorOffset = this.fillColorOffset ?? {};
|
|
43
|
+
if (data.fillColorOffset.h !== undefined) {
|
|
44
|
+
this.fillColorOffset.h = data.fillColorOffset.h;
|
|
45
|
+
}
|
|
46
|
+
if (data.fillColorOffset.s !== undefined) {
|
|
47
|
+
this.fillColorOffset.s = data.fillColorOffset.s;
|
|
48
|
+
}
|
|
49
|
+
if (data.fillColorOffset.l !== undefined) {
|
|
50
|
+
this.fillColorOffset.l = data.fillColorOffset.l;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
if (data.strokeColorOffset) {
|
|
54
|
+
this.strokeColorOffset = this.strokeColorOffset ?? {};
|
|
55
|
+
if (data.strokeColorOffset.h !== undefined) {
|
|
56
|
+
this.strokeColorOffset.h = data.strokeColorOffset.h;
|
|
33
57
|
}
|
|
34
|
-
if (data.
|
|
35
|
-
this.
|
|
58
|
+
if (data.strokeColorOffset.s !== undefined) {
|
|
59
|
+
this.strokeColorOffset.s = data.strokeColorOffset.s;
|
|
36
60
|
}
|
|
37
|
-
if (data.
|
|
38
|
-
this.
|
|
61
|
+
if (data.strokeColorOffset.l !== undefined) {
|
|
62
|
+
this.strokeColorOffset.l = data.strokeColorOffset.l;
|
|
39
63
|
}
|
|
40
64
|
}
|
|
41
65
|
}
|
package/esm/Utils.js
CHANGED
|
@@ -1,31 +1,58 @@
|
|
|
1
|
-
import { PixelMode, getRangeValue, isNumber, itemFromSingleOrMultiple, loadParticlesOptions, randomInRangeValue, setRangeValue, } from "@tsparticles/engine";
|
|
1
|
+
import { AnimatableColor, PixelMode, getRangeValue, identity, isNumber, itemFromSingleOrMultiple, loadParticlesOptions, randomInRangeValue, setRangeValue, } from "@tsparticles/engine";
|
|
2
2
|
const defaultOffset = 0, minDestroySize = 0.5, defaultSplitCount = 0, increment = 1, unbreakableTime = 500, minSplitCount = 0;
|
|
3
3
|
function addSplitParticle(engine, container, parent, splitParticlesOptions) {
|
|
4
4
|
const destroyOptions = parent.options.destroy;
|
|
5
5
|
if (!destroyOptions) {
|
|
6
6
|
return;
|
|
7
7
|
}
|
|
8
|
-
const splitOptions = destroyOptions.split, options = loadParticlesOptions(engine, container, parent.options),
|
|
9
|
-
if (
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
8
|
+
const splitOptions = destroyOptions.split, options = loadParticlesOptions(engine, container, parent.options), fillOptions = itemFromSingleOrMultiple(options.fill), strokeOptions = itemFromSingleOrMultiple(options.stroke);
|
|
9
|
+
if (fillOptions?.enable) {
|
|
10
|
+
const fillColor = AnimatableColor.create(undefined, fillOptions.color), parentFillColor = parent.getFillColor();
|
|
11
|
+
if (fillColor.value) {
|
|
12
|
+
fillColor.load(splitOptions.fillColor);
|
|
13
|
+
}
|
|
14
|
+
else if (splitOptions.fillColorOffset && parentFillColor) {
|
|
15
|
+
fillColor.load({
|
|
16
|
+
value: {
|
|
17
|
+
hsl: {
|
|
18
|
+
h: parentFillColor.h + getRangeValue(splitOptions.fillColorOffset.h ?? defaultOffset),
|
|
19
|
+
s: parentFillColor.s + getRangeValue(splitOptions.fillColorOffset.s ?? defaultOffset),
|
|
20
|
+
l: parentFillColor.l + getRangeValue(splitOptions.fillColorOffset.l ?? defaultOffset),
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
fillColor.load({
|
|
27
|
+
value: {
|
|
28
|
+
hsl: parent.getFillColor(),
|
|
19
29
|
},
|
|
20
|
-
}
|
|
21
|
-
}
|
|
30
|
+
});
|
|
31
|
+
}
|
|
22
32
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
33
|
+
if (strokeOptions?.width) {
|
|
34
|
+
const strokeColor = AnimatableColor.create(undefined, strokeOptions.color), parentStrokeColor = parent.getStrokeColor();
|
|
35
|
+
if (strokeColor.value) {
|
|
36
|
+
strokeColor.load(splitOptions.strokeColor);
|
|
37
|
+
}
|
|
38
|
+
else if (splitOptions.strokeColorOffset && parentStrokeColor) {
|
|
39
|
+
strokeColor.load({
|
|
40
|
+
value: {
|
|
41
|
+
hsl: {
|
|
42
|
+
h: parentStrokeColor.h + getRangeValue(splitOptions.strokeColorOffset.h ?? defaultOffset),
|
|
43
|
+
s: parentStrokeColor.s + getRangeValue(splitOptions.strokeColorOffset.s ?? defaultOffset),
|
|
44
|
+
l: parentStrokeColor.l + getRangeValue(splitOptions.strokeColorOffset.l ?? defaultOffset),
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
strokeColor.load({
|
|
51
|
+
value: {
|
|
52
|
+
hsl: parent.getStrokeColor(),
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
}
|
|
29
56
|
}
|
|
30
57
|
options.move.load({
|
|
31
58
|
center: {
|
|
@@ -34,12 +61,13 @@ function addSplitParticle(engine, container, parent, splitParticlesOptions) {
|
|
|
34
61
|
mode: PixelMode.precise,
|
|
35
62
|
},
|
|
36
63
|
});
|
|
64
|
+
const factor = identity / getRangeValue(splitOptions.factor.value);
|
|
37
65
|
if (isNumber(options.size.value)) {
|
|
38
|
-
options.size.value
|
|
66
|
+
options.size.value *= factor;
|
|
39
67
|
}
|
|
40
68
|
else {
|
|
41
|
-
options.size.value.min
|
|
42
|
-
options.size.value.max
|
|
69
|
+
options.size.value.min *= factor;
|
|
70
|
+
options.size.value.max *= factor;
|
|
43
71
|
}
|
|
44
72
|
options.load(splitParticlesOptions);
|
|
45
73
|
const offset = splitOptions.sizeOffset ? setRangeValue(-parent.size.value, parent.size.value) : defaultOffset, position = {
|
|
@@ -53,9 +81,7 @@ function addSplitParticle(engine, container, parent, splitParticlesOptions) {
|
|
|
53
81
|
particle.velocity.length = randomInRangeValue(setRangeValue(parent.velocity.length, particle.velocity.length));
|
|
54
82
|
particle.splitCount = (parent.splitCount ?? defaultSplitCount) + increment;
|
|
55
83
|
particle.unbreakable = true;
|
|
56
|
-
|
|
57
|
-
particle.unbreakable = false;
|
|
58
|
-
}, unbreakableTime);
|
|
84
|
+
particle.unbreakableUntil = performance.now() + unbreakableTime;
|
|
59
85
|
return true;
|
|
60
86
|
});
|
|
61
87
|
}
|
|
@@ -65,9 +91,11 @@ export function split(engine, container, particle) {
|
|
|
65
91
|
return;
|
|
66
92
|
}
|
|
67
93
|
const splitOptions = destroyOptions.split;
|
|
68
|
-
if (splitOptions.count >= minSplitCount
|
|
69
|
-
(particle.splitCount === undefined || particle.splitCount
|
|
70
|
-
|
|
94
|
+
if (splitOptions.count >= minSplitCount) {
|
|
95
|
+
if (particle.splitCount === undefined || particle.splitCount > splitOptions.count) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
particle.splitCount++;
|
|
71
99
|
}
|
|
72
100
|
const rate = getRangeValue(splitOptions.rate.value), particlesSplitOptions = itemFromSingleOrMultiple(splitOptions.particles);
|
|
73
101
|
for (let i = 0; i < rate; i++) {
|
package/esm/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export async function loadDestroyUpdater(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-
|
|
2
|
+
engine.checkVersion("4.0.0-beta.0");
|
|
3
3
|
await engine.register(e => {
|
|
4
4
|
e.addParticleUpdater("destroy", async (container) => {
|
|
5
5
|
const { DestroyUpdater } = await import("./DestroyUpdater.js");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/updater-destroy",
|
|
3
|
-
"version": "4.0.0-
|
|
3
|
+
"version": "4.0.0-beta.0",
|
|
4
4
|
"description": "tsParticles particles destroy updater",
|
|
5
5
|
"homepage": "https://particles.js.org",
|
|
6
6
|
"repository": {
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"./package.json": "./package.json"
|
|
88
88
|
},
|
|
89
89
|
"dependencies": {
|
|
90
|
-
"@tsparticles/engine": "4.0.0-
|
|
90
|
+
"@tsparticles/engine": "4.0.0-beta.0"
|
|
91
91
|
},
|
|
92
92
|
"publishConfig": {
|
|
93
93
|
"access": "public"
|
package/report.html
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8"/>
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
6
|
-
<title>@tsparticles/updater-destroy [
|
|
6
|
+
<title>@tsparticles/updater-destroy [19 Mar 2026 at 14:00]</title>
|
|
7
7
|
<link rel="shortcut icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAABrVBMVEUAAAD///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////+O1foceMD///+J0/qK1Pr7/v8Xdr/9///W8P4UdL7L7P0Scr2r4Pyj3vwad8D5/f/2/f+55f3E6f34+/2H0/ojfMKpzOd0rNgQcb3F3O/j9f7c8v6g3Pz0/P/w+v/q+P7n9v6T1/uQ1vuE0vqLut/y+v+Z2fvt+f+15Pzv9fuc2/vR7v2V2Pvd6/bg9P7I6/285/2y4/yp3/zp8vk8i8kqgMT7/P31+fyv4vxGkcz6/P6/6P3j7vfS5PNnpNUxhcbO7f7F6v3O4vHK3/DA2u631Ouy0eqXweKJud5wqthfoNMMbLvY8f73+v2dxeR8sNtTmdDx9/zX6PSjyeaCtd1YnNGX2PuQveCGt95Nls42h8dLlM3F4vBtAAAAM3RSTlMAAyOx0/sKBvik8opWGBMOAe3l1snDm2E9LSb06eHcu5JpHbarfHZCN9CBb08zzkdNS0kYaptYAAAFV0lEQVRYw92X51/aYBDHHS2O2qqttVbrqNq9m+TJIAYIShBkWwqIiCgoWvfeq7Z2/s29hyQNyUcR7LveGwVyXy6XH8/9rqxglLfUPLxVduUor3h0rfp2TYvpivk37929TkG037hffoX0+peVtZQc1589rigVUdXS/ABSAyEmGIO/1XfvldSK8vs3OqB6u3m0nxmIrvgB0dj7rr7Y9IbuF68hnfFaiHA/sxqm0wciIG43P60qKv9WXWc1RXGh/mFESFABTSBi0sNAKzqet17eCtOb3kZIDwxEEU0oAIJGYxNBDhBND29e0rtXXbcpuPmED9IhEAAQ/AXEaF8EPmnrrKsv0LvWR3fg5sWDNAFZOgAgaKvZDogHNU9MFwnnYROkc56RD5CjAbQX9Ow4g7upCsvYu55aSI/Nj0H1akgKQEUM94dwK65hYRmFU9MIcH/fqJYOZYcnuJSU/waKDgTOEVaVKhwrTRP5XzgSpAITYzom7UvkhFX5VutmxeNnWDjjswTKTyfgluNDGbUpWissXhF3s7mlSml+czWkg3D0l1nNjGNjz3myOQOa1KM/jOS6ebdbAVTCi4gljHSFrviza7tOgRWcS0MOUX9zdNgag5w7rRqA44Lzw0hr1WqES36dFliSJFlh2rXIae3FFcDDgKdxrUIDePr8jGcSClV1u7A9xeN0ModY/pHMxmR1EzRh8TJiwqsHmKW0l4FCEZI+jHio+JdPPE9qwQtTRxku2D8sIeRL2LnxWSllANCQGOIiqVHAz2ye2JR0DcH+HoxDkaADLjgxjKQ+AwCX/g0+DNgdG0ukYCONAe+dbc2IAc6fwt1ARoDSezNHxV2Cmzwv3O6lDMV55edBGwGK9n1+x2F8EDfAGCxug8MhpsMEcTEAWf3rx2vZhe/LAmtIn/6apE6PN0ULKgywD9mmdxbmFl3OvD5AS5fW5zLbv/YHmcsBTjf/afDz3MaZTVCfAP9z6/Bw6ycv8EUBWJIn9zYcoAWWlW9+OzO3vkTy8H+RANLmdrpOuYWdZYEXpo+TlCJrW5EARb7fF+bWdqf3hhyZI1nWJQHgznErZhbjoEsWqi8dQNoE294aldzFurwSABL2XXMf9+H1VQGke9exw5P/AnA5Pv5ngMul7LOvO922iwACu8WkCwLCafvM4CeWPxfA8lNHcWZSoi8EwMAIciKX2Z4SWCMAa3snCZ/G4EA8D6CMLNFsGQhkkz/gQNEBbPCbWsxGUpYVu3z8IyNAknwJkfPMEhLyrdi5RTyUVACkw4GSFRNWJNEW+fgPGwHD8/JxnRuLabN4CGNRkAE23na2+VmEAUmrYymSGjMAYqH84YUIyzgzs3XC7gNgH36Vcc4zKY9o9fgPBXUAiHHwVboBHGLiX6Zcjp1f2wu4tvzZKo0ecPnDtQYDQvJXaBeNzce45Fp28ZQLrEZVuFqgBwOalArKXnW1UzlnSusQKJqKYNuz4tOnI6sZG4zanpemv+7ySU2jbA9h6uhcgpfy6G2PahirDZ6zvq6zDduMVFTKvzw8wgyEdelwY9in3XkEPs3osJuwRQ4qTkfzifndg9Gfc4pdsu82+tTnHZTBa2EAMrqr2t43pguc8tNm7JQVQ2S0ukj2d22dhXYP0/veWtwKrCkNoNimAN5+Xr/oLrxswKbVJjteWrX7eR63o4j9q0GxnaBdWgGA5VStpanIjQmEhV0/nVt5VOFUvix6awJhPcAaTEShgrG+iGyvb5a0Ndb1YGHFPEwoqAinoaykaID1o1pdPNu7XsnCKQ3R+hwWIIhGvORcJUBYXe3Xa3vq/mF/N9V13ugufMkfXn+KHsRD0B8AAAAASUVORK5CYII=" type="image/x-icon" />
|
|
8
8
|
|
|
9
9
|
<script>
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Demo / Generator : https://particles.js.org/
|
|
5
5
|
* GitHub : https://www.github.com/matteobruni/tsparticles
|
|
6
6
|
* How to use? : Check the GitHub README
|
|
7
|
-
* v4.0.0-
|
|
7
|
+
* v4.0.0-beta.0
|
|
8
8
|
*/
|
|
9
9
|
/*
|
|
10
10
|
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
|
@@ -28,16 +28,6 @@ return /******/ (() => { // webpackBootstrap
|
|
|
28
28
|
/******/ "use strict";
|
|
29
29
|
/******/ var __webpack_modules__ = ({
|
|
30
30
|
|
|
31
|
-
/***/ "./dist/browser/index.js"
|
|
32
|
-
/*!*******************************!*\
|
|
33
|
-
!*** ./dist/browser/index.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 */ loadDestroyUpdater: () => (/* binding */ loadDestroyUpdater)\n/* harmony export */ });\nasync function loadDestroyUpdater(engine) {\n engine.checkVersion(\"4.0.0-alpha.8\");\n await engine.register(e => {\n e.addParticleUpdater(\"destroy\", async container => {\n const {\n DestroyUpdater\n } = await __webpack_require__.e(/*! import() */ \"dist_browser_DestroyUpdater_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./DestroyUpdater.js */ \"./dist/browser/DestroyUpdater.js\"));\n return new DestroyUpdater(e, container);\n });\n });\n}\n\n//# sourceURL=webpack://@tsparticles/updater-destroy/./dist/browser/index.js?\n}");
|
|
38
|
-
|
|
39
|
-
/***/ },
|
|
40
|
-
|
|
41
31
|
/***/ "@tsparticles/engine"
|
|
42
32
|
/*!*********************************************************************************************************************************!*\
|
|
43
33
|
!*** external {"commonjs":"@tsparticles/engine","commonjs2":"@tsparticles/engine","amd":"@tsparticles/engine","root":"window"} ***!
|
|
@@ -46,6 +36,16 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
46
36
|
|
|
47
37
|
module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
|
|
48
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 */ loadDestroyUpdater: () => (/* binding */ loadDestroyUpdater)\n/* harmony export */ });\nasync function loadDestroyUpdater(engine) {\n engine.checkVersion(\"4.0.0-beta.0\");\n await engine.register((e)=>{\n e.addParticleUpdater(\"destroy\", async (container)=>{\n const { DestroyUpdater } = await __webpack_require__.e(/*! import() */ \"dist_browser_DestroyUpdater_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./DestroyUpdater.js */ \"./dist/browser/DestroyUpdater.js\"));\n return new DestroyUpdater(e, container);\n });\n });\n}\n\n\n//# sourceURL=webpack://@tsparticles/updater-destroy/./dist/browser/index.js?\n}");
|
|
48
|
+
|
|
49
49
|
/***/ }
|
|
50
50
|
|
|
51
51
|
/******/ });
|
|
@@ -60,12 +60,6 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
|
|
|
60
60
|
/******/ if (cachedModule !== undefined) {
|
|
61
61
|
/******/ return cachedModule.exports;
|
|
62
62
|
/******/ }
|
|
63
|
-
/******/ // Check if module exists (development only)
|
|
64
|
-
/******/ if (__webpack_modules__[moduleId] === undefined) {
|
|
65
|
-
/******/ var e = new Error("Cannot find module '" + moduleId + "'");
|
|
66
|
-
/******/ e.code = 'MODULE_NOT_FOUND';
|
|
67
|
-
/******/ throw e;
|
|
68
|
-
/******/ }
|
|
69
63
|
/******/ // Create a new module (and put it into the cache)
|
|
70
64
|
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
71
65
|
/******/ // no module.id needed
|
|
@@ -74,6 +68,12 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
|
|
|
74
68
|
/******/ };
|
|
75
69
|
/******/
|
|
76
70
|
/******/ // Execute the module function
|
|
71
|
+
/******/ if (!(moduleId in __webpack_modules__)) {
|
|
72
|
+
/******/ delete __webpack_module_cache__[moduleId];
|
|
73
|
+
/******/ var e = new Error("Cannot find module '" + moduleId + "'");
|
|
74
|
+
/******/ e.code = 'MODULE_NOT_FOUND';
|
|
75
|
+
/******/ throw e;
|
|
76
|
+
/******/ }
|
|
77
77
|
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
78
78
|
/******/
|
|
79
79
|
/******/ // Return the exports of the module
|
|
@@ -118,6 +118,18 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
|
|
|
118
118
|
/******/ };
|
|
119
119
|
/******/ })();
|
|
120
120
|
/******/
|
|
121
|
+
/******/ /* webpack/runtime/global */
|
|
122
|
+
/******/ (() => {
|
|
123
|
+
/******/ __webpack_require__.g = (function() {
|
|
124
|
+
/******/ if (typeof globalThis === 'object') return globalThis;
|
|
125
|
+
/******/ try {
|
|
126
|
+
/******/ return this || new Function('return this')();
|
|
127
|
+
/******/ } catch (e) {
|
|
128
|
+
/******/ if (typeof window === 'object') return window;
|
|
129
|
+
/******/ }
|
|
130
|
+
/******/ })();
|
|
131
|
+
/******/ })();
|
|
132
|
+
/******/
|
|
121
133
|
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
122
134
|
/******/ (() => {
|
|
123
135
|
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
@@ -182,8 +194,8 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
|
|
|
182
194
|
/******/ /* webpack/runtime/publicPath */
|
|
183
195
|
/******/ (() => {
|
|
184
196
|
/******/ var scriptUrl;
|
|
185
|
-
/******/ if (
|
|
186
|
-
/******/ var document =
|
|
197
|
+
/******/ if (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + "";
|
|
198
|
+
/******/ var document = __webpack_require__.g.document;
|
|
187
199
|
/******/ if (!scriptUrl && document) {
|
|
188
200
|
/******/ if (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT')
|
|
189
201
|
/******/ scriptUrl = document.currentScript.src;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],t);else{var r="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var o in r)("object"==typeof exports?exports:e)[o]=r[o]}}(this,e=>(()=>{"use strict";var t,r,o,i={303(t){t.exports=e}},n={};function a(e){var t=n[e];if(void 0!==t)return t.exports;var r=n[e]={exports:{}};return i[e](r,r.exports,a),r.exports}a.m=i,a.d=(e,t)=>{for(var r in t)a.o(t,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},a.f={},a.e=e=>Promise.all(Object.keys(a.f).reduce((t,r)=>(a.f[r](e,t),t),[])),a.u=e=>""+e+".min.js",a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s={},a.l=(e,t,r,o)=>{if(s[e])return void s[e].push(t);if(void 0!==r)for(var i,n,c=document.getElementsByTagName("script"),p=0;p<c.length;p++){var u=c[p];if(u.getAttribute("src")==e||u.getAttribute("data-webpack")=="@tsparticles/updater-destroy:"+r){i=u;break}}i||(n=!0,(i=document.createElement("script")).charset="utf-8",a.nc&&i.setAttribute("nonce",a.nc),i.setAttribute("data-webpack","@tsparticles/updater-destroy:"+r),i.src=e),s[e]=[t];var l=(t,r)=>{i.onerror=i.onload=null,clearTimeout(d);var o=s[e];if(delete s[e],i.parentNode&&i.parentNode.removeChild(i),o&&o.forEach(e=>e(r)),t)return t(r)},d=setTimeout(l.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=l.bind(null,i.onerror),i.onload=l.bind(null,i.onload),n&&document.head.appendChild(i)},a.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.g.importScripts&&(c=a.g.location+"");var s,c,p=a.g.document;if(!c&&p&&(p.currentScript&&"SCRIPT"===p.currentScript.tagName.toUpperCase()&&(c=p.currentScript.src),!c)){var u=p.getElementsByTagName("script");if(u.length)for(var l=u.length-1;l>-1&&(!c||!/^http(s?):/.test(c));)c=u[l--].src}if(!c)throw Error("Automatic publicPath is not supported in this browser");a.p=c=c.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),t={114:0},a.f.j=(e,r)=>{var o=a.o(t,e)?t[e]:void 0;if(0!==o)if(o)r.push(o[2]);else{var i=new Promise((r,i)=>o=t[e]=[r,i]);r.push(o[2]=i);var n=a.p+a.u(e),s=Error();a.l(n,r=>{if(a.o(t,e)&&(0!==(o=t[e])&&(t[e]=void 0),o)){var i=r&&("load"===r.type?"missing":r.type),n=r&&r.target&&r.target.src;s.message="Loading chunk "+e+` failed.
|
|
2
|
+
(`+i+": "+n+")",s.name="ChunkLoadError",s.type=i,s.request=n,o[1](s)}},"chunk-"+e,e)}},r=(e,r)=>{var o,i,[n,s,c]=r,p=0;if(n.some(e=>0!==t[e])){for(o in s)a.o(s,o)&&(a.m[o]=s[o]);c&&c(a)}for(e&&e(r);p<n.length;p++)i=n[p],a.o(t,i)&&t[i]&&t[i][0](),t[i]=0},(o=this.webpackChunk_tsparticles_updater_destroy=this.webpackChunk_tsparticles_updater_destroy||[]).forEach(r.bind(null,0)),o.push=r.bind(null,o.push.bind(o));var d={};async function f(e){e.checkVersion("4.0.0-beta.0"),await e.register(e=>{e.addParticleUpdater("destroy",async t=>{let{DestroyUpdater:r}=await a.e(819).then(a.bind(a,819));return new r(e,t)})})}return a.r(d),a.d(d,{loadDestroyUpdater:()=>f}),d})());
|
|
@@ -3,13 +3,15 @@ import type { ISplit } from "../Interfaces/ISplit.js";
|
|
|
3
3
|
import { SplitFactor } from "./SplitFactor.js";
|
|
4
4
|
import { SplitRate } from "./SplitRate.js";
|
|
5
5
|
export declare class Split implements ISplit, IOptionLoader<ISplit> {
|
|
6
|
-
color?: OptionsColor;
|
|
7
|
-
colorOffset?: Partial<IRangeHsl>;
|
|
8
6
|
count: number;
|
|
9
7
|
factor: SplitFactor;
|
|
8
|
+
fillColor?: OptionsColor;
|
|
9
|
+
fillColorOffset?: Partial<IRangeHsl>;
|
|
10
10
|
particles?: SingleOrMultiple<RecursivePartial<IParticlesOptions>>;
|
|
11
11
|
rate: SplitRate;
|
|
12
12
|
sizeOffset: boolean;
|
|
13
|
+
strokeColor?: OptionsColor;
|
|
14
|
+
strokeColorOffset?: Partial<IRangeHsl>;
|
|
13
15
|
constructor();
|
|
14
16
|
load(data?: RecursivePartial<ISplit>): void;
|
|
15
17
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { IOptionsColor, IParticlesOptions, IRangeHsl, IValueWithRandom, RecursivePartial, SingleOrMultiple } from "@tsparticles/engine";
|
|
2
2
|
export interface ISplit {
|
|
3
|
-
color?: string | IOptionsColor;
|
|
4
|
-
colorOffset?: Partial<IRangeHsl>;
|
|
5
3
|
count: number;
|
|
6
4
|
factor: IValueWithRandom;
|
|
5
|
+
fillColor?: string | IOptionsColor;
|
|
6
|
+
fillColorOffset?: Partial<IRangeHsl>;
|
|
7
7
|
particles?: SingleOrMultiple<RecursivePartial<IParticlesOptions>>;
|
|
8
8
|
rate: IValueWithRandom;
|
|
9
9
|
sizeOffset: boolean;
|
|
10
|
+
strokeColor?: string | IOptionsColor;
|
|
11
|
+
strokeColorOffset?: Partial<IRangeHsl>;
|
|
10
12
|
}
|
package/types/Types.d.ts
CHANGED
package/umd/DestroyUpdater.js
CHANGED
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
const DestroyMode_js_1 = require("./Enums/DestroyMode.js");
|
|
16
16
|
const Utils_js_1 = require("./Utils.js");
|
|
17
17
|
class DestroyUpdater {
|
|
18
|
+
container;
|
|
19
|
+
engine;
|
|
18
20
|
constructor(engine, container) {
|
|
19
21
|
this.container = container;
|
|
20
22
|
this.engine = engine;
|
|
@@ -60,8 +62,9 @@
|
|
|
60
62
|
}
|
|
61
63
|
}
|
|
62
64
|
update(particle) {
|
|
63
|
-
if (
|
|
64
|
-
|
|
65
|
+
if (particle.unbreakableUntil !== undefined && performance.now() >= particle.unbreakableUntil) {
|
|
66
|
+
particle.unbreakable = false;
|
|
67
|
+
particle.unbreakableUntil = undefined;
|
|
65
68
|
}
|
|
66
69
|
const position = particle.getPosition(), bounds = particle.destroyBounds;
|
|
67
70
|
if (!bounds) {
|