@tsparticles/plugin-emitters 4.0.0-beta.0 → 4.0.0-beta.10
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/{803.min.js → 100.min.js} +1 -1
- package/106.min.js +1 -0
- package/443.min.js +1 -0
- package/475.min.js +1 -0
- package/{588.min.js → 515.min.js} +1 -1
- package/746.min.js +1 -0
- package/{526.min.js → 812.min.js} +1 -1
- package/903.min.js +1 -0
- package/README.md +27 -0
- package/browser/EmitterInstance.js +39 -43
- package/browser/EmittersInstancesManager.js +4 -4
- package/browser/addEmittersShapesManager.js +7 -0
- package/browser/ensureEmittersPluginLoaded.js +5 -0
- package/browser/getEmittersInstancesManager.js +15 -0
- package/browser/index.js +5 -24
- package/browser/interaction.js +18 -0
- package/browser/plugin.js +14 -0
- package/cjs/EmitterInstance.js +39 -43
- package/cjs/EmittersInstancesManager.js +4 -4
- package/cjs/addEmittersShapesManager.js +7 -0
- package/cjs/ensureEmittersPluginLoaded.js +5 -0
- package/cjs/getEmittersInstancesManager.js +15 -0
- package/cjs/index.js +5 -24
- package/cjs/interaction.js +18 -0
- package/cjs/plugin.js +14 -0
- package/dist_browser_EmitterInstance_js.js +2 -2
- package/dist_browser_EmittersInstancesManager_js.js +2 -2
- package/dist_browser_EmittersInteractor_js.js +1 -1
- package/dist_browser_EmittersPluginInstance_js.js +1 -1
- package/dist_browser_EmittersPlugin_js.js +1 -1
- package/dist_browser_ShapeManager_js.js +1 -1
- package/dist_browser_addEmittersShapesManager_js.js +30 -0
- package/dist_browser_getEmittersInstancesManager_js.js +30 -0
- package/esm/EmitterInstance.js +39 -43
- package/esm/EmittersInstancesManager.js +4 -4
- package/esm/addEmittersShapesManager.js +7 -0
- package/esm/ensureEmittersPluginLoaded.js +5 -0
- package/esm/getEmittersInstancesManager.js +15 -0
- package/esm/index.js +5 -24
- package/esm/interaction.js +18 -0
- package/esm/plugin.js +14 -0
- package/package.json +24 -6
- package/report.html +84 -29
- package/tsparticles.plugin.emitters.js +32 -2
- package/tsparticles.plugin.emitters.min.js +2 -2
- package/types/EmitterInstance.d.ts +5 -5
- package/types/EmittersEngine.d.ts +5 -2
- package/types/EmittersInstancesManager.d.ts +3 -3
- package/types/addEmittersShapesManager.d.ts +2 -0
- package/types/ensureEmittersPluginLoaded.d.ts +2 -0
- package/types/getEmittersInstancesManager.d.ts +3 -0
- package/types/index.d.ts +1 -1
- package/types/interaction.d.ts +9 -0
- package/types/plugin.d.ts +9 -0
- package/772.min.js +0 -1
- package/784.min.js +0 -1
- package/795.min.js +0 -1
- package/umd/EmitterContainer.js +0 -12
- package/umd/EmitterInstance.js +0 -366
- package/umd/EmitterShapeBase.js +0 -30
- package/umd/EmittersEngine.js +0 -12
- package/umd/EmittersInstancesManager.js +0 -119
- package/umd/EmittersInteractor.js +0 -130
- package/umd/EmittersPlugin.js +0 -80
- package/umd/EmittersPluginInstance.js +0 -58
- package/umd/Enums/EmitterClickMode.js +0 -17
- package/umd/IEmitterShape.js +0 -12
- package/umd/IEmitterShapeGenerator.js +0 -12
- package/umd/IRandomPositionData.js +0 -12
- package/umd/Options/Classes/Emitter.js +0 -93
- package/umd/Options/Classes/EmitterLife.js +0 -41
- package/umd/Options/Classes/EmitterRate.js +0 -34
- package/umd/Options/Classes/EmitterShape.js +0 -38
- package/umd/Options/Classes/EmitterShapeReplace.js +0 -34
- package/umd/Options/Classes/EmitterSize.js +0 -39
- package/umd/Options/Classes/EmitterSpawn.js +0 -32
- package/umd/Options/Interfaces/IEmitter.js +0 -12
- package/umd/Options/Interfaces/IEmitterLife.js +0 -12
- package/umd/Options/Interfaces/IEmitterRate.js +0 -12
- package/umd/Options/Interfaces/IEmitterShape.js +0 -12
- package/umd/Options/Interfaces/IEmitterShapeReplace.js +0 -12
- package/umd/Options/Interfaces/IEmitterSize.js +0 -12
- package/umd/Options/Interfaces/IEmitterSpawn.js +0 -12
- package/umd/ShapeManager.js +0 -28
- package/umd/constants.js +0 -17
- package/umd/index.js +0 -79
- package/umd/types.js +0 -12
package/umd/EmitterShapeBase.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
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.EmitterShapeBase = void 0;
|
|
13
|
-
class EmitterShapeBase {
|
|
14
|
-
fill;
|
|
15
|
-
options;
|
|
16
|
-
position;
|
|
17
|
-
size;
|
|
18
|
-
constructor(position, size, fill, options) {
|
|
19
|
-
this.position = position;
|
|
20
|
-
this.size = size;
|
|
21
|
-
this.fill = fill;
|
|
22
|
-
this.options = options;
|
|
23
|
-
}
|
|
24
|
-
resize(position, size) {
|
|
25
|
-
this.position = position;
|
|
26
|
-
this.size = size;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
exports.EmitterShapeBase = EmitterShapeBase;
|
|
30
|
-
});
|
package/umd/EmittersEngine.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1,119 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1,130 +0,0 @@
|
|
|
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
|
-
maxDistance;
|
|
21
|
-
_instancesManager;
|
|
22
|
-
constructor(instancesManager, container) {
|
|
23
|
-
super(container);
|
|
24
|
-
this._instancesManager = instancesManager;
|
|
25
|
-
this.maxDistance = 0;
|
|
26
|
-
this.handleClickMode = (mode, interactivityData) => {
|
|
27
|
-
const container = this.container, options = container.actualOptions, modeEmitters = options.interactivity.modes.emitters;
|
|
28
|
-
if (!modeEmitters || mode !== emittersMode) {
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
let emittersModeOptions;
|
|
32
|
-
if ((0, engine_1.isArray)(modeEmitters.value)) {
|
|
33
|
-
const minLength = 0, modeEmittersCount = modeEmitters.value.length;
|
|
34
|
-
if (modeEmittersCount > minLength && modeEmitters.random.enable) {
|
|
35
|
-
emittersModeOptions = [];
|
|
36
|
-
const usedIndexes = new Set();
|
|
37
|
-
for (let i = 0; i < modeEmitters.random.count; i++) {
|
|
38
|
-
const idx = (0, engine_1.arrayRandomIndex)(modeEmitters.value);
|
|
39
|
-
if (usedIndexes.has(idx) && usedIndexes.size < modeEmittersCount) {
|
|
40
|
-
i--;
|
|
41
|
-
continue;
|
|
42
|
-
}
|
|
43
|
-
usedIndexes.add(idx);
|
|
44
|
-
const selectedOptions = (0, engine_1.itemFromArray)(modeEmitters.value, idx);
|
|
45
|
-
if (!selectedOptions) {
|
|
46
|
-
continue;
|
|
47
|
-
}
|
|
48
|
-
emittersModeOptions.push(selectedOptions);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
emittersModeOptions = modeEmitters.value;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
emittersModeOptions = modeEmitters.value;
|
|
57
|
-
}
|
|
58
|
-
const emittersOptions = emittersModeOptions, ePosition = interactivityData.mouse.clickPosition;
|
|
59
|
-
void (0, engine_1.executeOnSingleOrMultiple)(emittersOptions, async (emitter) => {
|
|
60
|
-
await this._instancesManager.addEmitter(this.container, emitter, ePosition);
|
|
61
|
-
});
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
clear() {
|
|
65
|
-
}
|
|
66
|
-
init() {
|
|
67
|
-
}
|
|
68
|
-
interact(_interactivityData, delta) {
|
|
69
|
-
for (const emitter of this._instancesManager.getArray(this.container)) {
|
|
70
|
-
emitter.update(delta);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
isEnabled(interactivityData, particle) {
|
|
74
|
-
const container = this.container, options = container.actualOptions, mouse = interactivityData.mouse, events = (particle?.interactivity ?? options.interactivity).events;
|
|
75
|
-
if (!mouse.clickPosition || !events.onClick.enable) {
|
|
76
|
-
return false;
|
|
77
|
-
}
|
|
78
|
-
return (0, engine_1.isInArray)(emittersMode, events.onClick.mode);
|
|
79
|
-
}
|
|
80
|
-
loadModeOptions(options, ...sources) {
|
|
81
|
-
options.emitters = {
|
|
82
|
-
random: constants_js_1.defaultRandomOptions,
|
|
83
|
-
value: [],
|
|
84
|
-
};
|
|
85
|
-
for (const source of sources) {
|
|
86
|
-
if (!source?.emitters) {
|
|
87
|
-
continue;
|
|
88
|
-
}
|
|
89
|
-
if ((0, engine_1.isArray)(source.emitters)) {
|
|
90
|
-
for (const emitter of source.emitters) {
|
|
91
|
-
const tmp = new Emitter_js_1.Emitter();
|
|
92
|
-
tmp.load(emitter);
|
|
93
|
-
options.emitters.value.push(tmp);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
else if ("value" in source.emitters) {
|
|
97
|
-
const emitterModeOptions = source.emitters;
|
|
98
|
-
options.emitters.random.enable = emitterModeOptions.random?.enable ?? options.emitters.random.enable;
|
|
99
|
-
options.emitters.random.count = emitterModeOptions.random?.count ?? options.emitters.random.count;
|
|
100
|
-
if ((0, engine_1.isArray)(emitterModeOptions.value)) {
|
|
101
|
-
for (const emitter of emitterModeOptions.value) {
|
|
102
|
-
const tmp = new Emitter_js_1.Emitter();
|
|
103
|
-
tmp.load(emitter);
|
|
104
|
-
options.emitters.value.push(tmp);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
else {
|
|
108
|
-
const tmp = new Emitter_js_1.Emitter();
|
|
109
|
-
tmp.load(emitterModeOptions.value);
|
|
110
|
-
options.emitters.value.push(tmp);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
else {
|
|
114
|
-
const tmp = new Emitter_js_1.Emitter();
|
|
115
|
-
tmp.load(source.emitters);
|
|
116
|
-
options.emitters.value.push(tmp);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
removeEmitter(emitter) {
|
|
121
|
-
const index = this._instancesManager.getArray(this.container).indexOf(emitter), minIndex = 0, deleteCount = 1;
|
|
122
|
-
if (index >= minIndex) {
|
|
123
|
-
this._instancesManager.getArray(this.container).splice(index, deleteCount);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
reset() {
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
exports.EmittersInteractor = EmittersInteractor;
|
|
130
|
-
});
|
package/umd/EmittersPlugin.js
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
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.EmittersPlugin = void 0;
|
|
47
|
-
const engine_1 = require("@tsparticles/engine");
|
|
48
|
-
const Emitter_js_1 = require("./Options/Classes/Emitter.js");
|
|
49
|
-
class EmittersPlugin {
|
|
50
|
-
id = "emitters";
|
|
51
|
-
_instancesManager;
|
|
52
|
-
constructor(instancesManager) {
|
|
53
|
-
this._instancesManager = instancesManager;
|
|
54
|
-
}
|
|
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);
|
|
58
|
-
}
|
|
59
|
-
loadOptions(_container, options, source) {
|
|
60
|
-
if (!this.needsPlugin(options) && !this.needsPlugin(source)) {
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
if (source?.emitters) {
|
|
64
|
-
options.emitters = (0, engine_1.executeOnSingleOrMultiple)(source.emitters, emitter => {
|
|
65
|
-
const tmp = new Emitter_js_1.Emitter();
|
|
66
|
-
tmp.load(emitter);
|
|
67
|
-
return tmp;
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
needsPlugin(options) {
|
|
72
|
-
if (!options) {
|
|
73
|
-
return false;
|
|
74
|
-
}
|
|
75
|
-
const emitters = options.emitters;
|
|
76
|
-
return ((0, engine_1.isArray)(emitters) && !!emitters.length) || emitters !== undefined;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
exports.EmittersPlugin = EmittersPlugin;
|
|
80
|
-
});
|
|
@@ -1,58 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1,17 +0,0 @@
|
|
|
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.EmitterClickMode = void 0;
|
|
13
|
-
var EmitterClickMode;
|
|
14
|
-
(function (EmitterClickMode) {
|
|
15
|
-
EmitterClickMode["emitter"] = "emitter";
|
|
16
|
-
})(EmitterClickMode || (exports.EmitterClickMode = EmitterClickMode = {}));
|
|
17
|
-
});
|
package/umd/IEmitterShape.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1,12 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1,12 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1,93 +0,0 @@
|
|
|
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", "./EmitterLife.js", "./EmitterRate.js", "./EmitterShape.js", "./EmitterSize.js", "./EmitterSpawn.js"], factory);
|
|
8
|
-
}
|
|
9
|
-
})(function (require, exports) {
|
|
10
|
-
"use strict";
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.Emitter = void 0;
|
|
13
|
-
const engine_1 = require("@tsparticles/engine");
|
|
14
|
-
const EmitterLife_js_1 = require("./EmitterLife.js");
|
|
15
|
-
const EmitterRate_js_1 = require("./EmitterRate.js");
|
|
16
|
-
const EmitterShape_js_1 = require("./EmitterShape.js");
|
|
17
|
-
const EmitterSize_js_1 = require("./EmitterSize.js");
|
|
18
|
-
const EmitterSpawn_js_1 = require("./EmitterSpawn.js");
|
|
19
|
-
class Emitter {
|
|
20
|
-
autoPlay;
|
|
21
|
-
direction;
|
|
22
|
-
domId;
|
|
23
|
-
fill;
|
|
24
|
-
life;
|
|
25
|
-
name;
|
|
26
|
-
particles;
|
|
27
|
-
position;
|
|
28
|
-
rate;
|
|
29
|
-
shape;
|
|
30
|
-
size;
|
|
31
|
-
spawn;
|
|
32
|
-
spawnFillColor;
|
|
33
|
-
spawnStrokeColor;
|
|
34
|
-
startCount;
|
|
35
|
-
constructor() {
|
|
36
|
-
this.autoPlay = true;
|
|
37
|
-
this.fill = true;
|
|
38
|
-
this.life = new EmitterLife_js_1.EmitterLife();
|
|
39
|
-
this.rate = new EmitterRate_js_1.EmitterRate();
|
|
40
|
-
this.shape = new EmitterShape_js_1.EmitterShape();
|
|
41
|
-
this.spawn = new EmitterSpawn_js_1.EmitterSpawn();
|
|
42
|
-
this.startCount = 0;
|
|
43
|
-
}
|
|
44
|
-
load(data) {
|
|
45
|
-
if ((0, engine_1.isNull)(data)) {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
if (data.autoPlay !== undefined) {
|
|
49
|
-
this.autoPlay = data.autoPlay;
|
|
50
|
-
}
|
|
51
|
-
if (data.size !== undefined) {
|
|
52
|
-
this.size ??= new EmitterSize_js_1.EmitterSize();
|
|
53
|
-
this.size.load(data.size);
|
|
54
|
-
}
|
|
55
|
-
if (data.direction !== undefined) {
|
|
56
|
-
this.direction = data.direction;
|
|
57
|
-
}
|
|
58
|
-
this.domId = data.domId;
|
|
59
|
-
if (data.fill !== undefined) {
|
|
60
|
-
this.fill = data.fill;
|
|
61
|
-
}
|
|
62
|
-
this.life.load(data.life);
|
|
63
|
-
this.name = data.name;
|
|
64
|
-
this.particles = (0, engine_1.executeOnSingleOrMultiple)(data.particles, particles => {
|
|
65
|
-
return (0, engine_1.deepExtend)({}, particles);
|
|
66
|
-
});
|
|
67
|
-
this.rate.load(data.rate);
|
|
68
|
-
this.shape.load(data.shape);
|
|
69
|
-
this.spawn.load(data.spawn);
|
|
70
|
-
if (data.position !== undefined) {
|
|
71
|
-
this.position = {};
|
|
72
|
-
if (data.position.x !== undefined) {
|
|
73
|
-
this.position.x = (0, engine_1.setRangeValue)(data.position.x);
|
|
74
|
-
}
|
|
75
|
-
if (data.position.y !== undefined) {
|
|
76
|
-
this.position.y = (0, engine_1.setRangeValue)(data.position.y);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
if (data.spawnFillColor !== undefined) {
|
|
80
|
-
this.spawnFillColor ??= new engine_1.AnimatableColor();
|
|
81
|
-
this.spawnFillColor.load(data.spawnFillColor);
|
|
82
|
-
}
|
|
83
|
-
if (data.spawnStrokeColor !== undefined) {
|
|
84
|
-
this.spawnStrokeColor ??= new engine_1.AnimatableColor();
|
|
85
|
-
this.spawnStrokeColor.load(data.spawnStrokeColor);
|
|
86
|
-
}
|
|
87
|
-
if (data.startCount !== undefined) {
|
|
88
|
-
this.startCount = data.startCount;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
exports.Emitter = Emitter;
|
|
93
|
-
});
|
|
@@ -1,41 +0,0 @@
|
|
|
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.EmitterLife = void 0;
|
|
13
|
-
const engine_1 = require("@tsparticles/engine");
|
|
14
|
-
class EmitterLife {
|
|
15
|
-
count;
|
|
16
|
-
delay;
|
|
17
|
-
duration;
|
|
18
|
-
wait;
|
|
19
|
-
constructor() {
|
|
20
|
-
this.wait = false;
|
|
21
|
-
}
|
|
22
|
-
load(data) {
|
|
23
|
-
if ((0, engine_1.isNull)(data)) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
if (data.count !== undefined) {
|
|
27
|
-
this.count = data.count;
|
|
28
|
-
}
|
|
29
|
-
if (data.delay !== undefined) {
|
|
30
|
-
this.delay = (0, engine_1.setRangeValue)(data.delay);
|
|
31
|
-
}
|
|
32
|
-
if (data.duration !== undefined) {
|
|
33
|
-
this.duration = (0, engine_1.setRangeValue)(data.duration);
|
|
34
|
-
}
|
|
35
|
-
if (data.wait !== undefined) {
|
|
36
|
-
this.wait = data.wait;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
exports.EmitterLife = EmitterLife;
|
|
41
|
-
});
|
|
@@ -1,34 +0,0 @@
|
|
|
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.EmitterRate = void 0;
|
|
13
|
-
const engine_1 = require("@tsparticles/engine");
|
|
14
|
-
class EmitterRate {
|
|
15
|
-
delay;
|
|
16
|
-
quantity;
|
|
17
|
-
constructor() {
|
|
18
|
-
this.quantity = 1;
|
|
19
|
-
this.delay = 0.1;
|
|
20
|
-
}
|
|
21
|
-
load(data) {
|
|
22
|
-
if ((0, engine_1.isNull)(data)) {
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
if (data.quantity !== undefined) {
|
|
26
|
-
this.quantity = (0, engine_1.setRangeValue)(data.quantity);
|
|
27
|
-
}
|
|
28
|
-
if (data.delay !== undefined) {
|
|
29
|
-
this.delay = (0, engine_1.setRangeValue)(data.delay);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
exports.EmitterRate = EmitterRate;
|
|
34
|
-
});
|