@tsparticles/updater-destroy 3.2.1 → 3.3.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/830.min.js +2 -0
- package/830.min.js.LICENSE.txt +1 -0
- package/browser/DestroyUpdater.js +3 -5
- package/browser/Utils.js +3 -3
- package/cjs/DestroyUpdater.js +3 -5
- package/cjs/Utils.js +3 -3
- package/cjs/index.js +1 -24
- package/dist_browser_DestroyUpdater_js.js +3 -3
- package/esm/DestroyUpdater.js +3 -5
- package/esm/Utils.js +3 -3
- package/package.json +2 -2
- package/report.html +1 -1
- package/tsparticles.updater.destroy.js +2 -2
- package/tsparticles.updater.destroy.min.js +1 -1
- package/tsparticles.updater.destroy.min.js.LICENSE.txt +1 -1
- package/types/DestroyUpdater.d.ts +2 -2
- package/types/Utils.d.ts +1 -1
- package/umd/DestroyUpdater.js +3 -5
- package/umd/Utils.js +3 -3
- package/190.min.js +0 -2
- package/190.min.js.LICENSE.txt +0 -1
package/830.min.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! For license information please see 830.min.js.LICENSE.txt */
|
|
2
|
+
(this.webpackChunk_tsparticles_updater_destroy=this.webpackChunk_tsparticles_updater_destroy||[]).push([[830],{830:(t,o,e)=>{e.d(o,{DestroyUpdater:()=>g});var s=e(303);class i{load(t){t&&(void 0!==t.bottom&&(this.bottom=(0,s.setRangeValue)(t.bottom)),void 0!==t.left&&(this.left=(0,s.setRangeValue)(t.left)),void 0!==t.right&&(this.right=(0,s.setRangeValue)(t.right)),void 0!==t.top&&(this.top=(0,s.setRangeValue)(t.top)))}}class n extends s.ValueWithRandom{constructor(){super(),this.value=3}}class l extends s.ValueWithRandom{constructor(){super(),this.value={min:4,max:9}}}class r{constructor(){this.count=1,this.factor=new n,this.rate=new l,this.sizeOffset=!0}load(t){t&&(void 0!==t.color&&(this.color=s.OptionsColor.create(this.color,t.color)),void 0!==t.count&&(this.count=t.count),this.factor.load(t.factor),this.rate.load(t.rate),this.particles=(0,s.executeOnSingleOrMultiple)(t.particles,(t=>(0,s.deepExtend)({},t))),void 0!==t.sizeOffset&&(this.sizeOffset=t.sizeOffset),t.colorOffset&&(this.colorOffset=this.colorOffset??{},void 0!==t.colorOffset.h&&(this.colorOffset.h=t.colorOffset.h),void 0!==t.colorOffset.s&&(this.colorOffset.s=t.colorOffset.s),void 0!==t.colorOffset.l&&(this.colorOffset.l=t.colorOffset.l)))}}class a{constructor(){this.bounds=new i,this.mode="none",this.split=new r}load(t){t&&(t.mode&&(this.mode=t.mode),t.bounds&&this.bounds.load(t.bounds),this.split.load(t.split))}}const c=0,d=.5,u=0,h=1,f=500;function p(t,o,e,i){const n=e.options.destroy;if(!n)return;const l=n.split,r=(0,s.loadParticlesOptions)(t,o,e.options),a=(0,s.getRangeValue)(l.factor.value),p=e.getFillColor();l.color?r.color.load(l.color):l.colorOffset&&p?r.color.load({value:{hsl:{h:p.h+(0,s.getRangeValue)(l.colorOffset.h??c),s:p.s+(0,s.getRangeValue)(l.colorOffset.s??c),l:p.l+(0,s.getRangeValue)(l.colorOffset.l??c)}}}):r.color.load({value:{hsl:e.getFillColor()}}),r.move.load({center:{x:e.position.x,y:e.position.y,mode:"precise"}}),(0,s.isNumber)(r.size.value)?r.size.value/=a:(r.size.value.min/=a,r.size.value.max/=a),r.load(i);const g=l.sizeOffset?(0,s.setRangeValue)(-e.size.value,e.size.value):c,v={x:e.position.x+(0,s.randomInRange)(g),y:e.position.y+(0,s.randomInRange)(g)};return o.particles.addParticle(v,r,e.group,(t=>!(t.size.value<d)&&(t.velocity.length=(0,s.randomInRange)((0,s.setRangeValue)(e.velocity.length,t.velocity.length)),t.splitCount=(e.splitCount??u)+h,t.unbreakable=!0,setTimeout((()=>{t.unbreakable=!1}),f),!0)))}class g{constructor(t,o){this.container=o,this.engine=t}init(t){const o=this.container,e=t.options.destroy;if(!e)return;t.splitCount=0;const i=e.bounds;t.destroyBounds||(t.destroyBounds={});const{bottom:n,left:l,right:r,top:a}=i,{destroyBounds:c}=t,d=o.canvas.size;n&&(c.bottom=(0,s.getRangeValue)(n)*d.height/s.percentDenominator),l&&(c.left=(0,s.getRangeValue)(l)*d.width/s.percentDenominator),r&&(c.right=(0,s.getRangeValue)(r)*d.width/s.percentDenominator),a&&(c.top=(0,s.getRangeValue)(a)*d.height/s.percentDenominator)}isEnabled(t){return!t.destroyed}loadOptions(t,...o){t.destroy||(t.destroy=new a);for(const e of o)t.destroy.load(e?.destroy)}particleDestroyed(t,o){if(o)return;const e=t.options.destroy;e&&"split"===e.mode&&function(t,o,e){const i=e.options.destroy;if(!i)return;const n=i.split;if(n.count>=0&&(void 0===e.splitCount||e.splitCount++>n.count))return;const l=(0,s.getRangeValue)(n.rate.value),r=(0,s.itemFromSingleOrMultiple)(n.particles);for(let s=0;s<l;s++)p(t,o,e,r)}(this.engine,this.container,t)}update(t){if(!this.isEnabled(t))return;const o=t.getPosition(),e=t.destroyBounds;e&&(void 0!==e.bottom&&o.y>=e.bottom||void 0!==e.left&&o.x<=e.left||void 0!==e.right&&o.x>=e.right||void 0!==e.top&&o.y<=e.top)&&t.destroy()}}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! tsParticles Destroy Updater v3.3.0 by Matteo Bruni */
|
|
@@ -6,7 +6,7 @@ export class DestroyUpdater {
|
|
|
6
6
|
this.container = container;
|
|
7
7
|
this.engine = engine;
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
init(particle) {
|
|
10
10
|
const container = this.container, particlesOptions = particle.options, destroyOptions = particlesOptions.destroy;
|
|
11
11
|
if (!destroyOptions) {
|
|
12
12
|
return;
|
|
@@ -29,7 +29,6 @@ export class DestroyUpdater {
|
|
|
29
29
|
if (top) {
|
|
30
30
|
destroyBounds.top = (getRangeValue(top) * canvasSize.height) / percentDenominator;
|
|
31
31
|
}
|
|
32
|
-
await Promise.resolve();
|
|
33
32
|
}
|
|
34
33
|
isEnabled(particle) {
|
|
35
34
|
return !particle.destroyed;
|
|
@@ -48,10 +47,10 @@ export class DestroyUpdater {
|
|
|
48
47
|
}
|
|
49
48
|
const destroyOptions = particle.options.destroy;
|
|
50
49
|
if (destroyOptions && destroyOptions.mode === "split") {
|
|
51
|
-
|
|
50
|
+
split(this.engine, this.container, particle);
|
|
52
51
|
}
|
|
53
52
|
}
|
|
54
|
-
|
|
53
|
+
update(particle) {
|
|
55
54
|
if (!this.isEnabled(particle)) {
|
|
56
55
|
return;
|
|
57
56
|
}
|
|
@@ -65,6 +64,5 @@ export class DestroyUpdater {
|
|
|
65
64
|
(bounds.top !== undefined && position.y <= bounds.top)) {
|
|
66
65
|
particle.destroy();
|
|
67
66
|
}
|
|
68
|
-
await Promise.resolve();
|
|
69
67
|
}
|
|
70
68
|
}
|
package/browser/Utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getRangeValue, isNumber, itemFromSingleOrMultiple, loadParticlesOptions, randomInRange, 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;
|
|
@@ -59,7 +59,7 @@ async function addSplitParticle(engine, container, parent, splitParticlesOptions
|
|
|
59
59
|
return true;
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
|
-
export
|
|
62
|
+
export function split(engine, container, particle) {
|
|
63
63
|
const destroyOptions = particle.options.destroy;
|
|
64
64
|
if (!destroyOptions) {
|
|
65
65
|
return;
|
|
@@ -71,6 +71,6 @@ export async function split(engine, container, particle) {
|
|
|
71
71
|
}
|
|
72
72
|
const rate = getRangeValue(splitOptions.rate.value), particlesSplitOptions = itemFromSingleOrMultiple(splitOptions.particles);
|
|
73
73
|
for (let i = 0; i < rate; i++) {
|
|
74
|
-
|
|
74
|
+
addSplitParticle(engine, container, particle, particlesSplitOptions);
|
|
75
75
|
}
|
|
76
76
|
}
|
package/cjs/DestroyUpdater.js
CHANGED
|
@@ -9,7 +9,7 @@ class DestroyUpdater {
|
|
|
9
9
|
this.container = container;
|
|
10
10
|
this.engine = engine;
|
|
11
11
|
}
|
|
12
|
-
|
|
12
|
+
init(particle) {
|
|
13
13
|
const container = this.container, particlesOptions = particle.options, destroyOptions = particlesOptions.destroy;
|
|
14
14
|
if (!destroyOptions) {
|
|
15
15
|
return;
|
|
@@ -32,7 +32,6 @@ class DestroyUpdater {
|
|
|
32
32
|
if (top) {
|
|
33
33
|
destroyBounds.top = ((0, engine_1.getRangeValue)(top) * canvasSize.height) / engine_1.percentDenominator;
|
|
34
34
|
}
|
|
35
|
-
await Promise.resolve();
|
|
36
35
|
}
|
|
37
36
|
isEnabled(particle) {
|
|
38
37
|
return !particle.destroyed;
|
|
@@ -51,10 +50,10 @@ class DestroyUpdater {
|
|
|
51
50
|
}
|
|
52
51
|
const destroyOptions = particle.options.destroy;
|
|
53
52
|
if (destroyOptions && destroyOptions.mode === "split") {
|
|
54
|
-
|
|
53
|
+
(0, Utils_js_1.split)(this.engine, this.container, particle);
|
|
55
54
|
}
|
|
56
55
|
}
|
|
57
|
-
|
|
56
|
+
update(particle) {
|
|
58
57
|
if (!this.isEnabled(particle)) {
|
|
59
58
|
return;
|
|
60
59
|
}
|
|
@@ -68,7 +67,6 @@ class DestroyUpdater {
|
|
|
68
67
|
(bounds.top !== undefined && position.y <= bounds.top)) {
|
|
69
68
|
particle.destroy();
|
|
70
69
|
}
|
|
71
|
-
await Promise.resolve();
|
|
72
70
|
}
|
|
73
71
|
}
|
|
74
72
|
exports.DestroyUpdater = DestroyUpdater;
|
package/cjs/Utils.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.split = void 0;
|
|
4
4
|
const engine_1 = require("@tsparticles/engine");
|
|
5
5
|
const defaultOffset = 0, minDestroySize = 0.5, defaultSplitCount = 0, increment = 1, unbreakableTime = 500, minSplitCount = 0;
|
|
6
|
-
|
|
6
|
+
function addSplitParticle(engine, container, parent, splitParticlesOptions) {
|
|
7
7
|
const destroyOptions = parent.options.destroy;
|
|
8
8
|
if (!destroyOptions) {
|
|
9
9
|
return;
|
|
@@ -62,7 +62,7 @@ async function addSplitParticle(engine, container, parent, splitParticlesOptions
|
|
|
62
62
|
return true;
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
|
-
|
|
65
|
+
function split(engine, container, particle) {
|
|
66
66
|
const destroyOptions = particle.options.destroy;
|
|
67
67
|
if (!destroyOptions) {
|
|
68
68
|
return;
|
|
@@ -74,7 +74,7 @@ async function split(engine, container, particle) {
|
|
|
74
74
|
}
|
|
75
75
|
const rate = (0, engine_1.getRangeValue)(splitOptions.rate.value), particlesSplitOptions = (0, engine_1.itemFromSingleOrMultiple)(splitOptions.particles);
|
|
76
76
|
for (let i = 0; i < rate; i++) {
|
|
77
|
-
|
|
77
|
+
addSplitParticle(engine, container, particle, particlesSplitOptions);
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
exports.split = split;
|
package/cjs/index.js
CHANGED
|
@@ -1,32 +1,9 @@
|
|
|
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.loadDestroyUpdater = void 0;
|
|
27
4
|
async function loadDestroyUpdater(engine, refresh = true) {
|
|
28
5
|
await engine.addParticleUpdater("destroy", async (container) => {
|
|
29
|
-
const { DestroyUpdater } = await
|
|
6
|
+
const { DestroyUpdater } = await import("./DestroyUpdater.js");
|
|
30
7
|
return new DestroyUpdater(engine, container);
|
|
31
8
|
}, refresh);
|
|
32
9
|
}
|
|
@@ -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.3.0
|
|
8
8
|
*/
|
|
9
9
|
"use strict";
|
|
10
10
|
/*
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
\****************************************/
|
|
24
24
|
/***/ ((__unused_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 _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\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 _Utils_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Utils.js */ \"./dist/browser/Utils.js\");\n\n\n\nclass DestroyUpdater {\n constructor(engine, container) {\n this.container = container;\n this.engine = engine;\n }\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 _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\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 _Utils_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Utils.js */ \"./dist/browser/Utils.js\");\n\n\n\nclass DestroyUpdater {\n constructor(engine, container) {\n this.container = container;\n this.engine = engine;\n }\n init(particle) {\n const container = this.container,\n particlesOptions = particle.options,\n destroyOptions = particlesOptions.destroy;\n if (!destroyOptions) {\n return;\n }\n particle.splitCount = 0;\n const destroyBoundsOptions = destroyOptions.bounds;\n if (!particle.destroyBounds) {\n particle.destroyBounds = {};\n }\n const {\n bottom,\n left,\n right,\n top\n } = destroyBoundsOptions,\n {\n destroyBounds\n } = particle,\n 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 if (!options.destroy) {\n options.destroy = new _Options_Classes_Destroy_js__WEBPACK_IMPORTED_MODULE_1__.Destroy();\n }\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 && destroyOptions.mode === \"split\") {\n (0,_Utils_js__WEBPACK_IMPORTED_MODULE_2__.split)(this.engine, this.container, particle);\n }\n }\n update(particle) {\n if (!this.isEnabled(particle)) {\n return;\n }\n const position = particle.getPosition(),\n 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//# sourceURL=webpack://@tsparticles/updater-destroy/./dist/browser/DestroyUpdater.js?");
|
|
27
27
|
|
|
28
28
|
/***/ }),
|
|
29
29
|
|
|
@@ -83,7 +83,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
83
83
|
\*******************************/
|
|
84
84
|
/***/ ((__unused_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 */ 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 _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n\nconst defaultOffset = 0,\n minDestroySize = 0.5,\n defaultSplitCount = 0,\n increment = 1,\n unbreakableTime = 500,\n minSplitCount = 0;\
|
|
86
|
+
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 _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n\nconst defaultOffset = 0,\n minDestroySize = 0.5,\n defaultSplitCount = 0,\n increment = 1,\n unbreakableTime = 500,\n 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,\n options = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.loadParticlesOptions)(engine, container, parent.options),\n factor = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(splitOptions.factor.value),\n parentColor = parent.getFillColor();\n if (splitOptions.color) {\n options.color.load(splitOptions.color);\n } else if (splitOptions.colorOffset && parentColor) {\n options.color.load({\n value: {\n hsl: {\n h: parentColor.h + (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(splitOptions.colorOffset.h ?? defaultOffset),\n s: parentColor.s + (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(splitOptions.colorOffset.s ?? defaultOffset),\n l: parentColor.l + (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(splitOptions.colorOffset.l ?? defaultOffset)\n }\n }\n });\n } else {\n options.color.load({\n value: {\n hsl: parent.getFillColor()\n }\n });\n }\n options.move.load({\n center: {\n x: parent.position.x,\n y: parent.position.y,\n mode: \"precise\"\n }\n });\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,\n position = {\n x: parent.position.x + (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.randomInRange)(offset),\n y: parent.position.y + (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.randomInRange)(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__.randomInRange)((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 setTimeout(() => {\n particle.unbreakable = false;\n }, 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 && (particle.splitCount === undefined || particle.splitCount++ > splitOptions.count)) {\n return;\n }\n const rate = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(splitOptions.rate.value),\n 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//# sourceURL=webpack://@tsparticles/updater-destroy/./dist/browser/Utils.js?");
|
|
87
87
|
|
|
88
88
|
/***/ })
|
|
89
89
|
|
package/esm/DestroyUpdater.js
CHANGED
|
@@ -6,7 +6,7 @@ export class DestroyUpdater {
|
|
|
6
6
|
this.container = container;
|
|
7
7
|
this.engine = engine;
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
init(particle) {
|
|
10
10
|
const container = this.container, particlesOptions = particle.options, destroyOptions = particlesOptions.destroy;
|
|
11
11
|
if (!destroyOptions) {
|
|
12
12
|
return;
|
|
@@ -29,7 +29,6 @@ export class DestroyUpdater {
|
|
|
29
29
|
if (top) {
|
|
30
30
|
destroyBounds.top = (getRangeValue(top) * canvasSize.height) / percentDenominator;
|
|
31
31
|
}
|
|
32
|
-
await Promise.resolve();
|
|
33
32
|
}
|
|
34
33
|
isEnabled(particle) {
|
|
35
34
|
return !particle.destroyed;
|
|
@@ -48,10 +47,10 @@ export class DestroyUpdater {
|
|
|
48
47
|
}
|
|
49
48
|
const destroyOptions = particle.options.destroy;
|
|
50
49
|
if (destroyOptions && destroyOptions.mode === "split") {
|
|
51
|
-
|
|
50
|
+
split(this.engine, this.container, particle);
|
|
52
51
|
}
|
|
53
52
|
}
|
|
54
|
-
|
|
53
|
+
update(particle) {
|
|
55
54
|
if (!this.isEnabled(particle)) {
|
|
56
55
|
return;
|
|
57
56
|
}
|
|
@@ -65,6 +64,5 @@ export class DestroyUpdater {
|
|
|
65
64
|
(bounds.top !== undefined && position.y <= bounds.top)) {
|
|
66
65
|
particle.destroy();
|
|
67
66
|
}
|
|
68
|
-
await Promise.resolve();
|
|
69
67
|
}
|
|
70
68
|
}
|
package/esm/Utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getRangeValue, isNumber, itemFromSingleOrMultiple, loadParticlesOptions, randomInRange, 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;
|
|
@@ -59,7 +59,7 @@ async function addSplitParticle(engine, container, parent, splitParticlesOptions
|
|
|
59
59
|
return true;
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
|
-
export
|
|
62
|
+
export function split(engine, container, particle) {
|
|
63
63
|
const destroyOptions = particle.options.destroy;
|
|
64
64
|
if (!destroyOptions) {
|
|
65
65
|
return;
|
|
@@ -71,6 +71,6 @@ export async function split(engine, container, particle) {
|
|
|
71
71
|
}
|
|
72
72
|
const rate = getRangeValue(splitOptions.rate.value), particlesSplitOptions = itemFromSingleOrMultiple(splitOptions.particles);
|
|
73
73
|
for (let i = 0; i < rate; i++) {
|
|
74
|
-
|
|
74
|
+
addSplitParticle(engine, container, particle, particlesSplitOptions);
|
|
75
75
|
}
|
|
76
76
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/updater-destroy",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.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": "^3.
|
|
90
|
+
"@tsparticles/engine": "^3.3.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 [27 Feb 2024 at 12:21]</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.3.0
|
|
8
8
|
*/
|
|
9
9
|
/*
|
|
10
10
|
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
|
@@ -210,7 +210,7 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
|
|
|
210
210
|
/******/ var scripts = document.getElementsByTagName("script");
|
|
211
211
|
/******/ if(scripts.length) {
|
|
212
212
|
/******/ var i = scripts.length - 1;
|
|
213
|
-
/******/ while (i > -1 && !scriptUrl) scriptUrl = scripts[i--].src;
|
|
213
|
+
/******/ while (i > -1 && (!scriptUrl || !/^http(s?):/.test(scriptUrl))) scriptUrl = scripts[i--].src;
|
|
214
214
|
/******/ }
|
|
215
215
|
/******/ }
|
|
216
216
|
/******/ }
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see tsparticles.updater.destroy.min.js.LICENSE.txt */
|
|
2
|
-
!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=>(()=>{var t,r,o={
|
|
2
|
+
!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=>(()=>{var t,r,o={303:t=>{t.exports=e}},n={};function i(e){var t=n[e];if(void 0!==t)return t.exports;var r=n[e]={exports:{}};return o[e](r,r.exports,i),r.exports}i.m=o,i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.f={},i.e=e=>Promise.all(Object.keys(i.f).reduce(((t,r)=>(i.f[r](e,t),t)),[])),i.u=e=>e+".min.js",i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),t={},r="@tsparticles/updater-destroy:",i.l=(e,o,n,a)=>{if(t[e])t[e].push(o);else{var s,p;if(void 0!==n)for(var c=document.getElementsByTagName("script"),u=0;u<c.length;u++){var d=c[u];if(d.getAttribute("src")==e||d.getAttribute("data-webpack")==r+n){s=d;break}}s||(p=!0,(s=document.createElement("script")).charset="utf-8",s.timeout=120,i.nc&&s.setAttribute("nonce",i.nc),s.setAttribute("data-webpack",r+n),s.src=e),t[e]=[o];var l=(r,o)=>{s.onerror=s.onload=null,clearTimeout(f);var n=t[e];if(delete t[e],s.parentNode&&s.parentNode.removeChild(s),n&&n.forEach((e=>e(o))),r)return r(o)},f=setTimeout(l.bind(null,void 0,{type:"timeout",target:s}),12e4);s.onerror=l.bind(null,s.onerror),s.onload=l.bind(null,s.onload),p&&document.head.appendChild(s)}},i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;i.g.importScripts&&(e=i.g.location+"");var t=i.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var o=r.length-1;o>-1&&(!e||!/^http(s?):/.test(e));)e=r[o--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),i.p=e})(),(()=>{var e={114:0};i.f.j=(t,r)=>{var o=i.o(e,t)?e[t]:void 0;if(0!==o)if(o)r.push(o[2]);else{var n=new Promise(((r,n)=>o=e[t]=[r,n]));r.push(o[2]=n);var a=i.p+i.u(t),s=new Error;i.l(a,(r=>{if(i.o(e,t)&&(0!==(o=e[t])&&(e[t]=void 0),o)){var n=r&&("load"===r.type?"missing":r.type),a=r&&r.target&&r.target.src;s.message="Loading chunk "+t+" failed.\n("+n+": "+a+")",s.name="ChunkLoadError",s.type=n,s.request=a,o[1](s)}}),"chunk-"+t,t)}};var t=(t,r)=>{var o,n,a=r[0],s=r[1],p=r[2],c=0;if(a.some((t=>0!==e[t]))){for(o in s)i.o(s,o)&&(i.m[o]=s[o]);if(p)p(i)}for(t&&t(r);c<a.length;c++)n=a[c],i.o(e,n)&&e[n]&&e[n][0](),e[n]=0},r=this.webpackChunk_tsparticles_updater_destroy=this.webpackChunk_tsparticles_updater_destroy||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var a={};return(()=>{async function e(e,t=!0){await e.addParticleUpdater("destroy",(async t=>{const{DestroyUpdater:r}=await i.e(830).then(i.bind(i,830));return new r(e,t)}),t)}i.r(a),i.d(a,{loadDestroyUpdater:()=>e})})(),a})()));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
/*! tsParticles Destroy Updater v3.
|
|
1
|
+
/*! tsParticles Destroy Updater v3.3.0 by Matteo Bruni */
|
|
@@ -4,9 +4,9 @@ export declare class DestroyUpdater implements IParticleUpdater {
|
|
|
4
4
|
private readonly container;
|
|
5
5
|
private readonly engine;
|
|
6
6
|
constructor(engine: Engine, container: Container);
|
|
7
|
-
init(particle: DestroyParticle):
|
|
7
|
+
init(particle: DestroyParticle): void;
|
|
8
8
|
isEnabled(particle: Particle): boolean;
|
|
9
9
|
loadOptions(options: DestroyParticlesOptions, ...sources: (RecursivePartial<IDestroyParticlesOptions> | undefined)[]): void;
|
|
10
10
|
particleDestroyed(particle: DestroyParticle, override?: boolean): void;
|
|
11
|
-
update(particle: DestroyParticle):
|
|
11
|
+
update(particle: DestroyParticle): void;
|
|
12
12
|
}
|
package/types/Utils.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type Container, type Engine } from "@tsparticles/engine";
|
|
2
2
|
import type { DestroyParticle } from "./Types.js";
|
|
3
|
-
export declare function split(engine: Engine, container: Container, particle: DestroyParticle):
|
|
3
|
+
export declare function split(engine: Engine, container: Container, particle: DestroyParticle): void;
|
package/umd/DestroyUpdater.js
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
this.container = container;
|
|
19
19
|
this.engine = engine;
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
init(particle) {
|
|
22
22
|
const container = this.container, particlesOptions = particle.options, destroyOptions = particlesOptions.destroy;
|
|
23
23
|
if (!destroyOptions) {
|
|
24
24
|
return;
|
|
@@ -41,7 +41,6 @@
|
|
|
41
41
|
if (top) {
|
|
42
42
|
destroyBounds.top = ((0, engine_1.getRangeValue)(top) * canvasSize.height) / engine_1.percentDenominator;
|
|
43
43
|
}
|
|
44
|
-
await Promise.resolve();
|
|
45
44
|
}
|
|
46
45
|
isEnabled(particle) {
|
|
47
46
|
return !particle.destroyed;
|
|
@@ -60,10 +59,10 @@
|
|
|
60
59
|
}
|
|
61
60
|
const destroyOptions = particle.options.destroy;
|
|
62
61
|
if (destroyOptions && destroyOptions.mode === "split") {
|
|
63
|
-
|
|
62
|
+
(0, Utils_js_1.split)(this.engine, this.container, particle);
|
|
64
63
|
}
|
|
65
64
|
}
|
|
66
|
-
|
|
65
|
+
update(particle) {
|
|
67
66
|
if (!this.isEnabled(particle)) {
|
|
68
67
|
return;
|
|
69
68
|
}
|
|
@@ -77,7 +76,6 @@
|
|
|
77
76
|
(bounds.top !== undefined && position.y <= bounds.top)) {
|
|
78
77
|
particle.destroy();
|
|
79
78
|
}
|
|
80
|
-
await Promise.resolve();
|
|
81
79
|
}
|
|
82
80
|
}
|
|
83
81
|
exports.DestroyUpdater = DestroyUpdater;
|
package/umd/Utils.js
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
exports.split = void 0;
|
|
13
13
|
const engine_1 = require("@tsparticles/engine");
|
|
14
14
|
const defaultOffset = 0, minDestroySize = 0.5, defaultSplitCount = 0, increment = 1, unbreakableTime = 500, minSplitCount = 0;
|
|
15
|
-
|
|
15
|
+
function addSplitParticle(engine, container, parent, splitParticlesOptions) {
|
|
16
16
|
const destroyOptions = parent.options.destroy;
|
|
17
17
|
if (!destroyOptions) {
|
|
18
18
|
return;
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
return true;
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
|
-
|
|
74
|
+
function split(engine, container, particle) {
|
|
75
75
|
const destroyOptions = particle.options.destroy;
|
|
76
76
|
if (!destroyOptions) {
|
|
77
77
|
return;
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
}
|
|
84
84
|
const rate = (0, engine_1.getRangeValue)(splitOptions.rate.value), particlesSplitOptions = (0, engine_1.itemFromSingleOrMultiple)(splitOptions.particles);
|
|
85
85
|
for (let i = 0; i < rate; i++) {
|
|
86
|
-
|
|
86
|
+
addSplitParticle(engine, container, particle, particlesSplitOptions);
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
exports.split = split;
|
package/190.min.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/*! For license information please see 190.min.js.LICENSE.txt */
|
|
2
|
-
(this.webpackChunk_tsparticles_updater_destroy=this.webpackChunk_tsparticles_updater_destroy||[]).push([[190],{190:(t,o,e)=>{e.d(o,{DestroyUpdater:()=>g});var s=e(533);class i{load(t){t&&(void 0!==t.bottom&&(this.bottom=(0,s.setRangeValue)(t.bottom)),void 0!==t.left&&(this.left=(0,s.setRangeValue)(t.left)),void 0!==t.right&&(this.right=(0,s.setRangeValue)(t.right)),void 0!==t.top&&(this.top=(0,s.setRangeValue)(t.top)))}}class n extends s.ValueWithRandom{constructor(){super(),this.value=3}}class l extends s.ValueWithRandom{constructor(){super(),this.value={min:4,max:9}}}class r{constructor(){this.count=1,this.factor=new n,this.rate=new l,this.sizeOffset=!0}load(t){t&&(void 0!==t.color&&(this.color=s.OptionsColor.create(this.color,t.color)),void 0!==t.count&&(this.count=t.count),this.factor.load(t.factor),this.rate.load(t.rate),this.particles=(0,s.executeOnSingleOrMultiple)(t.particles,(t=>(0,s.deepExtend)({},t))),void 0!==t.sizeOffset&&(this.sizeOffset=t.sizeOffset),t.colorOffset&&(this.colorOffset=this.colorOffset??{},void 0!==t.colorOffset.h&&(this.colorOffset.h=t.colorOffset.h),void 0!==t.colorOffset.s&&(this.colorOffset.s=t.colorOffset.s),void 0!==t.colorOffset.l&&(this.colorOffset.l=t.colorOffset.l)))}}class a{constructor(){this.bounds=new i,this.mode="none",this.split=new r}load(t){t&&(t.mode&&(this.mode=t.mode),t.bounds&&this.bounds.load(t.bounds),this.split.load(t.split))}}const c=0,d=.5,u=0,h=1,f=500;async function p(t,o,e,i){const n=e.options.destroy;if(!n)return;const l=n.split,r=(0,s.loadParticlesOptions)(t,o,e.options),a=(0,s.getRangeValue)(l.factor.value),p=e.getFillColor();l.color?r.color.load(l.color):l.colorOffset&&p?r.color.load({value:{hsl:{h:p.h+(0,s.getRangeValue)(l.colorOffset.h??c),s:p.s+(0,s.getRangeValue)(l.colorOffset.s??c),l:p.l+(0,s.getRangeValue)(l.colorOffset.l??c)}}}):r.color.load({value:{hsl:e.getFillColor()}}),r.move.load({center:{x:e.position.x,y:e.position.y,mode:"precise"}}),(0,s.isNumber)(r.size.value)?r.size.value/=a:(r.size.value.min/=a,r.size.value.max/=a),r.load(i);const g=l.sizeOffset?(0,s.setRangeValue)(-e.size.value,e.size.value):c,v={x:e.position.x+(0,s.randomInRange)(g),y:e.position.y+(0,s.randomInRange)(g)};return o.particles.addParticle(v,r,e.group,(t=>!(t.size.value<d)&&(t.velocity.length=(0,s.randomInRange)((0,s.setRangeValue)(e.velocity.length,t.velocity.length)),t.splitCount=(e.splitCount??u)+h,t.unbreakable=!0,setTimeout((()=>{t.unbreakable=!1}),f),!0)))}class g{constructor(t,o){this.container=o,this.engine=t}async init(t){const o=this.container,e=t.options.destroy;if(!e)return;t.splitCount=0;const i=e.bounds;t.destroyBounds||(t.destroyBounds={});const{bottom:n,left:l,right:r,top:a}=i,{destroyBounds:c}=t,d=o.canvas.size;n&&(c.bottom=(0,s.getRangeValue)(n)*d.height/s.percentDenominator),l&&(c.left=(0,s.getRangeValue)(l)*d.width/s.percentDenominator),r&&(c.right=(0,s.getRangeValue)(r)*d.width/s.percentDenominator),a&&(c.top=(0,s.getRangeValue)(a)*d.height/s.percentDenominator),await Promise.resolve()}isEnabled(t){return!t.destroyed}loadOptions(t,...o){t.destroy||(t.destroy=new a);for(const e of o)t.destroy.load(e?.destroy)}particleDestroyed(t,o){if(o)return;const e=t.options.destroy;e&&"split"===e.mode&&async function(t,o,e){const i=e.options.destroy;if(!i)return;const n=i.split;if(n.count>=0&&(void 0===e.splitCount||e.splitCount++>n.count))return;const l=(0,s.getRangeValue)(n.rate.value),r=(0,s.itemFromSingleOrMultiple)(n.particles);for(let s=0;s<l;s++)await p(t,o,e,r)}(this.engine,this.container,t)}async update(t){if(!this.isEnabled(t))return;const o=t.getPosition(),e=t.destroyBounds;e&&((void 0!==e.bottom&&o.y>=e.bottom||void 0!==e.left&&o.x<=e.left||void 0!==e.right&&o.x>=e.right||void 0!==e.top&&o.y<=e.top)&&t.destroy(),await Promise.resolve())}}}}]);
|
package/190.min.js.LICENSE.txt
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/*! tsParticles Destroy Updater v3.2.1 by Matteo Bruni */
|