tsparticles 2.5.2 → 2.6.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/README.md +0 -2
- package/package.json +11 -11
- package/report.html +2 -2
- package/tsparticles.bundle.js +127 -95
- 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.6.0
|
|
8
8
|
*/
|
|
9
9
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
10
10
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
@@ -100,6 +100,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
100
100
|
"Point": () => (/* reexport */ Point),
|
|
101
101
|
"Range": () => (/* reexport */ Range),
|
|
102
102
|
"Rectangle": () => (/* reexport */ Rectangle),
|
|
103
|
+
"ResizeEvent": () => (/* reexport */ ResizeEvent),
|
|
103
104
|
"Responsive": () => (/* reexport */ Responsive),
|
|
104
105
|
"RgbColorManager": () => (/* reexport */ RgbColorManager),
|
|
105
106
|
"Shadow": () => (/* reexport */ Shadow),
|
|
@@ -372,9 +373,7 @@ function addEasing(name, easing) {
|
|
|
372
373
|
}
|
|
373
374
|
}
|
|
374
375
|
function getEasing(name) {
|
|
375
|
-
|
|
376
|
-
const noEasing = value => value;
|
|
377
|
-
return (_a = easings.get(name)) !== null && _a !== void 0 ? _a : noEasing;
|
|
376
|
+
return easings.get(name) || (value => value);
|
|
378
377
|
}
|
|
379
378
|
function setRandom(rnd = Math.random) {
|
|
380
379
|
_random = rnd;
|
|
@@ -433,7 +432,7 @@ function getDistances(pointA, pointB) {
|
|
|
433
432
|
return {
|
|
434
433
|
dx: dx,
|
|
435
434
|
dy: dy,
|
|
436
|
-
distance: Math.sqrt(dx
|
|
435
|
+
distance: Math.sqrt(dx ** 2 + dy ** 2)
|
|
437
436
|
};
|
|
438
437
|
}
|
|
439
438
|
function getDistance(pointA, pointB) {
|
|
@@ -1019,7 +1018,7 @@ function setColorAnimation(colorValue, colorAnimation, reduceFactor) {
|
|
|
1019
1018
|
if (colorValue.enable) {
|
|
1020
1019
|
colorValue.velocity = getRangeValue(colorAnimation.speed) / 100 * reduceFactor;
|
|
1021
1020
|
colorValue.decay = 1 - getRangeValue(colorAnimation.decay);
|
|
1022
|
-
colorValue.status =
|
|
1021
|
+
colorValue.status = "increasing";
|
|
1023
1022
|
if (!colorAnimation.sync) {
|
|
1024
1023
|
colorValue.velocity *= getRandom();
|
|
1025
1024
|
colorValue.value *= getRandom();
|
|
@@ -1589,19 +1588,21 @@ class EventListeners {
|
|
|
1589
1588
|
constructor(container) {
|
|
1590
1589
|
this.container = container;
|
|
1591
1590
|
this.canPush = true;
|
|
1592
|
-
this.
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1591
|
+
this.handlers = {
|
|
1592
|
+
mouseMove: e => this.mouseTouchMove(e),
|
|
1593
|
+
touchStart: e => this.mouseTouchMove(e),
|
|
1594
|
+
touchMove: e => this.mouseTouchMove(e),
|
|
1595
|
+
touchEnd: () => this.mouseTouchFinish(),
|
|
1596
|
+
mouseLeave: () => this.mouseTouchFinish(),
|
|
1597
|
+
touchCancel: () => this.mouseTouchFinish(),
|
|
1598
|
+
touchEndClick: e => this.mouseTouchClick(e),
|
|
1599
|
+
mouseUp: e => this.mouseTouchClick(e),
|
|
1600
|
+
mouseDown: () => this.mouseDown(),
|
|
1601
|
+
visibilityChange: () => this.handleVisibilityChange(),
|
|
1602
|
+
themeChange: e => this.handleThemeChange(e),
|
|
1603
|
+
oldThemeChange: e => this.handleThemeChange(e),
|
|
1604
|
+
resize: () => this.handleWindowResize()
|
|
1605
|
+
};
|
|
1605
1606
|
}
|
|
1606
1607
|
addListeners() {
|
|
1607
1608
|
this.manageListeners(true);
|
|
@@ -1613,12 +1614,13 @@ class EventListeners {
|
|
|
1613
1614
|
const container = this.container,
|
|
1614
1615
|
options = container.actualOptions;
|
|
1615
1616
|
if (this.canPush) {
|
|
1616
|
-
const
|
|
1617
|
+
const mouseInteractivity = container.interactivity.mouse,
|
|
1618
|
+
mousePos = mouseInteractivity.position;
|
|
1617
1619
|
if (!mousePos) {
|
|
1618
1620
|
return;
|
|
1619
1621
|
}
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
+
mouseInteractivity.clickPosition = Object.assign({}, mousePos);
|
|
1623
|
+
mouseInteractivity.clickTime = new Date().getTime();
|
|
1622
1624
|
const onClick = options.interactivity.events.onClick;
|
|
1623
1625
|
executeOnSingleOrMultiple(onClick.mode, mode => this.handleClickMode(mode));
|
|
1624
1626
|
}
|
|
@@ -1631,10 +1633,13 @@ class EventListeners {
|
|
|
1631
1633
|
}
|
|
1632
1634
|
handleThemeChange(e) {
|
|
1633
1635
|
const mediaEvent = e,
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
+
container = this.container,
|
|
1637
|
+
options = container.options,
|
|
1638
|
+
defaultThemes = options.defaultThemes,
|
|
1639
|
+
themeName = mediaEvent.matches ? defaultThemes.dark : defaultThemes.light,
|
|
1640
|
+
theme = options.themes.find(theme => theme.name === themeName);
|
|
1636
1641
|
if (theme && theme.default.auto) {
|
|
1637
|
-
|
|
1642
|
+
container.loadTheme(themeName);
|
|
1638
1643
|
}
|
|
1639
1644
|
}
|
|
1640
1645
|
handleVisibilityChange() {
|
|
@@ -1664,11 +1669,12 @@ class EventListeners {
|
|
|
1664
1669
|
this.resizeTimeout = setTimeout(async () => {
|
|
1665
1670
|
var _a;
|
|
1666
1671
|
return (_a = this.container.canvas) === null || _a === void 0 ? void 0 : _a.windowResize();
|
|
1667
|
-
},
|
|
1672
|
+
}, this.container.actualOptions.interactivity.events.resize.delay * 1000);
|
|
1668
1673
|
}
|
|
1669
1674
|
manageListeners(add) {
|
|
1670
1675
|
var _a;
|
|
1671
|
-
const
|
|
1676
|
+
const handlers = this.handlers,
|
|
1677
|
+
container = this.container,
|
|
1672
1678
|
options = container.actualOptions,
|
|
1673
1679
|
detectType = options.interactivity.detectsOn;
|
|
1674
1680
|
let mouseLeaveTmpEvent = mouseLeaveEvent;
|
|
@@ -1684,12 +1690,12 @@ class EventListeners {
|
|
|
1684
1690
|
const mediaMatch = safeMatchMedia("(prefers-color-scheme: dark)");
|
|
1685
1691
|
if (mediaMatch) {
|
|
1686
1692
|
if (mediaMatch.addEventListener !== undefined) {
|
|
1687
|
-
manageListener(mediaMatch, "change",
|
|
1693
|
+
manageListener(mediaMatch, "change", handlers.themeChange, add);
|
|
1688
1694
|
} else if (mediaMatch.addListener !== undefined) {
|
|
1689
1695
|
if (add) {
|
|
1690
|
-
mediaMatch.addListener(
|
|
1696
|
+
mediaMatch.addListener(handlers.oldThemeChange);
|
|
1691
1697
|
} else {
|
|
1692
|
-
mediaMatch.removeListener(
|
|
1698
|
+
mediaMatch.removeListener(handlers.oldThemeChange);
|
|
1693
1699
|
}
|
|
1694
1700
|
}
|
|
1695
1701
|
}
|
|
@@ -1699,18 +1705,18 @@ class EventListeners {
|
|
|
1699
1705
|
}
|
|
1700
1706
|
const html = interactivityEl;
|
|
1701
1707
|
if (options.interactivity.events.onHover.enable || options.interactivity.events.onClick.enable) {
|
|
1702
|
-
manageListener(interactivityEl, mouseMoveEvent,
|
|
1703
|
-
manageListener(interactivityEl, touchStartEvent,
|
|
1704
|
-
manageListener(interactivityEl, touchMoveEvent,
|
|
1708
|
+
manageListener(interactivityEl, mouseMoveEvent, handlers.mouseMove, add);
|
|
1709
|
+
manageListener(interactivityEl, touchStartEvent, handlers.touchStart, add);
|
|
1710
|
+
manageListener(interactivityEl, touchMoveEvent, handlers.touchMove, add);
|
|
1705
1711
|
if (!options.interactivity.events.onClick.enable) {
|
|
1706
|
-
manageListener(interactivityEl, touchEndEvent,
|
|
1712
|
+
manageListener(interactivityEl, touchEndEvent, handlers.touchEnd, add);
|
|
1707
1713
|
} else {
|
|
1708
|
-
manageListener(interactivityEl, touchEndEvent,
|
|
1709
|
-
manageListener(interactivityEl, mouseUpEvent,
|
|
1710
|
-
manageListener(interactivityEl, mouseDownEvent,
|
|
1714
|
+
manageListener(interactivityEl, touchEndEvent, handlers.touchEndClick, add);
|
|
1715
|
+
manageListener(interactivityEl, mouseUpEvent, handlers.mouseUp, add);
|
|
1716
|
+
manageListener(interactivityEl, mouseDownEvent, handlers.mouseDown, add);
|
|
1711
1717
|
}
|
|
1712
|
-
manageListener(interactivityEl, mouseLeaveTmpEvent,
|
|
1713
|
-
manageListener(interactivityEl, touchCancelEvent,
|
|
1718
|
+
manageListener(interactivityEl, mouseLeaveTmpEvent, handlers.mouseLeave, add);
|
|
1719
|
+
manageListener(interactivityEl, touchCancelEvent, handlers.touchCancel, add);
|
|
1714
1720
|
}
|
|
1715
1721
|
if (container.canvas.element) {
|
|
1716
1722
|
container.canvas.element.style.pointerEvents = html === container.canvas.element ? "initial" : "none";
|
|
@@ -1734,11 +1740,11 @@ class EventListeners {
|
|
|
1734
1740
|
this.resizeObserver.observe(container.canvas.element);
|
|
1735
1741
|
}
|
|
1736
1742
|
} else {
|
|
1737
|
-
manageListener(window, resizeEvent,
|
|
1743
|
+
manageListener(window, resizeEvent, handlers.resize, add);
|
|
1738
1744
|
}
|
|
1739
1745
|
}
|
|
1740
1746
|
if (document) {
|
|
1741
|
-
manageListener(document, visibilityChangeEvent,
|
|
1747
|
+
manageListener(document, visibilityChangeEvent, handlers.visibilityChange, add, false);
|
|
1742
1748
|
}
|
|
1743
1749
|
}
|
|
1744
1750
|
mouseDown() {
|
|
@@ -2130,17 +2136,36 @@ class HoverEvent {
|
|
|
2130
2136
|
this.parallax.load(data.parallax);
|
|
2131
2137
|
}
|
|
2132
2138
|
}
|
|
2139
|
+
;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Interactivity/Events/ResizeEvent.js
|
|
2140
|
+
class ResizeEvent {
|
|
2141
|
+
constructor() {
|
|
2142
|
+
this.delay = 0.5;
|
|
2143
|
+
this.enable = true;
|
|
2144
|
+
}
|
|
2145
|
+
load(data) {
|
|
2146
|
+
if (data === undefined) {
|
|
2147
|
+
return;
|
|
2148
|
+
}
|
|
2149
|
+
if (data.delay !== undefined) {
|
|
2150
|
+
this.delay = data.delay;
|
|
2151
|
+
}
|
|
2152
|
+
if (data.enable !== undefined) {
|
|
2153
|
+
this.enable = data.enable;
|
|
2154
|
+
}
|
|
2155
|
+
}
|
|
2156
|
+
}
|
|
2133
2157
|
;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Interactivity/Events/Events.js
|
|
2134
2158
|
|
|
2135
2159
|
|
|
2136
2160
|
|
|
2137
2161
|
|
|
2162
|
+
|
|
2138
2163
|
class Events {
|
|
2139
2164
|
constructor() {
|
|
2140
2165
|
this.onClick = new ClickEvent();
|
|
2141
2166
|
this.onDiv = new DivEvent();
|
|
2142
2167
|
this.onHover = new HoverEvent();
|
|
2143
|
-
this.resize =
|
|
2168
|
+
this.resize = new ResizeEvent();
|
|
2144
2169
|
}
|
|
2145
2170
|
get onclick() {
|
|
2146
2171
|
return this.onClick;
|
|
@@ -2175,8 +2200,10 @@ class Events {
|
|
|
2175
2200
|
});
|
|
2176
2201
|
}
|
|
2177
2202
|
this.onHover.load((_c = data.onHover) !== null && _c !== void 0 ? _c : data.onhover);
|
|
2178
|
-
if (data.resize
|
|
2179
|
-
this.resize = data.resize;
|
|
2203
|
+
if (typeof data.resize === "boolean") {
|
|
2204
|
+
this.resize.enable = data.resize;
|
|
2205
|
+
} else {
|
|
2206
|
+
this.resize.load(data.resize);
|
|
2180
2207
|
}
|
|
2181
2208
|
}
|
|
2182
2209
|
}
|
|
@@ -3495,9 +3522,14 @@ class Options {
|
|
|
3495
3522
|
this.responsive.sort((a, b) => a.maxWidth - b.maxWidth);
|
|
3496
3523
|
if (data.themes !== undefined) {
|
|
3497
3524
|
for (const theme of data.themes) {
|
|
3498
|
-
const
|
|
3499
|
-
|
|
3500
|
-
|
|
3525
|
+
const existingTheme = this.themes.find(t => t.name === theme.name);
|
|
3526
|
+
if (!existingTheme) {
|
|
3527
|
+
const optTheme = new Theme();
|
|
3528
|
+
optTheme.load(theme);
|
|
3529
|
+
this.themes.push(optTheme);
|
|
3530
|
+
} else {
|
|
3531
|
+
existingTheme.load(theme);
|
|
3532
|
+
}
|
|
3501
3533
|
}
|
|
3502
3534
|
}
|
|
3503
3535
|
this.defaultThemes.dark = (_d = this._findDefaultTheme("dark")) === null || _d === void 0 ? void 0 : _d.name;
|
|
@@ -3560,10 +3592,10 @@ class InteractionManager {
|
|
|
3560
3592
|
this._particleInteractors = [];
|
|
3561
3593
|
for (const interactor of this._interactors) {
|
|
3562
3594
|
switch (interactor.type) {
|
|
3563
|
-
case
|
|
3595
|
+
case "external":
|
|
3564
3596
|
this._externalInteractors.push(interactor);
|
|
3565
3597
|
break;
|
|
3566
|
-
case
|
|
3598
|
+
case "particles":
|
|
3567
3599
|
this._particleInteractors.push(interactor);
|
|
3568
3600
|
break;
|
|
3569
3601
|
}
|
|
@@ -3619,6 +3651,7 @@ class Particle {
|
|
|
3619
3651
|
this.init(id, position, overrideOptions, group);
|
|
3620
3652
|
}
|
|
3621
3653
|
destroy(override) {
|
|
3654
|
+
var _a;
|
|
3622
3655
|
if (this.unbreakable || this.destroyed) {
|
|
3623
3656
|
return;
|
|
3624
3657
|
}
|
|
@@ -3635,6 +3668,7 @@ class Particle {
|
|
|
3635
3668
|
updater.particleDestroyed(this, override);
|
|
3636
3669
|
}
|
|
3637
3670
|
}
|
|
3671
|
+
(_a = this.pathGenerator) === null || _a === void 0 ? void 0 : _a.reset(this);
|
|
3638
3672
|
}
|
|
3639
3673
|
draw(delta) {
|
|
3640
3674
|
const container = this.container;
|
|
@@ -3705,7 +3739,6 @@ class Particle {
|
|
|
3705
3739
|
{
|
|
3706
3740
|
reduceDuplicates
|
|
3707
3741
|
} = particlesOptions;
|
|
3708
|
-
console.log(this.id, container.particles.count, this.id % container.particles.count);
|
|
3709
3742
|
this.shape = itemFromSingleOrMultiple(shapeType, this.id, reduceDuplicates);
|
|
3710
3743
|
const shapeOptions = particlesOptions.shape;
|
|
3711
3744
|
if (overrideOptions && overrideOptions.shape && overrideOptions.shape.type) {
|
|
@@ -3747,21 +3780,21 @@ class Particle {
|
|
|
3747
3780
|
maxLoops: getRangeValue(sizeOptions.animation.count)
|
|
3748
3781
|
};
|
|
3749
3782
|
if (sizeAnimation.enable) {
|
|
3750
|
-
this.size.status =
|
|
3783
|
+
this.size.status = "increasing";
|
|
3751
3784
|
this.size.decay = 1 - getRangeValue(sizeAnimation.decay);
|
|
3752
3785
|
switch (sizeAnimation.startValue) {
|
|
3753
3786
|
case "min":
|
|
3754
3787
|
this.size.value = this.size.min;
|
|
3755
|
-
this.size.status =
|
|
3788
|
+
this.size.status = "increasing";
|
|
3756
3789
|
break;
|
|
3757
3790
|
case "random":
|
|
3758
3791
|
this.size.value = randomInRange(this.size) * pxRatio;
|
|
3759
|
-
this.size.status = getRandom() >= 0.5 ?
|
|
3792
|
+
this.size.status = getRandom() >= 0.5 ? "increasing" : "decreasing";
|
|
3760
3793
|
break;
|
|
3761
3794
|
case "max":
|
|
3762
3795
|
default:
|
|
3763
3796
|
this.size.value = this.size.max;
|
|
3764
|
-
this.size.status =
|
|
3797
|
+
this.size.status = "decreasing";
|
|
3765
3798
|
break;
|
|
3766
3799
|
}
|
|
3767
3800
|
}
|
|
@@ -3890,9 +3923,9 @@ class Particle {
|
|
|
3890
3923
|
return pos;
|
|
3891
3924
|
}
|
|
3892
3925
|
_calculateVelocity() {
|
|
3893
|
-
const baseVelocity = getParticleBaseVelocity(this.direction)
|
|
3894
|
-
|
|
3895
|
-
|
|
3926
|
+
const baseVelocity = getParticleBaseVelocity(this.direction),
|
|
3927
|
+
res = baseVelocity.copy(),
|
|
3928
|
+
moveOptions = this.options.move;
|
|
3896
3929
|
if (moveOptions.direction === "inside" || moveOptions.direction === "outside") {
|
|
3897
3930
|
return res;
|
|
3898
3931
|
}
|
|
@@ -4427,7 +4460,8 @@ const defaultPathGeneratorKey = "default",
|
|
|
4427
4460
|
return v;
|
|
4428
4461
|
},
|
|
4429
4462
|
init: () => {},
|
|
4430
|
-
update: () => {}
|
|
4463
|
+
update: () => {},
|
|
4464
|
+
reset: () => {}
|
|
4431
4465
|
};
|
|
4432
4466
|
class Container {
|
|
4433
4467
|
constructor(engine, id, sourceOptions) {
|
|
@@ -4865,9 +4899,6 @@ class Container {
|
|
|
4865
4899
|
|
|
4866
4900
|
|
|
4867
4901
|
|
|
4868
|
-
function fetchError(statusCode) {
|
|
4869
|
-
console.error(`tsParticles - Error ${statusCode} while retrieving config file`);
|
|
4870
|
-
}
|
|
4871
4902
|
async function getDataFromUrl(jsonUrl, index) {
|
|
4872
4903
|
const url = itemFromSingleOrMultiple(jsonUrl, index);
|
|
4873
4904
|
if (!url) {
|
|
@@ -4877,7 +4908,7 @@ async function getDataFromUrl(jsonUrl, index) {
|
|
|
4877
4908
|
if (response.ok) {
|
|
4878
4909
|
return response.json();
|
|
4879
4910
|
}
|
|
4880
|
-
|
|
4911
|
+
console.error(`tsParticles - Error ${response.status} while retrieving config file`);
|
|
4881
4912
|
}
|
|
4882
4913
|
class Loader {
|
|
4883
4914
|
constructor(engine) {
|
|
@@ -5245,7 +5276,7 @@ class HslColorManager {
|
|
|
5245
5276
|
var _a;
|
|
5246
5277
|
const colorValue = color.value,
|
|
5247
5278
|
hslColor = (_a = colorValue.hsl) !== null && _a !== void 0 ? _a : color.value;
|
|
5248
|
-
if (hslColor.h !== undefined && hslColor.l !== undefined) {
|
|
5279
|
+
if (hslColor.h !== undefined && hslColor.s !== undefined && hslColor.l !== undefined) {
|
|
5249
5280
|
return hslToRgb(hslColor);
|
|
5250
5281
|
}
|
|
5251
5282
|
}
|
|
@@ -5320,14 +5351,14 @@ class RgbColorManager {
|
|
|
5320
5351
|
class ExternalInteractorBase {
|
|
5321
5352
|
constructor(container) {
|
|
5322
5353
|
this.container = container;
|
|
5323
|
-
this.type =
|
|
5354
|
+
this.type = "external";
|
|
5324
5355
|
}
|
|
5325
5356
|
}
|
|
5326
5357
|
;// CONCATENATED MODULE: ../../engine/dist/esm/Core/Utils/ParticlesInteractorBase.js
|
|
5327
5358
|
class ParticlesInteractorBase {
|
|
5328
5359
|
constructor(container) {
|
|
5329
5360
|
this.container = container;
|
|
5330
|
-
this.type =
|
|
5361
|
+
this.type = "particles";
|
|
5331
5362
|
}
|
|
5332
5363
|
}
|
|
5333
5364
|
;// CONCATENATED MODULE: ../../engine/dist/esm/index.js
|
|
@@ -5518,6 +5549,7 @@ tsParticles.init();
|
|
|
5518
5549
|
|
|
5519
5550
|
|
|
5520
5551
|
|
|
5552
|
+
|
|
5521
5553
|
|
|
5522
5554
|
|
|
5523
5555
|
;// CONCATENATED MODULE: ../../plugins/absorbers/dist/esm/Options/Classes/AbsorberSizeLimit.js
|
|
@@ -7118,13 +7150,13 @@ function updateAngle(particle, delta) {
|
|
|
7118
7150
|
return;
|
|
7119
7151
|
}
|
|
7120
7152
|
switch (rotate.status) {
|
|
7121
|
-
case
|
|
7153
|
+
case "increasing":
|
|
7122
7154
|
rotate.value += speed;
|
|
7123
7155
|
if (rotate.value > max) {
|
|
7124
7156
|
rotate.value -= max;
|
|
7125
7157
|
}
|
|
7126
7158
|
break;
|
|
7127
|
-
case
|
|
7159
|
+
case "decreasing":
|
|
7128
7160
|
default:
|
|
7129
7161
|
rotate.value -= speed;
|
|
7130
7162
|
if (rotate.value < 0) {
|
|
@@ -7158,10 +7190,10 @@ class RotateUpdater {
|
|
|
7158
7190
|
switch (rotateDirection) {
|
|
7159
7191
|
case "counter-clockwise":
|
|
7160
7192
|
case "counterClockwise":
|
|
7161
|
-
particle.rotate.status =
|
|
7193
|
+
particle.rotate.status = "decreasing";
|
|
7162
7194
|
break;
|
|
7163
7195
|
case "clockwise":
|
|
7164
|
-
particle.rotate.status =
|
|
7196
|
+
particle.rotate.status = "increasing";
|
|
7165
7197
|
break;
|
|
7166
7198
|
}
|
|
7167
7199
|
const rotateAnimation = rotateOptions.animation;
|
|
@@ -7411,16 +7443,16 @@ function updateColorValue(delta, value, valueAnimation, max, decrease) {
|
|
|
7411
7443
|
const offset = randomInRange(valueAnimation.offset),
|
|
7412
7444
|
velocity = ((_a = value.velocity) !== null && _a !== void 0 ? _a : 0) * delta.factor + offset * 3.6,
|
|
7413
7445
|
decay = (_b = value.decay) !== null && _b !== void 0 ? _b : 1;
|
|
7414
|
-
if (!decrease || colorValue.status ===
|
|
7446
|
+
if (!decrease || colorValue.status === "increasing") {
|
|
7415
7447
|
colorValue.value += velocity;
|
|
7416
7448
|
if (decrease && colorValue.value > max) {
|
|
7417
|
-
colorValue.status =
|
|
7449
|
+
colorValue.status = "decreasing";
|
|
7418
7450
|
colorValue.value -= colorValue.value % max;
|
|
7419
7451
|
}
|
|
7420
7452
|
} else {
|
|
7421
7453
|
colorValue.value -= velocity;
|
|
7422
7454
|
if (colorValue.value < 0) {
|
|
7423
|
-
colorValue.status =
|
|
7455
|
+
colorValue.status = "increasing";
|
|
7424
7456
|
colorValue.value += colorValue.value;
|
|
7425
7457
|
}
|
|
7426
7458
|
}
|
|
@@ -9477,9 +9509,9 @@ function updateOpacity(particle, delta) {
|
|
|
9477
9509
|
return;
|
|
9478
9510
|
}
|
|
9479
9511
|
switch (particle.opacity.status) {
|
|
9480
|
-
case
|
|
9512
|
+
case "increasing":
|
|
9481
9513
|
if (particle.opacity.value >= maxValue) {
|
|
9482
|
-
particle.opacity.status =
|
|
9514
|
+
particle.opacity.status = "decreasing";
|
|
9483
9515
|
if (!particle.opacity.loops) {
|
|
9484
9516
|
particle.opacity.loops = 0;
|
|
9485
9517
|
}
|
|
@@ -9488,9 +9520,9 @@ function updateOpacity(particle, delta) {
|
|
|
9488
9520
|
particle.opacity.value += ((_e = particle.opacity.velocity) !== null && _e !== void 0 ? _e : 0) * delta.factor;
|
|
9489
9521
|
}
|
|
9490
9522
|
break;
|
|
9491
|
-
case
|
|
9523
|
+
case "decreasing":
|
|
9492
9524
|
if (particle.opacity.value <= minValue) {
|
|
9493
|
-
particle.opacity.status =
|
|
9525
|
+
particle.opacity.status = "increasing";
|
|
9494
9526
|
if (!particle.opacity.loops) {
|
|
9495
9527
|
particle.opacity.loops = 0;
|
|
9496
9528
|
}
|
|
@@ -9525,23 +9557,23 @@ class OpacityUpdater {
|
|
|
9525
9557
|
const opacityAnimation = opacityOptions.animation;
|
|
9526
9558
|
if (opacityAnimation.enable) {
|
|
9527
9559
|
particle.opacity.decay = 1 - getRangeValue(opacityAnimation.decay);
|
|
9528
|
-
particle.opacity.status =
|
|
9560
|
+
particle.opacity.status = "increasing";
|
|
9529
9561
|
const opacityRange = opacityOptions.value;
|
|
9530
9562
|
particle.opacity.min = getRangeMin(opacityRange);
|
|
9531
9563
|
particle.opacity.max = getRangeMax(opacityRange);
|
|
9532
9564
|
switch (opacityAnimation.startValue) {
|
|
9533
9565
|
case "min":
|
|
9534
9566
|
particle.opacity.value = particle.opacity.min;
|
|
9535
|
-
particle.opacity.status =
|
|
9567
|
+
particle.opacity.status = "increasing";
|
|
9536
9568
|
break;
|
|
9537
9569
|
case "random":
|
|
9538
9570
|
particle.opacity.value = randomInRange(particle.opacity);
|
|
9539
|
-
particle.opacity.status = getRandom() >= 0.5 ?
|
|
9571
|
+
particle.opacity.status = getRandom() >= 0.5 ? "increasing" : "decreasing";
|
|
9540
9572
|
break;
|
|
9541
9573
|
case "max":
|
|
9542
9574
|
default:
|
|
9543
9575
|
particle.opacity.value = particle.opacity.max;
|
|
9544
|
-
particle.opacity.status =
|
|
9576
|
+
particle.opacity.status = "decreasing";
|
|
9545
9577
|
break;
|
|
9546
9578
|
}
|
|
9547
9579
|
particle.opacity.velocity = getRangeValue(opacityAnimation.speed) / 100 * this.container.retina.reduceFactor;
|
|
@@ -10291,6 +10323,7 @@ class Linker extends ParticlesInteractorBase {
|
|
|
10291
10323
|
}
|
|
10292
10324
|
clear() {}
|
|
10293
10325
|
init() {
|
|
10326
|
+
this.linkContainer.particles.linksColor = undefined;
|
|
10294
10327
|
this.linkContainer.particles.linksColors = new Map();
|
|
10295
10328
|
}
|
|
10296
10329
|
async interact(p1) {
|
|
@@ -10489,14 +10522,13 @@ class LinkInstance {
|
|
|
10489
10522
|
}
|
|
10490
10523
|
drawParticle(context, particle) {
|
|
10491
10524
|
var _a;
|
|
10492
|
-
const
|
|
10493
|
-
pOptions = particle.options;
|
|
10525
|
+
const pOptions = particle.options;
|
|
10494
10526
|
if (!particle.links || particle.links.length <= 0) {
|
|
10495
10527
|
return;
|
|
10496
10528
|
}
|
|
10497
10529
|
const p1Links = particle.links.filter(l => pOptions.links && this.getLinkFrequency(particle, l.destination) <= pOptions.links.frequency);
|
|
10498
10530
|
for (const link of p1Links) {
|
|
10499
|
-
this.drawTriangles(
|
|
10531
|
+
this.drawTriangles(pOptions, particle, link, p1Links);
|
|
10500
10532
|
if (link.opacity > 0 && ((_a = particle.retina.linksWidth) !== null && _a !== void 0 ? _a : 0) > 0) {
|
|
10501
10533
|
this.drawLinkLine(particle, link);
|
|
10502
10534
|
}
|
|
@@ -10589,7 +10621,7 @@ class LinkInstance {
|
|
|
10589
10621
|
drawLinkTriangle(ctx, pos1, pos2, pos3, options.backgroundMask.enable, options.backgroundMask.composite, colorTriangle, opacityTriangle);
|
|
10590
10622
|
});
|
|
10591
10623
|
}
|
|
10592
|
-
drawTriangles(
|
|
10624
|
+
drawTriangles(options, p1, link, p1Links) {
|
|
10593
10625
|
var _a, _b, _c;
|
|
10594
10626
|
const p2 = link.destination;
|
|
10595
10627
|
if (!(((_a = options.links) === null || _a === void 0 ? void 0 : _a.triangles.enable) && ((_b = p2.options.links) === null || _b === void 0 ? void 0 : _b.triangles.enable))) {
|
|
@@ -10760,9 +10792,9 @@ function updateSize(particle, delta) {
|
|
|
10760
10792
|
return;
|
|
10761
10793
|
}
|
|
10762
10794
|
switch (particle.size.status) {
|
|
10763
|
-
case
|
|
10795
|
+
case "increasing":
|
|
10764
10796
|
if (particle.size.value >= maxValue) {
|
|
10765
|
-
particle.size.status =
|
|
10797
|
+
particle.size.status = "decreasing";
|
|
10766
10798
|
if (!particle.size.loops) {
|
|
10767
10799
|
particle.size.loops = 0;
|
|
10768
10800
|
}
|
|
@@ -10771,9 +10803,9 @@ function updateSize(particle, delta) {
|
|
|
10771
10803
|
particle.size.value += sizeVelocity;
|
|
10772
10804
|
}
|
|
10773
10805
|
break;
|
|
10774
|
-
case
|
|
10806
|
+
case "decreasing":
|
|
10775
10807
|
if (particle.size.value <= minValue) {
|
|
10776
|
-
particle.size.status =
|
|
10808
|
+
particle.size.status = "increasing";
|
|
10777
10809
|
if (!particle.size.loops) {
|
|
10778
10810
|
particle.size.loops = 0;
|
|
10779
10811
|
}
|
|
@@ -10876,16 +10908,16 @@ function StrokeColorUpdater_updateColorValue(delta, value, valueAnimation, max,
|
|
|
10876
10908
|
const offset = randomInRange(valueAnimation.offset),
|
|
10877
10909
|
velocity = ((_a = value.velocity) !== null && _a !== void 0 ? _a : 0) * delta.factor + offset * 3.6,
|
|
10878
10910
|
decay = (_b = value.decay) !== null && _b !== void 0 ? _b : 1;
|
|
10879
|
-
if (!decrease || colorValue.status ===
|
|
10911
|
+
if (!decrease || colorValue.status === "increasing") {
|
|
10880
10912
|
colorValue.value += velocity;
|
|
10881
10913
|
if (decrease && colorValue.value > max) {
|
|
10882
|
-
colorValue.status =
|
|
10914
|
+
colorValue.status = "decreasing";
|
|
10883
10915
|
colorValue.value -= colorValue.value % max;
|
|
10884
10916
|
}
|
|
10885
10917
|
} else {
|
|
10886
10918
|
colorValue.value -= velocity;
|
|
10887
10919
|
if (colorValue.value < 0) {
|
|
10888
|
-
colorValue.status =
|
|
10920
|
+
colorValue.status = "increasing";
|
|
10889
10921
|
colorValue.value += colorValue.value;
|
|
10890
10922
|
}
|
|
10891
10923
|
}
|
|
@@ -11139,13 +11171,13 @@ function updateTilt(particle, delta) {
|
|
|
11139
11171
|
return;
|
|
11140
11172
|
}
|
|
11141
11173
|
switch (particle.tilt.status) {
|
|
11142
|
-
case
|
|
11174
|
+
case "increasing":
|
|
11143
11175
|
particle.tilt.value += speed;
|
|
11144
11176
|
if (particle.tilt.value > max) {
|
|
11145
11177
|
particle.tilt.value -= max;
|
|
11146
11178
|
}
|
|
11147
11179
|
break;
|
|
11148
|
-
case
|
|
11180
|
+
case "decreasing":
|
|
11149
11181
|
default:
|
|
11150
11182
|
particle.tilt.value -= speed;
|
|
11151
11183
|
if (particle.tilt.value < 0) {
|
|
@@ -11189,10 +11221,10 @@ class TiltUpdater {
|
|
|
11189
11221
|
switch (tiltDirection) {
|
|
11190
11222
|
case "counter-clockwise":
|
|
11191
11223
|
case "counterClockwise":
|
|
11192
|
-
particle.tilt.status =
|
|
11224
|
+
particle.tilt.status = "decreasing";
|
|
11193
11225
|
break;
|
|
11194
11226
|
case "clockwise":
|
|
11195
|
-
particle.tilt.status =
|
|
11227
|
+
particle.tilt.status = "increasing";
|
|
11196
11228
|
break;
|
|
11197
11229
|
}
|
|
11198
11230
|
const tiltAnimation = (_a = particle.options.tilt) === null || _a === void 0 ? void 0 : _a.animation;
|