@tsparticles/plugin-emitters 3.0.3 → 3.2.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/113.min.js +2 -0
- package/113.min.js.LICENSE.txt +1 -0
- package/927.min.js +2 -0
- package/927.min.js.LICENSE.txt +1 -0
- package/964.min.js +2 -0
- package/964.min.js.LICENSE.txt +1 -0
- package/973.min.js +2 -0
- package/973.min.js.LICENSE.txt +1 -0
- package/browser/EmitterInstance.js +37 -28
- package/browser/Emitters.js +10 -10
- package/browser/EmittersPlugin.js +90 -0
- package/browser/index.js +2 -91
- package/cjs/EmitterInstance.js +36 -27
- package/cjs/Emitters.js +34 -11
- package/cjs/EmittersPlugin.js +117 -0
- package/cjs/index.js +15 -92
- package/dist_browser_EmitterInstance_js.js +30 -0
- package/dist_browser_EmittersPlugin_js.js +90 -0
- package/dist_browser_Emitters_js.js +30 -0
- package/dist_browser_ShapeManager_js.js +30 -0
- package/esm/EmitterInstance.js +37 -28
- package/esm/Emitters.js +10 -10
- package/esm/EmittersPlugin.js +90 -0
- package/esm/index.js +2 -91
- package/package.json +2 -2
- package/report.html +3 -3
- package/tsparticles.plugin.emitters.js +251 -734
- package/tsparticles.plugin.emitters.min.js +1 -1
- package/tsparticles.plugin.emitters.min.js.LICENSE.txt +1 -1
- package/types/EmitterInstance.d.ts +1 -1
- package/types/Emitters.d.ts +2 -2
- package/types/EmittersPlugin.d.ts +13 -0
- package/umd/EmitterInstance.js +36 -27
- package/umd/Emitters.js +36 -12
- package/umd/EmittersPlugin.js +128 -0
- package/umd/index.js +17 -93
package/esm/EmitterInstance.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { Vector, calcPositionOrRandomFromSizeRanged, deepExtend, getRangeValue, getSize, isPointInside, itemFromSingleOrMultiple, randomInRange, rangeColorToHsl, } from "@tsparticles/engine";
|
|
1
|
+
import { Vector, calcPositionOrRandomFromSizeRanged, deepExtend, getRangeValue, getSize, isPointInside, itemFromSingleOrMultiple, millisecondsToSeconds, randomInRange, rangeColorToHsl, } from "@tsparticles/engine";
|
|
2
2
|
import { Emitter } from "./Options/Classes/Emitter.js";
|
|
3
3
|
import { EmitterSize } from "./Options/Classes/EmitterSize.js";
|
|
4
|
+
const half = 0.5, defaultLifeDelay = 0, minLifeCount = 0, defaultSpawnDelay = 0, defaultEmitDelay = 0, defaultLifeCount = -1, defaultColorAnimationFactor = 1;
|
|
4
5
|
function setParticlesOptionsColor(particlesOptions, color) {
|
|
5
6
|
if (particlesOptions.color) {
|
|
6
7
|
particlesOptions.color.value = color;
|
|
@@ -32,21 +33,21 @@ export class EmitterInstance {
|
|
|
32
33
|
if (this._paused) {
|
|
33
34
|
return;
|
|
34
35
|
}
|
|
35
|
-
const duration = this.options.life?.duration !== undefined ? getRangeValue(this.options.life.duration) : undefined;
|
|
36
|
+
const duration = this.options.life?.duration !== undefined ? getRangeValue(this.options.life.duration) : undefined, minDuration = 0, minLifeCount = 0;
|
|
36
37
|
if (this.container.retina.reduceFactor &&
|
|
37
|
-
(this._lifeCount >
|
|
38
|
+
(this._lifeCount > minLifeCount || this._immortal) &&
|
|
38
39
|
duration !== undefined &&
|
|
39
|
-
duration >
|
|
40
|
-
this._duration = duration *
|
|
40
|
+
duration > minDuration) {
|
|
41
|
+
this._duration = duration * millisecondsToSeconds;
|
|
41
42
|
}
|
|
42
43
|
};
|
|
43
|
-
this._setColorAnimation = (animation, initValue, maxValue) => {
|
|
44
|
+
this._setColorAnimation = (animation, initValue, maxValue, factor = defaultColorAnimationFactor) => {
|
|
44
45
|
const container = this.container;
|
|
45
46
|
if (!animation.enable) {
|
|
46
47
|
return initValue;
|
|
47
48
|
}
|
|
48
|
-
const colorOffset = randomInRange(animation.offset), delay = getRangeValue(this.options.rate.delay), emitFactor = (
|
|
49
|
-
return (initValue + (colorSpeed * container.fpsLimit) / emitFactor + colorOffset *
|
|
49
|
+
const colorOffset = randomInRange(animation.offset), delay = getRangeValue(this.options.rate.delay), emitFactor = (delay * millisecondsToSeconds) / container.retina.reduceFactor, defaultColorSpeed = 0, colorSpeed = getRangeValue(animation.speed ?? defaultColorSpeed);
|
|
50
|
+
return (initValue + (colorSpeed * container.fpsLimit) / emitFactor + colorOffset * factor) % maxValue;
|
|
50
51
|
};
|
|
51
52
|
this._engine = engine;
|
|
52
53
|
this._currentDuration = 0;
|
|
@@ -60,7 +61,9 @@ export class EmitterInstance {
|
|
|
60
61
|
this.options = new Emitter();
|
|
61
62
|
this.options.load(options);
|
|
62
63
|
}
|
|
63
|
-
this._spawnDelay =
|
|
64
|
+
this._spawnDelay =
|
|
65
|
+
(getRangeValue(this.options.life.delay ?? defaultLifeDelay) * millisecondsToSeconds) /
|
|
66
|
+
this.container.retina.reduceFactor;
|
|
64
67
|
this.position = this._initialPosition ?? this._calcPosition();
|
|
65
68
|
this.name = this.options.name;
|
|
66
69
|
this.fill = this.options.fill;
|
|
@@ -77,8 +80,8 @@ export class EmitterInstance {
|
|
|
77
80
|
this._particlesOptions = particlesOptions;
|
|
78
81
|
this._size = this._calcSize();
|
|
79
82
|
this.size = getSize(this._size, this.container.canvas.size);
|
|
80
|
-
this._lifeCount = this.options.life.count ??
|
|
81
|
-
this._immortal = this._lifeCount <=
|
|
83
|
+
this._lifeCount = this.options.life.count ?? defaultLifeCount;
|
|
84
|
+
this._immortal = this._lifeCount <= minLifeCount;
|
|
82
85
|
if (this.options.domId) {
|
|
83
86
|
const element = document.getElementById(this.options.domId);
|
|
84
87
|
if (element) {
|
|
@@ -129,15 +132,15 @@ export class EmitterInstance {
|
|
|
129
132
|
return;
|
|
130
133
|
}
|
|
131
134
|
if (!(this.container.retina.reduceFactor &&
|
|
132
|
-
(this._lifeCount >
|
|
133
|
-
(this._firstSpawn || this._currentSpawnDelay >= (this._spawnDelay ??
|
|
135
|
+
(this._lifeCount > minLifeCount || this._immortal || !this.options.life.count) &&
|
|
136
|
+
(this._firstSpawn || this._currentSpawnDelay >= (this._spawnDelay ?? defaultSpawnDelay)))) {
|
|
134
137
|
return;
|
|
135
138
|
}
|
|
136
139
|
if (this._emitDelay === undefined) {
|
|
137
140
|
const delay = getRangeValue(this.options.rate.delay);
|
|
138
|
-
this._emitDelay = (
|
|
141
|
+
this._emitDelay = (delay * millisecondsToSeconds) / this.container.retina.reduceFactor;
|
|
139
142
|
}
|
|
140
|
-
if (this._lifeCount >
|
|
143
|
+
if (this._lifeCount > minLifeCount || this._immortal) {
|
|
141
144
|
this._prepareToDie();
|
|
142
145
|
}
|
|
143
146
|
}
|
|
@@ -157,8 +160,8 @@ export class EmitterInstance {
|
|
|
157
160
|
}
|
|
158
161
|
if (this._firstSpawn) {
|
|
159
162
|
this._firstSpawn = false;
|
|
160
|
-
this._currentSpawnDelay = this._spawnDelay ??
|
|
161
|
-
this._currentEmitDelay = this._emitDelay ??
|
|
163
|
+
this._currentSpawnDelay = this._spawnDelay ?? defaultSpawnDelay;
|
|
164
|
+
this._currentEmitDelay = this._emitDelay ?? defaultEmitDelay;
|
|
162
165
|
}
|
|
163
166
|
if (!this._startParticlesAdded) {
|
|
164
167
|
this._startParticlesAdded = true;
|
|
@@ -174,11 +177,12 @@ export class EmitterInstance {
|
|
|
174
177
|
if (!this._immortal) {
|
|
175
178
|
this._lifeCount--;
|
|
176
179
|
}
|
|
177
|
-
if (this._lifeCount >
|
|
180
|
+
if (this._lifeCount > minLifeCount || this._immortal) {
|
|
178
181
|
this.position = this._calcPosition();
|
|
179
182
|
this._shape?.resize(this.position, this.size);
|
|
180
183
|
this._spawnDelay =
|
|
181
|
-
(getRangeValue(this.options.life.delay ??
|
|
184
|
+
(getRangeValue(this.options.life.delay ?? defaultLifeDelay) * millisecondsToSeconds) /
|
|
185
|
+
this.container.retina.reduceFactor;
|
|
182
186
|
}
|
|
183
187
|
else {
|
|
184
188
|
this._destroy();
|
|
@@ -201,19 +205,19 @@ export class EmitterInstance {
|
|
|
201
205
|
if (this._emitDelay !== undefined) {
|
|
202
206
|
this._currentEmitDelay += delta.value;
|
|
203
207
|
if (this._currentEmitDelay >= this._emitDelay) {
|
|
204
|
-
this._emit();
|
|
208
|
+
await this._emit();
|
|
205
209
|
this._currentEmitDelay -= this._emitDelay;
|
|
206
210
|
}
|
|
207
211
|
}
|
|
208
212
|
}
|
|
209
213
|
_calcPosition() {
|
|
210
214
|
if (this.options.domId) {
|
|
211
|
-
const
|
|
215
|
+
const element = document.getElementById(this.options.domId);
|
|
212
216
|
if (element) {
|
|
213
|
-
const elRect = element.getBoundingClientRect();
|
|
217
|
+
const elRect = element.getBoundingClientRect(), pxRatio = this.container.retina.pixelRatio;
|
|
214
218
|
return {
|
|
215
|
-
x: (elRect.x + elRect.width
|
|
216
|
-
y: (elRect.y + elRect.height
|
|
219
|
+
x: (elRect.x + elRect.width * half) * pxRatio,
|
|
220
|
+
y: (elRect.y + elRect.height * half) * pxRatio,
|
|
217
221
|
};
|
|
218
222
|
}
|
|
219
223
|
}
|
|
@@ -260,9 +264,14 @@ export class EmitterInstance {
|
|
|
260
264
|
if (this.spawnColor) {
|
|
261
265
|
const hslAnimation = this.options.spawnColor?.animation;
|
|
262
266
|
if (hslAnimation) {
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
267
|
+
const maxValues = {
|
|
268
|
+
h: 360,
|
|
269
|
+
s: 100,
|
|
270
|
+
l: 100,
|
|
271
|
+
}, colorFactor = 3.6;
|
|
272
|
+
this.spawnColor.h = this._setColorAnimation(hslAnimation.h, this.spawnColor.h, maxValues.h, colorFactor);
|
|
273
|
+
this.spawnColor.s = this._setColorAnimation(hslAnimation.s, this.spawnColor.s, maxValues.s);
|
|
274
|
+
this.spawnColor.l = this._setColorAnimation(hslAnimation.l, this.spawnColor.l, maxValues.l);
|
|
266
275
|
}
|
|
267
276
|
setParticlesOptionsColor(particlesOptions, this.spawnColor);
|
|
268
277
|
}
|
|
@@ -292,7 +301,7 @@ export class EmitterInstance {
|
|
|
292
301
|
}
|
|
293
302
|
}
|
|
294
303
|
if (position) {
|
|
295
|
-
this.container.particles.addParticle(position, particlesOptions);
|
|
304
|
+
await this.container.particles.addParticle(position, particlesOptions);
|
|
296
305
|
}
|
|
297
306
|
}
|
|
298
307
|
}
|
package/esm/Emitters.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { arrayRandomIndex, executeOnSingleOrMultiple, isArray, isNumber, itemFromArray, } from "@tsparticles/engine";
|
|
2
|
-
import { Emitter } from "./Options/Classes/Emitter.js";
|
|
3
|
-
import { EmitterInstance } from "./EmitterInstance.js";
|
|
4
2
|
export class Emitters {
|
|
5
3
|
constructor(engine, container) {
|
|
6
4
|
this.container = container;
|
|
@@ -14,8 +12,9 @@ export class Emitters {
|
|
|
14
12
|
},
|
|
15
13
|
value: [],
|
|
16
14
|
};
|
|
15
|
+
const defaultIndex = 0;
|
|
17
16
|
container.getEmitter = (idxOrName) => idxOrName === undefined || isNumber(idxOrName)
|
|
18
|
-
? this.array[idxOrName
|
|
17
|
+
? this.array[idxOrName ?? defaultIndex]
|
|
19
18
|
: this.array.find((t) => t.name === idxOrName);
|
|
20
19
|
container.addEmitter = async (options, position) => this.addEmitter(options, position);
|
|
21
20
|
container.removeEmitter = (idxOrName) => {
|
|
@@ -38,7 +37,7 @@ export class Emitters {
|
|
|
38
37
|
};
|
|
39
38
|
}
|
|
40
39
|
async addEmitter(options, position) {
|
|
41
|
-
const emitterOptions = new Emitter();
|
|
40
|
+
const { Emitter } = await import("./Options/Classes/Emitter.js"), { EmitterInstance } = await import("./EmitterInstance.js"), emitterOptions = new Emitter();
|
|
42
41
|
emitterOptions.load(options);
|
|
43
42
|
const emitter = new EmitterInstance(this._engine, this, this.container, emitterOptions, position);
|
|
44
43
|
await emitter.init();
|
|
@@ -52,7 +51,8 @@ export class Emitters {
|
|
|
52
51
|
}
|
|
53
52
|
let emittersModeOptions;
|
|
54
53
|
if (modeEmitters && isArray(modeEmitters.value)) {
|
|
55
|
-
|
|
54
|
+
const minLength = 0;
|
|
55
|
+
if (modeEmitters.value.length > minLength && modeEmitters.random.enable) {
|
|
56
56
|
emittersModeOptions = [];
|
|
57
57
|
const usedIndexes = [];
|
|
58
58
|
for (let i = 0; i < modeEmitters.random.count; i++) {
|
|
@@ -73,8 +73,8 @@ export class Emitters {
|
|
|
73
73
|
emittersModeOptions = modeEmitters?.value;
|
|
74
74
|
}
|
|
75
75
|
const emittersOptions = emittersModeOptions ?? emitterOptions, ePosition = this.container.interactivity.mouse.clickPosition;
|
|
76
|
-
executeOnSingleOrMultiple(emittersOptions, (emitter) => {
|
|
77
|
-
this.addEmitter(emitter, ePosition);
|
|
76
|
+
void executeOnSingleOrMultiple(emittersOptions, async (emitter) => {
|
|
77
|
+
await this.addEmitter(emitter, ePosition);
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
80
|
async init() {
|
|
@@ -103,9 +103,9 @@ export class Emitters {
|
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
removeEmitter(emitter) {
|
|
106
|
-
const index = this.array.indexOf(emitter);
|
|
107
|
-
if (index >=
|
|
108
|
-
this.array.splice(index,
|
|
106
|
+
const index = this.array.indexOf(emitter), minIndex = 0, deleteCount = 1;
|
|
107
|
+
if (index >= minIndex) {
|
|
108
|
+
this.array.splice(index, deleteCount);
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
resize() {
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { executeOnSingleOrMultiple, isArray, isInArray, } from "@tsparticles/engine";
|
|
2
|
+
import { Emitter } from "./Options/Classes/Emitter.js";
|
|
3
|
+
export class EmittersPlugin {
|
|
4
|
+
constructor(engine) {
|
|
5
|
+
this._engine = engine;
|
|
6
|
+
this.id = "emitters";
|
|
7
|
+
}
|
|
8
|
+
async getPlugin(container) {
|
|
9
|
+
const { Emitters } = await import("./Emitters.js");
|
|
10
|
+
return new Emitters(this._engine, container);
|
|
11
|
+
}
|
|
12
|
+
loadOptions(options, source) {
|
|
13
|
+
if (!this.needsPlugin(options) && !this.needsPlugin(source)) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
if (source?.emitters) {
|
|
17
|
+
options.emitters = executeOnSingleOrMultiple(source.emitters, (emitter) => {
|
|
18
|
+
const tmp = new Emitter();
|
|
19
|
+
tmp.load(emitter);
|
|
20
|
+
return tmp;
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
const interactivityEmitters = source?.interactivity?.modes?.emitters;
|
|
24
|
+
if (interactivityEmitters) {
|
|
25
|
+
if (isArray(interactivityEmitters)) {
|
|
26
|
+
options.interactivity.modes.emitters = {
|
|
27
|
+
random: {
|
|
28
|
+
count: 1,
|
|
29
|
+
enable: true,
|
|
30
|
+
},
|
|
31
|
+
value: interactivityEmitters.map((s) => {
|
|
32
|
+
const tmp = new Emitter();
|
|
33
|
+
tmp.load(s);
|
|
34
|
+
return tmp;
|
|
35
|
+
}),
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
const emitterMode = interactivityEmitters;
|
|
40
|
+
if (emitterMode.value !== undefined) {
|
|
41
|
+
const defaultCount = 1;
|
|
42
|
+
if (isArray(emitterMode.value)) {
|
|
43
|
+
options.interactivity.modes.emitters = {
|
|
44
|
+
random: {
|
|
45
|
+
count: emitterMode.random.count ?? defaultCount,
|
|
46
|
+
enable: emitterMode.random.enable ?? false,
|
|
47
|
+
},
|
|
48
|
+
value: emitterMode.value.map((s) => {
|
|
49
|
+
const tmp = new Emitter();
|
|
50
|
+
tmp.load(s);
|
|
51
|
+
return tmp;
|
|
52
|
+
}),
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
const tmp = new Emitter();
|
|
57
|
+
tmp.load(emitterMode.value);
|
|
58
|
+
options.interactivity.modes.emitters = {
|
|
59
|
+
random: {
|
|
60
|
+
count: emitterMode.random.count ?? defaultCount,
|
|
61
|
+
enable: emitterMode.random.enable ?? false,
|
|
62
|
+
},
|
|
63
|
+
value: tmp,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
const emitterOptions = (options.interactivity.modes.emitters = {
|
|
69
|
+
random: {
|
|
70
|
+
count: 1,
|
|
71
|
+
enable: false,
|
|
72
|
+
},
|
|
73
|
+
value: new Emitter(),
|
|
74
|
+
});
|
|
75
|
+
emitterOptions.value.load(interactivityEmitters);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
needsPlugin(options) {
|
|
81
|
+
if (!options) {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
const emitters = options.emitters;
|
|
85
|
+
return ((isArray(emitters) && !!emitters.length) ||
|
|
86
|
+
emitters !== undefined ||
|
|
87
|
+
(!!options.interactivity?.events?.onClick?.mode &&
|
|
88
|
+
isInArray("emitter", options.interactivity.events.onClick.mode)));
|
|
89
|
+
}
|
|
90
|
+
}
|
package/esm/index.js
CHANGED
|
@@ -1,95 +1,6 @@
|
|
|
1
|
-
import { executeOnSingleOrMultiple, isArray, isInArray, } from "@tsparticles/engine";
|
|
2
|
-
import { Emitter } from "./Options/Classes/Emitter.js";
|
|
3
|
-
import { Emitters } from "./Emitters.js";
|
|
4
|
-
import { ShapeManager } from "./ShapeManager.js";
|
|
5
|
-
class EmittersPlugin {
|
|
6
|
-
constructor(engine) {
|
|
7
|
-
this._engine = engine;
|
|
8
|
-
this.id = "emitters";
|
|
9
|
-
}
|
|
10
|
-
getPlugin(container) {
|
|
11
|
-
return new Emitters(this._engine, container);
|
|
12
|
-
}
|
|
13
|
-
loadOptions(options, source) {
|
|
14
|
-
if (!this.needsPlugin(options) && !this.needsPlugin(source)) {
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
if (source?.emitters) {
|
|
18
|
-
options.emitters = executeOnSingleOrMultiple(source.emitters, (emitter) => {
|
|
19
|
-
const tmp = new Emitter();
|
|
20
|
-
tmp.load(emitter);
|
|
21
|
-
return tmp;
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
const interactivityEmitters = source?.interactivity?.modes?.emitters;
|
|
25
|
-
if (interactivityEmitters) {
|
|
26
|
-
if (isArray(interactivityEmitters)) {
|
|
27
|
-
options.interactivity.modes.emitters = {
|
|
28
|
-
random: {
|
|
29
|
-
count: 1,
|
|
30
|
-
enable: true,
|
|
31
|
-
},
|
|
32
|
-
value: interactivityEmitters.map((s) => {
|
|
33
|
-
const tmp = new Emitter();
|
|
34
|
-
tmp.load(s);
|
|
35
|
-
return tmp;
|
|
36
|
-
}),
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
const emitterMode = interactivityEmitters;
|
|
41
|
-
if (emitterMode.value !== undefined) {
|
|
42
|
-
if (isArray(emitterMode.value)) {
|
|
43
|
-
options.interactivity.modes.emitters = {
|
|
44
|
-
random: {
|
|
45
|
-
count: emitterMode.random.count ?? 1,
|
|
46
|
-
enable: emitterMode.random.enable ?? false,
|
|
47
|
-
},
|
|
48
|
-
value: emitterMode.value.map((s) => {
|
|
49
|
-
const tmp = new Emitter();
|
|
50
|
-
tmp.load(s);
|
|
51
|
-
return tmp;
|
|
52
|
-
}),
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
const tmp = new Emitter();
|
|
57
|
-
tmp.load(emitterMode.value);
|
|
58
|
-
options.interactivity.modes.emitters = {
|
|
59
|
-
random: {
|
|
60
|
-
count: emitterMode.random.count ?? 1,
|
|
61
|
-
enable: emitterMode.random.enable ?? false,
|
|
62
|
-
},
|
|
63
|
-
value: tmp,
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
68
|
-
const emitterOptions = (options.interactivity.modes.emitters = {
|
|
69
|
-
random: {
|
|
70
|
-
count: 1,
|
|
71
|
-
enable: false,
|
|
72
|
-
},
|
|
73
|
-
value: new Emitter(),
|
|
74
|
-
});
|
|
75
|
-
emitterOptions.value.load(interactivityEmitters);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
needsPlugin(options) {
|
|
81
|
-
if (!options) {
|
|
82
|
-
return false;
|
|
83
|
-
}
|
|
84
|
-
const emitters = options.emitters;
|
|
85
|
-
return ((isArray(emitters) && !!emitters.length) ||
|
|
86
|
-
emitters !== undefined ||
|
|
87
|
-
(!!options.interactivity?.events?.onClick?.mode &&
|
|
88
|
-
isInArray("emitter", options.interactivity.events.onClick.mode)));
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
1
|
export async function loadEmittersPlugin(engine, refresh = true) {
|
|
92
2
|
if (!engine.emitterShapeManager) {
|
|
3
|
+
const { ShapeManager } = await import("./ShapeManager.js");
|
|
93
4
|
engine.emitterShapeManager = new ShapeManager(engine);
|
|
94
5
|
}
|
|
95
6
|
if (!engine.addEmitterShapeGenerator) {
|
|
@@ -97,7 +8,7 @@ export async function loadEmittersPlugin(engine, refresh = true) {
|
|
|
97
8
|
engine.emitterShapeManager?.addShapeGenerator(name, generator);
|
|
98
9
|
};
|
|
99
10
|
}
|
|
100
|
-
const plugin = new EmittersPlugin(engine);
|
|
11
|
+
const { EmittersPlugin } = await import("./EmittersPlugin.js"), plugin = new EmittersPlugin(engine);
|
|
101
12
|
await engine.addPlugin(plugin, refresh);
|
|
102
13
|
}
|
|
103
14
|
export * from "./EmitterContainer.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/plugin-emitters",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "tsParticles emitters plugin",
|
|
5
5
|
"homepage": "https://particles.js.org",
|
|
6
6
|
"repository": {
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"./package.json": "./package.json"
|
|
87
87
|
},
|
|
88
88
|
"dependencies": {
|
|
89
|
-
"@tsparticles/engine": "^3.0
|
|
89
|
+
"@tsparticles/engine": "^3.2.0"
|
|
90
90
|
},
|
|
91
91
|
"publishConfig": {
|
|
92
92
|
"access": "public"
|
package/report.html
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8"/>
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
6
|
-
<title>@tsparticles/plugin-emitters [
|
|
6
|
+
<title>@tsparticles/plugin-emitters [31 Jan 2024 at 02:07]</title>
|
|
7
7
|
<link rel="shortcut icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAABrVBMVEUAAAD///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////+O1foceMD///+J0/qK1Pr7/v8Xdr/9///W8P4UdL7L7P0Scr2r4Pyj3vwad8D5/f/2/f+55f3E6f34+/2H0/ojfMKpzOd0rNgQcb3F3O/j9f7c8v6g3Pz0/P/w+v/q+P7n9v6T1/uQ1vuE0vqLut/y+v+Z2fvt+f+15Pzv9fuc2/vR7v2V2Pvd6/bg9P7I6/285/2y4/yp3/zp8vk8i8kqgMT7/P31+fyv4vxGkcz6/P6/6P3j7vfS5PNnpNUxhcbO7f7F6v3O4vHK3/DA2u631Ouy0eqXweKJud5wqthfoNMMbLvY8f73+v2dxeR8sNtTmdDx9/zX6PSjyeaCtd1YnNGX2PuQveCGt95Nls42h8dLlM3F4vBtAAAAM3RSTlMAAyOx0/sKBvik8opWGBMOAe3l1snDm2E9LSb06eHcu5JpHbarfHZCN9CBb08zzkdNS0kYaptYAAAFV0lEQVRYw92X51/aYBDHHS2O2qqttVbrqNq9m+TJIAYIShBkWwqIiCgoWvfeq7Z2/s29hyQNyUcR7LveGwVyXy6XH8/9rqxglLfUPLxVduUor3h0rfp2TYvpivk37929TkG037hffoX0+peVtZQc1589rigVUdXS/ABSAyEmGIO/1XfvldSK8vs3OqB6u3m0nxmIrvgB0dj7rr7Y9IbuF68hnfFaiHA/sxqm0wciIG43P60qKv9WXWc1RXGh/mFESFABTSBi0sNAKzqet17eCtOb3kZIDwxEEU0oAIJGYxNBDhBND29e0rtXXbcpuPmED9IhEAAQ/AXEaF8EPmnrrKsv0LvWR3fg5sWDNAFZOgAgaKvZDogHNU9MFwnnYROkc56RD5CjAbQX9Ow4g7upCsvYu55aSI/Nj0H1akgKQEUM94dwK65hYRmFU9MIcH/fqJYOZYcnuJSU/waKDgTOEVaVKhwrTRP5XzgSpAITYzom7UvkhFX5VutmxeNnWDjjswTKTyfgluNDGbUpWissXhF3s7mlSml+czWkg3D0l1nNjGNjz3myOQOa1KM/jOS6ebdbAVTCi4gljHSFrviza7tOgRWcS0MOUX9zdNgag5w7rRqA44Lzw0hr1WqES36dFliSJFlh2rXIae3FFcDDgKdxrUIDePr8jGcSClV1u7A9xeN0ModY/pHMxmR1EzRh8TJiwqsHmKW0l4FCEZI+jHio+JdPPE9qwQtTRxku2D8sIeRL2LnxWSllANCQGOIiqVHAz2ye2JR0DcH+HoxDkaADLjgxjKQ+AwCX/g0+DNgdG0ukYCONAe+dbc2IAc6fwt1ARoDSezNHxV2Cmzwv3O6lDMV55edBGwGK9n1+x2F8EDfAGCxug8MhpsMEcTEAWf3rx2vZhe/LAmtIn/6apE6PN0ULKgywD9mmdxbmFl3OvD5AS5fW5zLbv/YHmcsBTjf/afDz3MaZTVCfAP9z6/Bw6ycv8EUBWJIn9zYcoAWWlW9+OzO3vkTy8H+RANLmdrpOuYWdZYEXpo+TlCJrW5EARb7fF+bWdqf3hhyZI1nWJQHgznErZhbjoEsWqi8dQNoE294aldzFurwSABL2XXMf9+H1VQGke9exw5P/AnA5Pv5ngMul7LOvO922iwACu8WkCwLCafvM4CeWPxfA8lNHcWZSoi8EwMAIciKX2Z4SWCMAa3snCZ/G4EA8D6CMLNFsGQhkkz/gQNEBbPCbWsxGUpYVu3z8IyNAknwJkfPMEhLyrdi5RTyUVACkw4GSFRNWJNEW+fgPGwHD8/JxnRuLabN4CGNRkAE23na2+VmEAUmrYymSGjMAYqH84YUIyzgzs3XC7gNgH36Vcc4zKY9o9fgPBXUAiHHwVboBHGLiX6Zcjp1f2wu4tvzZKo0ecPnDtQYDQvJXaBeNzce45Fp28ZQLrEZVuFqgBwOalArKXnW1UzlnSusQKJqKYNuz4tOnI6sZG4zanpemv+7ySU2jbA9h6uhcgpfy6G2PahirDZ6zvq6zDduMVFTKvzw8wgyEdelwY9in3XkEPs3osJuwRQ4qTkfzifndg9Gfc4pdsu82+tTnHZTBa2EAMrqr2t43pguc8tNm7JQVQ2S0ukj2d22dhXYP0/veWtwKrCkNoNimAN5+Xr/oLrxswKbVJjteWrX7eR63o4j9q0GxnaBdWgGA5VStpanIjQmEhV0/nVt5VOFUvix6awJhPcAaTEShgrG+iGyvb5a0Ndb1YGHFPEwoqAinoaykaID1o1pdPNu7XsnCKQ3R+hwWIIhGvORcJUBYXe3Xa3vq/mF/N9V13ugufMkfXn+KHsRD0B8AAAAASUVORK5CYII=" type="image/x-icon" />
|
|
8
8
|
|
|
9
9
|
<script>
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
<body>
|
|
32
32
|
<div id="app"></div>
|
|
33
33
|
<script>
|
|
34
|
-
window.chartData = [
|
|
35
|
-
window.entrypoints = ["tsparticles.plugin.emitters
|
|
34
|
+
window.chartData = [];
|
|
35
|
+
window.entrypoints = ["tsparticles.plugin.emitters.min"];
|
|
36
36
|
window.defaultSizes = "parsed";
|
|
37
37
|
</script>
|
|
38
38
|
</body>
|