@tsparticles/updater-destroy 4.0.0-alpha.26 → 4.0.0-alpha.28

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 ADDED
@@ -0,0 +1 @@
1
+ "use strict";(this.webpackChunk_tsparticles_updater_destroy=this.webpackChunk_tsparticles_updater_destroy||[]).push([[819],{819(e,t,o){o.d(t,{DestroyUpdater:()=>d});var l,s,i=o(303);class r{bottom;left;right;top;load(e){(0,i.isNull)(e)||(void 0!==e.bottom&&(this.bottom=(0,i.setRangeValue)(e.bottom)),void 0!==e.left&&(this.left=(0,i.setRangeValue)(e.left)),void 0!==e.right&&(this.right=(0,i.setRangeValue)(e.right)),void 0!==e.top&&(this.top=(0,i.setRangeValue)(e.top)))}}(l=s||(s={})).none="none",l.split="split";class a extends i.ValueWithRandom{constructor(){super(),this.value=3}}class n extends i.ValueWithRandom{constructor(){super(),this.value={min:4,max:9}}}class f{count;factor;fillColor;fillColorOffset;particles;rate;sizeOffset;strokeColor;strokeColorOffset;constructor(){this.count=1,this.factor=new a,this.rate=new n,this.sizeOffset=!0}load(e){!(0,i.isNull)(e)&&(void 0!==e.fillColor&&(this.fillColor=i.OptionsColor.create(this.fillColor,e.fillColor)),void 0!==e.strokeColor&&(this.strokeColor=i.OptionsColor.create(this.strokeColor,e.strokeColor)),void 0!==e.count&&(this.count=e.count),this.factor.load(e.factor),this.rate.load(e.rate),this.particles=(0,i.executeOnSingleOrMultiple)(e.particles,e=>(0,i.deepExtend)({},e)),void 0!==e.sizeOffset&&(this.sizeOffset=e.sizeOffset),e.fillColorOffset&&(this.fillColorOffset=this.fillColorOffset??{},void 0!==e.fillColorOffset.h&&(this.fillColorOffset.h=e.fillColorOffset.h),void 0!==e.fillColorOffset.s&&(this.fillColorOffset.s=e.fillColorOffset.s),void 0!==e.fillColorOffset.l&&(this.fillColorOffset.l=e.fillColorOffset.l)),e.strokeColorOffset&&(this.strokeColorOffset=this.strokeColorOffset??{},void 0!==e.strokeColorOffset.h&&(this.strokeColorOffset.h=e.strokeColorOffset.h),void 0!==e.strokeColorOffset.s&&(this.strokeColorOffset.s=e.strokeColorOffset.s),void 0!==e.strokeColorOffset.l&&(this.strokeColorOffset.l=e.strokeColorOffset.l)))}}class u{bounds;mode;split;constructor(){this.bounds=new r,this.mode=s.none,this.split=new f}load(e){(0,i.isNull)(e)||(e.mode&&(this.mode=e.mode),e.bounds&&this.bounds.load(e.bounds),this.split.load(e.split))}}class d{container;engine;constructor(e,t){this.container=t,this.engine=e}init(e){let t=this.container,o=e.options.destroy;if(!o)return;e.splitCount=0;let l=o.bounds;e.destroyBounds??={};let{bottom:s,left:r,right:a,top:n}=l,{destroyBounds:f}=e,u=t.canvas.size;s&&(f.bottom=(0,i.getRangeValue)(s)*u.height/i.percentDenominator),r&&(f.left=(0,i.getRangeValue)(r)*u.width/i.percentDenominator),a&&(f.right=(0,i.getRangeValue)(a)*u.width/i.percentDenominator),n&&(f.top=(0,i.getRangeValue)(n)*u.height/i.percentDenominator)}isEnabled(e){return!e.destroyed}loadOptions(e,...t){for(let o of(e.destroy??=new u,t))e.destroy.load(o?.destroy)}particleDestroyed(e,t){if(t)return;let o=e.options.destroy;o?.mode===s.split&&function(e,t,o){let l=o.options.destroy;if(!l)return;let s=l.split;if(s.count>=0){if(void 0===o.splitCount||o.splitCount>s.count)return;o.splitCount++}let r=(0,i.getRangeValue)(s.rate.value),a=(0,i.itemFromSingleOrMultiple)(s.particles);for(let l=0;l<r;l++)!function(e,t,o,l){let s=o.options.destroy;if(!s)return;let r=s.split,a=(0,i.loadParticlesOptions)(e,t,o.options),n=(0,i.itemFromSingleOrMultiple)(a.fill),f=(0,i.itemFromSingleOrMultiple)(a.stroke);if(n?.enable){let e=i.AnimatableColor.create(void 0,n.color),t=o.getFillColor();e.value?e.load(r.fillColor):r.fillColorOffset&&t?e.load({value:{hsl:{h:t.h+(0,i.getRangeValue)(r.fillColorOffset.h??0),s:t.s+(0,i.getRangeValue)(r.fillColorOffset.s??0),l:t.l+(0,i.getRangeValue)(r.fillColorOffset.l??0)}}}):e.load({value:{hsl:o.getFillColor()}})}if(f?.width){let e=i.AnimatableColor.create(void 0,f.color),t=o.getStrokeColor();e.value?e.load(r.strokeColor):r.strokeColorOffset&&t?e.load({value:{hsl:{h:t.h+(0,i.getRangeValue)(r.strokeColorOffset.h??0),s:t.s+(0,i.getRangeValue)(r.strokeColorOffset.s??0),l:t.l+(0,i.getRangeValue)(r.strokeColorOffset.l??0)}}}):e.load({value:{hsl:o.getStrokeColor()}})}a.move.load({center:{x:o.position.x,y:o.position.y,mode:i.PixelMode.precise}});let u=i.identity/(0,i.getRangeValue)(r.factor.value);(0,i.isNumber)(a.size.value)?a.size.value*=u:(a.size.value.min*=u,a.size.value.max*=u),a.load(l);let d=r.sizeOffset?(0,i.setRangeValue)(-o.size.value,o.size.value):0,h={x:o.position.x+(0,i.randomInRangeValue)(d),y:o.position.y+(0,i.randomInRangeValue)(d)};t.particles.addParticle(h,a,o.group,e=>!(e.size.value<.5)&&(e.velocity.length=(0,i.randomInRangeValue)((0,i.setRangeValue)(o.velocity.length,e.velocity.length)),e.splitCount=(o.splitCount??0)+1,e.unbreakable=!0,e.unbreakableUntil=performance.now()+500,!0))}(e,t,o,a)}(this.engine,this.container,e)}update(e){void 0!==e.unbreakableUntil&&performance.now()>=e.unbreakableUntil&&(e.unbreakable=!1,e.unbreakableUntil=void 0);let t=e.getPosition(),o=e.destroyBounds;o&&(void 0!==o.bottom&&t.y>=o.bottom||void 0!==o.left&&t.x<=o.left||void 0!==o.right&&t.x>=o.right||void 0!==o.top&&t.y<=o.top)&&e.destroy()}}}}]);
@@ -2,13 +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
- color;
6
- colorOffset;
7
5
  count;
8
6
  factor;
7
+ fillColor;
8
+ fillColorOffset;
9
9
  particles;
10
10
  rate;
11
11
  sizeOffset;
12
+ strokeColor;
13
+ strokeColorOffset;
12
14
  constructor() {
13
15
  this.count = 1;
14
16
  this.factor = new SplitFactor();
@@ -19,8 +21,11 @@ export class Split {
19
21
  if (isNull(data)) {
20
22
  return;
21
23
  }
22
- if (data.color !== undefined) {
23
- this.color = OptionsColor.create(this.color, data.color);
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);
24
29
  }
25
30
  if (data.count !== undefined) {
26
31
  this.count = data.count;
@@ -33,16 +38,28 @@ export class Split {
33
38
  if (data.sizeOffset !== undefined) {
34
39
  this.sizeOffset = data.sizeOffset;
35
40
  }
36
- if (data.colorOffset) {
37
- this.colorOffset = this.colorOffset ?? {};
38
- if (data.colorOffset.h !== undefined) {
39
- this.colorOffset.h = data.colorOffset.h;
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;
40
57
  }
41
- if (data.colorOffset.s !== undefined) {
42
- this.colorOffset.s = data.colorOffset.s;
58
+ if (data.strokeColorOffset.s !== undefined) {
59
+ this.strokeColorOffset.s = data.strokeColorOffset.s;
43
60
  }
44
- if (data.colorOffset.l !== undefined) {
45
- this.colorOffset.l = data.colorOffset.l;
61
+ if (data.strokeColorOffset.l !== undefined) {
62
+ this.strokeColorOffset.l = data.strokeColorOffset.l;
46
63
  }
47
64
  }
48
65
  }
package/browser/Utils.js CHANGED
@@ -1,31 +1,58 @@
1
- import { PixelMode, getRangeValue, identity, 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), parentColor = parent.getFillColor();
9
- if (splitOptions.color) {
10
- options.color.load(splitOptions.color);
11
- }
12
- else if (splitOptions.colorOffset && parentColor) {
13
- options.color.load({
14
- value: {
15
- hsl: {
16
- h: parentColor.h + getRangeValue(splitOptions.colorOffset.h ?? defaultOffset),
17
- s: parentColor.s + getRangeValue(splitOptions.colorOffset.s ?? defaultOffset),
18
- l: parentColor.l + getRangeValue(splitOptions.colorOffset.l ?? defaultOffset),
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
- else {
24
- options.color.load({
25
- value: {
26
- hsl: parent.getFillColor(),
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: {
package/browser/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export async function loadDestroyUpdater(engine) {
2
- engine.checkVersion("4.0.0-alpha.26");
2
+ engine.checkVersion("4.0.0-alpha.28");
3
3
  await engine.register(e => {
4
4
  e.addParticleUpdater("destroy", async (container) => {
5
5
  const { DestroyUpdater } = await import("./DestroyUpdater.js");
@@ -2,13 +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
- color;
6
- colorOffset;
7
5
  count;
8
6
  factor;
7
+ fillColor;
8
+ fillColorOffset;
9
9
  particles;
10
10
  rate;
11
11
  sizeOffset;
12
+ strokeColor;
13
+ strokeColorOffset;
12
14
  constructor() {
13
15
  this.count = 1;
14
16
  this.factor = new SplitFactor();
@@ -19,8 +21,11 @@ export class Split {
19
21
  if (isNull(data)) {
20
22
  return;
21
23
  }
22
- if (data.color !== undefined) {
23
- this.color = OptionsColor.create(this.color, data.color);
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);
24
29
  }
25
30
  if (data.count !== undefined) {
26
31
  this.count = data.count;
@@ -33,16 +38,28 @@ export class Split {
33
38
  if (data.sizeOffset !== undefined) {
34
39
  this.sizeOffset = data.sizeOffset;
35
40
  }
36
- if (data.colorOffset) {
37
- this.colorOffset = this.colorOffset ?? {};
38
- if (data.colorOffset.h !== undefined) {
39
- this.colorOffset.h = data.colorOffset.h;
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;
40
57
  }
41
- if (data.colorOffset.s !== undefined) {
42
- this.colorOffset.s = data.colorOffset.s;
58
+ if (data.strokeColorOffset.s !== undefined) {
59
+ this.strokeColorOffset.s = data.strokeColorOffset.s;
43
60
  }
44
- if (data.colorOffset.l !== undefined) {
45
- this.colorOffset.l = data.colorOffset.l;
61
+ if (data.strokeColorOffset.l !== undefined) {
62
+ this.strokeColorOffset.l = data.strokeColorOffset.l;
46
63
  }
47
64
  }
48
65
  }
package/cjs/Utils.js CHANGED
@@ -1,31 +1,58 @@
1
- import { PixelMode, getRangeValue, identity, 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), parentColor = parent.getFillColor();
9
- if (splitOptions.color) {
10
- options.color.load(splitOptions.color);
11
- }
12
- else if (splitOptions.colorOffset && parentColor) {
13
- options.color.load({
14
- value: {
15
- hsl: {
16
- h: parentColor.h + getRangeValue(splitOptions.colorOffset.h ?? defaultOffset),
17
- s: parentColor.s + getRangeValue(splitOptions.colorOffset.s ?? defaultOffset),
18
- l: parentColor.l + getRangeValue(splitOptions.colorOffset.l ?? defaultOffset),
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
- else {
24
- options.color.load({
25
- value: {
26
- hsl: parent.getFillColor(),
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: {
package/cjs/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export async function loadDestroyUpdater(engine) {
2
- engine.checkVersion("4.0.0-alpha.26");
2
+ engine.checkVersion("4.0.0-alpha.28");
3
3
  await engine.register(e => {
4
4
  e.addParticleUpdater("destroy", async (container) => {
5
5
  const { DestroyUpdater } = await import("./DestroyUpdater.js");
@@ -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-alpha.26
7
+ * v4.0.0-alpha.28
8
8
  */
9
9
  "use strict";
10
10
  /*
@@ -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 color;\n colorOffset;\n count;\n factor;\n particles;\n rate;\n sizeOffset;\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.color !== undefined) {\n this.color = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.OptionsColor.create(this.color, data.color);\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.colorOffset) {\n this.colorOffset = this.colorOffset ?? {};\n if (data.colorOffset.h !== undefined) {\n this.colorOffset.h = data.colorOffset.h;\n }\n if (data.colorOffset.s !== undefined) {\n this.colorOffset.s = data.colorOffset.s;\n }\n if (data.colorOffset.l !== undefined) {\n this.colorOffset.l = data.colorOffset.l;\n }\n }\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/updater-destroy/./dist/browser/Options/Classes/Split.js?\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
 
@@ -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, 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), 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: _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}");
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
 
@@ -2,13 +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
- color;
6
- colorOffset;
7
5
  count;
8
6
  factor;
7
+ fillColor;
8
+ fillColorOffset;
9
9
  particles;
10
10
  rate;
11
11
  sizeOffset;
12
+ strokeColor;
13
+ strokeColorOffset;
12
14
  constructor() {
13
15
  this.count = 1;
14
16
  this.factor = new SplitFactor();
@@ -19,8 +21,11 @@ export class Split {
19
21
  if (isNull(data)) {
20
22
  return;
21
23
  }
22
- if (data.color !== undefined) {
23
- this.color = OptionsColor.create(this.color, data.color);
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);
24
29
  }
25
30
  if (data.count !== undefined) {
26
31
  this.count = data.count;
@@ -33,16 +38,28 @@ export class Split {
33
38
  if (data.sizeOffset !== undefined) {
34
39
  this.sizeOffset = data.sizeOffset;
35
40
  }
36
- if (data.colorOffset) {
37
- this.colorOffset = this.colorOffset ?? {};
38
- if (data.colorOffset.h !== undefined) {
39
- this.colorOffset.h = data.colorOffset.h;
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;
40
57
  }
41
- if (data.colorOffset.s !== undefined) {
42
- this.colorOffset.s = data.colorOffset.s;
58
+ if (data.strokeColorOffset.s !== undefined) {
59
+ this.strokeColorOffset.s = data.strokeColorOffset.s;
43
60
  }
44
- if (data.colorOffset.l !== undefined) {
45
- this.colorOffset.l = data.colorOffset.l;
61
+ if (data.strokeColorOffset.l !== undefined) {
62
+ this.strokeColorOffset.l = data.strokeColorOffset.l;
46
63
  }
47
64
  }
48
65
  }
package/esm/Utils.js CHANGED
@@ -1,31 +1,58 @@
1
- import { PixelMode, getRangeValue, identity, 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), parentColor = parent.getFillColor();
9
- if (splitOptions.color) {
10
- options.color.load(splitOptions.color);
11
- }
12
- else if (splitOptions.colorOffset && parentColor) {
13
- options.color.load({
14
- value: {
15
- hsl: {
16
- h: parentColor.h + getRangeValue(splitOptions.colorOffset.h ?? defaultOffset),
17
- s: parentColor.s + getRangeValue(splitOptions.colorOffset.s ?? defaultOffset),
18
- l: parentColor.l + getRangeValue(splitOptions.colorOffset.l ?? defaultOffset),
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
- else {
24
- options.color.load({
25
- value: {
26
- hsl: parent.getFillColor(),
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: {
package/esm/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export async function loadDestroyUpdater(engine) {
2
- engine.checkVersion("4.0.0-alpha.26");
2
+ engine.checkVersion("4.0.0-alpha.28");
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-alpha.26",
3
+ "version": "4.0.0-alpha.28",
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-alpha.26"
90
+ "@tsparticles/engine": "4.0.0-alpha.28"
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 [26 Feb 2026 at 18:03]</title>
6
+ <title>@tsparticles/updater-destroy [15 Mar 2026 at 13:48]</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-alpha.26
7
+ * v4.0.0-alpha.28
8
8
  */
9
9
  /*
10
10
  * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
@@ -44,7 +44,7 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
44
44
  \*******************************/
45
45
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
46
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-alpha.26\");\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}");
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-alpha.28\");\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
48
 
49
49
  /***/ }
50
50
 
@@ -60,12 +60,6 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
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 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
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
@@ -1,2 +1,2 @@
1
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,p=document.getElementsByTagName("script"),c=0;c<p.length;c++){var l=p[c];if(l.getAttribute("src")==e||l.getAttribute("data-webpack")=="@tsparticles/updater-destroy:"+r){i=l;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 u=(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(u.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=u.bind(null,i.onerror),i.onload=u.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&&(p=a.g.location+"");var s,p,c=a.g.document;if(!p&&c&&(c.currentScript&&"SCRIPT"===c.currentScript.tagName.toUpperCase()&&(p=c.currentScript.src),!p)){var l=c.getElementsByTagName("script");if(l.length)for(var u=l.length-1;u>-1&&(!p||!/^http(s?):/.test(p));)p=l[u--].src}if(!p)throw Error("Automatic publicPath is not supported in this browser");a.p=p=p.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,p]=r,c=0;if(n.some(e=>0!==t[e])){for(o in s)a.o(s,o)&&(a.m[o]=s[o]);p&&p(a)}for(e&&e(r);c<n.length;c++)i=n[c],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-alpha.26"),await e.register(e=>{e.addParticleUpdater("destroy",async t=>{let{DestroyUpdater:r}=await a.e(674).then(a.bind(a,674));return new r(e,t)})})}return a.r(d),a.d(d,{loadDestroyUpdater:()=>f}),d})());
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,p]=r,c=0;if(n.some(e=>0!==t[e])){for(o in s)a.o(s,o)&&(a.m[o]=s[o]);p&&p(a)}for(e&&e(r);c<n.length;c++)i=n[c],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-alpha.28"),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
  }
@@ -14,13 +14,15 @@
14
14
  const SplitFactor_js_1 = require("./SplitFactor.js");
15
15
  const SplitRate_js_1 = require("./SplitRate.js");
16
16
  class Split {
17
- color;
18
- colorOffset;
19
17
  count;
20
18
  factor;
19
+ fillColor;
20
+ fillColorOffset;
21
21
  particles;
22
22
  rate;
23
23
  sizeOffset;
24
+ strokeColor;
25
+ strokeColorOffset;
24
26
  constructor() {
25
27
  this.count = 1;
26
28
  this.factor = new SplitFactor_js_1.SplitFactor();
@@ -31,8 +33,11 @@
31
33
  if ((0, engine_1.isNull)(data)) {
32
34
  return;
33
35
  }
34
- if (data.color !== undefined) {
35
- this.color = engine_1.OptionsColor.create(this.color, data.color);
36
+ if (data.fillColor !== undefined) {
37
+ this.fillColor = engine_1.OptionsColor.create(this.fillColor, data.fillColor);
38
+ }
39
+ if (data.strokeColor !== undefined) {
40
+ this.strokeColor = engine_1.OptionsColor.create(this.strokeColor, data.strokeColor);
36
41
  }
37
42
  if (data.count !== undefined) {
38
43
  this.count = data.count;
@@ -45,16 +50,28 @@
45
50
  if (data.sizeOffset !== undefined) {
46
51
  this.sizeOffset = data.sizeOffset;
47
52
  }
48
- if (data.colorOffset) {
49
- this.colorOffset = this.colorOffset ?? {};
50
- if (data.colorOffset.h !== undefined) {
51
- this.colorOffset.h = data.colorOffset.h;
53
+ if (data.fillColorOffset) {
54
+ this.fillColorOffset = this.fillColorOffset ?? {};
55
+ if (data.fillColorOffset.h !== undefined) {
56
+ this.fillColorOffset.h = data.fillColorOffset.h;
57
+ }
58
+ if (data.fillColorOffset.s !== undefined) {
59
+ this.fillColorOffset.s = data.fillColorOffset.s;
60
+ }
61
+ if (data.fillColorOffset.l !== undefined) {
62
+ this.fillColorOffset.l = data.fillColorOffset.l;
63
+ }
64
+ }
65
+ if (data.strokeColorOffset) {
66
+ this.strokeColorOffset = this.strokeColorOffset ?? {};
67
+ if (data.strokeColorOffset.h !== undefined) {
68
+ this.strokeColorOffset.h = data.strokeColorOffset.h;
52
69
  }
53
- if (data.colorOffset.s !== undefined) {
54
- this.colorOffset.s = data.colorOffset.s;
70
+ if (data.strokeColorOffset.s !== undefined) {
71
+ this.strokeColorOffset.s = data.strokeColorOffset.s;
55
72
  }
56
- if (data.colorOffset.l !== undefined) {
57
- this.colorOffset.l = data.colorOffset.l;
73
+ if (data.strokeColorOffset.l !== undefined) {
74
+ this.strokeColorOffset.l = data.strokeColorOffset.l;
58
75
  }
59
76
  }
60
77
  }
package/umd/Utils.js CHANGED
@@ -17,27 +17,54 @@
17
17
  if (!destroyOptions) {
18
18
  return;
19
19
  }
20
- const splitOptions = destroyOptions.split, options = (0, engine_1.loadParticlesOptions)(engine, container, parent.options), parentColor = parent.getFillColor();
21
- if (splitOptions.color) {
22
- options.color.load(splitOptions.color);
23
- }
24
- else if (splitOptions.colorOffset && parentColor) {
25
- options.color.load({
26
- value: {
27
- hsl: {
28
- h: parentColor.h + (0, engine_1.getRangeValue)(splitOptions.colorOffset.h ?? defaultOffset),
29
- s: parentColor.s + (0, engine_1.getRangeValue)(splitOptions.colorOffset.s ?? defaultOffset),
30
- l: parentColor.l + (0, engine_1.getRangeValue)(splitOptions.colorOffset.l ?? defaultOffset),
20
+ const splitOptions = destroyOptions.split, options = (0, engine_1.loadParticlesOptions)(engine, container, parent.options), fillOptions = (0, engine_1.itemFromSingleOrMultiple)(options.fill), strokeOptions = (0, engine_1.itemFromSingleOrMultiple)(options.stroke);
21
+ if (fillOptions?.enable) {
22
+ const fillColor = engine_1.AnimatableColor.create(undefined, fillOptions.color), parentFillColor = parent.getFillColor();
23
+ if (fillColor.value) {
24
+ fillColor.load(splitOptions.fillColor);
25
+ }
26
+ else if (splitOptions.fillColorOffset && parentFillColor) {
27
+ fillColor.load({
28
+ value: {
29
+ hsl: {
30
+ h: parentFillColor.h + (0, engine_1.getRangeValue)(splitOptions.fillColorOffset.h ?? defaultOffset),
31
+ s: parentFillColor.s + (0, engine_1.getRangeValue)(splitOptions.fillColorOffset.s ?? defaultOffset),
32
+ l: parentFillColor.l + (0, engine_1.getRangeValue)(splitOptions.fillColorOffset.l ?? defaultOffset),
33
+ },
34
+ },
35
+ });
36
+ }
37
+ else {
38
+ fillColor.load({
39
+ value: {
40
+ hsl: parent.getFillColor(),
31
41
  },
32
- },
33
- });
42
+ });
43
+ }
34
44
  }
35
- else {
36
- options.color.load({
37
- value: {
38
- hsl: parent.getFillColor(),
39
- },
40
- });
45
+ if (strokeOptions?.width) {
46
+ const strokeColor = engine_1.AnimatableColor.create(undefined, strokeOptions.color), parentStrokeColor = parent.getStrokeColor();
47
+ if (strokeColor.value) {
48
+ strokeColor.load(splitOptions.strokeColor);
49
+ }
50
+ else if (splitOptions.strokeColorOffset && parentStrokeColor) {
51
+ strokeColor.load({
52
+ value: {
53
+ hsl: {
54
+ h: parentStrokeColor.h + (0, engine_1.getRangeValue)(splitOptions.strokeColorOffset.h ?? defaultOffset),
55
+ s: parentStrokeColor.s + (0, engine_1.getRangeValue)(splitOptions.strokeColorOffset.s ?? defaultOffset),
56
+ l: parentStrokeColor.l + (0, engine_1.getRangeValue)(splitOptions.strokeColorOffset.l ?? defaultOffset),
57
+ },
58
+ },
59
+ });
60
+ }
61
+ else {
62
+ strokeColor.load({
63
+ value: {
64
+ hsl: parent.getStrokeColor(),
65
+ },
66
+ });
67
+ }
41
68
  }
42
69
  options.move.load({
43
70
  center: {
package/umd/index.js CHANGED
@@ -45,7 +45,7 @@ var __importStar = (this && this.__importStar) || (function () {
45
45
  Object.defineProperty(exports, "__esModule", { value: true });
46
46
  exports.loadDestroyUpdater = loadDestroyUpdater;
47
47
  async function loadDestroyUpdater(engine) {
48
- engine.checkVersion("4.0.0-alpha.26");
48
+ engine.checkVersion("4.0.0-alpha.28");
49
49
  await engine.register(e => {
50
50
  e.addParticleUpdater("destroy", async (container) => {
51
51
  const { DestroyUpdater } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./DestroyUpdater.js"))) : new Promise((resolve_1, reject_1) => { require(["./DestroyUpdater.js"], resolve_1, reject_1); }).then(__importStar));
package/674.min.js DELETED
@@ -1 +0,0 @@
1
- "use strict";(this.webpackChunk_tsparticles_updater_destroy=this.webpackChunk_tsparticles_updater_destroy||[]).push([[674],{674(t,e,o){o.d(e,{DestroyUpdater:()=>d});var s,l,i=o(303);class n{bottom;left;right;top;load(t){(0,i.isNull)(t)||(void 0!==t.bottom&&(this.bottom=(0,i.setRangeValue)(t.bottom)),void 0!==t.left&&(this.left=(0,i.setRangeValue)(t.left)),void 0!==t.right&&(this.right=(0,i.setRangeValue)(t.right)),void 0!==t.top&&(this.top=(0,i.setRangeValue)(t.top)))}}(s=l||(l={})).none="none",s.split="split";class r extends i.ValueWithRandom{constructor(){super(),this.value=3}}class a extends i.ValueWithRandom{constructor(){super(),this.value={min:4,max:9}}}class u{color;colorOffset;count;factor;particles;rate;sizeOffset;constructor(){this.count=1,this.factor=new r,this.rate=new a,this.sizeOffset=!0}load(t){!(0,i.isNull)(t)&&(void 0!==t.color&&(this.color=i.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,i.executeOnSingleOrMultiple)(t.particles,t=>(0,i.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 c{bounds;mode;split;constructor(){this.bounds=new n,this.mode=l.none,this.split=new u}load(t){(0,i.isNull)(t)||(t.mode&&(this.mode=t.mode),t.bounds&&this.bounds.load(t.bounds),this.split.load(t.split))}}class d{container;engine;constructor(t,e){this.container=e,this.engine=t}init(t){let e=this.container,o=t.options.destroy;if(!o)return;t.splitCount=0;let s=o.bounds;t.destroyBounds??={};let{bottom:l,left:n,right:r,top:a}=s,{destroyBounds:u}=t,c=e.canvas.size;l&&(u.bottom=(0,i.getRangeValue)(l)*c.height/i.percentDenominator),n&&(u.left=(0,i.getRangeValue)(n)*c.width/i.percentDenominator),r&&(u.right=(0,i.getRangeValue)(r)*c.width/i.percentDenominator),a&&(u.top=(0,i.getRangeValue)(a)*c.height/i.percentDenominator)}isEnabled(t){return!t.destroyed}loadOptions(t,...e){for(let o of(t.destroy??=new c,e))t.destroy.load(o?.destroy)}particleDestroyed(t,e){if(e)return;let o=t.options.destroy;o?.mode===l.split&&function(t,e,o){let s=o.options.destroy;if(!s)return;let l=s.split;if(l.count>=0){if(void 0===o.splitCount||o.splitCount>l.count)return;o.splitCount++}let n=(0,i.getRangeValue)(l.rate.value),r=(0,i.itemFromSingleOrMultiple)(l.particles);for(let s=0;s<n;s++)!function(t,e,o,s){let l=o.options.destroy;if(!l)return;let n=l.split,r=(0,i.loadParticlesOptions)(t,e,o.options),a=o.getFillColor();n.color?r.color.load(n.color):n.colorOffset&&a?r.color.load({value:{hsl:{h:a.h+(0,i.getRangeValue)(n.colorOffset.h??0),s:a.s+(0,i.getRangeValue)(n.colorOffset.s??0),l:a.l+(0,i.getRangeValue)(n.colorOffset.l??0)}}}):r.color.load({value:{hsl:o.getFillColor()}}),r.move.load({center:{x:o.position.x,y:o.position.y,mode:i.PixelMode.precise}});let u=i.identity/(0,i.getRangeValue)(n.factor.value);(0,i.isNumber)(r.size.value)?r.size.value*=u:(r.size.value.min*=u,r.size.value.max*=u),r.load(s);let c=n.sizeOffset?(0,i.setRangeValue)(-o.size.value,o.size.value):0,d={x:o.position.x+(0,i.randomInRangeValue)(c),y:o.position.y+(0,i.randomInRangeValue)(c)};e.particles.addParticle(d,r,o.group,t=>!(t.size.value<.5)&&(t.velocity.length=(0,i.randomInRangeValue)((0,i.setRangeValue)(o.velocity.length,t.velocity.length)),t.splitCount=(o.splitCount??0)+1,t.unbreakable=!0,t.unbreakableUntil=performance.now()+500,!0))}(t,e,o,r)}(this.engine,this.container,t)}update(t){void 0!==t.unbreakableUntil&&performance.now()>=t.unbreakableUntil&&(t.unbreakable=!1,t.unbreakableUntil=void 0);let e=t.getPosition(),o=t.destroyBounds;o&&(void 0!==o.bottom&&e.y>=o.bottom||void 0!==o.left&&e.x<=o.left||void 0!==o.right&&e.x>=o.right||void 0!==o.top&&e.y<=o.top)&&t.destroy()}}}}]);