@tsparticles/preset-triangles 4.5.0 → 4.5.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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(function(g){g.__tsParticlesInternals=g.__tsParticlesInternals||{};g.__tsParticlesInternals.bundles=g.__tsParticlesInternals.bundles||{};g.__tsParticlesInternals.effects=g.__tsParticlesInternals.effects||{};g.__tsParticlesInternals.engine=g.__tsParticlesInternals.engine||{};g.__tsParticlesInternals.interactions=g.__tsParticlesInternals.interactions||{};g.__tsParticlesInternals.palettes=g.__tsParticlesInternals.palettes||{};g.__tsParticlesInternals.paths=g.__tsParticlesInternals.paths||{};g.__tsParticlesInternals.plugins=g.__tsParticlesInternals.plugins||{};g.__tsParticlesInternals.plugins=g.__tsParticlesInternals.plugins||{};g.__tsParticlesInternals.plugins.emittersShapes=g.__tsParticlesInternals.plugins.emittersShapes||{};g.__tsParticlesInternals.presets=g.__tsParticlesInternals.presets||{};g.__tsParticlesInternals.shapes=g.__tsParticlesInternals.shapes||{};g.__tsParticlesInternals.updaters=g.__tsParticlesInternals.updaters||{};g.__tsParticlesInternals.utils=g.__tsParticlesInternals.utils||{};g.__tsParticlesInternals.canvas=g.__tsParticlesInternals.canvas||{};g.__tsParticlesInternals.canvas=g.__tsParticlesInternals.canvas||{};g.__tsParticlesInternals.canvas.utils=g.__tsParticlesInternals.canvas.utils||{};g.__tsParticlesInternals.path=g.__tsParticlesInternals.path||{};g.__tsParticlesInternals.path=g.__tsParticlesInternals.path||{};g.__tsParticlesInternals.path.utils=g.__tsParticlesInternals.path.utils||{};var __tsProxyFactory=typeof Proxy!=="undefined"?function(obj){return new Proxy(obj,{get:function(target,key){if(!(key in target)){target[key]={};}return target[key];}});}:function(obj){return obj;};g.__tsParticlesInternals.bundles=__tsProxyFactory(g.__tsParticlesInternals.bundles);g.__tsParticlesInternals.effects=__tsProxyFactory(g.__tsParticlesInternals.effects);g.__tsParticlesInternals.interactions=__tsProxyFactory(g.__tsParticlesInternals.interactions);g.__tsParticlesInternals.palettes=__tsProxyFactory(g.__tsParticlesInternals.palettes);g.__tsParticlesInternals.paths=__tsProxyFactory(g.__tsParticlesInternals.paths);g.__tsParticlesInternals.plugins=__tsProxyFactory(g.__tsParticlesInternals.plugins);g.__tsParticlesInternals.plugins.emittersShapes=__tsProxyFactory(g.__tsParticlesInternals.plugins.emittersShapes);g.__tsParticlesInternals.presets=__tsProxyFactory(g.__tsParticlesInternals.presets);g.__tsParticlesInternals.shapes=__tsProxyFactory(g.__tsParticlesInternals.shapes);g.__tsParticlesInternals.updaters=__tsProxyFactory(g.__tsParticlesInternals.updaters);g.__tsParticlesInternals.utils=__tsProxyFactory(g.__tsParticlesInternals.utils);g.__tsParticlesInternals.canvas=__tsProxyFactory(g.__tsParticlesInternals.canvas);g.__tsParticlesInternals.path=__tsProxyFactory(g.__tsParticlesInternals.path);})(typeof globalThis!=="undefined"?globalThis:typeof window!=="undefined"?window:this);
|
|
2
2
|
(function (g) {
|
|
3
|
-
/* Preset v4.5.
|
|
3
|
+
/* Preset v4.5.1 */
|
|
4
4
|
g.__tsParticlesInternals = g.__tsParticlesInternals || {};
|
|
5
5
|
g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
6
6
|
(function (exports) {
|
|
@@ -657,12 +657,8 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
657
657
|
}
|
|
658
658
|
addEventListener(type, listener) {
|
|
659
659
|
this.removeEventListener(type, listener);
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
arr = [];
|
|
663
|
-
this.#listeners.set(type, arr);
|
|
664
|
-
}
|
|
665
|
-
arr.push(listener);
|
|
660
|
+
const arr = this.#listeners.get(type);
|
|
661
|
+
this.#listeners.set(type, arr ? [...arr, listener] : [listener]);
|
|
666
662
|
}
|
|
667
663
|
dispatchEvent(type, args) {
|
|
668
664
|
const listeners = this.#listeners.get(type);
|
|
@@ -694,7 +690,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
694
690
|
this.#listeners.delete(type);
|
|
695
691
|
}
|
|
696
692
|
else {
|
|
697
|
-
arr.
|
|
693
|
+
this.#listeners.set(type, [...arr.slice(minIndex, idx), ...arr.slice(idx + deleteCount)]);
|
|
698
694
|
}
|
|
699
695
|
}
|
|
700
696
|
}
|
|
@@ -875,7 +871,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
875
871
|
return this.#domArray;
|
|
876
872
|
}
|
|
877
873
|
get version() {
|
|
878
|
-
return "4.5.
|
|
874
|
+
return "4.5.1";
|
|
879
875
|
}
|
|
880
876
|
addEventListener(type, listener) {
|
|
881
877
|
this.#eventDispatcher.addEventListener(type, listener);
|
|
@@ -2355,7 +2351,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
2355
2351
|
}
|
|
2356
2352
|
|
|
2357
2353
|
async function loadBlendPlugin(engine) {
|
|
2358
|
-
engine.checkVersion("4.5.
|
|
2354
|
+
engine.checkVersion("4.5.1");
|
|
2359
2355
|
await engine.pluginManager.register(e => {
|
|
2360
2356
|
e.pluginManager.addPlugin(new BlendPlugin());
|
|
2361
2357
|
});
|
|
@@ -2392,7 +2388,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
2392
2388
|
}
|
|
2393
2389
|
|
|
2394
2390
|
async function loadCircleShape(engine) {
|
|
2395
|
-
engine.checkVersion("4.5.
|
|
2391
|
+
engine.checkVersion("4.5.1");
|
|
2396
2392
|
await engine.pluginManager.register(e => {
|
|
2397
2393
|
e.pluginManager.addShape(["circle"], () => {
|
|
2398
2394
|
return Promise.resolve(new CircleDrawer());
|
|
@@ -2440,7 +2436,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
2440
2436
|
}
|
|
2441
2437
|
|
|
2442
2438
|
async function loadHexColorPlugin(engine) {
|
|
2443
|
-
engine.checkVersion("4.5.
|
|
2439
|
+
engine.checkVersion("4.5.1");
|
|
2444
2440
|
await engine.pluginManager.register(e => {
|
|
2445
2441
|
e.pluginManager.addColorManager("hex", new HexColorManager());
|
|
2446
2442
|
});
|
|
@@ -2493,7 +2489,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
2493
2489
|
}
|
|
2494
2490
|
|
|
2495
2491
|
async function loadHslColorPlugin(engine) {
|
|
2496
|
-
engine.checkVersion("4.5.
|
|
2492
|
+
engine.checkVersion("4.5.1");
|
|
2497
2493
|
await engine.pluginManager.register(e => {
|
|
2498
2494
|
e.pluginManager.addColorManager("hsl", new HslColorManager());
|
|
2499
2495
|
});
|
|
@@ -2525,7 +2521,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
2525
2521
|
}
|
|
2526
2522
|
|
|
2527
2523
|
async function loadMovePlugin(engine) {
|
|
2528
|
-
engine.checkVersion("4.5.
|
|
2524
|
+
engine.checkVersion("4.5.1");
|
|
2529
2525
|
if (typeof process !== "undefined" && process.env.NODE_ENV !== "production") {
|
|
2530
2526
|
addErrorMessages(ErrorMessages$1);
|
|
2531
2527
|
}
|
|
@@ -2735,7 +2731,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
2735
2731
|
}
|
|
2736
2732
|
|
|
2737
2733
|
async function loadOpacityUpdater(engine) {
|
|
2738
|
-
engine.checkVersion("4.5.
|
|
2734
|
+
engine.checkVersion("4.5.1");
|
|
2739
2735
|
await engine.pluginManager.register(e => {
|
|
2740
2736
|
e.pluginManager.addParticleUpdater("opacity", container => {
|
|
2741
2737
|
return Promise.resolve(new OpacityUpdater(container));
|
|
@@ -3064,7 +3060,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
3064
3060
|
}
|
|
3065
3061
|
|
|
3066
3062
|
async function loadOutModesUpdater(engine) {
|
|
3067
|
-
engine.checkVersion("4.5.
|
|
3063
|
+
engine.checkVersion("4.5.1");
|
|
3068
3064
|
await engine.pluginManager.register(e => {
|
|
3069
3065
|
e.pluginManager.addParticleUpdater("outModes", container => {
|
|
3070
3066
|
return Promise.resolve(new OutOfCanvasUpdater(container));
|
|
@@ -3143,7 +3139,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
3143
3139
|
}
|
|
3144
3140
|
|
|
3145
3141
|
async function loadPaintUpdater(engine) {
|
|
3146
|
-
engine.checkVersion("4.5.
|
|
3142
|
+
engine.checkVersion("4.5.1");
|
|
3147
3143
|
await engine.pluginManager.register(e => {
|
|
3148
3144
|
e.pluginManager.addParticleUpdater("paint", container => {
|
|
3149
3145
|
return Promise.resolve(new PaintUpdater(e.pluginManager, container));
|
|
@@ -3198,7 +3194,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
3198
3194
|
}
|
|
3199
3195
|
|
|
3200
3196
|
async function loadRgbColorPlugin(engine) {
|
|
3201
|
-
engine.checkVersion("4.5.
|
|
3197
|
+
engine.checkVersion("4.5.1");
|
|
3202
3198
|
await engine.pluginManager.register(e => {
|
|
3203
3199
|
e.pluginManager.addColorManager("rgb", new RgbColorManager());
|
|
3204
3200
|
});
|
|
@@ -3283,7 +3279,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
3283
3279
|
}
|
|
3284
3280
|
|
|
3285
3281
|
async function loadSizeUpdater(engine) {
|
|
3286
|
-
engine.checkVersion("4.5.
|
|
3282
|
+
engine.checkVersion("4.5.1");
|
|
3287
3283
|
await engine.pluginManager.register(e => {
|
|
3288
3284
|
e.pluginManager.addParticleUpdater("size", container => {
|
|
3289
3285
|
return Promise.resolve(new SizeUpdater(container));
|
|
@@ -3292,7 +3288,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
3292
3288
|
}
|
|
3293
3289
|
|
|
3294
3290
|
async function loadBasic(engine) {
|
|
3295
|
-
engine.checkVersion("4.5.
|
|
3291
|
+
engine.checkVersion("4.5.1");
|
|
3296
3292
|
await engine.pluginManager.register(async (e) => {
|
|
3297
3293
|
await Promise.all([
|
|
3298
3294
|
loadBlendPlugin(e),
|
|
@@ -3498,7 +3494,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
3498
3494
|
const clickEvent = "click", mouseDownEvent = "pointerdown", mouseUpEvent = "pointerup", mouseLeaveEvent = "pointerleave", mouseMoveEvent = "pointermove", touchStartEvent = "touchstart", touchEndEvent = "touchend", touchMoveEvent = "touchmove", touchCancelEvent = "touchcancel";
|
|
3499
3495
|
|
|
3500
3496
|
async function loadInteractivityPlugin(engine) {
|
|
3501
|
-
engine.checkVersion("4.5.
|
|
3497
|
+
engine.checkVersion("4.5.1");
|
|
3502
3498
|
if (typeof process !== "undefined" && process.env.NODE_ENV !== "production") {
|
|
3503
3499
|
addErrorMessages(ErrorMessages);
|
|
3504
3500
|
}
|
|
@@ -3578,6 +3574,30 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
3578
3574
|
}
|
|
3579
3575
|
return false;
|
|
3580
3576
|
}
|
|
3577
|
+
query(grid) {
|
|
3578
|
+
const { x, y } = this.position, { width, height } = this.#canvasSize, radius = this.radius, crossesLeft = x - radius <= originPoint.x, crossesRight = x + radius >= width, crossesTop = y - radius <= originPoint.y, crossesBottom = y + radius >= height;
|
|
3579
|
+
if (!crossesLeft && !crossesRight && !crossesTop && !crossesBottom) {
|
|
3580
|
+
return grid.query(this);
|
|
3581
|
+
}
|
|
3582
|
+
const xShifts = [originPoint.x], yShifts = [originPoint.y];
|
|
3583
|
+
if (crossesLeft)
|
|
3584
|
+
xShifts.push(width);
|
|
3585
|
+
if (crossesRight)
|
|
3586
|
+
xShifts.push(-width);
|
|
3587
|
+
if (crossesTop)
|
|
3588
|
+
yShifts.push(height);
|
|
3589
|
+
if (crossesBottom)
|
|
3590
|
+
yShifts.push(-height);
|
|
3591
|
+
const particles = new Set();
|
|
3592
|
+
for (const dx of xShifts) {
|
|
3593
|
+
for (const dy of yShifts) {
|
|
3594
|
+
for (const particle of grid.queryCircle({ x: x + dx, y: y + dy }, radius)) {
|
|
3595
|
+
particles.add(particle);
|
|
3596
|
+
}
|
|
3597
|
+
}
|
|
3598
|
+
}
|
|
3599
|
+
return [...particles];
|
|
3600
|
+
}
|
|
3581
3601
|
}
|
|
3582
3602
|
|
|
3583
3603
|
class LinksShadow {
|
|
@@ -3687,7 +3707,9 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
3687
3707
|
if (pos1.x < originPoint.x || pos1.y < originPoint.y || pos1.x > canvasSize.width || pos1.y > canvasSize.height) {
|
|
3688
3708
|
return;
|
|
3689
3709
|
}
|
|
3690
|
-
const linkOpt1 = p1.options.links, optOpacity = linkOpt1.opacity, optDistance = p1.retina.linksDistance ?? minDistance$1, warp = linkOpt1.warp,
|
|
3710
|
+
const linkOpt1 = p1.options.links, optOpacity = linkOpt1.opacity, optDistance = p1.retina.linksDistance ?? minDistance$1, warp = linkOpt1.warp, query = (warp
|
|
3711
|
+
? new CircleWarp(pos1.x, pos1.y, optDistance, canvasSize).query(container.particles.grid)
|
|
3712
|
+
: container.particles.grid.queryCircle(pos1, optDistance));
|
|
3691
3713
|
for (const p2 of query) {
|
|
3692
3714
|
const linkOpt2 = p2.options.links;
|
|
3693
3715
|
if (p1 === p2 ||
|
|
@@ -3775,7 +3797,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
3775
3797
|
}
|
|
3776
3798
|
|
|
3777
3799
|
async function loadParticlesLinksInteraction(engine) {
|
|
3778
|
-
engine.checkVersion("4.5.
|
|
3800
|
+
engine.checkVersion("4.5.1");
|
|
3779
3801
|
await engine.pluginManager.register((e) => {
|
|
3780
3802
|
const pluginManager = e.pluginManager;
|
|
3781
3803
|
ensureInteractivityPluginLoaded(e);
|
|
@@ -4761,6 +4783,10 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
4761
4783
|
this.#manageListeners(true);
|
|
4762
4784
|
}
|
|
4763
4785
|
removeListeners() {
|
|
4786
|
+
if (this.#resizeTimeout !== undefined) {
|
|
4787
|
+
clearTimeout(this.#resizeTimeout);
|
|
4788
|
+
this.#resizeTimeout = undefined;
|
|
4789
|
+
}
|
|
4764
4790
|
this.#manageListeners(false);
|
|
4765
4791
|
}
|
|
4766
4792
|
#handleVisibilityChange() {
|
|
@@ -5415,14 +5441,22 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
5415
5441
|
return out;
|
|
5416
5442
|
}
|
|
5417
5443
|
queryCircle(position, radius, check, out = []) {
|
|
5418
|
-
const circle = this.#acquireCircle(position.x, position.y, radius)
|
|
5419
|
-
|
|
5420
|
-
|
|
5444
|
+
const circle = this.#acquireCircle(position.x, position.y, radius);
|
|
5445
|
+
try {
|
|
5446
|
+
return this.query(circle, check, out);
|
|
5447
|
+
}
|
|
5448
|
+
finally {
|
|
5449
|
+
this.#circlePoolIdx--;
|
|
5450
|
+
}
|
|
5421
5451
|
}
|
|
5422
5452
|
queryRectangle(position, size, check, out = []) {
|
|
5423
|
-
const rect = this.#acquireRectangle(position.x, position.y, size.width, size.height)
|
|
5424
|
-
|
|
5425
|
-
|
|
5453
|
+
const rect = this.#acquireRectangle(position.x, position.y, size.width, size.height);
|
|
5454
|
+
try {
|
|
5455
|
+
return this.query(rect, check, out);
|
|
5456
|
+
}
|
|
5457
|
+
finally {
|
|
5458
|
+
this.#rectanglePoolIdx--;
|
|
5459
|
+
}
|
|
5426
5460
|
}
|
|
5427
5461
|
#acquireCircle(x, y, r) {
|
|
5428
5462
|
const idx = this.#circlePoolIdx++;
|
|
@@ -5481,10 +5515,6 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
5481
5515
|
}
|
|
5482
5516
|
}
|
|
5483
5517
|
}
|
|
5484
|
-
#releaseShapes() {
|
|
5485
|
-
this.#circlePoolIdx = 0;
|
|
5486
|
-
this.#rectanglePoolIdx = 0;
|
|
5487
|
-
}
|
|
5488
5518
|
}
|
|
5489
5519
|
|
|
5490
5520
|
class ParticlesManager {
|
|
@@ -6032,6 +6062,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
6032
6062
|
started;
|
|
6033
6063
|
zLayers;
|
|
6034
6064
|
#delay;
|
|
6065
|
+
#delayResolve;
|
|
6035
6066
|
#delayTimeout;
|
|
6036
6067
|
#delta = { value: 0, factor: 0 };
|
|
6037
6068
|
#dispatchCallback;
|
|
@@ -6270,7 +6301,10 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
6270
6301
|
await this.init();
|
|
6271
6302
|
this.started = true;
|
|
6272
6303
|
await new Promise(resolve => {
|
|
6304
|
+
this.#delayResolve = resolve;
|
|
6273
6305
|
const start = async () => {
|
|
6306
|
+
this.#delayTimeout = undefined;
|
|
6307
|
+
this.#delayResolve = undefined;
|
|
6274
6308
|
this.#eventListeners.addListeners();
|
|
6275
6309
|
for (const plugin of this.plugins) {
|
|
6276
6310
|
await plugin.start?.();
|
|
@@ -6286,9 +6320,11 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
6286
6320
|
if (!guardCheck(this) || !this.started) {
|
|
6287
6321
|
return;
|
|
6288
6322
|
}
|
|
6289
|
-
if (this.#delayTimeout) {
|
|
6323
|
+
if (this.#delayTimeout !== undefined) {
|
|
6290
6324
|
clearTimeout(this.#delayTimeout);
|
|
6291
6325
|
this.#delayTimeout = undefined;
|
|
6326
|
+
this.#delayResolve?.();
|
|
6327
|
+
this.#delayResolve = undefined;
|
|
6292
6328
|
}
|
|
6293
6329
|
this.#firstStart = true;
|
|
6294
6330
|
this.started = false;
|
|
@@ -6722,7 +6758,9 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
6722
6758
|
manageListener(interactivityEl, mouseMoveEvent, handlers.mouseMove, add);
|
|
6723
6759
|
manageListener(interactivityEl, touchStartEvent, handlers.touchStart, add);
|
|
6724
6760
|
manageListener(interactivityEl, touchMoveEvent, handlers.touchMove, add);
|
|
6725
|
-
|
|
6761
|
+
const onClickEnabled = !!options.interactivity?.events.onClick.enable;
|
|
6762
|
+
manageListener(interactivityEl, touchEndEvent, handlers.touchEndClick, add && onClickEnabled);
|
|
6763
|
+
manageListener(interactivityEl, touchEndEvent, handlers.touchEnd, add && !onClickEnabled);
|
|
6726
6764
|
manageListener(interactivityEl, mouseUpEvent, handlers.mouseUp, add);
|
|
6727
6765
|
manageListener(interactivityEl, mouseDownEvent, handlers.mouseDown, add);
|
|
6728
6766
|
manageListener(interactivityEl, mouseLeaveEvent, handlers.mouseLeave, add);
|