@tsparticles/updater-destroy 3.0.3 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/DestroyUpdater.js +6 -6
- package/browser/Utils.js +10 -8
- package/cjs/DestroyUpdater.js +5 -5
- package/cjs/Utils.js +10 -8
- package/esm/DestroyUpdater.js +6 -6
- package/esm/Utils.js +10 -8
- package/package.json +2 -2
- package/report.html +2 -2
- package/tsparticles.updater.destroy.js +20 -14
- package/tsparticles.updater.destroy.min.js +1 -1
- package/tsparticles.updater.destroy.min.js.LICENSE.txt +1 -1
- package/types/DestroyUpdater.d.ts +1 -1
- package/umd/DestroyUpdater.js +5 -5
- package/umd/Utils.js +10 -8
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { getRangeValue, } from "@tsparticles/engine";
|
|
1
|
+
import { getRangeValue, percentDenominator, } from "@tsparticles/engine";
|
|
2
2
|
import { Destroy } from "./Options/Classes/Destroy.js";
|
|
3
3
|
import { split } from "./Utils.js";
|
|
4
4
|
export class DestroyUpdater {
|
|
5
5
|
constructor(engine, container) {
|
|
6
|
-
this.engine = engine;
|
|
7
6
|
this.container = container;
|
|
7
|
+
this.engine = engine;
|
|
8
8
|
}
|
|
9
9
|
init(particle) {
|
|
10
10
|
const container = this.container, particlesOptions = particle.options, destroyOptions = particlesOptions.destroy;
|
|
@@ -18,16 +18,16 @@ export class DestroyUpdater {
|
|
|
18
18
|
}
|
|
19
19
|
const { bottom, left, right, top } = destroyBoundsOptions, { destroyBounds } = particle, canvasSize = container.canvas.size;
|
|
20
20
|
if (bottom) {
|
|
21
|
-
destroyBounds.bottom = (getRangeValue(bottom) * canvasSize.height) /
|
|
21
|
+
destroyBounds.bottom = (getRangeValue(bottom) * canvasSize.height) / percentDenominator;
|
|
22
22
|
}
|
|
23
23
|
if (left) {
|
|
24
|
-
destroyBounds.left = (getRangeValue(left) * canvasSize.width) /
|
|
24
|
+
destroyBounds.left = (getRangeValue(left) * canvasSize.width) / percentDenominator;
|
|
25
25
|
}
|
|
26
26
|
if (right) {
|
|
27
|
-
destroyBounds.right = (getRangeValue(right) * canvasSize.width) /
|
|
27
|
+
destroyBounds.right = (getRangeValue(right) * canvasSize.width) / percentDenominator;
|
|
28
28
|
}
|
|
29
29
|
if (top) {
|
|
30
|
-
destroyBounds.top = (getRangeValue(top) * canvasSize.height) /
|
|
30
|
+
destroyBounds.top = (getRangeValue(top) * canvasSize.height) / percentDenominator;
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
isEnabled(particle) {
|
package/browser/Utils.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getRangeValue, isNumber, itemFromSingleOrMultiple, loadParticlesOptions, randomInRange, setRangeValue, } from "@tsparticles/engine";
|
|
2
|
+
const defaultOffset = 0, minDestroySize = 0.5, defaultSplitCount = 0, increment = 1, unbreakableTime = 500, minSplitCount = 0;
|
|
2
3
|
function addSplitParticle(engine, container, parent, splitParticlesOptions) {
|
|
3
4
|
const destroyOptions = parent.options.destroy;
|
|
4
5
|
if (!destroyOptions) {
|
|
@@ -12,9 +13,9 @@ function addSplitParticle(engine, container, parent, splitParticlesOptions) {
|
|
|
12
13
|
options.color.load({
|
|
13
14
|
value: {
|
|
14
15
|
hsl: {
|
|
15
|
-
h: parentColor.h + getRangeValue(splitOptions.colorOffset.h ??
|
|
16
|
-
s: parentColor.s + getRangeValue(splitOptions.colorOffset.s ??
|
|
17
|
-
l: parentColor.l + getRangeValue(splitOptions.colorOffset.l ??
|
|
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),
|
|
18
19
|
},
|
|
19
20
|
},
|
|
20
21
|
});
|
|
@@ -41,20 +42,20 @@ function addSplitParticle(engine, container, parent, splitParticlesOptions) {
|
|
|
41
42
|
options.size.value.max /= factor;
|
|
42
43
|
}
|
|
43
44
|
options.load(splitParticlesOptions);
|
|
44
|
-
const offset = splitOptions.sizeOffset ? setRangeValue(-parent.size.value, parent.size.value) :
|
|
45
|
+
const offset = splitOptions.sizeOffset ? setRangeValue(-parent.size.value, parent.size.value) : defaultOffset, position = {
|
|
45
46
|
x: parent.position.x + randomInRange(offset),
|
|
46
47
|
y: parent.position.y + randomInRange(offset),
|
|
47
48
|
};
|
|
48
49
|
return container.particles.addParticle(position, options, parent.group, (particle) => {
|
|
49
|
-
if (particle.size.value <
|
|
50
|
+
if (particle.size.value < minDestroySize) {
|
|
50
51
|
return false;
|
|
51
52
|
}
|
|
52
53
|
particle.velocity.length = randomInRange(setRangeValue(parent.velocity.length, particle.velocity.length));
|
|
53
|
-
particle.splitCount = (parent.splitCount ??
|
|
54
|
+
particle.splitCount = (parent.splitCount ?? defaultSplitCount) + increment;
|
|
54
55
|
particle.unbreakable = true;
|
|
55
56
|
setTimeout(() => {
|
|
56
57
|
particle.unbreakable = false;
|
|
57
|
-
},
|
|
58
|
+
}, unbreakableTime);
|
|
58
59
|
return true;
|
|
59
60
|
});
|
|
60
61
|
}
|
|
@@ -64,7 +65,8 @@ export function split(engine, container, particle) {
|
|
|
64
65
|
return;
|
|
65
66
|
}
|
|
66
67
|
const splitOptions = destroyOptions.split;
|
|
67
|
-
if (splitOptions.count >=
|
|
68
|
+
if (splitOptions.count >= minSplitCount &&
|
|
69
|
+
(particle.splitCount === undefined || particle.splitCount++ > splitOptions.count)) {
|
|
68
70
|
return;
|
|
69
71
|
}
|
|
70
72
|
const rate = getRangeValue(splitOptions.rate.value), particlesSplitOptions = itemFromSingleOrMultiple(splitOptions.particles);
|
package/cjs/DestroyUpdater.js
CHANGED
|
@@ -6,8 +6,8 @@ const Destroy_js_1 = require("./Options/Classes/Destroy.js");
|
|
|
6
6
|
const Utils_js_1 = require("./Utils.js");
|
|
7
7
|
class DestroyUpdater {
|
|
8
8
|
constructor(engine, container) {
|
|
9
|
-
this.engine = engine;
|
|
10
9
|
this.container = container;
|
|
10
|
+
this.engine = engine;
|
|
11
11
|
}
|
|
12
12
|
init(particle) {
|
|
13
13
|
const container = this.container, particlesOptions = particle.options, destroyOptions = particlesOptions.destroy;
|
|
@@ -21,16 +21,16 @@ class DestroyUpdater {
|
|
|
21
21
|
}
|
|
22
22
|
const { bottom, left, right, top } = destroyBoundsOptions, { destroyBounds } = particle, canvasSize = container.canvas.size;
|
|
23
23
|
if (bottom) {
|
|
24
|
-
destroyBounds.bottom = ((0, engine_1.getRangeValue)(bottom) * canvasSize.height) /
|
|
24
|
+
destroyBounds.bottom = ((0, engine_1.getRangeValue)(bottom) * canvasSize.height) / engine_1.percentDenominator;
|
|
25
25
|
}
|
|
26
26
|
if (left) {
|
|
27
|
-
destroyBounds.left = ((0, engine_1.getRangeValue)(left) * canvasSize.width) /
|
|
27
|
+
destroyBounds.left = ((0, engine_1.getRangeValue)(left) * canvasSize.width) / engine_1.percentDenominator;
|
|
28
28
|
}
|
|
29
29
|
if (right) {
|
|
30
|
-
destroyBounds.right = ((0, engine_1.getRangeValue)(right) * canvasSize.width) /
|
|
30
|
+
destroyBounds.right = ((0, engine_1.getRangeValue)(right) * canvasSize.width) / engine_1.percentDenominator;
|
|
31
31
|
}
|
|
32
32
|
if (top) {
|
|
33
|
-
destroyBounds.top = ((0, engine_1.getRangeValue)(top) * canvasSize.height) /
|
|
33
|
+
destroyBounds.top = ((0, engine_1.getRangeValue)(top) * canvasSize.height) / engine_1.percentDenominator;
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
isEnabled(particle) {
|
package/cjs/Utils.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.split = void 0;
|
|
4
4
|
const engine_1 = require("@tsparticles/engine");
|
|
5
|
+
const defaultOffset = 0, minDestroySize = 0.5, defaultSplitCount = 0, increment = 1, unbreakableTime = 500, minSplitCount = 0;
|
|
5
6
|
function addSplitParticle(engine, container, parent, splitParticlesOptions) {
|
|
6
7
|
const destroyOptions = parent.options.destroy;
|
|
7
8
|
if (!destroyOptions) {
|
|
@@ -15,9 +16,9 @@ function addSplitParticle(engine, container, parent, splitParticlesOptions) {
|
|
|
15
16
|
options.color.load({
|
|
16
17
|
value: {
|
|
17
18
|
hsl: {
|
|
18
|
-
h: parentColor.h + (0, engine_1.getRangeValue)(splitOptions.colorOffset.h ??
|
|
19
|
-
s: parentColor.s + (0, engine_1.getRangeValue)(splitOptions.colorOffset.s ??
|
|
20
|
-
l: parentColor.l + (0, engine_1.getRangeValue)(splitOptions.colorOffset.l ??
|
|
19
|
+
h: parentColor.h + (0, engine_1.getRangeValue)(splitOptions.colorOffset.h ?? defaultOffset),
|
|
20
|
+
s: parentColor.s + (0, engine_1.getRangeValue)(splitOptions.colorOffset.s ?? defaultOffset),
|
|
21
|
+
l: parentColor.l + (0, engine_1.getRangeValue)(splitOptions.colorOffset.l ?? defaultOffset),
|
|
21
22
|
},
|
|
22
23
|
},
|
|
23
24
|
});
|
|
@@ -44,20 +45,20 @@ function addSplitParticle(engine, container, parent, splitParticlesOptions) {
|
|
|
44
45
|
options.size.value.max /= factor;
|
|
45
46
|
}
|
|
46
47
|
options.load(splitParticlesOptions);
|
|
47
|
-
const offset = splitOptions.sizeOffset ? (0, engine_1.setRangeValue)(-parent.size.value, parent.size.value) :
|
|
48
|
+
const offset = splitOptions.sizeOffset ? (0, engine_1.setRangeValue)(-parent.size.value, parent.size.value) : defaultOffset, position = {
|
|
48
49
|
x: parent.position.x + (0, engine_1.randomInRange)(offset),
|
|
49
50
|
y: parent.position.y + (0, engine_1.randomInRange)(offset),
|
|
50
51
|
};
|
|
51
52
|
return container.particles.addParticle(position, options, parent.group, (particle) => {
|
|
52
|
-
if (particle.size.value <
|
|
53
|
+
if (particle.size.value < minDestroySize) {
|
|
53
54
|
return false;
|
|
54
55
|
}
|
|
55
56
|
particle.velocity.length = (0, engine_1.randomInRange)((0, engine_1.setRangeValue)(parent.velocity.length, particle.velocity.length));
|
|
56
|
-
particle.splitCount = (parent.splitCount ??
|
|
57
|
+
particle.splitCount = (parent.splitCount ?? defaultSplitCount) + increment;
|
|
57
58
|
particle.unbreakable = true;
|
|
58
59
|
setTimeout(() => {
|
|
59
60
|
particle.unbreakable = false;
|
|
60
|
-
},
|
|
61
|
+
}, unbreakableTime);
|
|
61
62
|
return true;
|
|
62
63
|
});
|
|
63
64
|
}
|
|
@@ -67,7 +68,8 @@ function split(engine, container, particle) {
|
|
|
67
68
|
return;
|
|
68
69
|
}
|
|
69
70
|
const splitOptions = destroyOptions.split;
|
|
70
|
-
if (splitOptions.count >=
|
|
71
|
+
if (splitOptions.count >= minSplitCount &&
|
|
72
|
+
(particle.splitCount === undefined || particle.splitCount++ > splitOptions.count)) {
|
|
71
73
|
return;
|
|
72
74
|
}
|
|
73
75
|
const rate = (0, engine_1.getRangeValue)(splitOptions.rate.value), particlesSplitOptions = (0, engine_1.itemFromSingleOrMultiple)(splitOptions.particles);
|
package/esm/DestroyUpdater.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { getRangeValue, } from "@tsparticles/engine";
|
|
1
|
+
import { getRangeValue, percentDenominator, } from "@tsparticles/engine";
|
|
2
2
|
import { Destroy } from "./Options/Classes/Destroy.js";
|
|
3
3
|
import { split } from "./Utils.js";
|
|
4
4
|
export class DestroyUpdater {
|
|
5
5
|
constructor(engine, container) {
|
|
6
|
-
this.engine = engine;
|
|
7
6
|
this.container = container;
|
|
7
|
+
this.engine = engine;
|
|
8
8
|
}
|
|
9
9
|
init(particle) {
|
|
10
10
|
const container = this.container, particlesOptions = particle.options, destroyOptions = particlesOptions.destroy;
|
|
@@ -18,16 +18,16 @@ export class DestroyUpdater {
|
|
|
18
18
|
}
|
|
19
19
|
const { bottom, left, right, top } = destroyBoundsOptions, { destroyBounds } = particle, canvasSize = container.canvas.size;
|
|
20
20
|
if (bottom) {
|
|
21
|
-
destroyBounds.bottom = (getRangeValue(bottom) * canvasSize.height) /
|
|
21
|
+
destroyBounds.bottom = (getRangeValue(bottom) * canvasSize.height) / percentDenominator;
|
|
22
22
|
}
|
|
23
23
|
if (left) {
|
|
24
|
-
destroyBounds.left = (getRangeValue(left) * canvasSize.width) /
|
|
24
|
+
destroyBounds.left = (getRangeValue(left) * canvasSize.width) / percentDenominator;
|
|
25
25
|
}
|
|
26
26
|
if (right) {
|
|
27
|
-
destroyBounds.right = (getRangeValue(right) * canvasSize.width) /
|
|
27
|
+
destroyBounds.right = (getRangeValue(right) * canvasSize.width) / percentDenominator;
|
|
28
28
|
}
|
|
29
29
|
if (top) {
|
|
30
|
-
destroyBounds.top = (getRangeValue(top) * canvasSize.height) /
|
|
30
|
+
destroyBounds.top = (getRangeValue(top) * canvasSize.height) / percentDenominator;
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
isEnabled(particle) {
|
package/esm/Utils.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getRangeValue, isNumber, itemFromSingleOrMultiple, loadParticlesOptions, randomInRange, setRangeValue, } from "@tsparticles/engine";
|
|
2
|
+
const defaultOffset = 0, minDestroySize = 0.5, defaultSplitCount = 0, increment = 1, unbreakableTime = 500, minSplitCount = 0;
|
|
2
3
|
function addSplitParticle(engine, container, parent, splitParticlesOptions) {
|
|
3
4
|
const destroyOptions = parent.options.destroy;
|
|
4
5
|
if (!destroyOptions) {
|
|
@@ -12,9 +13,9 @@ function addSplitParticle(engine, container, parent, splitParticlesOptions) {
|
|
|
12
13
|
options.color.load({
|
|
13
14
|
value: {
|
|
14
15
|
hsl: {
|
|
15
|
-
h: parentColor.h + getRangeValue(splitOptions.colorOffset.h ??
|
|
16
|
-
s: parentColor.s + getRangeValue(splitOptions.colorOffset.s ??
|
|
17
|
-
l: parentColor.l + getRangeValue(splitOptions.colorOffset.l ??
|
|
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),
|
|
18
19
|
},
|
|
19
20
|
},
|
|
20
21
|
});
|
|
@@ -41,20 +42,20 @@ function addSplitParticle(engine, container, parent, splitParticlesOptions) {
|
|
|
41
42
|
options.size.value.max /= factor;
|
|
42
43
|
}
|
|
43
44
|
options.load(splitParticlesOptions);
|
|
44
|
-
const offset = splitOptions.sizeOffset ? setRangeValue(-parent.size.value, parent.size.value) :
|
|
45
|
+
const offset = splitOptions.sizeOffset ? setRangeValue(-parent.size.value, parent.size.value) : defaultOffset, position = {
|
|
45
46
|
x: parent.position.x + randomInRange(offset),
|
|
46
47
|
y: parent.position.y + randomInRange(offset),
|
|
47
48
|
};
|
|
48
49
|
return container.particles.addParticle(position, options, parent.group, (particle) => {
|
|
49
|
-
if (particle.size.value <
|
|
50
|
+
if (particle.size.value < minDestroySize) {
|
|
50
51
|
return false;
|
|
51
52
|
}
|
|
52
53
|
particle.velocity.length = randomInRange(setRangeValue(parent.velocity.length, particle.velocity.length));
|
|
53
|
-
particle.splitCount = (parent.splitCount ??
|
|
54
|
+
particle.splitCount = (parent.splitCount ?? defaultSplitCount) + increment;
|
|
54
55
|
particle.unbreakable = true;
|
|
55
56
|
setTimeout(() => {
|
|
56
57
|
particle.unbreakable = false;
|
|
57
|
-
},
|
|
58
|
+
}, unbreakableTime);
|
|
58
59
|
return true;
|
|
59
60
|
});
|
|
60
61
|
}
|
|
@@ -64,7 +65,8 @@ export function split(engine, container, particle) {
|
|
|
64
65
|
return;
|
|
65
66
|
}
|
|
66
67
|
const splitOptions = destroyOptions.split;
|
|
67
|
-
if (splitOptions.count >=
|
|
68
|
+
if (splitOptions.count >= minSplitCount &&
|
|
69
|
+
(particle.splitCount === undefined || particle.splitCount++ > splitOptions.count)) {
|
|
68
70
|
return;
|
|
69
71
|
}
|
|
70
72
|
const rate = getRangeValue(splitOptions.rate.value), particlesSplitOptions = itemFromSingleOrMultiple(splitOptions.particles);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/updater-destroy",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.1.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.0
|
|
90
|
+
"@tsparticles/engine": "^3.1.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 [13 Jan 2024 at 23:08]</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>
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
<body>
|
|
32
32
|
<div id="app"></div>
|
|
33
33
|
<script>
|
|
34
|
-
window.chartData = [{"label":"tsparticles.updater.destroy.js","isAsset":true,"statSize":
|
|
34
|
+
window.chartData = [{"label":"tsparticles.updater.destroy.js","isAsset":true,"statSize":7981,"parsedSize":12132,"gzipSize":3030,"groups":[{"label":"dist/browser","path":"./dist/browser","statSize":7939,"groups":[{"id":105,"label":"index.js + 7 modules (concatenated)","path":"./dist/browser/index.js + 7 modules (concatenated)","statSize":7939,"parsedSize":12132,"gzipSize":3030,"concatenated":true,"groups":[{"label":"dist/browser","path":"./dist/browser/index.js + 7 modules (concatenated)/dist/browser","statSize":7939,"groups":[{"id":null,"label":"index.js","path":"./dist/browser/index.js + 7 modules (concatenated)/dist/browser/index.js","statSize":229,"parsedSize":349,"gzipSize":87,"inaccurateSizes":true},{"id":null,"label":"DestroyUpdater.js","path":"./dist/browser/index.js + 7 modules (concatenated)/dist/browser/DestroyUpdater.js","statSize":2295,"parsedSize":3507,"gzipSize":875,"inaccurateSizes":true},{"label":"Options/Classes","path":"./dist/browser/index.js + 7 modules (concatenated)/dist/browser/Options/Classes","statSize":2530,"groups":[{"id":null,"label":"Destroy.js","path":"./dist/browser/index.js + 7 modules (concatenated)/dist/browser/Options/Classes/Destroy.js","statSize":438,"parsedSize":669,"gzipSize":167,"inaccurateSizes":true},{"id":null,"label":"DestroyBounds.js","path":"./dist/browser/index.js + 7 modules (concatenated)/dist/browser/Options/Classes/DestroyBounds.js","statSize":485,"parsedSize":741,"gzipSize":185,"inaccurateSizes":true},{"id":null,"label":"Split.js","path":"./dist/browser/index.js + 7 modules (concatenated)/dist/browser/Options/Classes/Split.js","statSize":1252,"parsedSize":1913,"gzipSize":477,"inaccurateSizes":true},{"id":null,"label":"SplitFactor.js","path":"./dist/browser/index.js + 7 modules (concatenated)/dist/browser/Options/Classes/SplitFactor.js","statSize":162,"parsedSize":247,"gzipSize":61,"inaccurateSizes":true},{"id":null,"label":"SplitRate.js","path":"./dist/browser/index.js + 7 modules (concatenated)/dist/browser/Options/Classes/SplitRate.js","statSize":193,"parsedSize":294,"gzipSize":73,"inaccurateSizes":true}],"parsedSize":3866,"gzipSize":965,"inaccurateSizes":true},{"id":null,"label":"Utils.js","path":"./dist/browser/index.js + 7 modules (concatenated)/dist/browser/Utils.js","statSize":2885,"parsedSize":4408,"gzipSize":1101,"inaccurateSizes":true}],"parsedSize":12132,"gzipSize":3030,"inaccurateSizes":true}]}],"parsedSize":12132,"gzipSize":3030},{"label":"engine\",\"commonjs2\":\"@tsparticles/engine\",\"amd\":\"@tsparticles","path":"./engine\",\"commonjs2\":\"@tsparticles/engine\",\"amd\":\"@tsparticles","statSize":42,"groups":[{"id":533,"label":"engine\",\"root\":\"window\"}","path":"./engine\",\"commonjs2\":\"@tsparticles/engine\",\"amd\":\"@tsparticles/engine\",\"root\":\"window\"}","statSize":42}],"parsedSize":0,"gzipSize":0}],"isInitialByEntrypoint":{"tsparticles.updater.destroy":true}}];
|
|
35
35
|
window.entrypoints = ["tsparticles.updater.destroy","tsparticles.updater.destroy.min"];
|
|
36
36
|
window.defaultSizes = "parsed";
|
|
37
37
|
</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.0
|
|
7
|
+
* v3.1.0
|
|
8
8
|
*/
|
|
9
9
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
10
10
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
@@ -203,6 +203,12 @@ class Destroy {
|
|
|
203
203
|
}
|
|
204
204
|
;// CONCATENATED MODULE: ./dist/browser/Utils.js
|
|
205
205
|
|
|
206
|
+
const defaultOffset = 0,
|
|
207
|
+
minDestroySize = 0.5,
|
|
208
|
+
defaultSplitCount = 0,
|
|
209
|
+
increment = 1,
|
|
210
|
+
unbreakableTime = 500,
|
|
211
|
+
minSplitCount = 0;
|
|
206
212
|
function addSplitParticle(engine, container, parent, splitParticlesOptions) {
|
|
207
213
|
const destroyOptions = parent.options.destroy;
|
|
208
214
|
if (!destroyOptions) {
|
|
@@ -218,9 +224,9 @@ function addSplitParticle(engine, container, parent, splitParticlesOptions) {
|
|
|
218
224
|
options.color.load({
|
|
219
225
|
value: {
|
|
220
226
|
hsl: {
|
|
221
|
-
h: parentColor.h + (0,engine_root_window_.getRangeValue)(splitOptions.colorOffset.h ??
|
|
222
|
-
s: parentColor.s + (0,engine_root_window_.getRangeValue)(splitOptions.colorOffset.s ??
|
|
223
|
-
l: parentColor.l + (0,engine_root_window_.getRangeValue)(splitOptions.colorOffset.l ??
|
|
227
|
+
h: parentColor.h + (0,engine_root_window_.getRangeValue)(splitOptions.colorOffset.h ?? defaultOffset),
|
|
228
|
+
s: parentColor.s + (0,engine_root_window_.getRangeValue)(splitOptions.colorOffset.s ?? defaultOffset),
|
|
229
|
+
l: parentColor.l + (0,engine_root_window_.getRangeValue)(splitOptions.colorOffset.l ?? defaultOffset)
|
|
224
230
|
}
|
|
225
231
|
}
|
|
226
232
|
});
|
|
@@ -245,21 +251,21 @@ function addSplitParticle(engine, container, parent, splitParticlesOptions) {
|
|
|
245
251
|
options.size.value.max /= factor;
|
|
246
252
|
}
|
|
247
253
|
options.load(splitParticlesOptions);
|
|
248
|
-
const offset = splitOptions.sizeOffset ? (0,engine_root_window_.setRangeValue)(-parent.size.value, parent.size.value) :
|
|
254
|
+
const offset = splitOptions.sizeOffset ? (0,engine_root_window_.setRangeValue)(-parent.size.value, parent.size.value) : defaultOffset,
|
|
249
255
|
position = {
|
|
250
256
|
x: parent.position.x + (0,engine_root_window_.randomInRange)(offset),
|
|
251
257
|
y: parent.position.y + (0,engine_root_window_.randomInRange)(offset)
|
|
252
258
|
};
|
|
253
259
|
return container.particles.addParticle(position, options, parent.group, particle => {
|
|
254
|
-
if (particle.size.value <
|
|
260
|
+
if (particle.size.value < minDestroySize) {
|
|
255
261
|
return false;
|
|
256
262
|
}
|
|
257
263
|
particle.velocity.length = (0,engine_root_window_.randomInRange)((0,engine_root_window_.setRangeValue)(parent.velocity.length, particle.velocity.length));
|
|
258
|
-
particle.splitCount = (parent.splitCount ??
|
|
264
|
+
particle.splitCount = (parent.splitCount ?? defaultSplitCount) + increment;
|
|
259
265
|
particle.unbreakable = true;
|
|
260
266
|
setTimeout(() => {
|
|
261
267
|
particle.unbreakable = false;
|
|
262
|
-
},
|
|
268
|
+
}, unbreakableTime);
|
|
263
269
|
return true;
|
|
264
270
|
});
|
|
265
271
|
}
|
|
@@ -269,7 +275,7 @@ function split(engine, container, particle) {
|
|
|
269
275
|
return;
|
|
270
276
|
}
|
|
271
277
|
const splitOptions = destroyOptions.split;
|
|
272
|
-
if (splitOptions.count >=
|
|
278
|
+
if (splitOptions.count >= minSplitCount && (particle.splitCount === undefined || particle.splitCount++ > splitOptions.count)) {
|
|
273
279
|
return;
|
|
274
280
|
}
|
|
275
281
|
const rate = (0,engine_root_window_.getRangeValue)(splitOptions.rate.value),
|
|
@@ -284,8 +290,8 @@ function split(engine, container, particle) {
|
|
|
284
290
|
|
|
285
291
|
class DestroyUpdater {
|
|
286
292
|
constructor(engine, container) {
|
|
287
|
-
this.engine = engine;
|
|
288
293
|
this.container = container;
|
|
294
|
+
this.engine = engine;
|
|
289
295
|
}
|
|
290
296
|
init(particle) {
|
|
291
297
|
const container = this.container,
|
|
@@ -310,16 +316,16 @@ class DestroyUpdater {
|
|
|
310
316
|
} = particle,
|
|
311
317
|
canvasSize = container.canvas.size;
|
|
312
318
|
if (bottom) {
|
|
313
|
-
destroyBounds.bottom = (0,engine_root_window_.getRangeValue)(bottom) * canvasSize.height /
|
|
319
|
+
destroyBounds.bottom = (0,engine_root_window_.getRangeValue)(bottom) * canvasSize.height / engine_root_window_.percentDenominator;
|
|
314
320
|
}
|
|
315
321
|
if (left) {
|
|
316
|
-
destroyBounds.left = (0,engine_root_window_.getRangeValue)(left) * canvasSize.width /
|
|
322
|
+
destroyBounds.left = (0,engine_root_window_.getRangeValue)(left) * canvasSize.width / engine_root_window_.percentDenominator;
|
|
317
323
|
}
|
|
318
324
|
if (right) {
|
|
319
|
-
destroyBounds.right = (0,engine_root_window_.getRangeValue)(right) * canvasSize.width /
|
|
325
|
+
destroyBounds.right = (0,engine_root_window_.getRangeValue)(right) * canvasSize.width / engine_root_window_.percentDenominator;
|
|
320
326
|
}
|
|
321
327
|
if (top) {
|
|
322
|
-
destroyBounds.top = (0,engine_root_window_.getRangeValue)(top) * canvasSize.height /
|
|
328
|
+
destroyBounds.top = (0,engine_root_window_.getRangeValue)(top) * canvasSize.height / engine_root_window_.percentDenominator;
|
|
323
329
|
}
|
|
324
330
|
}
|
|
325
331
|
isEnabled(particle) {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see tsparticles.updater.destroy.min.js.LICENSE.txt */
|
|
2
|
-
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],e);else{var o="object"==typeof exports?e(require("@tsparticles/engine")):e(t.window);for(var s in o)("object"==typeof exports?exports:t)[s]=o[s]}}(this,(t=>(()=>{"use strict";var e={533:e=>{e.exports=t}},o={};function s(t){var i=o[t];if(void 0!==i)return i.exports;var r=o[t]={exports:{}};return e[t](r,r.exports,s),r.exports}s.d=(t,e)=>{for(var o in e)s.o(e,o)&&!s.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},s.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),s.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var i={};return(()=>{s.r(i),s.d(i,{loadDestroyUpdater:()=>
|
|
2
|
+
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],e);else{var o="object"==typeof exports?e(require("@tsparticles/engine")):e(t.window);for(var s in o)("object"==typeof exports?exports:t)[s]=o[s]}}(this,(t=>(()=>{"use strict";var e={533:e=>{e.exports=t}},o={};function s(t){var i=o[t];if(void 0!==i)return i.exports;var r=o[t]={exports:{}};return e[t](r,r.exports,s),r.exports}s.d=(t,e)=>{for(var o in e)s.o(e,o)&&!s.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},s.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),s.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var i={};return(()=>{s.r(i),s.d(i,{loadDestroyUpdater:()=>g});var t=s(533);class e{load(e){e&&(void 0!==e.bottom&&(this.bottom=(0,t.setRangeValue)(e.bottom)),void 0!==e.left&&(this.left=(0,t.setRangeValue)(e.left)),void 0!==e.right&&(this.right=(0,t.setRangeValue)(e.right)),void 0!==e.top&&(this.top=(0,t.setRangeValue)(e.top)))}}class o extends t.ValueWithRandom{constructor(){super(),this.value=3}}class r extends t.ValueWithRandom{constructor(){super(),this.value={min:4,max:9}}}class n{constructor(){this.count=1,this.factor=new o,this.rate=new r,this.sizeOffset=!0}load(e){e&&(void 0!==e.color&&(this.color=t.OptionsColor.create(this.color,e.color)),void 0!==e.count&&(this.count=e.count),this.factor.load(e.factor),this.rate.load(e.rate),this.particles=(0,t.executeOnSingleOrMultiple)(e.particles,(e=>(0,t.deepExtend)({},e))),void 0!==e.sizeOffset&&(this.sizeOffset=e.sizeOffset),e.colorOffset&&(this.colorOffset=this.colorOffset??{},void 0!==e.colorOffset.h&&(this.colorOffset.h=e.colorOffset.h),void 0!==e.colorOffset.s&&(this.colorOffset.s=e.colorOffset.s),void 0!==e.colorOffset.l&&(this.colorOffset.l=e.colorOffset.l)))}}class l{constructor(){this.bounds=new e,this.mode="none",this.split=new n}load(t){t&&(t.mode&&(this.mode=t.mode),t.bounds&&this.bounds.load(t.bounds),this.split.load(t.split))}}const a=0,c=.5,d=0,u=1,f=500;function p(e,o,s,i){const r=s.options.destroy;if(!r)return;const n=r.split,l=(0,t.loadParticlesOptions)(e,o,s.options),p=(0,t.getRangeValue)(n.factor.value),h=s.getFillColor();n.color?l.color.load(n.color):n.colorOffset&&h?l.color.load({value:{hsl:{h:h.h+(0,t.getRangeValue)(n.colorOffset.h??a),s:h.s+(0,t.getRangeValue)(n.colorOffset.s??a),l:h.l+(0,t.getRangeValue)(n.colorOffset.l??a)}}}):l.color.load({value:{hsl:s.getFillColor()}}),l.move.load({center:{x:s.position.x,y:s.position.y,mode:"precise"}}),(0,t.isNumber)(l.size.value)?l.size.value/=p:(l.size.value.min/=p,l.size.value.max/=p),l.load(i);const g=n.sizeOffset?(0,t.setRangeValue)(-s.size.value,s.size.value):a,v={x:s.position.x+(0,t.randomInRange)(g),y:s.position.y+(0,t.randomInRange)(g)};return o.particles.addParticle(v,l,s.group,(e=>!(e.size.value<c)&&(e.velocity.length=(0,t.randomInRange)((0,t.setRangeValue)(s.velocity.length,e.velocity.length)),e.splitCount=(s.splitCount??d)+u,e.unbreakable=!0,setTimeout((()=>{e.unbreakable=!1}),f),!0)))}class h{constructor(t,e){this.container=e,this.engine=t}init(e){const o=this.container,s=e.options.destroy;if(!s)return;e.splitCount=0;const i=s.bounds;e.destroyBounds||(e.destroyBounds={});const{bottom:r,left:n,right:l,top:a}=i,{destroyBounds:c}=e,d=o.canvas.size;r&&(c.bottom=(0,t.getRangeValue)(r)*d.height/t.percentDenominator),n&&(c.left=(0,t.getRangeValue)(n)*d.width/t.percentDenominator),l&&(c.right=(0,t.getRangeValue)(l)*d.width/t.percentDenominator),a&&(c.top=(0,t.getRangeValue)(a)*d.height/t.percentDenominator)}isEnabled(t){return!t.destroyed}loadOptions(t,...e){t.destroy||(t.destroy=new l);for(const o of e)t.destroy.load(o?.destroy)}particleDestroyed(e,o){if(o)return;const s=e.options.destroy;s&&"split"===s.mode&&function(e,o,s){const i=s.options.destroy;if(!i)return;const r=i.split;if(r.count>=0&&(void 0===s.splitCount||s.splitCount++>r.count))return;const n=(0,t.getRangeValue)(r.rate.value),l=(0,t.itemFromSingleOrMultiple)(r.particles);for(let t=0;t<n;t++)p(e,o,s,l)}(this.engine,this.container,e)}update(t){if(!this.isEnabled(t))return;const 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()}}async function g(t,e=!0){await t.addParticleUpdater("destroy",(e=>new h(t,e)),e)}})(),i})()));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
/*! tsParticles Destroy Updater v3.0
|
|
1
|
+
/*! tsParticles Destroy Updater v3.1.0 by Matteo Bruni */
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type Container, type Engine, type IParticleUpdater, type Particle, type RecursivePartial } from "@tsparticles/engine";
|
|
2
2
|
import type { DestroyParticle, DestroyParticlesOptions, IDestroyParticlesOptions } from "./Types.js";
|
|
3
3
|
export declare class DestroyUpdater implements IParticleUpdater {
|
|
4
|
-
private readonly engine;
|
|
5
4
|
private readonly container;
|
|
5
|
+
private readonly engine;
|
|
6
6
|
constructor(engine: Engine, container: Container);
|
|
7
7
|
init(particle: DestroyParticle): void;
|
|
8
8
|
isEnabled(particle: Particle): boolean;
|
package/umd/DestroyUpdater.js
CHANGED
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
const Utils_js_1 = require("./Utils.js");
|
|
16
16
|
class DestroyUpdater {
|
|
17
17
|
constructor(engine, container) {
|
|
18
|
-
this.engine = engine;
|
|
19
18
|
this.container = container;
|
|
19
|
+
this.engine = engine;
|
|
20
20
|
}
|
|
21
21
|
init(particle) {
|
|
22
22
|
const container = this.container, particlesOptions = particle.options, destroyOptions = particlesOptions.destroy;
|
|
@@ -30,16 +30,16 @@
|
|
|
30
30
|
}
|
|
31
31
|
const { bottom, left, right, top } = destroyBoundsOptions, { destroyBounds } = particle, canvasSize = container.canvas.size;
|
|
32
32
|
if (bottom) {
|
|
33
|
-
destroyBounds.bottom = ((0, engine_1.getRangeValue)(bottom) * canvasSize.height) /
|
|
33
|
+
destroyBounds.bottom = ((0, engine_1.getRangeValue)(bottom) * canvasSize.height) / engine_1.percentDenominator;
|
|
34
34
|
}
|
|
35
35
|
if (left) {
|
|
36
|
-
destroyBounds.left = ((0, engine_1.getRangeValue)(left) * canvasSize.width) /
|
|
36
|
+
destroyBounds.left = ((0, engine_1.getRangeValue)(left) * canvasSize.width) / engine_1.percentDenominator;
|
|
37
37
|
}
|
|
38
38
|
if (right) {
|
|
39
|
-
destroyBounds.right = ((0, engine_1.getRangeValue)(right) * canvasSize.width) /
|
|
39
|
+
destroyBounds.right = ((0, engine_1.getRangeValue)(right) * canvasSize.width) / engine_1.percentDenominator;
|
|
40
40
|
}
|
|
41
41
|
if (top) {
|
|
42
|
-
destroyBounds.top = ((0, engine_1.getRangeValue)(top) * canvasSize.height) /
|
|
42
|
+
destroyBounds.top = ((0, engine_1.getRangeValue)(top) * canvasSize.height) / engine_1.percentDenominator;
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
isEnabled(particle) {
|
package/umd/Utils.js
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.split = void 0;
|
|
13
13
|
const engine_1 = require("@tsparticles/engine");
|
|
14
|
+
const defaultOffset = 0, minDestroySize = 0.5, defaultSplitCount = 0, increment = 1, unbreakableTime = 500, minSplitCount = 0;
|
|
14
15
|
function addSplitParticle(engine, container, parent, splitParticlesOptions) {
|
|
15
16
|
const destroyOptions = parent.options.destroy;
|
|
16
17
|
if (!destroyOptions) {
|
|
@@ -24,9 +25,9 @@
|
|
|
24
25
|
options.color.load({
|
|
25
26
|
value: {
|
|
26
27
|
hsl: {
|
|
27
|
-
h: parentColor.h + (0, engine_1.getRangeValue)(splitOptions.colorOffset.h ??
|
|
28
|
-
s: parentColor.s + (0, engine_1.getRangeValue)(splitOptions.colorOffset.s ??
|
|
29
|
-
l: parentColor.l + (0, engine_1.getRangeValue)(splitOptions.colorOffset.l ??
|
|
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),
|
|
30
31
|
},
|
|
31
32
|
},
|
|
32
33
|
});
|
|
@@ -53,20 +54,20 @@
|
|
|
53
54
|
options.size.value.max /= factor;
|
|
54
55
|
}
|
|
55
56
|
options.load(splitParticlesOptions);
|
|
56
|
-
const offset = splitOptions.sizeOffset ? (0, engine_1.setRangeValue)(-parent.size.value, parent.size.value) :
|
|
57
|
+
const offset = splitOptions.sizeOffset ? (0, engine_1.setRangeValue)(-parent.size.value, parent.size.value) : defaultOffset, position = {
|
|
57
58
|
x: parent.position.x + (0, engine_1.randomInRange)(offset),
|
|
58
59
|
y: parent.position.y + (0, engine_1.randomInRange)(offset),
|
|
59
60
|
};
|
|
60
61
|
return container.particles.addParticle(position, options, parent.group, (particle) => {
|
|
61
|
-
if (particle.size.value <
|
|
62
|
+
if (particle.size.value < minDestroySize) {
|
|
62
63
|
return false;
|
|
63
64
|
}
|
|
64
65
|
particle.velocity.length = (0, engine_1.randomInRange)((0, engine_1.setRangeValue)(parent.velocity.length, particle.velocity.length));
|
|
65
|
-
particle.splitCount = (parent.splitCount ??
|
|
66
|
+
particle.splitCount = (parent.splitCount ?? defaultSplitCount) + increment;
|
|
66
67
|
particle.unbreakable = true;
|
|
67
68
|
setTimeout(() => {
|
|
68
69
|
particle.unbreakable = false;
|
|
69
|
-
},
|
|
70
|
+
}, unbreakableTime);
|
|
70
71
|
return true;
|
|
71
72
|
});
|
|
72
73
|
}
|
|
@@ -76,7 +77,8 @@
|
|
|
76
77
|
return;
|
|
77
78
|
}
|
|
78
79
|
const splitOptions = destroyOptions.split;
|
|
79
|
-
if (splitOptions.count >=
|
|
80
|
+
if (splitOptions.count >= minSplitCount &&
|
|
81
|
+
(particle.splitCount === undefined || particle.splitCount++ > splitOptions.count)) {
|
|
80
82
|
return;
|
|
81
83
|
}
|
|
82
84
|
const rate = (0, engine_1.getRangeValue)(splitOptions.rate.value), particlesSplitOptions = (0, engine_1.itemFromSingleOrMultiple)(splitOptions.particles);
|