@tsparticles/plugin-emitters 4.0.0-alpha.2 → 4.0.0-alpha.21
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/278.min.js +1 -0
- package/615.min.js +1 -0
- package/751.min.js +1 -0
- package/816.min.js +1 -0
- package/88.min.js +1 -0
- package/975.min.js +1 -0
- package/README.md +5 -0
- package/browser/EmitterInstance.js +69 -47
- package/browser/EmitterShapeBase.js +4 -0
- package/browser/EmittersInstancesManager.js +71 -0
- package/browser/EmittersInteractor.js +114 -0
- package/browser/EmittersPlugin.js +10 -56
- package/browser/EmittersPluginInstance.js +44 -0
- package/browser/Options/Classes/Emitter.js +13 -0
- package/browser/Options/Classes/EmitterLife.js +4 -0
- package/browser/Options/Classes/EmitterRate.js +2 -0
- package/browser/Options/Classes/EmitterShape.js +3 -0
- package/browser/Options/Classes/EmitterShapeReplace.js +2 -0
- package/browser/Options/Classes/EmitterSize.js +3 -0
- package/browser/ShapeManager.js +4 -4
- package/browser/constants.js +4 -0
- package/browser/index.js +20 -6
- package/cjs/EmitterInstance.js +69 -47
- package/cjs/EmitterShapeBase.js +4 -0
- package/cjs/EmittersInstancesManager.js +71 -0
- package/cjs/EmittersInteractor.js +114 -0
- package/cjs/EmittersPlugin.js +10 -56
- package/cjs/EmittersPluginInstance.js +44 -0
- package/cjs/Options/Classes/Emitter.js +13 -0
- package/cjs/Options/Classes/EmitterLife.js +4 -0
- package/cjs/Options/Classes/EmitterRate.js +2 -0
- package/cjs/Options/Classes/EmitterShape.js +3 -0
- package/cjs/Options/Classes/EmitterShapeReplace.js +2 -0
- package/cjs/Options/Classes/EmitterSize.js +3 -0
- package/cjs/ShapeManager.js +4 -4
- package/cjs/constants.js +4 -0
- package/cjs/index.js +20 -6
- package/dist_browser_EmitterInstance_js.js +30 -0
- package/dist_browser_EmittersInstancesManager_js.js +90 -0
- package/dist_browser_EmittersInteractor_js.js +100 -0
- package/dist_browser_EmittersPluginInstance_js.js +30 -0
- package/dist_browser_EmittersPlugin_js.js +8 -28
- package/dist_browser_ShapeManager_js.js +2 -2
- package/esm/EmitterInstance.js +69 -47
- package/esm/EmitterShapeBase.js +4 -0
- package/esm/EmittersInstancesManager.js +71 -0
- package/esm/EmittersInteractor.js +114 -0
- package/esm/EmittersPlugin.js +10 -56
- package/esm/EmittersPluginInstance.js +44 -0
- package/esm/Options/Classes/Emitter.js +13 -0
- package/esm/Options/Classes/EmitterLife.js +4 -0
- package/esm/Options/Classes/EmitterRate.js +2 -0
- package/esm/Options/Classes/EmitterShape.js +3 -0
- package/esm/Options/Classes/EmitterShapeReplace.js +2 -0
- package/esm/Options/Classes/EmitterSize.js +3 -0
- package/esm/ShapeManager.js +4 -4
- package/esm/constants.js +4 -0
- package/esm/index.js +20 -6
- package/package.json +3 -2
- package/report.html +3 -3
- package/tsparticles.plugin.emitters.js +58 -18
- package/tsparticles.plugin.emitters.min.js +2 -2
- package/types/EmitterContainer.d.ts +8 -7
- package/types/EmitterInstance.d.ts +2 -3
- package/types/EmittersEngine.d.ts +2 -2
- package/types/EmittersInstancesManager.d.ts +15 -0
- package/types/EmittersInteractor.d.ts +18 -0
- package/types/EmittersPlugin.d.ts +7 -8
- package/types/EmittersPluginInstance.d.ts +14 -0
- package/types/IEmitterShapeGenerator.d.ts +2 -2
- package/types/constants.d.ts +2 -0
- package/types/index.d.ts +3 -2
- package/types/types.d.ts +15 -9
- package/umd/EmitterInstance.js +69 -47
- package/umd/EmitterShapeBase.js +4 -0
- package/umd/EmittersInstancesManager.js +119 -0
- package/umd/EmittersInteractor.js +128 -0
- package/umd/EmittersPlugin.js +44 -56
- package/umd/EmittersPluginInstance.js +58 -0
- package/umd/Options/Classes/Emitter.js +13 -0
- package/umd/Options/Classes/EmitterLife.js +4 -0
- package/umd/Options/Classes/EmitterRate.js +2 -0
- package/umd/Options/Classes/EmitterShape.js +3 -0
- package/umd/Options/Classes/EmitterShapeReplace.js +2 -0
- package/umd/Options/Classes/EmitterSize.js +3 -0
- package/umd/ShapeManager.js +4 -4
- package/umd/constants.js +17 -0
- package/umd/index.js +21 -6
- package/214.min.js +0 -2
- package/214.min.js.LICENSE.txt +0 -1
- package/921.min.js +0 -2
- package/921.min.js.LICENSE.txt +0 -1
- package/browser/Emitters.js +0 -128
- package/cjs/Emitters.js +0 -128
- package/esm/Emitters.js +0 -128
- package/tsparticles.plugin.emitters.min.js.LICENSE.txt +0 -1
- package/types/Emitters.d.ts +0 -24
- package/umd/Emitters.js +0 -142
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
2
|
+
if (k2 === undefined) k2 = k;
|
|
3
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
4
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
5
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
6
|
+
}
|
|
7
|
+
Object.defineProperty(o, k2, desc);
|
|
8
|
+
}) : (function(o, m, k, k2) {
|
|
9
|
+
if (k2 === undefined) k2 = k;
|
|
10
|
+
o[k2] = m[k];
|
|
11
|
+
}));
|
|
12
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
13
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
14
|
+
}) : function(o, v) {
|
|
15
|
+
o["default"] = v;
|
|
16
|
+
});
|
|
17
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
18
|
+
var ownKeys = function(o) {
|
|
19
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
20
|
+
var ar = [];
|
|
21
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
22
|
+
return ar;
|
|
23
|
+
};
|
|
24
|
+
return ownKeys(o);
|
|
25
|
+
};
|
|
26
|
+
return function (mod) {
|
|
27
|
+
if (mod && mod.__esModule) return mod;
|
|
28
|
+
var result = {};
|
|
29
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
30
|
+
__setModuleDefault(result, mod);
|
|
31
|
+
return result;
|
|
32
|
+
};
|
|
33
|
+
})();
|
|
34
|
+
(function (factory) {
|
|
35
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
36
|
+
var v = factory(require, exports);
|
|
37
|
+
if (v !== undefined) module.exports = v;
|
|
38
|
+
}
|
|
39
|
+
else if (typeof define === "function" && define.amd) {
|
|
40
|
+
define(["require", "exports", "@tsparticles/engine", "./Options/Classes/Emitter.js"], factory);
|
|
41
|
+
}
|
|
42
|
+
})(function (require, exports) {
|
|
43
|
+
"use strict";
|
|
44
|
+
var __syncRequire = typeof module === "object" && typeof module.exports === "object";
|
|
45
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
+
exports.EmittersInstancesManager = void 0;
|
|
47
|
+
const engine_1 = require("@tsparticles/engine");
|
|
48
|
+
const Emitter_js_1 = require("./Options/Classes/Emitter.js");
|
|
49
|
+
const defaultIndex = 0;
|
|
50
|
+
class EmittersInstancesManager {
|
|
51
|
+
_containerArrays;
|
|
52
|
+
_engine;
|
|
53
|
+
constructor(engine) {
|
|
54
|
+
this._containerArrays = new Map();
|
|
55
|
+
this._engine = engine;
|
|
56
|
+
}
|
|
57
|
+
async addEmitter(container, options, position) {
|
|
58
|
+
const emitterOptions = new Emitter_js_1.Emitter();
|
|
59
|
+
emitterOptions.load(options);
|
|
60
|
+
const { EmitterInstance } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./EmitterInstance.js"))) : new Promise((resolve_1, reject_1) => { require(["./EmitterInstance.js"], resolve_1, reject_1); }).then(__importStar)), emitter = new EmitterInstance(this._engine, container, (emitter) => {
|
|
61
|
+
this.removeEmitter(container, emitter);
|
|
62
|
+
}, emitterOptions, position);
|
|
63
|
+
await emitter.init();
|
|
64
|
+
this.getArray(container).push(emitter);
|
|
65
|
+
return emitter;
|
|
66
|
+
}
|
|
67
|
+
clear(container) {
|
|
68
|
+
this.initContainer(container);
|
|
69
|
+
this._containerArrays.set(container, []);
|
|
70
|
+
}
|
|
71
|
+
getArray(container) {
|
|
72
|
+
this.initContainer(container);
|
|
73
|
+
let array = this._containerArrays.get(container);
|
|
74
|
+
if (!array) {
|
|
75
|
+
array = [];
|
|
76
|
+
this._containerArrays.set(container, array);
|
|
77
|
+
}
|
|
78
|
+
return array;
|
|
79
|
+
}
|
|
80
|
+
initContainer(container) {
|
|
81
|
+
if (this._containerArrays.has(container)) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
this._containerArrays.set(container, []);
|
|
85
|
+
container.getEmitter = (idxOrName) => {
|
|
86
|
+
const array = this.getArray(container);
|
|
87
|
+
return idxOrName === undefined || (0, engine_1.isNumber)(idxOrName)
|
|
88
|
+
? array[idxOrName ?? defaultIndex]
|
|
89
|
+
: array.find(t => t.name === idxOrName);
|
|
90
|
+
};
|
|
91
|
+
container.addEmitter = async (options, position) => this.addEmitter(container, options, position);
|
|
92
|
+
container.removeEmitter = (idxOrName) => {
|
|
93
|
+
const emitter = container.getEmitter?.(idxOrName);
|
|
94
|
+
if (emitter) {
|
|
95
|
+
this.removeEmitter(container, emitter);
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
container.playEmitter = (idxOrName) => {
|
|
99
|
+
const emitter = container.getEmitter?.(idxOrName);
|
|
100
|
+
if (emitter) {
|
|
101
|
+
emitter.externalPlay();
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
container.pauseEmitter = (idxOrName) => {
|
|
105
|
+
const emitter = container.getEmitter?.(idxOrName);
|
|
106
|
+
if (emitter) {
|
|
107
|
+
emitter.externalPause();
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
removeEmitter(container, emitter) {
|
|
112
|
+
const index = this.getArray(container).indexOf(emitter), minIndex = 0, deleteCount = 1;
|
|
113
|
+
if (index >= minIndex) {
|
|
114
|
+
this.getArray(container).splice(index, deleteCount);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
exports.EmittersInstancesManager = EmittersInstancesManager;
|
|
119
|
+
});
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
(function (factory) {
|
|
2
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
+
var v = factory(require, exports);
|
|
4
|
+
if (v !== undefined) module.exports = v;
|
|
5
|
+
}
|
|
6
|
+
else if (typeof define === "function" && define.amd) {
|
|
7
|
+
define(["require", "exports", "@tsparticles/plugin-interactivity", "@tsparticles/engine", "./Options/Classes/Emitter.js", "./constants.js"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.EmittersInteractor = void 0;
|
|
13
|
+
const plugin_interactivity_1 = require("@tsparticles/plugin-interactivity");
|
|
14
|
+
const engine_1 = require("@tsparticles/engine");
|
|
15
|
+
const Emitter_js_1 = require("./Options/Classes/Emitter.js");
|
|
16
|
+
const constants_js_1 = require("./constants.js");
|
|
17
|
+
const emittersMode = "emitters";
|
|
18
|
+
class EmittersInteractor extends plugin_interactivity_1.ExternalInteractorBase {
|
|
19
|
+
handleClickMode;
|
|
20
|
+
_instancesManager;
|
|
21
|
+
constructor(instancesManager, container) {
|
|
22
|
+
super(container);
|
|
23
|
+
this._instancesManager = instancesManager;
|
|
24
|
+
this.handleClickMode = (mode, interactivityData) => {
|
|
25
|
+
const container = this.container, options = container.actualOptions, modeEmitters = options.interactivity.modes.emitters;
|
|
26
|
+
if (!modeEmitters || mode !== emittersMode) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
let emittersModeOptions;
|
|
30
|
+
if ((0, engine_1.isArray)(modeEmitters.value)) {
|
|
31
|
+
const minLength = 0, modeEmittersCount = modeEmitters.value.length;
|
|
32
|
+
if (modeEmittersCount > minLength && modeEmitters.random.enable) {
|
|
33
|
+
emittersModeOptions = [];
|
|
34
|
+
const usedIndexes = new Set();
|
|
35
|
+
for (let i = 0; i < modeEmitters.random.count; i++) {
|
|
36
|
+
const idx = (0, engine_1.arrayRandomIndex)(modeEmitters.value);
|
|
37
|
+
if (usedIndexes.has(idx) && usedIndexes.size < modeEmittersCount) {
|
|
38
|
+
i--;
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
usedIndexes.add(idx);
|
|
42
|
+
const selectedOptions = (0, engine_1.itemFromArray)(modeEmitters.value, idx);
|
|
43
|
+
if (!selectedOptions) {
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
emittersModeOptions.push(selectedOptions);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
emittersModeOptions = modeEmitters.value;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
emittersModeOptions = modeEmitters.value;
|
|
55
|
+
}
|
|
56
|
+
const emittersOptions = emittersModeOptions, ePosition = interactivityData.mouse.clickPosition;
|
|
57
|
+
void (0, engine_1.executeOnSingleOrMultiple)(emittersOptions, async (emitter) => {
|
|
58
|
+
await this._instancesManager.addEmitter(this.container, emitter, ePosition);
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
clear() {
|
|
63
|
+
}
|
|
64
|
+
init() {
|
|
65
|
+
}
|
|
66
|
+
interact(_interactivityData, delta) {
|
|
67
|
+
for (const emitter of this._instancesManager.getArray(this.container)) {
|
|
68
|
+
emitter.update(delta);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
isEnabled(interactivityData, particle) {
|
|
72
|
+
const container = this.container, options = container.actualOptions, mouse = interactivityData.mouse, events = (particle?.interactivity ?? options.interactivity).events;
|
|
73
|
+
if (!mouse.clickPosition || !events.onClick.enable) {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
return (0, engine_1.isInArray)(emittersMode, events.onClick.mode);
|
|
77
|
+
}
|
|
78
|
+
loadModeOptions(options, ...sources) {
|
|
79
|
+
options.emitters = {
|
|
80
|
+
random: constants_js_1.defaultRandomOptions,
|
|
81
|
+
value: [],
|
|
82
|
+
};
|
|
83
|
+
for (const source of sources) {
|
|
84
|
+
if (!source?.emitters) {
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
if ((0, engine_1.isArray)(source.emitters)) {
|
|
88
|
+
for (const emitter of source.emitters) {
|
|
89
|
+
const tmp = new Emitter_js_1.Emitter();
|
|
90
|
+
tmp.load(emitter);
|
|
91
|
+
options.emitters.value.push(tmp);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
else if (Object.hasOwn(source.emitters, "value")) {
|
|
95
|
+
const emitterModeOptions = source.emitters;
|
|
96
|
+
options.emitters.random.enable = emitterModeOptions.random?.enable ?? options.emitters.random.enable;
|
|
97
|
+
options.emitters.random.count = emitterModeOptions.random?.count ?? options.emitters.random.count;
|
|
98
|
+
if ((0, engine_1.isArray)(emitterModeOptions.value)) {
|
|
99
|
+
for (const emitter of emitterModeOptions.value) {
|
|
100
|
+
const tmp = new Emitter_js_1.Emitter();
|
|
101
|
+
tmp.load(emitter);
|
|
102
|
+
options.emitters.value.push(tmp);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
const tmp = new Emitter_js_1.Emitter();
|
|
107
|
+
tmp.load(emitterModeOptions.value);
|
|
108
|
+
options.emitters.value.push(tmp);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
const tmp = new Emitter_js_1.Emitter();
|
|
113
|
+
tmp.load(source.emitters);
|
|
114
|
+
options.emitters.value.push(tmp);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
removeEmitter(emitter) {
|
|
119
|
+
const index = this._instancesManager.getArray(this.container).indexOf(emitter), minIndex = 0, deleteCount = 1;
|
|
120
|
+
if (index >= minIndex) {
|
|
121
|
+
this._instancesManager.getArray(this.container).splice(index, deleteCount);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
reset() {
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
exports.EmittersInteractor = EmittersInteractor;
|
|
128
|
+
});
|
package/umd/EmittersPlugin.js
CHANGED
|
@@ -1,28 +1,62 @@
|
|
|
1
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
2
|
+
if (k2 === undefined) k2 = k;
|
|
3
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
4
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
5
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
6
|
+
}
|
|
7
|
+
Object.defineProperty(o, k2, desc);
|
|
8
|
+
}) : (function(o, m, k, k2) {
|
|
9
|
+
if (k2 === undefined) k2 = k;
|
|
10
|
+
o[k2] = m[k];
|
|
11
|
+
}));
|
|
12
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
13
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
14
|
+
}) : function(o, v) {
|
|
15
|
+
o["default"] = v;
|
|
16
|
+
});
|
|
17
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
18
|
+
var ownKeys = function(o) {
|
|
19
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
20
|
+
var ar = [];
|
|
21
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
22
|
+
return ar;
|
|
23
|
+
};
|
|
24
|
+
return ownKeys(o);
|
|
25
|
+
};
|
|
26
|
+
return function (mod) {
|
|
27
|
+
if (mod && mod.__esModule) return mod;
|
|
28
|
+
var result = {};
|
|
29
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
30
|
+
__setModuleDefault(result, mod);
|
|
31
|
+
return result;
|
|
32
|
+
};
|
|
33
|
+
})();
|
|
1
34
|
(function (factory) {
|
|
2
35
|
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
36
|
var v = factory(require, exports);
|
|
4
37
|
if (v !== undefined) module.exports = v;
|
|
5
38
|
}
|
|
6
39
|
else if (typeof define === "function" && define.amd) {
|
|
7
|
-
define(["require", "exports", "@tsparticles/engine", "./Options/Classes/Emitter.js"
|
|
40
|
+
define(["require", "exports", "@tsparticles/engine", "./Options/Classes/Emitter.js"], factory);
|
|
8
41
|
}
|
|
9
42
|
})(function (require, exports) {
|
|
10
43
|
"use strict";
|
|
44
|
+
var __syncRequire = typeof module === "object" && typeof module.exports === "object";
|
|
11
45
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
46
|
exports.EmittersPlugin = void 0;
|
|
13
47
|
const engine_1 = require("@tsparticles/engine");
|
|
14
48
|
const Emitter_js_1 = require("./Options/Classes/Emitter.js");
|
|
15
|
-
const EmitterClickMode_js_1 = require("./Enums/EmitterClickMode.js");
|
|
16
|
-
const Emitters_js_1 = require("./Emitters.js");
|
|
17
49
|
class EmittersPlugin {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
50
|
+
id = "emitters";
|
|
51
|
+
_instancesManager;
|
|
52
|
+
constructor(instancesManager) {
|
|
53
|
+
this._instancesManager = instancesManager;
|
|
21
54
|
}
|
|
22
|
-
getPlugin(container) {
|
|
23
|
-
|
|
55
|
+
async getPlugin(container) {
|
|
56
|
+
const { EmittersPluginInstance } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./EmittersPluginInstance.js"))) : new Promise((resolve_1, reject_1) => { require(["./EmittersPluginInstance.js"], resolve_1, reject_1); }).then(__importStar));
|
|
57
|
+
return new EmittersPluginInstance(this._instancesManager, container);
|
|
24
58
|
}
|
|
25
|
-
loadOptions(options, source) {
|
|
59
|
+
loadOptions(_container, options, source) {
|
|
26
60
|
if (!this.needsPlugin(options) && !this.needsPlugin(source)) {
|
|
27
61
|
return;
|
|
28
62
|
}
|
|
@@ -33,59 +67,13 @@
|
|
|
33
67
|
return tmp;
|
|
34
68
|
});
|
|
35
69
|
}
|
|
36
|
-
const interactivityEmitters = source?.interactivity?.modes?.emitters;
|
|
37
|
-
if (interactivityEmitters) {
|
|
38
|
-
if ((0, engine_1.isArray)(interactivityEmitters)) {
|
|
39
|
-
options.interactivity.modes.emitters = {
|
|
40
|
-
random: {
|
|
41
|
-
count: 1,
|
|
42
|
-
enable: true,
|
|
43
|
-
},
|
|
44
|
-
value: interactivityEmitters.map(s => {
|
|
45
|
-
const tmp = new Emitter_js_1.Emitter();
|
|
46
|
-
tmp.load(s);
|
|
47
|
-
return tmp;
|
|
48
|
-
}),
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
const emitterMode = interactivityEmitters;
|
|
53
|
-
if ((0, engine_1.isArray)(emitterMode.value)) {
|
|
54
|
-
options.interactivity.modes.emitters = {
|
|
55
|
-
random: {
|
|
56
|
-
count: emitterMode.random.count,
|
|
57
|
-
enable: emitterMode.random.enable,
|
|
58
|
-
},
|
|
59
|
-
value: emitterMode.value.map(s => {
|
|
60
|
-
const tmp = new Emitter_js_1.Emitter();
|
|
61
|
-
tmp.load(s);
|
|
62
|
-
return tmp;
|
|
63
|
-
}),
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
const tmp = new Emitter_js_1.Emitter();
|
|
68
|
-
tmp.load(emitterMode.value);
|
|
69
|
-
options.interactivity.modes.emitters = {
|
|
70
|
-
random: {
|
|
71
|
-
count: emitterMode.random.count,
|
|
72
|
-
enable: emitterMode.random.enable,
|
|
73
|
-
},
|
|
74
|
-
value: tmp,
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
70
|
}
|
|
80
71
|
needsPlugin(options) {
|
|
81
72
|
if (!options) {
|
|
82
73
|
return false;
|
|
83
74
|
}
|
|
84
75
|
const emitters = options.emitters;
|
|
85
|
-
return ((
|
|
86
|
-
emitters !== undefined ||
|
|
87
|
-
(!!options.interactivity?.events?.onClick?.mode &&
|
|
88
|
-
(0, engine_1.isInArray)(EmitterClickMode_js_1.EmitterClickMode.emitter, options.interactivity.events.onClick.mode)));
|
|
76
|
+
return ((0, engine_1.isArray)(emitters) && !!emitters.length) || emitters !== undefined;
|
|
89
77
|
}
|
|
90
78
|
}
|
|
91
79
|
exports.EmittersPlugin = EmittersPlugin;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
(function (factory) {
|
|
2
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
+
var v = factory(require, exports);
|
|
4
|
+
if (v !== undefined) module.exports = v;
|
|
5
|
+
}
|
|
6
|
+
else if (typeof define === "function" && define.amd) {
|
|
7
|
+
define(["require", "exports", "@tsparticles/engine"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.EmittersPluginInstance = void 0;
|
|
13
|
+
const engine_1 = require("@tsparticles/engine");
|
|
14
|
+
class EmittersPluginInstance {
|
|
15
|
+
container;
|
|
16
|
+
_instancesManager;
|
|
17
|
+
constructor(instancesManager, container) {
|
|
18
|
+
this.container = container;
|
|
19
|
+
this._instancesManager = instancesManager;
|
|
20
|
+
this._instancesManager.initContainer(container);
|
|
21
|
+
}
|
|
22
|
+
async init() {
|
|
23
|
+
const emittersOptions = this.container.actualOptions.emitters;
|
|
24
|
+
if ((0, engine_1.isArray)(emittersOptions)) {
|
|
25
|
+
for (const emitterOptions of emittersOptions) {
|
|
26
|
+
await this._instancesManager.addEmitter(this.container, emitterOptions);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
await this._instancesManager.addEmitter(this.container, emittersOptions);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
pause() {
|
|
34
|
+
for (const emitter of this._instancesManager.getArray(this.container)) {
|
|
35
|
+
emitter.pause();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
play() {
|
|
39
|
+
for (const emitter of this._instancesManager.getArray(this.container)) {
|
|
40
|
+
emitter.play();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
resize() {
|
|
44
|
+
for (const emitter of this._instancesManager.getArray(this.container)) {
|
|
45
|
+
emitter.resize();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
stop() {
|
|
49
|
+
this._instancesManager.clear(this.container);
|
|
50
|
+
}
|
|
51
|
+
update(delta) {
|
|
52
|
+
this._instancesManager.getArray(this.container).forEach(emitter => {
|
|
53
|
+
emitter.update(delta);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.EmittersPluginInstance = EmittersPluginInstance;
|
|
58
|
+
});
|
|
@@ -16,6 +16,19 @@
|
|
|
16
16
|
const EmitterShape_js_1 = require("./EmitterShape.js");
|
|
17
17
|
const EmitterSize_js_1 = require("./EmitterSize.js");
|
|
18
18
|
class Emitter {
|
|
19
|
+
autoPlay;
|
|
20
|
+
direction;
|
|
21
|
+
domId;
|
|
22
|
+
fill;
|
|
23
|
+
life;
|
|
24
|
+
name;
|
|
25
|
+
particles;
|
|
26
|
+
position;
|
|
27
|
+
rate;
|
|
28
|
+
shape;
|
|
29
|
+
size;
|
|
30
|
+
spawnColor;
|
|
31
|
+
startCount;
|
|
19
32
|
constructor() {
|
|
20
33
|
this.autoPlay = true;
|
|
21
34
|
this.fill = true;
|
|
@@ -13,6 +13,9 @@
|
|
|
13
13
|
const engine_1 = require("@tsparticles/engine");
|
|
14
14
|
const EmitterShapeReplace_js_1 = require("./EmitterShapeReplace.js");
|
|
15
15
|
class EmitterShape {
|
|
16
|
+
options;
|
|
17
|
+
replace;
|
|
18
|
+
type;
|
|
16
19
|
constructor() {
|
|
17
20
|
this.options = {};
|
|
18
21
|
this.replace = new EmitterShapeReplace_js_1.EmitterShapeReplace();
|
package/umd/ShapeManager.js
CHANGED
|
@@ -10,18 +10,18 @@
|
|
|
10
10
|
"use strict";
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.ShapeManager = void 0;
|
|
13
|
-
const
|
|
13
|
+
const shapeGenerators = new Map();
|
|
14
14
|
class ShapeManager {
|
|
15
15
|
addShapeGenerator(name, generator) {
|
|
16
16
|
if (!this.getShapeGenerator(name)) {
|
|
17
|
-
|
|
17
|
+
shapeGenerators.set(name, generator);
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
getShapeGenerator(name) {
|
|
21
|
-
return
|
|
21
|
+
return shapeGenerators.get(name);
|
|
22
22
|
}
|
|
23
23
|
getSupportedShapeGenerators() {
|
|
24
|
-
return
|
|
24
|
+
return shapeGenerators.keys();
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
exports.ShapeManager = ShapeManager;
|
package/umd/constants.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
(function (factory) {
|
|
2
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
+
var v = factory(require, exports);
|
|
4
|
+
if (v !== undefined) module.exports = v;
|
|
5
|
+
}
|
|
6
|
+
else if (typeof define === "function" && define.amd) {
|
|
7
|
+
define(["require", "exports"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.defaultRandomOptions = void 0;
|
|
13
|
+
exports.defaultRandomOptions = {
|
|
14
|
+
count: 1,
|
|
15
|
+
enable: true,
|
|
16
|
+
};
|
|
17
|
+
});
|
package/umd/index.js
CHANGED
|
@@ -47,18 +47,33 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
47
47
|
var __syncRequire = typeof module === "object" && typeof module.exports === "object";
|
|
48
48
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
49
49
|
exports.loadEmittersPlugin = loadEmittersPlugin;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
engine.
|
|
53
|
-
|
|
50
|
+
exports.ensureEmittersPluginLoaded = ensureEmittersPluginLoaded;
|
|
51
|
+
async function loadEmittersPlugin(engine) {
|
|
52
|
+
engine.checkVersion("4.0.0-alpha.21");
|
|
53
|
+
await engine.register(async (e) => {
|
|
54
|
+
const [{ ensureInteractivityPluginLoaded }, { ShapeManager }, { EmittersInstancesManager }, { EmittersPlugin },] = await Promise.all([
|
|
55
|
+
__syncRequire ? Promise.resolve().then(() => __importStar(require("@tsparticles/plugin-interactivity"))) : new Promise((resolve_1, reject_1) => { require(["@tsparticles/plugin-interactivity"], resolve_1, reject_1); }).then(__importStar),
|
|
56
|
+
__syncRequire ? Promise.resolve().then(() => __importStar(require("./ShapeManager.js"))) : new Promise((resolve_2, reject_2) => { require(["./ShapeManager.js"], resolve_2, reject_2); }).then(__importStar),
|
|
57
|
+
__syncRequire ? Promise.resolve().then(() => __importStar(require("./EmittersInstancesManager.js"))) : new Promise((resolve_3, reject_3) => { require(["./EmittersInstancesManager.js"], resolve_3, reject_3); }).then(__importStar),
|
|
58
|
+
__syncRequire ? Promise.resolve().then(() => __importStar(require("./EmittersPlugin.js"))) : new Promise((resolve_4, reject_4) => { require(["./EmittersPlugin.js"], resolve_4, reject_4); }).then(__importStar),
|
|
59
|
+
]), instancesManager = new EmittersInstancesManager(e);
|
|
60
|
+
ensureInteractivityPluginLoaded(e);
|
|
54
61
|
e.emitterShapeManager ??= new ShapeManager();
|
|
55
62
|
e.addEmitterShapeGenerator ??= (name, generator) => {
|
|
56
63
|
e.emitterShapeManager?.addShapeGenerator(name, generator);
|
|
57
64
|
};
|
|
58
|
-
|
|
59
|
-
e.
|
|
65
|
+
e.addPlugin(new EmittersPlugin(instancesManager));
|
|
66
|
+
e.addInteractor?.("externalEmitters", async (container) => {
|
|
67
|
+
const { EmittersInteractor } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./EmittersInteractor.js"))) : new Promise((resolve_5, reject_5) => { require(["./EmittersInteractor.js"], resolve_5, reject_5); }).then(__importStar));
|
|
68
|
+
return new EmittersInteractor(instancesManager, container);
|
|
69
|
+
});
|
|
60
70
|
});
|
|
61
71
|
}
|
|
72
|
+
function ensureEmittersPluginLoaded(e) {
|
|
73
|
+
if (!e.addEmitterShapeGenerator) {
|
|
74
|
+
throw new Error("tsParticles Emitters Plugin is not loaded");
|
|
75
|
+
}
|
|
76
|
+
}
|
|
62
77
|
__exportStar(require("./EmitterShapeBase.js"), exports);
|
|
63
78
|
__exportStar(require("./Enums/EmitterClickMode.js"), exports);
|
|
64
79
|
});
|
package/214.min.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/*! For license information please see 214.min.js.LICENSE.txt */
|
|
2
|
-
(this.webpackChunk_tsparticles_plugin_emitters=this.webpackChunk_tsparticles_plugin_emitters||[]).push([[214],{214(t,i,e){e.d(i,{EmittersPlugin:()=>m});var s=e(303);class o{constructor(){this.wait=!1}load(t){(0,s.isNull)(t)||(void 0!==t.count&&(this.count=t.count),void 0!==t.delay&&(this.delay=(0,s.setRangeValue)(t.delay)),void 0!==t.duration&&(this.duration=(0,s.setRangeValue)(t.duration)),void 0!==t.wait&&(this.wait=t.wait))}}class n{constructor(){this.quantity=1,this.delay=.1}load(t){(0,s.isNull)(t)||(void 0!==t.quantity&&(this.quantity=(0,s.setRangeValue)(t.quantity)),void 0!==t.delay&&(this.delay=(0,s.setRangeValue)(t.delay)))}}class a{constructor(){this.color=!1,this.opacity=!1}load(t){(0,s.isNull)(t)||(void 0!==t.color&&(this.color=t.color),void 0!==t.opacity&&(this.opacity=t.opacity))}}class r{constructor(){this.options={},this.replace=new a,this.type="square"}load(t){(0,s.isNull)(t)||(void 0!==t.options&&(this.options=(0,s.deepExtend)({},t.options??{})),this.replace.load(t.replace),void 0!==t.type&&(this.type=t.type))}}class h{constructor(){this.mode=s.PixelMode.percent,this.height=0,this.width=0}load(t){(0,s.isNull)(t)||(void 0!==t.mode&&(this.mode=t.mode),void 0!==t.height&&(this.height=t.height),void 0!==t.width&&(this.width=t.width))}}class l{constructor(){this.autoPlay=!0,this.fill=!0,this.life=new o,this.rate=new n,this.shape=new r,this.startCount=0}load(t){(0,s.isNull)(t)||(void 0!==t.autoPlay&&(this.autoPlay=t.autoPlay),void 0!==t.size&&(this.size??=new h,this.size.load(t.size)),void 0!==t.direction&&(this.direction=t.direction),this.domId=t.domId,void 0!==t.fill&&(this.fill=t.fill),this.life.load(t.life),this.name=t.name,this.particles=(0,s.executeOnSingleOrMultiple)(t.particles,(t=>(0,s.deepExtend)({},t))),this.rate.load(t.rate),this.shape.load(t.shape),void 0!==t.position&&(this.position={},void 0!==t.position.x&&(this.position.x=(0,s.setRangeValue)(t.position.x)),void 0!==t.position.y&&(this.position.y=(0,s.setRangeValue)(t.position.y))),void 0!==t.spawnColor&&(this.spawnColor??=new s.AnimatableColor,this.spawnColor.load(t.spawnColor)),void 0!==t.startCount&&(this.startCount=t.startCount))}}var c=e(271);function d(t,i){t.color?t.color.value=i:t.color={value:i}}class u{constructor(t,i,e,o,n){this.emitters=i,this.container=e,this._destroy=()=>{this._mutationObserver?.disconnect(),this._mutationObserver=void 0,this._resizeObserver?.disconnect(),this._resizeObserver=void 0,this.emitters.removeEmitter(this),this._engine.dispatchEvent("emitterDestroyed",{container:this.container,data:{emitter:this}})},this._prepareToDie=()=>{if(this._paused)return;const t=void 0!==this.options.life.duration?(0,s.getRangeValue)(this.options.life.duration):void 0;(this._lifeCount>0||this._immortal)&&void 0!==t&&t>0&&(this._duration=t*s.millisecondsToSeconds)},this._setColorAnimation=(t,i,e,o=1)=>{const n=this.container;if(!t.enable)return i;const a=(0,s.randomInRangeValue)(t.offset),r=(0,s.getRangeValue)(this.options.rate.delay),h=n.retina.reduceFactor?r*s.millisecondsToSeconds/n.retina.reduceFactor:1/0;return(i+(0,s.getRangeValue)(t.speed)*n.fpsLimit/h+a*o)%e},this._engine=t,this._currentDuration=0,this._currentEmitDelay=0,this._currentSpawnDelay=0,this._initialPosition=n,o instanceof l?this.options=o:(this.options=new l,this.options.load(o)),this._spawnDelay=e.retina.reduceFactor?(0,s.getRangeValue)(this.options.life.delay??0)*s.millisecondsToSeconds/e.retina.reduceFactor:1/0,this.position=this._initialPosition??this._calcPosition(),this.name=this.options.name,this.fill=this.options.fill,this._firstSpawn=!this.options.life.wait,this._startParticlesAdded=!1;const a=(0,s.deepExtend)({},this.options.particles);if(a.move??={},a.move.direction??=this.options.direction,this.options.spawnColor&&(this.spawnColor=(0,s.rangeColorToHsl)(this._engine,this.options.spawnColor)),this._paused=!this.options.autoPlay,this._particlesOptions=a,this._size=this._calcSize(),this.size=(0,s.getSize)(this._size,this.container.canvas.size),this._lifeCount=this.options.life.count??-1,this._immortal=this._lifeCount<=0,this.options.domId){const t=(0,s.safeDocument)().getElementById(this.options.domId);t&&(this._mutationObserver=new MutationObserver((()=>{this.resize()})),this._resizeObserver=new ResizeObserver((()=>{this.resize()})),this._mutationObserver.observe(t,{attributes:!0,attributeFilter:["style","width","height"]}),this._resizeObserver.observe(t))}const r=this.options.shape,h=this._engine.emitterShapeManager?.getShapeGenerator(r.type);h&&(this._shape=h.generate(this.position,this.size,this.fill,r.options)),this._engine.dispatchEvent("emitterCreated",{container:e,data:{emitter:this}}),this.play()}externalPause(){this._paused=!0,this.pause()}externalPlay(){this._paused=!1,this.play()}async init(){await(this._shape?.init())}pause(){this._paused||delete this._emitDelay}play(){if(this._paused)return;if(!(this._lifeCount>0||this._immortal)&&this.options.life.count||!(this._firstSpawn||this._currentSpawnDelay>=(this._spawnDelay??0)))return;const t=this.container;if(void 0===this._emitDelay){const i=(0,s.getRangeValue)(this.options.rate.delay);this._emitDelay=t.retina.reduceFactor?i*s.millisecondsToSeconds/t.retina.reduceFactor:1/0}(this._lifeCount>0||this._immortal)&&this._prepareToDie()}resize(){const t=this._initialPosition,i=this.container;this.position=t&&(0,s.isPointInside)(t,i.canvas.size,s.Vector.origin)?t:this._calcPosition(),this._size=this._calcSize(),this.size=(0,s.getSize)(this._size,i.canvas.size),this._shape?.resize(this.position,this.size)}update(t){if(this._paused)return;const i=this.container;this._firstSpawn&&(this._firstSpawn=!1,this._currentSpawnDelay=this._spawnDelay??0,this._currentEmitDelay=this._emitDelay??0),this._startParticlesAdded||(this._startParticlesAdded=!0,this._emitParticles(this.options.startCount)),void 0!==this._duration&&(this._currentDuration+=t.value,this._currentDuration>=this._duration&&(this.pause(),void 0!==this._spawnDelay&&delete this._spawnDelay,this._immortal||this._lifeCount--,this._lifeCount>0||this._immortal?(this.position=this._calcPosition(),this._shape?.resize(this.position,this.size),this._spawnDelay=i.retina.reduceFactor?(0,s.getRangeValue)(this.options.life.delay??0)*s.millisecondsToSeconds/i.retina.reduceFactor:1/0):this._destroy(),this._currentDuration-=this._duration,delete this._duration)),void 0!==this._spawnDelay&&(this._currentSpawnDelay+=t.value,this._currentSpawnDelay>=this._spawnDelay&&(this._engine.dispatchEvent("emitterPlay",{container:this.container}),this.play(),this._currentSpawnDelay-=this._currentSpawnDelay,delete this._spawnDelay)),void 0!==this._emitDelay&&(this._currentEmitDelay+=t.value,this._currentEmitDelay>=this._emitDelay&&(this._emit(),this._currentEmitDelay-=this._emitDelay))}_calcPosition(){const t=this.container;if(this.options.domId){const i=(0,s.safeDocument)().getElementById(this.options.domId);if(i){const e=i.getBoundingClientRect(),o=t.retina.pixelRatio;return{x:(e.x+e.width*s.half)*o,y:(e.y+e.height*s.half)*o}}}return(0,s.calcPositionOrRandomFromSizeRanged)({size:t.canvas.size,position:this.options.position})}_calcSize(){const t=this.container;if(this.options.domId){const i=(0,s.safeDocument)().getElementById(this.options.domId);if(i){const e=i.getBoundingClientRect();return{width:e.width*t.retina.pixelRatio,height:e.height*t.retina.pixelRatio,mode:s.PixelMode.precise}}}return this.options.size??(()=>{const t=new h;return t.load({height:0,mode:s.PixelMode.percent,width:0}),t})()}_emit(){if(this._paused)return;const t=(0,s.getRangeValue)(this.options.rate.quantity);this._emitParticles(t)}_emitParticles(t){const i=(0,s.itemFromSingleOrMultiple)(this._particlesOptions),e=this.container.retina.reduceFactor;for(let o=0;o<t*e;o++){const t=(0,s.deepExtend)({},i);if(this.spawnColor){const i=this.options.spawnColor?.animation;if(i){const t={h:s.hMax,s:s.sMax,l:s.lMax},e=3.6;this.spawnColor.h=this._setColorAnimation(i.h,this.spawnColor.h,t.h,e),this.spawnColor.s=this._setColorAnimation(i.s,this.spawnColor.s,t.s),this.spawnColor.l=this._setColorAnimation(i.l,this.spawnColor.l,t.l)}d(t,this.spawnColor)}const e=this.options.shape;let o=this.position;if(this._shape){const i=this._shape.randomPosition();if(i){o=i.position;const s=e.replace;s.color&&i.color&&d(t,i.color),s.opacity&&(t.opacity?t.opacity.value=i.opacity:t.opacity={value:i.opacity})}else o=null}o&&this.container.particles.addParticle(o,t)}}}class p{constructor(t,i){this.container=i,this._engine=t,this.array=[],this.emitters=[],this.interactivityEmitters={random:{count:1,enable:!1},value:[]};i.getEmitter=t=>void 0===t||(0,s.isNumber)(t)?this.array[t??0]:this.array.find((i=>i.name===t)),i.addEmitter=async(t,i)=>this.addEmitter(t,i),i.removeEmitter=t=>{const e=i.getEmitter(t);e&&this.removeEmitter(e)},i.playEmitter=t=>{const e=i.getEmitter(t);e&&e.externalPlay()},i.pauseEmitter=t=>{const e=i.getEmitter(t);e&&e.externalPause()}}async addEmitter(t,i){const e=new l;e.load(t);const s=new u(this._engine,this,this.container,e,i);return await s.init(),this.array.push(s),s}handleClickMode(t){const i=this.interactivityEmitters;if(t!==c.c.emitter)return;let e;if((0,s.isArray)(i.value)){const t=0;if(i.value.length>t&&i.random.enable){e=[];const t=[];for(let o=0;o<i.random.count;o++){const n=(0,s.arrayRandomIndex)(i.value);if(t.includes(n)&&t.length<i.value.length){o--;continue}t.push(n);const a=(0,s.itemFromArray)(i.value,n);a&&e.push(a)}}else e=i.value}else e=i.value;const o=e,n=this.container.interactivity.mouse.clickPosition;(0,s.executeOnSingleOrMultiple)(o,(async t=>{await this.addEmitter(t,n)}))}async init(){if(this.emitters=this.container.actualOptions.emitters,this.interactivityEmitters=this.container.actualOptions.interactivity.modes.emitters,(0,s.isArray)(this.emitters))for(const t of this.emitters)await this.addEmitter(t);else await this.addEmitter(this.emitters)}pause(){for(const t of this.array)t.pause()}play(){for(const t of this.array)t.play()}removeEmitter(t){const i=this.array.indexOf(t);i>=0&&this.array.splice(i,1)}resize(){for(const t of this.array)t.resize()}stop(){this.array=[]}update(t){for(const i of this.array)i.update(t)}}class m{constructor(t){this._engine=t,this.id="emitters"}getPlugin(t){return Promise.resolve(new p(this._engine,t))}loadOptions(t,i){if(!this.needsPlugin(t)&&!this.needsPlugin(i))return;i?.emitters&&(t.emitters=(0,s.executeOnSingleOrMultiple)(i.emitters,(t=>{const i=new l;return i.load(t),i})));const e=i?.interactivity?.modes?.emitters;if(e)if((0,s.isArray)(e))t.interactivity.modes.emitters={random:{count:1,enable:!0},value:e.map((t=>{const i=new l;return i.load(t),i}))};else{const i=e;if((0,s.isArray)(i.value))t.interactivity.modes.emitters={random:{count:i.random.count,enable:i.random.enable},value:i.value.map((t=>{const i=new l;return i.load(t),i}))};else{const e=new l;e.load(i.value),t.interactivity.modes.emitters={random:{count:i.random.count,enable:i.random.enable},value:e}}}}needsPlugin(t){if(!t)return!1;const i=t.emitters;return(0,s.isArray)(i)&&!!i.length||void 0!==i||!!t.interactivity?.events?.onClick?.mode&&(0,s.isInArray)(c.c.emitter,t.interactivity.events.onClick.mode)}}}}]);
|
package/214.min.js.LICENSE.txt
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/*! tsParticles Emitters Plugin v4.0.0-alpha.2 by Matteo Bruni */
|
package/921.min.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/*! For license information please see 921.min.js.LICENSE.txt */
|
|
2
|
-
(this.webpackChunk_tsparticles_plugin_emitters=this.webpackChunk_tsparticles_plugin_emitters||[]).push([[921],{921(e,t,a){a.d(t,{ShapeManager:()=>s});const r=new Map;class s{addShapeGenerator(e,t){this.getShapeGenerator(e)||r.set(e,t)}getShapeGenerator(e){return r.get(e)}getSupportedShapeGenerators(){return r.keys()}}}}]);
|
package/921.min.js.LICENSE.txt
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/*! tsParticles Emitters Plugin v4.0.0-alpha.2 by Matteo Bruni */
|