@tsparticles/pjs 3.0.0-beta.4 → 3.0.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/VincentGarreau/particles.js +249 -1
- package/cjs/VincentGarreau/particles.js +249 -1
- package/esm/VincentGarreau/particles.js +249 -1
- package/package.json +2 -2
- package/report.html +3 -3
- package/tsparticles.pjs.bundle.js +282 -24
- package/tsparticles.pjs.bundle.min.js +1 -1
- package/tsparticles.pjs.bundle.min.js.LICENSE.txt +1 -1
- package/tsparticles.pjs.js +239 -2
- package/tsparticles.pjs.min.js +1 -1
- package/tsparticles.pjs.min.js.LICENSE.txt +1 -1
- package/types/VincentGarreau/IParticlesJS.d.ts +113 -2
- package/umd/VincentGarreau/particles.js +250 -2
@@ -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.0
|
7
|
+
* v3.0.0
|
8
8
|
*/
|
9
9
|
(function webpackUniversalModuleDefinition(root, factory) {
|
10
10
|
if(typeof exports === 'object' && typeof module === 'object')
|
@@ -1229,7 +1229,8 @@ function drawParticle(data) {
|
|
1229
1229
|
particle,
|
1230
1230
|
radius,
|
1231
1231
|
opacity,
|
1232
|
-
delta
|
1232
|
+
delta,
|
1233
|
+
transformData
|
1233
1234
|
};
|
1234
1235
|
context.beginPath();
|
1235
1236
|
drawShape(drawData);
|
@@ -1254,7 +1255,8 @@ function drawEffect(data) {
|
|
1254
1255
|
particle,
|
1255
1256
|
radius,
|
1256
1257
|
opacity,
|
1257
|
-
delta
|
1258
|
+
delta,
|
1259
|
+
transformData
|
1258
1260
|
} = data;
|
1259
1261
|
if (!particle.effect) {
|
1260
1262
|
return;
|
@@ -1269,7 +1271,10 @@ function drawEffect(data) {
|
|
1269
1271
|
radius,
|
1270
1272
|
opacity,
|
1271
1273
|
delta,
|
1272
|
-
pixelRatio: container.retina.pixelRatio
|
1274
|
+
pixelRatio: container.retina.pixelRatio,
|
1275
|
+
transformData: {
|
1276
|
+
...transformData
|
1277
|
+
}
|
1273
1278
|
});
|
1274
1279
|
}
|
1275
1280
|
function drawShape(data) {
|
@@ -1279,7 +1284,8 @@ function drawShape(data) {
|
|
1279
1284
|
particle,
|
1280
1285
|
radius,
|
1281
1286
|
opacity,
|
1282
|
-
delta
|
1287
|
+
delta,
|
1288
|
+
transformData
|
1283
1289
|
} = data;
|
1284
1290
|
if (!particle.shape) {
|
1285
1291
|
return;
|
@@ -1294,7 +1300,10 @@ function drawShape(data) {
|
|
1294
1300
|
radius,
|
1295
1301
|
opacity,
|
1296
1302
|
delta,
|
1297
|
-
pixelRatio: container.retina.pixelRatio
|
1303
|
+
pixelRatio: container.retina.pixelRatio,
|
1304
|
+
transformData: {
|
1305
|
+
...transformData
|
1306
|
+
}
|
1298
1307
|
});
|
1299
1308
|
}
|
1300
1309
|
function drawShapeAfterDraw(data) {
|
@@ -1304,7 +1313,8 @@ function drawShapeAfterDraw(data) {
|
|
1304
1313
|
particle,
|
1305
1314
|
radius,
|
1306
1315
|
opacity,
|
1307
|
-
delta
|
1316
|
+
delta,
|
1317
|
+
transformData
|
1308
1318
|
} = data;
|
1309
1319
|
if (!particle.shape) {
|
1310
1320
|
return;
|
@@ -1319,7 +1329,10 @@ function drawShapeAfterDraw(data) {
|
|
1319
1329
|
radius,
|
1320
1330
|
opacity,
|
1321
1331
|
delta,
|
1322
|
-
pixelRatio: container.retina.pixelRatio
|
1332
|
+
pixelRatio: container.retina.pixelRatio,
|
1333
|
+
transformData: {
|
1334
|
+
...transformData
|
1335
|
+
}
|
1323
1336
|
});
|
1324
1337
|
}
|
1325
1338
|
function drawPlugin(context, plugin, delta) {
|
@@ -1556,7 +1569,7 @@ class Canvas {
|
|
1556
1569
|
} else if (trailFill.image) {
|
1557
1570
|
this._paintImage(trailFill.image, trailFill.opacity);
|
1558
1571
|
}
|
1559
|
-
} else {
|
1572
|
+
} else if (options.clear) {
|
1560
1573
|
this.draw(ctx => {
|
1561
1574
|
clear(ctx, this.size);
|
1562
1575
|
});
|
@@ -2403,11 +2416,7 @@ class Events {
|
|
2403
2416
|
});
|
2404
2417
|
}
|
2405
2418
|
this.onHover.load(data.onHover);
|
2406
|
-
|
2407
|
-
this.resize.enable = data.resize;
|
2408
|
-
} else {
|
2409
|
-
this.resize.load(data.resize);
|
2410
|
-
}
|
2419
|
+
this.resize.load(data.resize);
|
2411
2420
|
}
|
2412
2421
|
}
|
2413
2422
|
;// CONCATENATED MODULE: ../../engine/dist/browser/Options/Classes/Interactivity/Modes/Modes.js
|
@@ -3432,23 +3441,26 @@ class ParticlesOptions {
|
|
3432
3441
|
if (!data) {
|
3433
3442
|
return;
|
3434
3443
|
}
|
3435
|
-
this.bounce.load(data.bounce);
|
3436
|
-
this.color.load(AnimatableColor.create(this.color, data.color));
|
3437
|
-
this.effect.load(data.effect);
|
3438
3444
|
if (data.groups !== undefined) {
|
3439
|
-
for (const group
|
3445
|
+
for (const group of Object.keys(data.groups)) {
|
3446
|
+
if (!Object.hasOwn(data.groups, group)) {
|
3447
|
+
continue;
|
3448
|
+
}
|
3440
3449
|
const item = data.groups[group];
|
3441
3450
|
if (item !== undefined) {
|
3442
3451
|
this.groups[group] = deepExtend(this.groups[group] ?? {}, item);
|
3443
3452
|
}
|
3444
3453
|
}
|
3445
3454
|
}
|
3446
|
-
this.move.load(data.move);
|
3447
|
-
this.number.load(data.number);
|
3448
|
-
this.opacity.load(data.opacity);
|
3449
3455
|
if (data.reduceDuplicates !== undefined) {
|
3450
3456
|
this.reduceDuplicates = data.reduceDuplicates;
|
3451
3457
|
}
|
3458
|
+
this.bounce.load(data.bounce);
|
3459
|
+
this.color.load(AnimatableColor.create(this.color, data.color));
|
3460
|
+
this.effect.load(data.effect);
|
3461
|
+
this.move.load(data.move);
|
3462
|
+
this.number.load(data.number);
|
3463
|
+
this.opacity.load(data.opacity);
|
3452
3464
|
this.shape.load(data.shape);
|
3453
3465
|
this.size.load(data.size);
|
3454
3466
|
this.shadow.load(data.shadow);
|
@@ -3521,6 +3533,7 @@ class Options {
|
|
3521
3533
|
this.autoPlay = true;
|
3522
3534
|
this.background = new Background();
|
3523
3535
|
this.backgroundMask = new BackgroundMask();
|
3536
|
+
this.clear = true;
|
3524
3537
|
this.defaultThemes = {};
|
3525
3538
|
this.delay = 0;
|
3526
3539
|
this.fullScreen = new FullScreen();
|
@@ -3548,6 +3561,12 @@ class Options {
|
|
3548
3561
|
if (data.autoPlay !== undefined) {
|
3549
3562
|
this.autoPlay = data.autoPlay;
|
3550
3563
|
}
|
3564
|
+
if (data.clear !== undefined) {
|
3565
|
+
this.clear = data.clear;
|
3566
|
+
}
|
3567
|
+
if (data.name !== undefined) {
|
3568
|
+
this.name = data.name;
|
3569
|
+
}
|
3551
3570
|
if (data.delay !== undefined) {
|
3552
3571
|
this.delay = setRangeValue(data.delay);
|
3553
3572
|
}
|
@@ -3873,7 +3892,9 @@ class Particle {
|
|
3873
3892
|
this.bubble.inRange = false;
|
3874
3893
|
this.slow.inRange = false;
|
3875
3894
|
const container = this.container,
|
3876
|
-
pathGenerator = this.pathGenerator
|
3895
|
+
pathGenerator = this.pathGenerator,
|
3896
|
+
shapeDrawer = container.shapeDrawers.get(this.shape);
|
3897
|
+
shapeDrawer && shapeDrawer.particleDestroy && shapeDrawer.particleDestroy(this);
|
3877
3898
|
for (const [, plugin] of container.plugins) {
|
3878
3899
|
plugin.particleDestroyed && plugin.particleDestroyed(this, override);
|
3879
3900
|
}
|
@@ -5127,7 +5148,7 @@ class Engine {
|
|
5127
5148
|
return res;
|
5128
5149
|
}
|
5129
5150
|
get version() {
|
5130
|
-
return "3.0.0
|
5151
|
+
return "3.0.0";
|
5131
5152
|
}
|
5132
5153
|
addConfig(config) {
|
5133
5154
|
const name = config.name ?? "default";
|
@@ -5625,11 +5646,248 @@ class Particles_Particles {
|
|
5625
5646
|
}
|
5626
5647
|
}
|
5627
5648
|
;// CONCATENATED MODULE: ./dist/browser/VincentGarreau/particles.js
|
5649
|
+
|
5650
|
+
const defaultPjsOptions = {
|
5651
|
+
particles: {
|
5652
|
+
number: {
|
5653
|
+
value: 400,
|
5654
|
+
density: {
|
5655
|
+
enable: true,
|
5656
|
+
value_area: 800
|
5657
|
+
}
|
5658
|
+
},
|
5659
|
+
color: {
|
5660
|
+
value: "#fff"
|
5661
|
+
},
|
5662
|
+
shape: {
|
5663
|
+
type: "circle",
|
5664
|
+
stroke: {
|
5665
|
+
width: 0,
|
5666
|
+
color: "#ff0000"
|
5667
|
+
},
|
5668
|
+
polygon: {
|
5669
|
+
nb_sides: 5
|
5670
|
+
},
|
5671
|
+
image: {
|
5672
|
+
src: "",
|
5673
|
+
width: 100,
|
5674
|
+
height: 100
|
5675
|
+
}
|
5676
|
+
},
|
5677
|
+
opacity: {
|
5678
|
+
value: 1,
|
5679
|
+
random: false,
|
5680
|
+
anim: {
|
5681
|
+
enable: false,
|
5682
|
+
speed: 2,
|
5683
|
+
opacity_min: 0,
|
5684
|
+
sync: false
|
5685
|
+
}
|
5686
|
+
},
|
5687
|
+
size: {
|
5688
|
+
value: 20,
|
5689
|
+
random: false,
|
5690
|
+
anim: {
|
5691
|
+
enable: false,
|
5692
|
+
speed: 20,
|
5693
|
+
size_min: 0,
|
5694
|
+
sync: false
|
5695
|
+
}
|
5696
|
+
},
|
5697
|
+
line_linked: {
|
5698
|
+
enable: true,
|
5699
|
+
distance: 100,
|
5700
|
+
color: "#fff",
|
5701
|
+
opacity: 1,
|
5702
|
+
width: 1
|
5703
|
+
},
|
5704
|
+
move: {
|
5705
|
+
enable: true,
|
5706
|
+
speed: 2,
|
5707
|
+
direction: "none",
|
5708
|
+
random: false,
|
5709
|
+
straight: false,
|
5710
|
+
out_mode: "out",
|
5711
|
+
bounce: false,
|
5712
|
+
attract: {
|
5713
|
+
enable: false,
|
5714
|
+
rotateX: 3000,
|
5715
|
+
rotateY: 3000
|
5716
|
+
}
|
5717
|
+
}
|
5718
|
+
},
|
5719
|
+
interactivity: {
|
5720
|
+
detect_on: "canvas",
|
5721
|
+
events: {
|
5722
|
+
onhover: {
|
5723
|
+
enable: true,
|
5724
|
+
mode: "grab"
|
5725
|
+
},
|
5726
|
+
onclick: {
|
5727
|
+
enable: true,
|
5728
|
+
mode: "push"
|
5729
|
+
},
|
5730
|
+
resize: true
|
5731
|
+
},
|
5732
|
+
modes: {
|
5733
|
+
grab: {
|
5734
|
+
distance: 100,
|
5735
|
+
line_linked: {
|
5736
|
+
opacity: 1
|
5737
|
+
}
|
5738
|
+
},
|
5739
|
+
bubble: {
|
5740
|
+
distance: 200,
|
5741
|
+
size: 80,
|
5742
|
+
duration: 0.4,
|
5743
|
+
opacity: 1,
|
5744
|
+
speed: 3
|
5745
|
+
},
|
5746
|
+
repulse: {
|
5747
|
+
distance: 200,
|
5748
|
+
duration: 0.4
|
5749
|
+
},
|
5750
|
+
push: {
|
5751
|
+
particles_nb: 4
|
5752
|
+
},
|
5753
|
+
remove: {
|
5754
|
+
particles_nb: 2
|
5755
|
+
}
|
5756
|
+
}
|
5757
|
+
},
|
5758
|
+
retina_detect: false
|
5759
|
+
};
|
5628
5760
|
const initParticlesJS = engine => {
|
5629
5761
|
const particlesJS = (tagId, options) => {
|
5762
|
+
const fixedOptions = deepExtend(defaultPjsOptions, options);
|
5630
5763
|
return engine.load({
|
5631
5764
|
id: tagId,
|
5632
|
-
options
|
5765
|
+
options: {
|
5766
|
+
fullScreen: {
|
5767
|
+
enable: false
|
5768
|
+
},
|
5769
|
+
detectRetina: fixedOptions.retina_detect,
|
5770
|
+
smooth: true,
|
5771
|
+
interactivity: {
|
5772
|
+
detectsOn: fixedOptions.interactivity.detect_on,
|
5773
|
+
events: {
|
5774
|
+
onHover: {
|
5775
|
+
enable: fixedOptions.interactivity.events.onhover.enable,
|
5776
|
+
mode: fixedOptions.interactivity.events.onhover.mode
|
5777
|
+
},
|
5778
|
+
onClick: {
|
5779
|
+
enable: fixedOptions.interactivity.events.onclick.enable,
|
5780
|
+
mode: fixedOptions.interactivity.events.onclick.mode
|
5781
|
+
},
|
5782
|
+
resize: {
|
5783
|
+
enable: fixedOptions.interactivity.events.resize
|
5784
|
+
}
|
5785
|
+
},
|
5786
|
+
modes: {
|
5787
|
+
grab: {
|
5788
|
+
distance: fixedOptions.interactivity.modes.grab.distance,
|
5789
|
+
links: {
|
5790
|
+
opacity: fixedOptions.interactivity.modes.grab.line_linked.opacity
|
5791
|
+
}
|
5792
|
+
},
|
5793
|
+
bubble: {
|
5794
|
+
distance: fixedOptions.interactivity.modes.bubble.distance,
|
5795
|
+
size: fixedOptions.interactivity.modes.bubble.size,
|
5796
|
+
duration: fixedOptions.interactivity.modes.bubble.duration,
|
5797
|
+
opacity: fixedOptions.interactivity.modes.bubble.opacity,
|
5798
|
+
speed: fixedOptions.interactivity.modes.bubble.speed
|
5799
|
+
},
|
5800
|
+
repulse: {
|
5801
|
+
distance: fixedOptions.interactivity.modes.repulse.distance,
|
5802
|
+
duration: fixedOptions.interactivity.modes.repulse.duration
|
5803
|
+
},
|
5804
|
+
push: {
|
5805
|
+
quantity: fixedOptions.interactivity.modes.push.particles_nb
|
5806
|
+
},
|
5807
|
+
remove: {
|
5808
|
+
quantity: fixedOptions.interactivity.modes.remove.particles_nb
|
5809
|
+
}
|
5810
|
+
}
|
5811
|
+
},
|
5812
|
+
particles: {
|
5813
|
+
collisions: {
|
5814
|
+
enable: fixedOptions.particles.move.bounce
|
5815
|
+
},
|
5816
|
+
number: {
|
5817
|
+
value: fixedOptions.particles.number.value,
|
5818
|
+
density: {
|
5819
|
+
enable: fixedOptions.particles.number.density.enable,
|
5820
|
+
width: fixedOptions.particles.number.density.value_area
|
5821
|
+
}
|
5822
|
+
},
|
5823
|
+
color: {
|
5824
|
+
value: fixedOptions.particles.color.value
|
5825
|
+
},
|
5826
|
+
stroke: {
|
5827
|
+
width: fixedOptions.particles.shape.stroke.width,
|
5828
|
+
color: {
|
5829
|
+
value: fixedOptions.particles.shape.stroke.color
|
5830
|
+
}
|
5831
|
+
},
|
5832
|
+
shape: {
|
5833
|
+
type: fixedOptions.particles.shape.type,
|
5834
|
+
options: {
|
5835
|
+
polygon: {
|
5836
|
+
sides: fixedOptions.particles.shape.polygon.nb_sides
|
5837
|
+
},
|
5838
|
+
image: {
|
5839
|
+
src: fixedOptions.particles.shape.image.src,
|
5840
|
+
width: fixedOptions.particles.shape.image.width,
|
5841
|
+
height: fixedOptions.particles.shape.image.height
|
5842
|
+
}
|
5843
|
+
}
|
5844
|
+
},
|
5845
|
+
opacity: {
|
5846
|
+
value: fixedOptions.particles.opacity.random ? {
|
5847
|
+
min: fixedOptions.particles.opacity.anim.enable ? fixedOptions.particles.opacity.anim.opacity_min : 0,
|
5848
|
+
max: fixedOptions.particles.opacity.value
|
5849
|
+
} : fixedOptions.particles.opacity.value,
|
5850
|
+
animation: {
|
5851
|
+
enable: fixedOptions.particles.opacity.anim.enable,
|
5852
|
+
speed: fixedOptions.particles.opacity.anim.speed,
|
5853
|
+
sync: fixedOptions.particles.opacity.anim.sync
|
5854
|
+
}
|
5855
|
+
},
|
5856
|
+
size: {
|
5857
|
+
value: fixedOptions.particles.size.random ? {
|
5858
|
+
min: fixedOptions.particles.size.anim.enable ? fixedOptions.particles.size.anim.size_min : 0,
|
5859
|
+
max: fixedOptions.particles.size.value
|
5860
|
+
} : fixedOptions.particles.size.value,
|
5861
|
+
animation: {
|
5862
|
+
enable: fixedOptions.particles.size.anim.enable,
|
5863
|
+
speed: fixedOptions.particles.size.anim.speed,
|
5864
|
+
sync: fixedOptions.particles.size.anim.sync
|
5865
|
+
}
|
5866
|
+
},
|
5867
|
+
links: {
|
5868
|
+
enable: fixedOptions.particles.line_linked.enable,
|
5869
|
+
distance: fixedOptions.particles.line_linked.distance,
|
5870
|
+
color: fixedOptions.particles.line_linked.color,
|
5871
|
+
opacity: fixedOptions.particles.line_linked.opacity,
|
5872
|
+
width: fixedOptions.particles.line_linked.width
|
5873
|
+
},
|
5874
|
+
move: {
|
5875
|
+
enable: fixedOptions.particles.move.enable,
|
5876
|
+
speed: fixedOptions.particles.move.speed / 3,
|
5877
|
+
direction: fixedOptions.particles.move.direction,
|
5878
|
+
random: fixedOptions.particles.move.random,
|
5879
|
+
straight: fixedOptions.particles.move.straight,
|
5880
|
+
outModes: fixedOptions.particles.move.out_mode,
|
5881
|
+
attract: {
|
5882
|
+
enable: fixedOptions.particles.move.attract.enable,
|
5883
|
+
rotate: {
|
5884
|
+
x: fixedOptions.particles.move.attract.rotateX,
|
5885
|
+
y: fixedOptions.particles.move.attract.rotateY
|
5886
|
+
}
|
5887
|
+
}
|
5888
|
+
}
|
5889
|
+
}
|
5890
|
+
}
|
5633
5891
|
});
|
5634
5892
|
};
|
5635
5893
|
particlesJS.load = (tagId, pathConfigJson, callback) => {
|