tsparticles 2.6.0 → 2.7.1
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/package.json +13 -13
- package/report.html +2 -2
- package/tsparticles.bundle.js +175 -101
- package/tsparticles.bundle.min.js +1 -1
- package/tsparticles.bundle.min.js.LICENSE.txt +1 -1
- package/tsparticles.js +1 -1
- package/tsparticles.min.js.LICENSE.txt +1 -1
package/tsparticles.bundle.js
CHANGED
|
@@ -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
|
-
* v2.
|
|
7
|
+
* v2.7.1
|
|
8
8
|
*/
|
|
9
9
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
10
10
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
@@ -741,13 +741,13 @@ function rectBounce(particle, divBounds) {
|
|
|
741
741
|
}
|
|
742
742
|
}
|
|
743
743
|
function executeOnSingleOrMultiple(obj, callback) {
|
|
744
|
-
return obj instanceof Array ? obj.map(item => callback(item)) : callback(obj);
|
|
744
|
+
return obj instanceof Array ? obj.map((item, index) => callback(item, index)) : callback(obj, 0);
|
|
745
745
|
}
|
|
746
746
|
function itemFromSingleOrMultiple(obj, index, useIndex) {
|
|
747
747
|
return obj instanceof Array ? itemFromArray(obj, index, useIndex) : obj;
|
|
748
748
|
}
|
|
749
749
|
function findItemFromSingleOrMultiple(obj, callback) {
|
|
750
|
-
return obj instanceof Array ? obj.find(t => callback(t)) : callback(obj) ? obj : undefined;
|
|
750
|
+
return obj instanceof Array ? obj.find((t, index) => callback(t, index)) : callback(obj, 0) ? obj : undefined;
|
|
751
751
|
}
|
|
752
752
|
;// CONCATENATED MODULE: ../../engine/dist/esm/Utils/ColorUtils.js
|
|
753
753
|
|
|
@@ -1019,10 +1019,13 @@ function setColorAnimation(colorValue, colorAnimation, reduceFactor) {
|
|
|
1019
1019
|
colorValue.velocity = getRangeValue(colorAnimation.speed) / 100 * reduceFactor;
|
|
1020
1020
|
colorValue.decay = 1 - getRangeValue(colorAnimation.decay);
|
|
1021
1021
|
colorValue.status = "increasing";
|
|
1022
|
+
colorValue.loops = 0;
|
|
1023
|
+
colorValue.maxLoops = getRangeValue(colorAnimation.count);
|
|
1022
1024
|
if (!colorAnimation.sync) {
|
|
1023
1025
|
colorValue.velocity *= getRandom();
|
|
1024
1026
|
colorValue.value *= getRandom();
|
|
1025
1027
|
}
|
|
1028
|
+
colorValue.initialValue = colorValue.value;
|
|
1026
1029
|
} else {
|
|
1027
1030
|
colorValue.velocity = 0;
|
|
1028
1031
|
}
|
|
@@ -1050,7 +1053,7 @@ function clear(context, dimension) {
|
|
|
1050
1053
|
context.clearRect(0, 0, dimension.width, dimension.height);
|
|
1051
1054
|
}
|
|
1052
1055
|
function drawParticle(data) {
|
|
1053
|
-
var _a, _b, _c, _d, _e
|
|
1056
|
+
var _a, _b, _c, _d, _e;
|
|
1054
1057
|
const {
|
|
1055
1058
|
container,
|
|
1056
1059
|
context,
|
|
@@ -1091,13 +1094,13 @@ function drawParticle(data) {
|
|
|
1091
1094
|
if (colorStyles.fill) {
|
|
1092
1095
|
context.fillStyle = colorStyles.fill;
|
|
1093
1096
|
}
|
|
1094
|
-
const
|
|
1095
|
-
context.lineWidth =
|
|
1097
|
+
const strokeWidth = (_e = particle.strokeWidth) !== null && _e !== void 0 ? _e : 0;
|
|
1098
|
+
context.lineWidth = strokeWidth;
|
|
1096
1099
|
if (colorStyles.stroke) {
|
|
1097
1100
|
context.strokeStyle = colorStyles.stroke;
|
|
1098
1101
|
}
|
|
1099
1102
|
drawShape(container, context, particle, radius, opacity, delta);
|
|
1100
|
-
if (
|
|
1103
|
+
if (strokeWidth > 0) {
|
|
1101
1104
|
context.stroke();
|
|
1102
1105
|
}
|
|
1103
1106
|
if (particle.close) {
|
|
@@ -1255,12 +1258,12 @@ class Canvas {
|
|
|
1255
1258
|
return;
|
|
1256
1259
|
}
|
|
1257
1260
|
this.draw(ctx => {
|
|
1258
|
-
var _a, _b, _c, _d
|
|
1261
|
+
var _a, _b, _c, _d;
|
|
1259
1262
|
const options = this.container.actualOptions,
|
|
1260
1263
|
zIndexOptions = particle.options.zIndex,
|
|
1261
1264
|
zOpacityFactor = (1 - particle.zIndexFactor) ** zIndexOptions.opacityRate,
|
|
1262
1265
|
opacity = (_c = (_a = particle.bubble.opacity) !== null && _a !== void 0 ? _a : (_b = particle.opacity) === null || _b === void 0 ? void 0 : _b.value) !== null && _c !== void 0 ? _c : 1,
|
|
1263
|
-
strokeOpacity = (
|
|
1266
|
+
strokeOpacity = (_d = particle.strokeOpacity) !== null && _d !== void 0 ? _d : opacity,
|
|
1264
1267
|
zOpacity = opacity * zOpacityFactor,
|
|
1265
1268
|
zStrokeOpacity = strokeOpacity * zOpacityFactor,
|
|
1266
1269
|
transform = {},
|
|
@@ -2834,7 +2837,7 @@ class Move {
|
|
|
2834
2837
|
this.attract.load(data.attract);
|
|
2835
2838
|
this.center.load(data.center);
|
|
2836
2839
|
if (data.decay !== undefined) {
|
|
2837
|
-
this.decay = data.decay;
|
|
2840
|
+
this.decay = setRangeValue(data.decay);
|
|
2838
2841
|
}
|
|
2839
2842
|
if (data.direction !== undefined) {
|
|
2840
2843
|
this.direction = data.direction;
|
|
@@ -2991,8 +2994,20 @@ class Opacity extends ValueWithRandom {
|
|
|
2991
2994
|
class ParticlesDensity {
|
|
2992
2995
|
constructor() {
|
|
2993
2996
|
this.enable = false;
|
|
2994
|
-
this.
|
|
2995
|
-
this.
|
|
2997
|
+
this.width = 1920;
|
|
2998
|
+
this.height = 1080;
|
|
2999
|
+
}
|
|
3000
|
+
get area() {
|
|
3001
|
+
return this.width;
|
|
3002
|
+
}
|
|
3003
|
+
set area(value) {
|
|
3004
|
+
this.width = value;
|
|
3005
|
+
}
|
|
3006
|
+
get factor() {
|
|
3007
|
+
return this.height;
|
|
3008
|
+
}
|
|
3009
|
+
set factor(value) {
|
|
3010
|
+
this.height = value;
|
|
2996
3011
|
}
|
|
2997
3012
|
get value_area() {
|
|
2998
3013
|
return this.area;
|
|
@@ -3001,19 +3016,20 @@ class ParticlesDensity {
|
|
|
3001
3016
|
this.area = value;
|
|
3002
3017
|
}
|
|
3003
3018
|
load(data) {
|
|
3004
|
-
var _a;
|
|
3019
|
+
var _a, _b, _c;
|
|
3005
3020
|
if (!data) {
|
|
3006
3021
|
return;
|
|
3007
3022
|
}
|
|
3008
3023
|
if (data.enable !== undefined) {
|
|
3009
3024
|
this.enable = data.enable;
|
|
3010
3025
|
}
|
|
3011
|
-
const
|
|
3012
|
-
if (
|
|
3013
|
-
this.
|
|
3026
|
+
const width = (_b = (_a = data.width) !== null && _a !== void 0 ? _a : data.area) !== null && _b !== void 0 ? _b : data.value_area;
|
|
3027
|
+
if (width !== undefined) {
|
|
3028
|
+
this.width = width;
|
|
3014
3029
|
}
|
|
3015
|
-
|
|
3016
|
-
|
|
3030
|
+
const height = (_c = data.height) !== null && _c !== void 0 ? _c : data.factor;
|
|
3031
|
+
if (height !== undefined) {
|
|
3032
|
+
this.height = height;
|
|
3017
3033
|
}
|
|
3018
3034
|
}
|
|
3019
3035
|
}
|
|
@@ -3246,6 +3262,7 @@ class Size extends ValueWithRandom {
|
|
|
3246
3262
|
}
|
|
3247
3263
|
;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/Stroke.js
|
|
3248
3264
|
|
|
3265
|
+
|
|
3249
3266
|
class Stroke {
|
|
3250
3267
|
constructor() {
|
|
3251
3268
|
this.width = 0;
|
|
@@ -3258,10 +3275,10 @@ class Stroke {
|
|
|
3258
3275
|
this.color = AnimatableColor.create(this.color, data.color);
|
|
3259
3276
|
}
|
|
3260
3277
|
if (data.width !== undefined) {
|
|
3261
|
-
this.width = data.width;
|
|
3278
|
+
this.width = setRangeValue(data.width);
|
|
3262
3279
|
}
|
|
3263
3280
|
if (data.opacity !== undefined) {
|
|
3264
|
-
this.opacity = data.opacity;
|
|
3281
|
+
this.opacity = setRangeValue(data.opacity);
|
|
3265
3282
|
}
|
|
3266
3283
|
}
|
|
3267
3284
|
}
|
|
@@ -3678,22 +3695,8 @@ class Particle {
|
|
|
3678
3695
|
container.canvas.drawParticle(this, delta);
|
|
3679
3696
|
}
|
|
3680
3697
|
getFillColor() {
|
|
3681
|
-
var _a
|
|
3682
|
-
|
|
3683
|
-
if (color && this.roll && (this.backColor || this.roll.alter)) {
|
|
3684
|
-
const backFactor = this.roll.horizontal && this.roll.vertical ? 2 : 1,
|
|
3685
|
-
backSum = this.roll.horizontal ? Math.PI / 2 : 0,
|
|
3686
|
-
rolled = Math.floor((((_b = this.roll.angle) !== null && _b !== void 0 ? _b : 0) + backSum) / (Math.PI / backFactor)) % 2;
|
|
3687
|
-
if (rolled) {
|
|
3688
|
-
if (this.backColor) {
|
|
3689
|
-
return this.backColor;
|
|
3690
|
-
}
|
|
3691
|
-
if (this.roll.alter) {
|
|
3692
|
-
return alterHsl(color, this.roll.alter.type, this.roll.alter.value);
|
|
3693
|
-
}
|
|
3694
|
-
}
|
|
3695
|
-
}
|
|
3696
|
-
return color;
|
|
3698
|
+
var _a;
|
|
3699
|
+
return this._getRollColor((_a = this.bubble.color) !== null && _a !== void 0 ? _a : getHslFromAnimation(this.color));
|
|
3697
3700
|
}
|
|
3698
3701
|
getMass() {
|
|
3699
3702
|
return this.getRadius() ** 2 * Math.PI / 2;
|
|
@@ -3710,8 +3713,8 @@ class Particle {
|
|
|
3710
3713
|
return (_a = this.bubble.radius) !== null && _a !== void 0 ? _a : this.size.value;
|
|
3711
3714
|
}
|
|
3712
3715
|
getStrokeColor() {
|
|
3713
|
-
var _a
|
|
3714
|
-
return (
|
|
3716
|
+
var _a;
|
|
3717
|
+
return this._getRollColor((_a = this.bubble.color) !== null && _a !== void 0 ? _a : getHslFromAnimation(this.strokeColor));
|
|
3715
3718
|
}
|
|
3716
3719
|
init(id, position, overrideOptions, group) {
|
|
3717
3720
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
@@ -3788,7 +3791,7 @@ class Particle {
|
|
|
3788
3791
|
this.size.status = "increasing";
|
|
3789
3792
|
break;
|
|
3790
3793
|
case "random":
|
|
3791
|
-
this.size.value = randomInRange(this.size)
|
|
3794
|
+
this.size.value = randomInRange(this.size);
|
|
3792
3795
|
this.size.status = getRandom() >= 0.5 ? "increasing" : "decreasing";
|
|
3793
3796
|
break;
|
|
3794
3797
|
case "max":
|
|
@@ -3798,6 +3801,7 @@ class Particle {
|
|
|
3798
3801
|
break;
|
|
3799
3802
|
}
|
|
3800
3803
|
}
|
|
3804
|
+
this.size.initialValue = this.size.value;
|
|
3801
3805
|
this.bubble = {
|
|
3802
3806
|
inRange: false
|
|
3803
3807
|
};
|
|
@@ -3966,6 +3970,25 @@ class Particle {
|
|
|
3966
3970
|
}
|
|
3967
3971
|
return overlaps;
|
|
3968
3972
|
}
|
|
3973
|
+
_getRollColor(color) {
|
|
3974
|
+
var _a;
|
|
3975
|
+
if (!color || !this.roll || !this.backColor && !this.roll.alter) {
|
|
3976
|
+
return color;
|
|
3977
|
+
}
|
|
3978
|
+
const backFactor = this.roll.horizontal && this.roll.vertical ? 2 : 1,
|
|
3979
|
+
backSum = this.roll.horizontal ? Math.PI / 2 : 0,
|
|
3980
|
+
rolled = Math.floor((((_a = this.roll.angle) !== null && _a !== void 0 ? _a : 0) + backSum) / (Math.PI / backFactor)) % 2;
|
|
3981
|
+
if (!rolled) {
|
|
3982
|
+
return color;
|
|
3983
|
+
}
|
|
3984
|
+
if (this.backColor) {
|
|
3985
|
+
return this.backColor;
|
|
3986
|
+
}
|
|
3987
|
+
if (this.roll.alter) {
|
|
3988
|
+
return alterHsl(color, this.roll.alter.type, this.roll.alter.value);
|
|
3989
|
+
}
|
|
3990
|
+
return color;
|
|
3991
|
+
}
|
|
3969
3992
|
_loadShapeData(shapeOptions, reduceDuplicates) {
|
|
3970
3993
|
const shapeData = shapeOptions.options[this.shape];
|
|
3971
3994
|
if (shapeData) {
|
|
@@ -5049,6 +5072,7 @@ class Loader {
|
|
|
5049
5072
|
}
|
|
5050
5073
|
}
|
|
5051
5074
|
;// CONCATENATED MODULE: ../../engine/dist/esm/Core/Utils/Plugins.js
|
|
5075
|
+
|
|
5052
5076
|
function getItemsFromInitializer(container, map, initializers, force = false) {
|
|
5053
5077
|
let res = map.get(container);
|
|
5054
5078
|
if (!res || force) {
|
|
@@ -5097,10 +5121,12 @@ class Plugins {
|
|
|
5097
5121
|
this.presets.set(presetKey, options);
|
|
5098
5122
|
}
|
|
5099
5123
|
}
|
|
5100
|
-
addShapeDrawer(
|
|
5101
|
-
|
|
5102
|
-
this.
|
|
5103
|
-
|
|
5124
|
+
addShapeDrawer(types, drawer) {
|
|
5125
|
+
executeOnSingleOrMultiple(types, type => {
|
|
5126
|
+
if (!this.getShapeDrawer(type)) {
|
|
5127
|
+
this.drawers.set(type, drawer);
|
|
5128
|
+
}
|
|
5129
|
+
});
|
|
5104
5130
|
}
|
|
5105
5131
|
destroy(container) {
|
|
5106
5132
|
this.updaters.delete(container);
|
|
@@ -5548,6 +5574,9 @@ tsParticles.init();
|
|
|
5548
5574
|
|
|
5549
5575
|
|
|
5550
5576
|
|
|
5577
|
+
|
|
5578
|
+
|
|
5579
|
+
|
|
5551
5580
|
|
|
5552
5581
|
|
|
5553
5582
|
|
|
@@ -7421,11 +7450,33 @@ async function loadBaseMover(engine) {
|
|
|
7421
7450
|
;// CONCATENATED MODULE: ../../shapes/circle/dist/esm/CircleDrawer.js
|
|
7422
7451
|
class CircleDrawer {
|
|
7423
7452
|
draw(context, particle, radius) {
|
|
7424
|
-
|
|
7453
|
+
if (!particle.circleRange) {
|
|
7454
|
+
particle.circleRange = {
|
|
7455
|
+
min: 0,
|
|
7456
|
+
max: Math.PI * 2
|
|
7457
|
+
};
|
|
7458
|
+
}
|
|
7459
|
+
const circleRange = particle.circleRange;
|
|
7460
|
+
context.arc(0, 0, radius, circleRange.min, circleRange.max, false);
|
|
7425
7461
|
}
|
|
7426
7462
|
getSidesCount() {
|
|
7427
7463
|
return 12;
|
|
7428
7464
|
}
|
|
7465
|
+
particleInit(container, particle) {
|
|
7466
|
+
var _a;
|
|
7467
|
+
const shapeData = particle.shapeData,
|
|
7468
|
+
angle = (_a = shapeData === null || shapeData === void 0 ? void 0 : shapeData.angle) !== null && _a !== void 0 ? _a : {
|
|
7469
|
+
max: 360,
|
|
7470
|
+
min: 0
|
|
7471
|
+
};
|
|
7472
|
+
particle.circleRange = typeof angle !== "object" ? {
|
|
7473
|
+
min: 0,
|
|
7474
|
+
max: angle * Math.PI / 180
|
|
7475
|
+
} : {
|
|
7476
|
+
min: angle.min * Math.PI / 180,
|
|
7477
|
+
max: angle.max * Math.PI / 180
|
|
7478
|
+
};
|
|
7479
|
+
}
|
|
7429
7480
|
}
|
|
7430
7481
|
;// CONCATENATED MODULE: ../../shapes/circle/dist/esm/index.js
|
|
7431
7482
|
|
|
@@ -7437,7 +7488,7 @@ async function loadCircleShape(engine) {
|
|
|
7437
7488
|
function updateColorValue(delta, value, valueAnimation, max, decrease) {
|
|
7438
7489
|
var _a, _b;
|
|
7439
7490
|
const colorValue = value;
|
|
7440
|
-
if (!colorValue || !valueAnimation.enable) {
|
|
7491
|
+
if (!colorValue || !valueAnimation.enable || colorValue.loops !== undefined && colorValue.maxLoops !== undefined && colorValue.maxLoops > 0 && colorValue.loops >= colorValue.maxLoops) {
|
|
7441
7492
|
return;
|
|
7442
7493
|
}
|
|
7443
7494
|
const offset = randomInRange(valueAnimation.offset),
|
|
@@ -7445,13 +7496,23 @@ function updateColorValue(delta, value, valueAnimation, max, decrease) {
|
|
|
7445
7496
|
decay = (_b = value.decay) !== null && _b !== void 0 ? _b : 1;
|
|
7446
7497
|
if (!decrease || colorValue.status === "increasing") {
|
|
7447
7498
|
colorValue.value += velocity;
|
|
7448
|
-
if (
|
|
7449
|
-
colorValue.
|
|
7450
|
-
|
|
7499
|
+
if (colorValue.value > max) {
|
|
7500
|
+
if (!colorValue.loops) {
|
|
7501
|
+
colorValue.loops = 0;
|
|
7502
|
+
}
|
|
7503
|
+
colorValue.loops++;
|
|
7504
|
+
if (decrease) {
|
|
7505
|
+
colorValue.status = "decreasing";
|
|
7506
|
+
colorValue.value -= colorValue.value % max;
|
|
7507
|
+
}
|
|
7451
7508
|
}
|
|
7452
7509
|
} else {
|
|
7453
7510
|
colorValue.value -= velocity;
|
|
7454
7511
|
if (colorValue.value < 0) {
|
|
7512
|
+
if (!colorValue.loops) {
|
|
7513
|
+
colorValue.loops = 0;
|
|
7514
|
+
}
|
|
7515
|
+
colorValue.loops++;
|
|
7455
7516
|
colorValue.status = "increasing";
|
|
7456
7517
|
colorValue.value += colorValue.value;
|
|
7457
7518
|
}
|
|
@@ -7466,14 +7527,17 @@ function updateColorValue(delta, value, valueAnimation, max, decrease) {
|
|
|
7466
7527
|
function updateColor(particle, delta) {
|
|
7467
7528
|
var _a, _b, _c;
|
|
7468
7529
|
const animationOptions = particle.options.color.animation;
|
|
7469
|
-
|
|
7470
|
-
|
|
7530
|
+
const h = (_a = particle.color) === null || _a === void 0 ? void 0 : _a.h,
|
|
7531
|
+
s = (_b = particle.color) === null || _b === void 0 ? void 0 : _b.s,
|
|
7532
|
+
l = (_c = particle.color) === null || _c === void 0 ? void 0 : _c.l;
|
|
7533
|
+
if (h) {
|
|
7534
|
+
updateColorValue(delta, h, animationOptions.h, 360, false);
|
|
7471
7535
|
}
|
|
7472
|
-
if (
|
|
7473
|
-
updateColorValue(delta,
|
|
7536
|
+
if (s) {
|
|
7537
|
+
updateColorValue(delta, s, animationOptions.s, 100, true);
|
|
7474
7538
|
}
|
|
7475
|
-
if (
|
|
7476
|
-
updateColorValue(delta,
|
|
7539
|
+
if (l) {
|
|
7540
|
+
updateColorValue(delta, l, animationOptions.l, 100, true);
|
|
7477
7541
|
}
|
|
7478
7542
|
}
|
|
7479
7543
|
class ColorUpdater {
|
|
@@ -9305,9 +9369,7 @@ class ImageDrawer {
|
|
|
9305
9369
|
;// CONCATENATED MODULE: ../../shapes/image/dist/esm/index.js
|
|
9306
9370
|
|
|
9307
9371
|
async function loadImageShape(engine) {
|
|
9308
|
-
|
|
9309
|
-
await engine.addShape("image", imageDrawer);
|
|
9310
|
-
await engine.addShape("images", imageDrawer);
|
|
9372
|
+
await engine.addShape(["image", "images"], new ImageDrawer());
|
|
9311
9373
|
}
|
|
9312
9374
|
;// CONCATENATED MODULE: ../../updaters/life/dist/esm/Options/Classes/LifeDelay.js
|
|
9313
9375
|
|
|
@@ -9581,6 +9643,7 @@ class OpacityUpdater {
|
|
|
9581
9643
|
particle.opacity.velocity *= getRandom();
|
|
9582
9644
|
}
|
|
9583
9645
|
}
|
|
9646
|
+
particle.opacity.initialValue = particle.opacity.value;
|
|
9584
9647
|
}
|
|
9585
9648
|
isEnabled(particle) {
|
|
9586
9649
|
var _a, _b, _c, _d;
|
|
@@ -10682,14 +10745,15 @@ async function loadParticlesLinksInteraction(engine) {
|
|
|
10682
10745
|
|
|
10683
10746
|
|
|
10684
10747
|
;// CONCATENATED MODULE: ../../shapes/polygon/dist/esm/PolygonDrawerBase.js
|
|
10748
|
+
|
|
10685
10749
|
class PolygonDrawerBase {
|
|
10686
10750
|
draw(context, particle, radius) {
|
|
10687
|
-
const start = this.getCenter(particle, radius)
|
|
10688
|
-
|
|
10689
|
-
|
|
10690
|
-
|
|
10691
|
-
|
|
10692
|
-
|
|
10751
|
+
const start = this.getCenter(particle, radius),
|
|
10752
|
+
side = this.getSidesData(particle, radius),
|
|
10753
|
+
sideCount = side.count.numerator * side.count.denominator,
|
|
10754
|
+
decimalSides = side.count.numerator / side.count.denominator,
|
|
10755
|
+
interiorAngleDegrees = 180 * (decimalSides - 2) / decimalSides,
|
|
10756
|
+
interiorAngle = Math.PI - Math.PI * interiorAngleDegrees / 180;
|
|
10693
10757
|
if (!context) {
|
|
10694
10758
|
return;
|
|
10695
10759
|
}
|
|
@@ -10704,24 +10768,22 @@ class PolygonDrawerBase {
|
|
|
10704
10768
|
}
|
|
10705
10769
|
getSidesCount(particle) {
|
|
10706
10770
|
var _a, _b;
|
|
10707
|
-
const polygon = particle.shapeData
|
|
10708
|
-
|
|
10771
|
+
const polygon = particle.shapeData,
|
|
10772
|
+
sides = Math.round(getRangeValue((_b = (_a = polygon === null || polygon === void 0 ? void 0 : polygon.sides) !== null && _a !== void 0 ? _a : polygon === null || polygon === void 0 ? void 0 : polygon.nb_sides) !== null && _b !== void 0 ? _b : 5));
|
|
10773
|
+
return sides;
|
|
10709
10774
|
}
|
|
10710
10775
|
}
|
|
10711
10776
|
;// CONCATENATED MODULE: ../../shapes/polygon/dist/esm/PolygonDrawer.js
|
|
10712
10777
|
|
|
10713
10778
|
class PolygonDrawer extends PolygonDrawerBase {
|
|
10714
10779
|
getCenter(particle, radius) {
|
|
10715
|
-
const sides = this.getSidesCount(particle);
|
|
10716
10780
|
return {
|
|
10717
|
-
x: -radius / (sides / 3.5),
|
|
10781
|
+
x: -radius / (particle.sides / 3.5),
|
|
10718
10782
|
y: -radius / (2.66 / 3.5)
|
|
10719
10783
|
};
|
|
10720
10784
|
}
|
|
10721
10785
|
getSidesData(particle, radius) {
|
|
10722
|
-
|
|
10723
|
-
const polygon = particle.shapeData;
|
|
10724
|
-
const sides = (_b = (_a = polygon === null || polygon === void 0 ? void 0 : polygon.sides) !== null && _a !== void 0 ? _a : polygon === null || polygon === void 0 ? void 0 : polygon.nb_sides) !== null && _b !== void 0 ? _b : 5;
|
|
10786
|
+
const sides = particle.sides;
|
|
10725
10787
|
return {
|
|
10726
10788
|
count: {
|
|
10727
10789
|
denominator: 1,
|
|
@@ -10868,16 +10930,15 @@ class SquareDrawer {
|
|
|
10868
10930
|
|
|
10869
10931
|
async function loadSquareShape(engine) {
|
|
10870
10932
|
const drawer = new SquareDrawer();
|
|
10871
|
-
await engine.addShape("edge", drawer);
|
|
10872
|
-
await engine.addShape("square", drawer);
|
|
10933
|
+
await engine.addShape(["edge", "square"], drawer);
|
|
10873
10934
|
}
|
|
10874
10935
|
;// CONCATENATED MODULE: ../../shapes/star/dist/esm/StarDrawer.js
|
|
10936
|
+
|
|
10875
10937
|
class StarDrawer {
|
|
10876
10938
|
draw(context, particle, radius) {
|
|
10877
10939
|
var _a;
|
|
10878
|
-
const
|
|
10879
|
-
|
|
10880
|
-
inset = (_a = star === null || star === void 0 ? void 0 : star.inset) !== null && _a !== void 0 ? _a : 2;
|
|
10940
|
+
const sides = particle.sides,
|
|
10941
|
+
inset = (_a = particle.starInset) !== null && _a !== void 0 ? _a : 2;
|
|
10881
10942
|
context.moveTo(0, 0 - radius);
|
|
10882
10943
|
for (let i = 0; i < sides; i++) {
|
|
10883
10944
|
context.rotate(Math.PI / sides);
|
|
@@ -10889,7 +10950,13 @@ class StarDrawer {
|
|
|
10889
10950
|
getSidesCount(particle) {
|
|
10890
10951
|
var _a, _b;
|
|
10891
10952
|
const star = particle.shapeData;
|
|
10892
|
-
return (_b = (_a = star === null || star === void 0 ? void 0 : star.sides) !== null && _a !== void 0 ? _a : star === null || star === void 0 ? void 0 : star.nb_sides) !== null && _b !== void 0 ? _b : 5;
|
|
10953
|
+
return Math.round(getRangeValue((_b = (_a = star === null || star === void 0 ? void 0 : star.sides) !== null && _a !== void 0 ? _a : star === null || star === void 0 ? void 0 : star.nb_sides) !== null && _b !== void 0 ? _b : 5));
|
|
10954
|
+
}
|
|
10955
|
+
particleInit(container, particle) {
|
|
10956
|
+
var _a;
|
|
10957
|
+
const star = particle.shapeData,
|
|
10958
|
+
inset = getRangeValue((_a = star === null || star === void 0 ? void 0 : star.inset) !== null && _a !== void 0 ? _a : 2);
|
|
10959
|
+
particle.starInset = inset;
|
|
10893
10960
|
}
|
|
10894
10961
|
}
|
|
10895
10962
|
;// CONCATENATED MODULE: ../../shapes/star/dist/esm/index.js
|
|
@@ -10902,7 +10969,7 @@ async function loadStarShape(engine) {
|
|
|
10902
10969
|
function StrokeColorUpdater_updateColorValue(delta, value, valueAnimation, max, decrease) {
|
|
10903
10970
|
var _a, _b;
|
|
10904
10971
|
const colorValue = value;
|
|
10905
|
-
if (!colorValue || !colorValue.enable) {
|
|
10972
|
+
if (!colorValue || !colorValue.enable || colorValue.loops !== undefined && colorValue.maxLoops !== undefined && colorValue.maxLoops > 0 && colorValue.loops >= colorValue.maxLoops) {
|
|
10906
10973
|
return;
|
|
10907
10974
|
}
|
|
10908
10975
|
const offset = randomInRange(valueAnimation.offset),
|
|
@@ -10910,13 +10977,23 @@ function StrokeColorUpdater_updateColorValue(delta, value, valueAnimation, max,
|
|
|
10910
10977
|
decay = (_b = value.decay) !== null && _b !== void 0 ? _b : 1;
|
|
10911
10978
|
if (!decrease || colorValue.status === "increasing") {
|
|
10912
10979
|
colorValue.value += velocity;
|
|
10913
|
-
if (
|
|
10914
|
-
colorValue.
|
|
10915
|
-
|
|
10980
|
+
if (colorValue.value > max) {
|
|
10981
|
+
if (!colorValue.loops) {
|
|
10982
|
+
colorValue.loops = 0;
|
|
10983
|
+
}
|
|
10984
|
+
colorValue.loops++;
|
|
10985
|
+
if (decrease) {
|
|
10986
|
+
colorValue.status = "decreasing";
|
|
10987
|
+
colorValue.value -= colorValue.value % max;
|
|
10988
|
+
}
|
|
10916
10989
|
}
|
|
10917
10990
|
} else {
|
|
10918
10991
|
colorValue.value -= velocity;
|
|
10919
10992
|
if (colorValue.value < 0) {
|
|
10993
|
+
if (!colorValue.loops) {
|
|
10994
|
+
colorValue.loops = 0;
|
|
10995
|
+
}
|
|
10996
|
+
colorValue.loops++;
|
|
10920
10997
|
colorValue.status = "increasing";
|
|
10921
10998
|
colorValue.value += colorValue.value;
|
|
10922
10999
|
}
|
|
@@ -10929,22 +11006,20 @@ function StrokeColorUpdater_updateColorValue(delta, value, valueAnimation, max,
|
|
|
10929
11006
|
}
|
|
10930
11007
|
}
|
|
10931
11008
|
function updateStrokeColor(particle, delta) {
|
|
10932
|
-
|
|
10933
|
-
if (!((_a = particle.stroke) === null || _a === void 0 ? void 0 : _a.color)) {
|
|
11009
|
+
if (!particle.strokeColor || !particle.strokeAnimation) {
|
|
10934
11010
|
return;
|
|
10935
11011
|
}
|
|
10936
|
-
const
|
|
10937
|
-
h = (_c = (_b = particle.strokeColor) === null || _b === void 0 ? void 0 : _b.h) !== null && _c !== void 0 ? _c : (_d = particle.color) === null || _d === void 0 ? void 0 : _d.h;
|
|
11012
|
+
const h = particle.strokeColor.h;
|
|
10938
11013
|
if (h) {
|
|
10939
|
-
StrokeColorUpdater_updateColorValue(delta, h,
|
|
11014
|
+
StrokeColorUpdater_updateColorValue(delta, h, particle.strokeAnimation.h, 360, false);
|
|
10940
11015
|
}
|
|
10941
|
-
const s =
|
|
11016
|
+
const s = particle.strokeColor.s;
|
|
10942
11017
|
if (s) {
|
|
10943
|
-
StrokeColorUpdater_updateColorValue(delta, s,
|
|
11018
|
+
StrokeColorUpdater_updateColorValue(delta, s, particle.strokeAnimation.s, 100, true);
|
|
10944
11019
|
}
|
|
10945
|
-
const l =
|
|
11020
|
+
const l = particle.strokeColor.l;
|
|
10946
11021
|
if (l) {
|
|
10947
|
-
StrokeColorUpdater_updateColorValue(delta, l,
|
|
11022
|
+
StrokeColorUpdater_updateColorValue(delta, l, particle.strokeAnimation.l, 100, true);
|
|
10948
11023
|
}
|
|
10949
11024
|
}
|
|
10950
11025
|
class StrokeColorUpdater {
|
|
@@ -10952,19 +11027,21 @@ class StrokeColorUpdater {
|
|
|
10952
11027
|
this.container = container;
|
|
10953
11028
|
}
|
|
10954
11029
|
init(particle) {
|
|
10955
|
-
var _a, _b;
|
|
11030
|
+
var _a, _b, _c;
|
|
10956
11031
|
const container = this.container;
|
|
10957
|
-
|
|
10958
|
-
particle.strokeWidth =
|
|
10959
|
-
|
|
11032
|
+
const stroke = itemFromSingleOrMultiple(particle.options.stroke, particle.id, particle.options.reduceDuplicates);
|
|
11033
|
+
particle.strokeWidth = getRangeValue(stroke.width) * container.retina.pixelRatio;
|
|
11034
|
+
particle.strokeOpacity = getRangeValue((_a = stroke.opacity) !== null && _a !== void 0 ? _a : 1);
|
|
11035
|
+
particle.strokeAnimation = (_b = stroke.color) === null || _b === void 0 ? void 0 : _b.animation;
|
|
11036
|
+
const strokeHslColor = (_c = rangeColorToHsl(stroke.color)) !== null && _c !== void 0 ? _c : particle.getFillColor();
|
|
10960
11037
|
if (strokeHslColor) {
|
|
10961
|
-
particle.strokeColor = getHslAnimationFromHsl(strokeHslColor,
|
|
11038
|
+
particle.strokeColor = getHslAnimationFromHsl(strokeHslColor, particle.strokeAnimation, container.retina.reduceFactor);
|
|
10962
11039
|
}
|
|
10963
11040
|
}
|
|
10964
11041
|
isEnabled(particle) {
|
|
10965
|
-
var _a, _b, _c
|
|
10966
|
-
const color =
|
|
10967
|
-
return !particle.destroyed && !particle.spawning && !!color && (((
|
|
11042
|
+
var _a, _b, _c;
|
|
11043
|
+
const color = particle.strokeAnimation;
|
|
11044
|
+
return !particle.destroyed && !particle.spawning && !!color && (((_a = particle.strokeColor) === null || _a === void 0 ? void 0 : _a.h.value) !== undefined && particle.strokeColor.h.enable || ((_b = particle.strokeColor) === null || _b === void 0 ? void 0 : _b.s.value) !== undefined && particle.strokeColor.s.enable || ((_c = particle.strokeColor) === null || _c === void 0 ? void 0 : _c.l.value) !== undefined && particle.strokeColor.l.enable);
|
|
10968
11045
|
}
|
|
10969
11046
|
update(particle, delta) {
|
|
10970
11047
|
if (!this.isEnabled(particle)) {
|
|
@@ -11034,10 +11111,7 @@ class TextDrawer {
|
|
|
11034
11111
|
;// CONCATENATED MODULE: ../../shapes/text/dist/esm/index.js
|
|
11035
11112
|
|
|
11036
11113
|
async function loadTextShape(engine) {
|
|
11037
|
-
|
|
11038
|
-
for (const type of validTypes) {
|
|
11039
|
-
await engine.addShape(type, drawer);
|
|
11040
|
-
}
|
|
11114
|
+
await engine.addShape(validTypes, new TextDrawer());
|
|
11041
11115
|
}
|
|
11042
11116
|
;// CONCATENATED MODULE: ../slim/dist/esm/index.js
|
|
11043
11117
|
|