@tsparticles/particles 4.0.2 → 4.0.4
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/particles.js +2 -2
- package/browser/particles.lazy.js +2 -2
- package/cjs/particles.js +2 -2
- package/cjs/particles.lazy.js +2 -2
- package/esm/particles.js +2 -2
- package/esm/particles.lazy.js +2 -2
- package/package.json +6 -6
- package/report.html +1 -1
- package/tsparticles.particles.bundle.js +108 -17
- package/tsparticles.particles.bundle.min.js +1 -1
- package/tsparticles.particles.js +3 -3
- package/tsparticles.particles.min.js +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
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);g.tsparticlesInternalExports=g.tsparticlesInternalExports||{};})(typeof globalThis!=="undefined"?globalThis:typeof window!=="undefined"?window:this);
|
|
2
|
-
/* tsParticles v4.0.
|
|
2
|
+
/* tsParticles v4.0.4 */
|
|
3
3
|
(function (global, factory) {
|
|
4
4
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
5
5
|
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
|
@@ -1118,7 +1118,7 @@
|
|
|
1118
1118
|
return this._domArray;
|
|
1119
1119
|
}
|
|
1120
1120
|
get version() {
|
|
1121
|
-
return "4.0.
|
|
1121
|
+
return "4.0.4";
|
|
1122
1122
|
}
|
|
1123
1123
|
addEventListener(type, listener) {
|
|
1124
1124
|
this._eventDispatcher.addEventListener(type, listener);
|
|
@@ -3068,6 +3068,58 @@
|
|
|
3068
3068
|
return createPromise;
|
|
3069
3069
|
}
|
|
3070
3070
|
|
|
3071
|
+
class Blend {
|
|
3072
|
+
enable;
|
|
3073
|
+
mode;
|
|
3074
|
+
constructor() {
|
|
3075
|
+
this.mode = "destination-out";
|
|
3076
|
+
this.enable = false;
|
|
3077
|
+
}
|
|
3078
|
+
load(data) {
|
|
3079
|
+
if (isNull(data)) {
|
|
3080
|
+
return;
|
|
3081
|
+
}
|
|
3082
|
+
if (data.mode !== undefined) {
|
|
3083
|
+
this.mode = data.mode;
|
|
3084
|
+
}
|
|
3085
|
+
if (data.enable !== undefined) {
|
|
3086
|
+
this.enable = data.enable;
|
|
3087
|
+
}
|
|
3088
|
+
}
|
|
3089
|
+
}
|
|
3090
|
+
|
|
3091
|
+
class BlendPlugin {
|
|
3092
|
+
id = "blend";
|
|
3093
|
+
async getPlugin(container) {
|
|
3094
|
+
const { BlendPluginInstance } = await Promise.resolve().then(function () { return BlendPluginInstance$1; });
|
|
3095
|
+
return new BlendPluginInstance(container);
|
|
3096
|
+
}
|
|
3097
|
+
loadOptions(_container, options, source) {
|
|
3098
|
+
if (!this.needsPlugin(options) && !this.needsPlugin(source)) {
|
|
3099
|
+
return;
|
|
3100
|
+
}
|
|
3101
|
+
let blendOptions = options.blend;
|
|
3102
|
+
if (!blendOptions?.load) {
|
|
3103
|
+
options.blend = blendOptions = new Blend();
|
|
3104
|
+
}
|
|
3105
|
+
blendOptions.load(source?.blend);
|
|
3106
|
+
}
|
|
3107
|
+
loadParticlesOptions(_container, options, source) {
|
|
3108
|
+
options.blend ??= new Blend();
|
|
3109
|
+
options.blend.load(source?.blend);
|
|
3110
|
+
}
|
|
3111
|
+
needsPlugin(options) {
|
|
3112
|
+
return !!options?.blend?.enable || !!options?.particles?.blend?.enable;
|
|
3113
|
+
}
|
|
3114
|
+
}
|
|
3115
|
+
|
|
3116
|
+
async function loadBlendPlugin(engine) {
|
|
3117
|
+
engine.checkVersion("4.0.4");
|
|
3118
|
+
await engine.pluginManager.register(e => {
|
|
3119
|
+
e.pluginManager.addPlugin(new BlendPlugin());
|
|
3120
|
+
});
|
|
3121
|
+
}
|
|
3122
|
+
|
|
3071
3123
|
const minAngle$1 = 0;
|
|
3072
3124
|
function drawCircle(data) {
|
|
3073
3125
|
const { context, particle, radius } = data;
|
|
@@ -3099,7 +3151,7 @@
|
|
|
3099
3151
|
}
|
|
3100
3152
|
|
|
3101
3153
|
async function loadCircleShape(engine) {
|
|
3102
|
-
engine.checkVersion("4.0.
|
|
3154
|
+
engine.checkVersion("4.0.4");
|
|
3103
3155
|
await engine.pluginManager.register(e => {
|
|
3104
3156
|
e.pluginManager.addShape(["circle"], () => {
|
|
3105
3157
|
return Promise.resolve(new CircleDrawer());
|
|
@@ -3147,7 +3199,7 @@
|
|
|
3147
3199
|
}
|
|
3148
3200
|
|
|
3149
3201
|
async function loadHexColorPlugin(engine) {
|
|
3150
|
-
engine.checkVersion("4.0.
|
|
3202
|
+
engine.checkVersion("4.0.4");
|
|
3151
3203
|
await engine.pluginManager.register(e => {
|
|
3152
3204
|
e.pluginManager.addColorManager("hex", new HexColorManager());
|
|
3153
3205
|
});
|
|
@@ -3200,7 +3252,7 @@
|
|
|
3200
3252
|
}
|
|
3201
3253
|
|
|
3202
3254
|
async function loadHslColorPlugin(engine) {
|
|
3203
|
-
engine.checkVersion("4.0.
|
|
3255
|
+
engine.checkVersion("4.0.4");
|
|
3204
3256
|
await engine.pluginManager.register(e => {
|
|
3205
3257
|
e.pluginManager.addColorManager("hsl", new HslColorManager());
|
|
3206
3258
|
});
|
|
@@ -3224,7 +3276,7 @@
|
|
|
3224
3276
|
}
|
|
3225
3277
|
|
|
3226
3278
|
async function loadMovePlugin(engine) {
|
|
3227
|
-
engine.checkVersion("4.0.
|
|
3279
|
+
engine.checkVersion("4.0.4");
|
|
3228
3280
|
await engine.pluginManager.register(e => {
|
|
3229
3281
|
const moveEngine = e, movePluginManager = moveEngine.pluginManager;
|
|
3230
3282
|
movePluginManager.initializers.pathGenerators ??= new Map();
|
|
@@ -3285,7 +3337,7 @@
|
|
|
3285
3337
|
}
|
|
3286
3338
|
|
|
3287
3339
|
async function loadOpacityUpdater(engine) {
|
|
3288
|
-
engine.checkVersion("4.0.
|
|
3340
|
+
engine.checkVersion("4.0.4");
|
|
3289
3341
|
await engine.pluginManager.register(e => {
|
|
3290
3342
|
e.pluginManager.addParticleUpdater("opacity", container => {
|
|
3291
3343
|
return Promise.resolve(new OpacityUpdater(container));
|
|
@@ -3637,7 +3689,7 @@
|
|
|
3637
3689
|
}
|
|
3638
3690
|
|
|
3639
3691
|
async function loadOutModesUpdater(engine) {
|
|
3640
|
-
engine.checkVersion("4.0.
|
|
3692
|
+
engine.checkVersion("4.0.4");
|
|
3641
3693
|
await engine.pluginManager.register(e => {
|
|
3642
3694
|
e.pluginManager.addParticleUpdater("outModes", container => {
|
|
3643
3695
|
return Promise.resolve(new OutOfCanvasUpdater(container));
|
|
@@ -3708,7 +3760,7 @@
|
|
|
3708
3760
|
}
|
|
3709
3761
|
|
|
3710
3762
|
async function loadPaintUpdater(engine) {
|
|
3711
|
-
engine.checkVersion("4.0.
|
|
3763
|
+
engine.checkVersion("4.0.4");
|
|
3712
3764
|
await engine.pluginManager.register(e => {
|
|
3713
3765
|
e.pluginManager.addParticleUpdater("paint", container => {
|
|
3714
3766
|
return Promise.resolve(new PaintUpdater(e.pluginManager, container));
|
|
@@ -3763,7 +3815,7 @@
|
|
|
3763
3815
|
}
|
|
3764
3816
|
|
|
3765
3817
|
async function loadRgbColorPlugin(engine) {
|
|
3766
|
-
engine.checkVersion("4.0.
|
|
3818
|
+
engine.checkVersion("4.0.4");
|
|
3767
3819
|
await engine.pluginManager.register(e => {
|
|
3768
3820
|
e.pluginManager.addColorManager("rgb", new RgbColorManager());
|
|
3769
3821
|
});
|
|
@@ -3806,7 +3858,7 @@
|
|
|
3806
3858
|
}
|
|
3807
3859
|
|
|
3808
3860
|
async function loadSizeUpdater(engine) {
|
|
3809
|
-
engine.checkVersion("4.0.
|
|
3861
|
+
engine.checkVersion("4.0.4");
|
|
3810
3862
|
await engine.pluginManager.register(e => {
|
|
3811
3863
|
e.pluginManager.addParticleUpdater("size", container => {
|
|
3812
3864
|
return Promise.resolve(new SizeUpdater(container));
|
|
@@ -3815,9 +3867,10 @@
|
|
|
3815
3867
|
}
|
|
3816
3868
|
|
|
3817
3869
|
async function loadBasic(engine) {
|
|
3818
|
-
engine.checkVersion("4.0.
|
|
3870
|
+
engine.checkVersion("4.0.4");
|
|
3819
3871
|
await engine.pluginManager.register(async (e) => {
|
|
3820
3872
|
await Promise.all([
|
|
3873
|
+
loadBlendPlugin(e),
|
|
3821
3874
|
loadHexColorPlugin(e),
|
|
3822
3875
|
loadHslColorPlugin(e),
|
|
3823
3876
|
loadRgbColorPlugin(e),
|
|
@@ -4052,7 +4105,7 @@
|
|
|
4052
4105
|
const clickEvent = "click", mouseDownEvent = "pointerdown", mouseUpEvent = "pointerup", mouseLeaveEvent = "pointerleave", mouseMoveEvent = "pointermove", touchStartEvent = "touchstart", touchEndEvent = "touchend", touchMoveEvent = "touchmove", touchCancelEvent = "touchcancel";
|
|
4053
4106
|
|
|
4054
4107
|
async function loadInteractivityPlugin(engine) {
|
|
4055
|
-
engine.checkVersion("4.0.
|
|
4108
|
+
engine.checkVersion("4.0.4");
|
|
4056
4109
|
await engine.pluginManager.register(e => {
|
|
4057
4110
|
const interactivityEngine = e, interactivityPluginManager = interactivityEngine.pluginManager;
|
|
4058
4111
|
interactivityPluginManager.addPlugin(new InteractivityPlugin(interactivityPluginManager));
|
|
@@ -4316,7 +4369,7 @@
|
|
|
4316
4369
|
}
|
|
4317
4370
|
|
|
4318
4371
|
async function loadParticlesCollisionsInteraction(engine) {
|
|
4319
|
-
engine.checkVersion("4.0.
|
|
4372
|
+
engine.checkVersion("4.0.4");
|
|
4320
4373
|
await engine.pluginManager.register((e) => {
|
|
4321
4374
|
ensureInteractivityPluginLoaded(e);
|
|
4322
4375
|
e.pluginManager.addPlugin(new OverlapPlugin());
|
|
@@ -4619,7 +4672,7 @@
|
|
|
4619
4672
|
}
|
|
4620
4673
|
|
|
4621
4674
|
async function loadParticlesLinksInteraction(engine) {
|
|
4622
|
-
engine.checkVersion("4.0.
|
|
4675
|
+
engine.checkVersion("4.0.4");
|
|
4623
4676
|
await engine.pluginManager.register((e) => {
|
|
4624
4677
|
const pluginManager = e.pluginManager;
|
|
4625
4678
|
ensureInteractivityPluginLoaded(e);
|
|
@@ -4632,7 +4685,7 @@
|
|
|
4632
4685
|
|
|
4633
4686
|
let initPromise = null;
|
|
4634
4687
|
async function doInitPlugins(engine) {
|
|
4635
|
-
engine.checkVersion("4.0.
|
|
4688
|
+
engine.checkVersion("4.0.4");
|
|
4636
4689
|
await engine.pluginManager.register(async (e) => {
|
|
4637
4690
|
const loadParticlesInteractivity = async (e) => {
|
|
4638
4691
|
await loadInteractivityPlugin(e);
|
|
@@ -4675,7 +4728,7 @@
|
|
|
4675
4728
|
particles.init = async () => {
|
|
4676
4729
|
await initPlugins(tsParticles);
|
|
4677
4730
|
};
|
|
4678
|
-
particles.version = "4.0.
|
|
4731
|
+
particles.version = "4.0.4";
|
|
4679
4732
|
globalThis.particles = particles;
|
|
4680
4733
|
|
|
4681
4734
|
const globalObject = globalThis;
|
|
@@ -6768,6 +6821,44 @@
|
|
|
6768
6821
|
ParticlesInstance: ParticlesInstance
|
|
6769
6822
|
});
|
|
6770
6823
|
|
|
6824
|
+
class BlendPluginInstance {
|
|
6825
|
+
_container;
|
|
6826
|
+
_defaultCompositeValue;
|
|
6827
|
+
constructor(container) {
|
|
6828
|
+
this._container = container;
|
|
6829
|
+
}
|
|
6830
|
+
drawParticleCleanup(context, particle) {
|
|
6831
|
+
if (!particle.options.blend?.enable) {
|
|
6832
|
+
return;
|
|
6833
|
+
}
|
|
6834
|
+
context.globalCompositeOperation = particle.originalBlendMode ?? defaultCompositeValue;
|
|
6835
|
+
particle.originalBlendMode = undefined;
|
|
6836
|
+
}
|
|
6837
|
+
drawParticleSetup(context, particle) {
|
|
6838
|
+
if (!particle.options.blend?.enable) {
|
|
6839
|
+
return;
|
|
6840
|
+
}
|
|
6841
|
+
particle.originalBlendMode = context.globalCompositeOperation;
|
|
6842
|
+
context.globalCompositeOperation = particle.options.blend.mode;
|
|
6843
|
+
}
|
|
6844
|
+
drawSettingsCleanup(context) {
|
|
6845
|
+
if (!this._defaultCompositeValue) {
|
|
6846
|
+
return;
|
|
6847
|
+
}
|
|
6848
|
+
context.globalCompositeOperation = this._defaultCompositeValue;
|
|
6849
|
+
}
|
|
6850
|
+
drawSettingsSetup(context) {
|
|
6851
|
+
const previousComposite = context.globalCompositeOperation, blend = this._container.actualOptions.blend;
|
|
6852
|
+
this._defaultCompositeValue = previousComposite;
|
|
6853
|
+
context.globalCompositeOperation = blend?.enable ? blend.mode : previousComposite;
|
|
6854
|
+
}
|
|
6855
|
+
}
|
|
6856
|
+
|
|
6857
|
+
var BlendPluginInstance$1 = /*#__PURE__*/Object.freeze({
|
|
6858
|
+
__proto__: null,
|
|
6859
|
+
BlendPluginInstance: BlendPluginInstance
|
|
6860
|
+
});
|
|
6861
|
+
|
|
6771
6862
|
const minVelocity = 0, identity = 1, moveSpeedFactor = 60, minSpinRadius = 0, spinFactor = 0.01, defaultPathDelay = 0, noDecay = 1;
|
|
6772
6863
|
function applyDistance(particle) {
|
|
6773
6864
|
const initialPosition = particle.initialPosition, { dx, dy } = getDistances(initialPosition, particle.position), dxFixed = Math.abs(dx), dyFixed = Math.abs(dy), { maxDistance } = particle.retina, hDistance = maxDistance.horizontal, vDistance = maxDistance.vertical;
|