@tsparticles/plugin-emitters 3.9.1 → 4.0.0-alpha.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/214.min.js +2 -0
- package/214.min.js.LICENSE.txt +1 -0
- package/921.min.js +2 -0
- package/921.min.js.LICENSE.txt +1 -0
- package/browser/EmitterInstance.js +12 -13
- package/browser/Emitters.js +9 -8
- package/browser/EmittersPlugin.js +19 -32
- package/browser/Options/Classes/Emitter.js +2 -6
- package/browser/ShapeManager.js +0 -3
- package/browser/index.js +10 -18
- package/cjs/EmitterContainer.js +1 -2
- package/cjs/EmitterInstance.js +34 -39
- package/cjs/EmitterShapeBase.js +1 -5
- package/cjs/Emitters.js +21 -24
- package/cjs/EmittersEngine.js +1 -2
- package/cjs/EmittersPlugin.js +31 -48
- package/cjs/Enums/EmitterClickMode.js +2 -5
- package/cjs/IEmitterShape.js +1 -2
- package/cjs/IEmitterShapeGenerator.js +1 -2
- package/cjs/IRandomPositionData.js +1 -2
- package/cjs/Options/Classes/Emitter.js +16 -24
- package/cjs/Options/Classes/EmitterLife.js +5 -9
- package/cjs/Options/Classes/EmitterRate.js +5 -9
- package/cjs/Options/Classes/EmitterShape.js +6 -10
- package/cjs/Options/Classes/EmitterShapeReplace.js +3 -7
- package/cjs/Options/Classes/EmitterSize.js +4 -8
- package/cjs/Options/Interfaces/IEmitter.js +1 -2
- package/cjs/Options/Interfaces/IEmitterLife.js +1 -2
- package/cjs/Options/Interfaces/IEmitterRate.js +1 -2
- package/cjs/Options/Interfaces/IEmitterShape.js +1 -2
- package/cjs/Options/Interfaces/IEmitterShapeReplace.js +1 -2
- package/cjs/Options/Interfaces/IEmitterSize.js +1 -2
- package/cjs/ShapeManager.js +1 -8
- package/cjs/index.js +12 -37
- package/cjs/types.js +1 -2
- package/dist_browser_EmittersPlugin_js.js +110 -0
- package/dist_browser_ShapeManager_js.js +30 -0
- package/esm/EmitterInstance.js +12 -13
- package/esm/Emitters.js +9 -8
- package/esm/EmittersPlugin.js +19 -32
- package/esm/Options/Classes/Emitter.js +2 -6
- package/esm/ShapeManager.js +0 -3
- package/esm/index.js +10 -18
- package/package.json +4 -3
- package/report.html +5 -4
- package/tsparticles.plugin.emitters.js +215 -126
- package/tsparticles.plugin.emitters.min.js +1 -1
- package/tsparticles.plugin.emitters.min.js.LICENSE.txt +1 -1
- package/types/Options/Classes/EmitterShape.d.ts +1 -1
- package/types/Options/Classes/EmitterShapeReplace.d.ts +1 -1
- package/types/ShapeManager.d.ts +0 -3
- package/types/index.d.ts +7 -7
- package/umd/EmitterInstance.js +13 -14
- package/umd/Emitters.js +9 -8
- package/umd/EmittersPlugin.js +19 -32
- package/umd/Options/Classes/Emitter.js +2 -6
- package/umd/ShapeManager.js +0 -3
- package/umd/index.js +34 -19
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Demo / Generator : https://particles.js.org/
|
|
5
5
|
* GitHub : https://www.github.com/matteobruni/tsparticles
|
|
6
6
|
* How to use? : Check the GitHub README
|
|
7
|
-
*
|
|
7
|
+
* v4.0.0-alpha.0
|
|
8
8
|
*/
|
|
9
9
|
/*
|
|
10
10
|
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
|
@@ -28,145 +28,45 @@ return /******/ (() => { // webpackBootstrap
|
|
|
28
28
|
/******/ "use strict";
|
|
29
29
|
/******/ var __webpack_modules__ = ({
|
|
30
30
|
|
|
31
|
-
/***/ "./dist/browser/
|
|
32
|
-
/*!*****************************************!*\
|
|
33
|
-
!*** ./dist/browser/EmitterInstance.js ***!
|
|
34
|
-
\*****************************************/
|
|
35
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
36
|
-
|
|
37
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ EmitterInstance: () => (/* binding */ EmitterInstance)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _Options_Classes_Emitter_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Options/Classes/Emitter.js */ \"./dist/browser/Options/Classes/Emitter.js\");\n/* harmony import */ var _Options_Classes_EmitterSize_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Options/Classes/EmitterSize.js */ \"./dist/browser/Options/Classes/EmitterSize.js\");\n\n\n\nconst half = 0.5,\n defaultLifeDelay = 0,\n minLifeCount = 0,\n defaultSpawnDelay = 0,\n defaultEmitDelay = 0,\n defaultLifeCount = -1,\n defaultColorAnimationFactor = 1;\nfunction setParticlesOptionsColor(particlesOptions, color) {\n if (particlesOptions.color) {\n particlesOptions.color.value = color;\n } else {\n particlesOptions.color = {\n value: color\n };\n }\n}\nclass EmitterInstance {\n constructor(engine, emitters, container, options, position) {\n this.emitters = emitters;\n this.container = container;\n this._destroy = () => {\n this._mutationObserver?.disconnect();\n this._mutationObserver = undefined;\n this._resizeObserver?.disconnect();\n this._resizeObserver = undefined;\n this.emitters.removeEmitter(this);\n this._engine.dispatchEvent(\"emitterDestroyed\", {\n container: this.container,\n data: {\n emitter: this\n }\n });\n };\n this._prepareToDie = () => {\n if (this._paused) {\n return;\n }\n const duration = this.options.life?.duration !== undefined ? (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(this.options.life.duration) : undefined,\n minDuration = 0,\n minLifeCount = 0;\n if ((this._lifeCount > minLifeCount || this._immortal) && duration !== undefined && duration > minDuration) {\n this._duration = duration * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.millisecondsToSeconds;\n }\n };\n this._setColorAnimation = (animation, initValue, maxValue, factor = defaultColorAnimationFactor) => {\n const container = this.container;\n if (!animation.enable) {\n return initValue;\n }\n const colorOffset = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.randomInRange)(animation.offset),\n delay = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(this.options.rate.delay),\n emitFactor = container.retina.reduceFactor ? delay * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.millisecondsToSeconds / container.retina.reduceFactor : Infinity,\n defaultColorSpeed = 0,\n colorSpeed = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(animation.speed ?? defaultColorSpeed);\n return (initValue + colorSpeed * container.fpsLimit / emitFactor + colorOffset * factor) % maxValue;\n };\n this._engine = engine;\n this._currentDuration = 0;\n this._currentEmitDelay = 0;\n this._currentSpawnDelay = 0;\n this._initialPosition = position;\n if (options instanceof _Options_Classes_Emitter_js__WEBPACK_IMPORTED_MODULE_1__.Emitter) {\n this.options = options;\n } else {\n this.options = new _Options_Classes_Emitter_js__WEBPACK_IMPORTED_MODULE_1__.Emitter();\n this.options.load(options);\n }\n this._spawnDelay = container.retina.reduceFactor ? (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(this.options.life.delay ?? defaultLifeDelay) * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.millisecondsToSeconds / container.retina.reduceFactor : Infinity;\n this.position = this._initialPosition ?? this._calcPosition();\n this.name = this.options.name;\n this.fill = this.options.fill;\n this._firstSpawn = !this.options.life.wait;\n this._startParticlesAdded = false;\n let particlesOptions = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.deepExtend)({}, this.options.particles);\n particlesOptions ??= {};\n particlesOptions.move ??= {};\n particlesOptions.move.direction ??= this.options.direction;\n if (this.options.spawnColor) {\n this.spawnColor = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.rangeColorToHsl)(this._engine, this.options.spawnColor);\n }\n this._paused = !this.options.autoPlay;\n this._particlesOptions = particlesOptions;\n this._size = this._calcSize();\n this.size = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getSize)(this._size, this.container.canvas.size);\n this._lifeCount = this.options.life.count ?? defaultLifeCount;\n this._immortal = this._lifeCount <= minLifeCount;\n if (this.options.domId) {\n const element = document.getElementById(this.options.domId);\n if (element) {\n this._mutationObserver = new MutationObserver(() => {\n this.resize();\n });\n this._resizeObserver = new ResizeObserver(() => {\n this.resize();\n });\n this._mutationObserver.observe(element, {\n attributes: true,\n attributeFilter: [\"style\", \"width\", \"height\"]\n });\n this._resizeObserver.observe(element);\n }\n }\n const shapeOptions = this.options.shape,\n shapeGenerator = this._engine.emitterShapeManager?.getShapeGenerator(shapeOptions.type);\n if (shapeGenerator) {\n this._shape = shapeGenerator.generate(this.position, this.size, this.fill, shapeOptions.options);\n }\n this._engine.dispatchEvent(\"emitterCreated\", {\n container,\n data: {\n emitter: this\n }\n });\n this.play();\n }\n externalPause() {\n this._paused = true;\n this.pause();\n }\n externalPlay() {\n this._paused = false;\n this.play();\n }\n async init() {\n await this._shape?.init();\n }\n pause() {\n if (this._paused) {\n return;\n }\n delete this._emitDelay;\n }\n play() {\n if (this._paused) {\n return;\n }\n if (!((this._lifeCount > minLifeCount || this._immortal || !this.options.life.count) && (this._firstSpawn || this._currentSpawnDelay >= (this._spawnDelay ?? defaultSpawnDelay)))) {\n return;\n }\n const container = this.container;\n if (this._emitDelay === undefined) {\n const delay = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(this.options.rate.delay);\n this._emitDelay = container.retina.reduceFactor ? delay * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.millisecondsToSeconds / container.retina.reduceFactor : Infinity;\n }\n if (this._lifeCount > minLifeCount || this._immortal) {\n this._prepareToDie();\n }\n }\n resize() {\n const initialPosition = this._initialPosition,\n container = this.container;\n this.position = initialPosition && (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isPointInside)(initialPosition, container.canvas.size, _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.Vector.origin) ? initialPosition : this._calcPosition();\n this._size = this._calcSize();\n this.size = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getSize)(this._size, container.canvas.size);\n this._shape?.resize(this.position, this.size);\n }\n update(delta) {\n if (this._paused) {\n return;\n }\n const container = this.container;\n if (this._firstSpawn) {\n this._firstSpawn = false;\n this._currentSpawnDelay = this._spawnDelay ?? defaultSpawnDelay;\n this._currentEmitDelay = this._emitDelay ?? defaultEmitDelay;\n }\n if (!this._startParticlesAdded) {\n this._startParticlesAdded = true;\n this._emitParticles(this.options.startCount);\n }\n if (this._duration !== undefined) {\n this._currentDuration += delta.value;\n if (this._currentDuration >= this._duration) {\n this.pause();\n if (this._spawnDelay !== undefined) {\n delete this._spawnDelay;\n }\n if (!this._immortal) {\n this._lifeCount--;\n }\n if (this._lifeCount > minLifeCount || this._immortal) {\n this.position = this._calcPosition();\n this._shape?.resize(this.position, this.size);\n this._spawnDelay = container.retina.reduceFactor ? (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(this.options.life.delay ?? defaultLifeDelay) * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.millisecondsToSeconds / container.retina.reduceFactor : Infinity;\n } else {\n this._destroy();\n }\n this._currentDuration -= this._duration;\n delete this._duration;\n }\n }\n if (this._spawnDelay !== undefined) {\n this._currentSpawnDelay += delta.value;\n if (this._currentSpawnDelay >= this._spawnDelay) {\n this._engine.dispatchEvent(\"emitterPlay\", {\n container: this.container\n });\n this.play();\n this._currentSpawnDelay -= this._currentSpawnDelay;\n delete this._spawnDelay;\n }\n }\n if (this._emitDelay !== undefined) {\n this._currentEmitDelay += delta.value;\n if (this._currentEmitDelay >= this._emitDelay) {\n this._emit();\n this._currentEmitDelay -= this._emitDelay;\n }\n }\n }\n _calcPosition() {\n const container = this.container;\n if (this.options.domId) {\n const element = document.getElementById(this.options.domId);\n if (element) {\n const elRect = element.getBoundingClientRect(),\n pxRatio = container.retina.pixelRatio;\n return {\n x: (elRect.x + elRect.width * half) * pxRatio,\n y: (elRect.y + elRect.height * half) * pxRatio\n };\n }\n }\n return (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.calcPositionOrRandomFromSizeRanged)({\n size: container.canvas.size,\n position: this.options.position\n });\n }\n _calcSize() {\n const container = this.container;\n if (this.options.domId) {\n const element = document.getElementById(this.options.domId);\n if (element) {\n const elRect = element.getBoundingClientRect();\n return {\n width: elRect.width * container.retina.pixelRatio,\n height: elRect.height * container.retina.pixelRatio,\n mode: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.PixelMode.precise\n };\n }\n }\n return this.options.size ?? (() => {\n const size = new _Options_Classes_EmitterSize_js__WEBPACK_IMPORTED_MODULE_2__.EmitterSize();\n size.load({\n height: 0,\n mode: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.PixelMode.percent,\n width: 0\n });\n return size;\n })();\n }\n _emit() {\n if (this._paused) {\n return;\n }\n const quantity = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(this.options.rate.quantity);\n this._emitParticles(quantity);\n }\n _emitParticles(quantity) {\n const singleParticlesOptions = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.itemFromSingleOrMultiple)(this._particlesOptions),\n reduceFactor = this.container.retina.reduceFactor;\n for (let i = 0; i < quantity * reduceFactor; i++) {\n const particlesOptions = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.deepExtend)({}, singleParticlesOptions);\n if (this.spawnColor) {\n const hslAnimation = this.options.spawnColor?.animation;\n if (hslAnimation) {\n const maxValues = {\n h: 360,\n s: 100,\n l: 100\n },\n colorFactor = 3.6;\n this.spawnColor.h = this._setColorAnimation(hslAnimation.h, this.spawnColor.h, maxValues.h, colorFactor);\n this.spawnColor.s = this._setColorAnimation(hslAnimation.s, this.spawnColor.s, maxValues.s);\n this.spawnColor.l = this._setColorAnimation(hslAnimation.l, this.spawnColor.l, maxValues.l);\n }\n setParticlesOptionsColor(particlesOptions, this.spawnColor);\n }\n const shapeOptions = this.options.shape;\n let position = this.position;\n if (this._shape) {\n const shapePosData = this._shape.randomPosition();\n if (shapePosData) {\n position = shapePosData.position;\n const replaceData = shapeOptions.replace;\n if (replaceData.color && shapePosData.color) {\n setParticlesOptionsColor(particlesOptions, shapePosData.color);\n }\n if (replaceData.opacity) {\n if (particlesOptions.opacity) {\n particlesOptions.opacity.value = shapePosData.opacity;\n } else {\n particlesOptions.opacity = {\n value: shapePosData.opacity\n };\n }\n }\n } else {\n position = null;\n }\n }\n if (position) {\n this.container.particles.addParticle(position, particlesOptions);\n }\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-emitters/./dist/browser/EmitterInstance.js?\n}");
|
|
38
|
-
|
|
39
|
-
/***/ }),
|
|
40
|
-
|
|
41
|
-
/***/ "./dist/browser/EmitterShapeBase.js":
|
|
31
|
+
/***/ "./dist/browser/EmitterShapeBase.js"
|
|
42
32
|
/*!******************************************!*\
|
|
43
33
|
!*** ./dist/browser/EmitterShapeBase.js ***!
|
|
44
34
|
\******************************************/
|
|
45
|
-
|
|
35
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
46
36
|
|
|
47
37
|
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ EmitterShapeBase: () => (/* binding */ EmitterShapeBase)\n/* harmony export */ });\nclass EmitterShapeBase {\n constructor(position, size, fill, options) {\n this.position = position;\n this.size = size;\n this.fill = fill;\n this.options = options;\n }\n resize(position, size) {\n this.position = position;\n this.size = size;\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-emitters/./dist/browser/EmitterShapeBase.js?\n}");
|
|
48
38
|
|
|
49
|
-
/***/ }
|
|
50
|
-
|
|
51
|
-
/***/ "./dist/browser/Emitters.js":
|
|
52
|
-
/*!**********************************!*\
|
|
53
|
-
!*** ./dist/browser/Emitters.js ***!
|
|
54
|
-
\**********************************/
|
|
55
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
56
|
-
|
|
57
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Emitters: () => (/* binding */ Emitters)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _Options_Classes_Emitter_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Options/Classes/Emitter.js */ \"./dist/browser/Options/Classes/Emitter.js\");\n/* harmony import */ var _Enums_EmitterClickMode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Enums/EmitterClickMode.js */ \"./dist/browser/Enums/EmitterClickMode.js\");\n/* harmony import */ var _EmitterInstance_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./EmitterInstance.js */ \"./dist/browser/EmitterInstance.js\");\n\n\n\n\nclass Emitters {\n constructor(engine, container) {\n this.container = container;\n this._engine = engine;\n this.array = [];\n this.emitters = [];\n this.interactivityEmitters = {\n random: {\n count: 1,\n enable: false\n },\n value: []\n };\n const defaultIndex = 0;\n container.getEmitter = idxOrName => idxOrName === undefined || (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNumber)(idxOrName) ? this.array[idxOrName ?? defaultIndex] : this.array.find(t => t.name === idxOrName);\n container.addEmitter = async (options, position) => this.addEmitter(options, position);\n container.removeEmitter = idxOrName => {\n const emitter = container.getEmitter(idxOrName);\n if (emitter) {\n this.removeEmitter(emitter);\n }\n };\n container.playEmitter = idxOrName => {\n const emitter = container.getEmitter(idxOrName);\n if (emitter) {\n emitter.externalPlay();\n }\n };\n container.pauseEmitter = idxOrName => {\n const emitter = container.getEmitter(idxOrName);\n if (emitter) {\n emitter.externalPause();\n }\n };\n }\n async addEmitter(options, position) {\n const emitterOptions = new _Options_Classes_Emitter_js__WEBPACK_IMPORTED_MODULE_1__.Emitter();\n emitterOptions.load(options);\n const emitter = new _EmitterInstance_js__WEBPACK_IMPORTED_MODULE_3__.EmitterInstance(this._engine, this, this.container, emitterOptions, position);\n await emitter.init();\n this.array.push(emitter);\n return emitter;\n }\n handleClickMode(mode) {\n const emitterOptions = this.emitters,\n modeEmitters = this.interactivityEmitters;\n if (mode !== _Enums_EmitterClickMode_js__WEBPACK_IMPORTED_MODULE_2__.EmitterClickMode.emitter) {\n return;\n }\n let emittersModeOptions;\n if (modeEmitters && (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isArray)(modeEmitters.value)) {\n const minLength = 0;\n if (modeEmitters.value.length > minLength && modeEmitters.random.enable) {\n emittersModeOptions = [];\n const usedIndexes = [];\n for (let i = 0; i < modeEmitters.random.count; i++) {\n const idx = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.arrayRandomIndex)(modeEmitters.value);\n if (usedIndexes.includes(idx) && usedIndexes.length < modeEmitters.value.length) {\n i--;\n continue;\n }\n usedIndexes.push(idx);\n emittersModeOptions.push((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.itemFromArray)(modeEmitters.value, idx));\n }\n } else {\n emittersModeOptions = modeEmitters.value;\n }\n } else {\n emittersModeOptions = modeEmitters?.value;\n }\n const emittersOptions = emittersModeOptions ?? emitterOptions,\n ePosition = this.container.interactivity.mouse.clickPosition;\n void (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.executeOnSingleOrMultiple)(emittersOptions, async emitter => {\n await this.addEmitter(emitter, ePosition);\n });\n }\n async init() {\n this.emitters = this.container.actualOptions.emitters;\n this.interactivityEmitters = this.container.actualOptions.interactivity.modes.emitters;\n if (!this.emitters) {\n return;\n }\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isArray)(this.emitters)) {\n for (const emitterOptions of this.emitters) {\n await this.addEmitter(emitterOptions);\n }\n } else {\n await this.addEmitter(this.emitters);\n }\n }\n pause() {\n for (const emitter of this.array) {\n emitter.pause();\n }\n }\n play() {\n for (const emitter of this.array) {\n emitter.play();\n }\n }\n removeEmitter(emitter) {\n const index = this.array.indexOf(emitter),\n minIndex = 0,\n deleteCount = 1;\n if (index >= minIndex) {\n this.array.splice(index, deleteCount);\n }\n }\n resize() {\n for (const emitter of this.array) {\n emitter.resize();\n }\n }\n stop() {\n this.array = [];\n }\n update(delta) {\n for (const emitter of this.array) {\n emitter.update(delta);\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-emitters/./dist/browser/Emitters.js?\n}");
|
|
39
|
+
/***/ },
|
|
58
40
|
|
|
59
|
-
/***/
|
|
60
|
-
|
|
61
|
-
/***/ "./dist/browser/EmittersPlugin.js":
|
|
62
|
-
/*!****************************************!*\
|
|
63
|
-
!*** ./dist/browser/EmittersPlugin.js ***!
|
|
64
|
-
\****************************************/
|
|
65
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
66
|
-
|
|
67
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ EmittersPlugin: () => (/* binding */ EmittersPlugin)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _Options_Classes_Emitter_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Options/Classes/Emitter.js */ \"./dist/browser/Options/Classes/Emitter.js\");\n/* harmony import */ var _Enums_EmitterClickMode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Enums/EmitterClickMode.js */ \"./dist/browser/Enums/EmitterClickMode.js\");\n/* harmony import */ var _Emitters_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Emitters.js */ \"./dist/browser/Emitters.js\");\n\n\n\n\nclass EmittersPlugin {\n constructor(engine) {\n this._engine = engine;\n this.id = \"emitters\";\n }\n getPlugin(container) {\n return Promise.resolve(new _Emitters_js__WEBPACK_IMPORTED_MODULE_3__.Emitters(this._engine, container));\n }\n loadOptions(options, source) {\n if (!this.needsPlugin(options) && !this.needsPlugin(source)) {\n return;\n }\n if (source?.emitters) {\n options.emitters = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.executeOnSingleOrMultiple)(source.emitters, emitter => {\n const tmp = new _Options_Classes_Emitter_js__WEBPACK_IMPORTED_MODULE_1__.Emitter();\n tmp.load(emitter);\n return tmp;\n });\n }\n const interactivityEmitters = source?.interactivity?.modes?.emitters;\n if (interactivityEmitters) {\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isArray)(interactivityEmitters)) {\n options.interactivity.modes.emitters = {\n random: {\n count: 1,\n enable: true\n },\n value: interactivityEmitters.map(s => {\n const tmp = new _Options_Classes_Emitter_js__WEBPACK_IMPORTED_MODULE_1__.Emitter();\n tmp.load(s);\n return tmp;\n })\n };\n } else {\n const emitterMode = interactivityEmitters;\n if (emitterMode.value !== undefined) {\n const defaultCount = 1;\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isArray)(emitterMode.value)) {\n options.interactivity.modes.emitters = {\n random: {\n count: emitterMode.random.count ?? defaultCount,\n enable: emitterMode.random.enable ?? false\n },\n value: emitterMode.value.map(s => {\n const tmp = new _Options_Classes_Emitter_js__WEBPACK_IMPORTED_MODULE_1__.Emitter();\n tmp.load(s);\n return tmp;\n })\n };\n } else {\n const tmp = new _Options_Classes_Emitter_js__WEBPACK_IMPORTED_MODULE_1__.Emitter();\n tmp.load(emitterMode.value);\n options.interactivity.modes.emitters = {\n random: {\n count: emitterMode.random.count ?? defaultCount,\n enable: emitterMode.random.enable ?? false\n },\n value: tmp\n };\n }\n } else {\n const emitterOptions = options.interactivity.modes.emitters = {\n random: {\n count: 1,\n enable: false\n },\n value: new _Options_Classes_Emitter_js__WEBPACK_IMPORTED_MODULE_1__.Emitter()\n };\n emitterOptions.value.load(interactivityEmitters);\n }\n }\n }\n }\n needsPlugin(options) {\n if (!options) {\n return false;\n }\n const emitters = options.emitters;\n return (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isArray)(emitters) && !!emitters.length || emitters !== undefined || !!options.interactivity?.events?.onClick?.mode && (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isInArray)(_Enums_EmitterClickMode_js__WEBPACK_IMPORTED_MODULE_2__.EmitterClickMode.emitter, options.interactivity.events.onClick.mode);\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-emitters/./dist/browser/EmittersPlugin.js?\n}");
|
|
68
|
-
|
|
69
|
-
/***/ }),
|
|
70
|
-
|
|
71
|
-
/***/ "./dist/browser/Enums/EmitterClickMode.js":
|
|
41
|
+
/***/ "./dist/browser/Enums/EmitterClickMode.js"
|
|
72
42
|
/*!************************************************!*\
|
|
73
43
|
!*** ./dist/browser/Enums/EmitterClickMode.js ***!
|
|
74
44
|
\************************************************/
|
|
75
|
-
|
|
45
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
76
46
|
|
|
77
47
|
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ EmitterClickMode: () => (/* binding */ EmitterClickMode)\n/* harmony export */ });\nvar EmitterClickMode;\n(function (EmitterClickMode) {\n EmitterClickMode[\"emitter\"] = \"emitter\";\n})(EmitterClickMode || (EmitterClickMode = {}));\n\n//# sourceURL=webpack://@tsparticles/plugin-emitters/./dist/browser/Enums/EmitterClickMode.js?\n}");
|
|
78
48
|
|
|
79
|
-
/***/ }
|
|
80
|
-
|
|
81
|
-
/***/ "./dist/browser/Options/Classes/Emitter.js":
|
|
82
|
-
/*!*************************************************!*\
|
|
83
|
-
!*** ./dist/browser/Options/Classes/Emitter.js ***!
|
|
84
|
-
\*************************************************/
|
|
85
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
86
|
-
|
|
87
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Emitter: () => (/* binding */ Emitter)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _EmitterLife_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./EmitterLife.js */ \"./dist/browser/Options/Classes/EmitterLife.js\");\n/* harmony import */ var _EmitterRate_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./EmitterRate.js */ \"./dist/browser/Options/Classes/EmitterRate.js\");\n/* harmony import */ var _EmitterShape_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./EmitterShape.js */ \"./dist/browser/Options/Classes/EmitterShape.js\");\n/* harmony import */ var _EmitterSize_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./EmitterSize.js */ \"./dist/browser/Options/Classes/EmitterSize.js\");\n\n\n\n\n\nclass Emitter {\n constructor() {\n this.autoPlay = true;\n this.fill = true;\n this.life = new _EmitterLife_js__WEBPACK_IMPORTED_MODULE_1__.EmitterLife();\n this.rate = new _EmitterRate_js__WEBPACK_IMPORTED_MODULE_2__.EmitterRate();\n this.shape = new _EmitterShape_js__WEBPACK_IMPORTED_MODULE_3__.EmitterShape();\n this.startCount = 0;\n }\n load(data) {\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNull)(data)) {\n return;\n }\n if (data.autoPlay !== undefined) {\n this.autoPlay = data.autoPlay;\n }\n if (data.size !== undefined) {\n if (!this.size) {\n this.size = new _EmitterSize_js__WEBPACK_IMPORTED_MODULE_4__.EmitterSize();\n }\n this.size.load(data.size);\n }\n if (data.direction !== undefined) {\n this.direction = data.direction;\n }\n this.domId = data.domId;\n if (data.fill !== undefined) {\n this.fill = data.fill;\n }\n this.life.load(data.life);\n this.name = data.name;\n this.particles = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.executeOnSingleOrMultiple)(data.particles, particles => {\n return (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.deepExtend)({}, particles);\n });\n this.rate.load(data.rate);\n this.shape.load(data.shape);\n if (data.position !== undefined) {\n this.position = {};\n if (data.position.x !== undefined) {\n this.position.x = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.setRangeValue)(data.position.x);\n }\n if (data.position.y !== undefined) {\n this.position.y = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.setRangeValue)(data.position.y);\n }\n }\n if (data.spawnColor !== undefined) {\n if (this.spawnColor === undefined) {\n this.spawnColor = new _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.AnimatableColor();\n }\n this.spawnColor.load(data.spawnColor);\n }\n if (data.startCount !== undefined) {\n this.startCount = data.startCount;\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-emitters/./dist/browser/Options/Classes/Emitter.js?\n}");
|
|
88
|
-
|
|
89
|
-
/***/ }),
|
|
90
|
-
|
|
91
|
-
/***/ "./dist/browser/Options/Classes/EmitterLife.js":
|
|
92
|
-
/*!*****************************************************!*\
|
|
93
|
-
!*** ./dist/browser/Options/Classes/EmitterLife.js ***!
|
|
94
|
-
\*****************************************************/
|
|
95
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
96
|
-
|
|
97
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ EmitterLife: () => (/* binding */ EmitterLife)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n\nclass EmitterLife {\n constructor() {\n this.wait = false;\n }\n load(data) {\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNull)(data)) {\n return;\n }\n if (data.count !== undefined) {\n this.count = data.count;\n }\n if (data.delay !== undefined) {\n this.delay = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.setRangeValue)(data.delay);\n }\n if (data.duration !== undefined) {\n this.duration = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.setRangeValue)(data.duration);\n }\n if (data.wait !== undefined) {\n this.wait = data.wait;\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-emitters/./dist/browser/Options/Classes/EmitterLife.js?\n}");
|
|
98
|
-
|
|
99
|
-
/***/ }),
|
|
100
|
-
|
|
101
|
-
/***/ "./dist/browser/Options/Classes/EmitterRate.js":
|
|
102
|
-
/*!*****************************************************!*\
|
|
103
|
-
!*** ./dist/browser/Options/Classes/EmitterRate.js ***!
|
|
104
|
-
\*****************************************************/
|
|
105
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
106
|
-
|
|
107
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ EmitterRate: () => (/* binding */ EmitterRate)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n\nclass EmitterRate {\n constructor() {\n this.quantity = 1;\n this.delay = 0.1;\n }\n load(data) {\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNull)(data)) {\n return;\n }\n if (data.quantity !== undefined) {\n this.quantity = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.setRangeValue)(data.quantity);\n }\n if (data.delay !== undefined) {\n this.delay = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.setRangeValue)(data.delay);\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-emitters/./dist/browser/Options/Classes/EmitterRate.js?\n}");
|
|
108
|
-
|
|
109
|
-
/***/ }),
|
|
110
|
-
|
|
111
|
-
/***/ "./dist/browser/Options/Classes/EmitterShape.js":
|
|
112
|
-
/*!******************************************************!*\
|
|
113
|
-
!*** ./dist/browser/Options/Classes/EmitterShape.js ***!
|
|
114
|
-
\******************************************************/
|
|
115
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
49
|
+
/***/ },
|
|
116
50
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
/***/ }),
|
|
120
|
-
|
|
121
|
-
/***/ "./dist/browser/Options/Classes/EmitterShapeReplace.js":
|
|
122
|
-
/*!*************************************************************!*\
|
|
123
|
-
!*** ./dist/browser/Options/Classes/EmitterShapeReplace.js ***!
|
|
124
|
-
\*************************************************************/
|
|
125
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
126
|
-
|
|
127
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ EmitterShapeReplace: () => (/* binding */ EmitterShapeReplace)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n\nclass EmitterShapeReplace {\n constructor() {\n this.color = false;\n this.opacity = false;\n }\n load(data) {\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNull)(data)) {\n return;\n }\n if (data.color !== undefined) {\n this.color = data.color;\n }\n if (data.opacity !== undefined) {\n this.opacity = data.opacity;\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-emitters/./dist/browser/Options/Classes/EmitterShapeReplace.js?\n}");
|
|
128
|
-
|
|
129
|
-
/***/ }),
|
|
130
|
-
|
|
131
|
-
/***/ "./dist/browser/Options/Classes/EmitterSize.js":
|
|
132
|
-
/*!*****************************************************!*\
|
|
133
|
-
!*** ./dist/browser/Options/Classes/EmitterSize.js ***!
|
|
134
|
-
\*****************************************************/
|
|
135
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
136
|
-
|
|
137
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ EmitterSize: () => (/* binding */ EmitterSize)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n\nclass EmitterSize {\n constructor() {\n this.mode = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.PixelMode.percent;\n this.height = 0;\n this.width = 0;\n }\n load(data) {\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNull)(data)) {\n return;\n }\n if (data.mode !== undefined) {\n this.mode = data.mode;\n }\n if (data.height !== undefined) {\n this.height = data.height;\n }\n if (data.width !== undefined) {\n this.width = data.width;\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-emitters/./dist/browser/Options/Classes/EmitterSize.js?\n}");
|
|
138
|
-
|
|
139
|
-
/***/ }),
|
|
140
|
-
|
|
141
|
-
/***/ "./dist/browser/ShapeManager.js":
|
|
142
|
-
/*!**************************************!*\
|
|
143
|
-
!*** ./dist/browser/ShapeManager.js ***!
|
|
144
|
-
\**************************************/
|
|
145
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
146
|
-
|
|
147
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ShapeManager: () => (/* binding */ ShapeManager)\n/* harmony export */ });\nconst shapeGeneratorss = new Map();\nclass ShapeManager {\n constructor(engine) {\n this._engine = engine;\n }\n addShapeGenerator(name, generator) {\n if (!this.getShapeGenerator(name)) {\n shapeGeneratorss.set(name, generator);\n }\n }\n getShapeGenerator(name) {\n return shapeGeneratorss.get(name);\n }\n getSupportedShapeGenerators() {\n return shapeGeneratorss.keys();\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-emitters/./dist/browser/ShapeManager.js?\n}");
|
|
148
|
-
|
|
149
|
-
/***/ }),
|
|
150
|
-
|
|
151
|
-
/***/ "./dist/browser/index.js":
|
|
51
|
+
/***/ "./dist/browser/index.js"
|
|
152
52
|
/*!*******************************!*\
|
|
153
53
|
!*** ./dist/browser/index.js ***!
|
|
154
54
|
\*******************************/
|
|
155
|
-
|
|
55
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
156
56
|
|
|
157
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ EmitterClickMode: () => (/* reexport safe */
|
|
57
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ EmitterClickMode: () => (/* reexport safe */ _Enums_EmitterClickMode_js__WEBPACK_IMPORTED_MODULE_1__.EmitterClickMode),\n/* harmony export */ EmitterShapeBase: () => (/* reexport safe */ _EmitterShapeBase_js__WEBPACK_IMPORTED_MODULE_0__.EmitterShapeBase),\n/* harmony export */ loadEmittersPlugin: () => (/* binding */ loadEmittersPlugin)\n/* harmony export */ });\n/* harmony import */ var _EmitterShapeBase_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./EmitterShapeBase.js */ \"./dist/browser/EmitterShapeBase.js\");\n/* harmony import */ var _Enums_EmitterClickMode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Enums/EmitterClickMode.js */ \"./dist/browser/Enums/EmitterClickMode.js\");\nfunction loadEmittersPlugin(engine) {\n engine.checkVersion(\"4.0.0-alpha.0\");\n engine.register(async e => {\n const {\n ShapeManager\n } = await __webpack_require__.e(/*! import() */ \"dist_browser_ShapeManager_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./ShapeManager.js */ \"./dist/browser/ShapeManager.js\")),\n {\n EmittersPlugin\n } = await __webpack_require__.e(/*! import() */ \"dist_browser_EmittersPlugin_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./EmittersPlugin.js */ \"./dist/browser/EmittersPlugin.js\"));\n e.emitterShapeManager ??= new ShapeManager();\n e.addEmitterShapeGenerator ??= (name, generator) => {\n e.emitterShapeManager?.addShapeGenerator(name, generator);\n };\n const plugin = new EmittersPlugin(e);\n e.addPlugin(plugin);\n });\n}\n\n\n\n//# sourceURL=webpack://@tsparticles/plugin-emitters/./dist/browser/index.js?\n}");
|
|
158
58
|
|
|
159
|
-
/***/ }
|
|
59
|
+
/***/ },
|
|
160
60
|
|
|
161
|
-
/***/ "@tsparticles/engine"
|
|
61
|
+
/***/ "@tsparticles/engine"
|
|
162
62
|
/*!*********************************************************************************************************************************!*\
|
|
163
63
|
!*** external {"commonjs":"@tsparticles/engine","commonjs2":"@tsparticles/engine","amd":"@tsparticles/engine","root":"window"} ***!
|
|
164
64
|
\*********************************************************************************************************************************/
|
|
165
|
-
|
|
65
|
+
(module) {
|
|
166
66
|
|
|
167
67
|
module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
|
|
168
68
|
|
|
169
|
-
/***/ }
|
|
69
|
+
/***/ }
|
|
170
70
|
|
|
171
71
|
/******/ });
|
|
172
72
|
/************************************************************************/
|
|
@@ -180,6 +80,12 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
|
|
|
180
80
|
/******/ if (cachedModule !== undefined) {
|
|
181
81
|
/******/ return cachedModule.exports;
|
|
182
82
|
/******/ }
|
|
83
|
+
/******/ // Check if module exists (development only)
|
|
84
|
+
/******/ if (__webpack_modules__[moduleId] === undefined) {
|
|
85
|
+
/******/ var e = new Error("Cannot find module '" + moduleId + "'");
|
|
86
|
+
/******/ e.code = 'MODULE_NOT_FOUND';
|
|
87
|
+
/******/ throw e;
|
|
88
|
+
/******/ }
|
|
183
89
|
/******/ // Create a new module (and put it into the cache)
|
|
184
90
|
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
185
91
|
/******/ // no module.id needed
|
|
@@ -194,19 +100,10 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
|
|
|
194
100
|
/******/ return module.exports;
|
|
195
101
|
/******/ }
|
|
196
102
|
/******/
|
|
197
|
-
|
|
198
|
-
/******/
|
|
199
|
-
/******/ (() => {
|
|
200
|
-
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
201
|
-
/******/ __webpack_require__.n = (module) => {
|
|
202
|
-
/******/ var getter = module && module.__esModule ?
|
|
203
|
-
/******/ () => (module['default']) :
|
|
204
|
-
/******/ () => (module);
|
|
205
|
-
/******/ __webpack_require__.d(getter, { a: getter });
|
|
206
|
-
/******/ return getter;
|
|
207
|
-
/******/ };
|
|
208
|
-
/******/ })();
|
|
103
|
+
/******/ // expose the modules object (__webpack_modules__)
|
|
104
|
+
/******/ __webpack_require__.m = __webpack_modules__;
|
|
209
105
|
/******/
|
|
106
|
+
/************************************************************************/
|
|
210
107
|
/******/ /* webpack/runtime/define property getters */
|
|
211
108
|
/******/ (() => {
|
|
212
109
|
/******/ // define getter functions for harmony exports
|
|
@@ -219,11 +116,90 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
|
|
|
219
116
|
/******/ };
|
|
220
117
|
/******/ })();
|
|
221
118
|
/******/
|
|
119
|
+
/******/ /* webpack/runtime/ensure chunk */
|
|
120
|
+
/******/ (() => {
|
|
121
|
+
/******/ __webpack_require__.f = {};
|
|
122
|
+
/******/ // This file contains only the entry chunk.
|
|
123
|
+
/******/ // The chunk loading function for additional chunks
|
|
124
|
+
/******/ __webpack_require__.e = (chunkId) => {
|
|
125
|
+
/******/ return Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {
|
|
126
|
+
/******/ __webpack_require__.f[key](chunkId, promises);
|
|
127
|
+
/******/ return promises;
|
|
128
|
+
/******/ }, []));
|
|
129
|
+
/******/ };
|
|
130
|
+
/******/ })();
|
|
131
|
+
/******/
|
|
132
|
+
/******/ /* webpack/runtime/get javascript chunk filename */
|
|
133
|
+
/******/ (() => {
|
|
134
|
+
/******/ // This function allow to reference async chunks
|
|
135
|
+
/******/ __webpack_require__.u = (chunkId) => {
|
|
136
|
+
/******/ // return url for filenames based on template
|
|
137
|
+
/******/ return "" + chunkId + ".js";
|
|
138
|
+
/******/ };
|
|
139
|
+
/******/ })();
|
|
140
|
+
/******/
|
|
141
|
+
/******/ /* webpack/runtime/global */
|
|
142
|
+
/******/ (() => {
|
|
143
|
+
/******/ __webpack_require__.g = (function() {
|
|
144
|
+
/******/ if (typeof globalThis === 'object') return globalThis;
|
|
145
|
+
/******/ try {
|
|
146
|
+
/******/ return this || new Function('return this')();
|
|
147
|
+
/******/ } catch (e) {
|
|
148
|
+
/******/ if (typeof window === 'object') return window;
|
|
149
|
+
/******/ }
|
|
150
|
+
/******/ })();
|
|
151
|
+
/******/ })();
|
|
152
|
+
/******/
|
|
222
153
|
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
223
154
|
/******/ (() => {
|
|
224
155
|
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
225
156
|
/******/ })();
|
|
226
157
|
/******/
|
|
158
|
+
/******/ /* webpack/runtime/load script */
|
|
159
|
+
/******/ (() => {
|
|
160
|
+
/******/ var inProgress = {};
|
|
161
|
+
/******/ var dataWebpackPrefix = "@tsparticles/plugin-emitters:";
|
|
162
|
+
/******/ // loadScript function to load a script via script tag
|
|
163
|
+
/******/ __webpack_require__.l = (url, done, key, chunkId) => {
|
|
164
|
+
/******/ if(inProgress[url]) { inProgress[url].push(done); return; }
|
|
165
|
+
/******/ var script, needAttach;
|
|
166
|
+
/******/ if(key !== undefined) {
|
|
167
|
+
/******/ var scripts = document.getElementsByTagName("script");
|
|
168
|
+
/******/ for(var i = 0; i < scripts.length; i++) {
|
|
169
|
+
/******/ var s = scripts[i];
|
|
170
|
+
/******/ if(s.getAttribute("src") == url || s.getAttribute("data-webpack") == dataWebpackPrefix + key) { script = s; break; }
|
|
171
|
+
/******/ }
|
|
172
|
+
/******/ }
|
|
173
|
+
/******/ if(!script) {
|
|
174
|
+
/******/ needAttach = true;
|
|
175
|
+
/******/ script = document.createElement('script');
|
|
176
|
+
/******/
|
|
177
|
+
/******/ script.charset = 'utf-8';
|
|
178
|
+
/******/ if (__webpack_require__.nc) {
|
|
179
|
+
/******/ script.setAttribute("nonce", __webpack_require__.nc);
|
|
180
|
+
/******/ }
|
|
181
|
+
/******/ script.setAttribute("data-webpack", dataWebpackPrefix + key);
|
|
182
|
+
/******/
|
|
183
|
+
/******/ script.src = url;
|
|
184
|
+
/******/ }
|
|
185
|
+
/******/ inProgress[url] = [done];
|
|
186
|
+
/******/ var onScriptComplete = (prev, event) => {
|
|
187
|
+
/******/ // avoid mem leaks in IE.
|
|
188
|
+
/******/ script.onerror = script.onload = null;
|
|
189
|
+
/******/ clearTimeout(timeout);
|
|
190
|
+
/******/ var doneFns = inProgress[url];
|
|
191
|
+
/******/ delete inProgress[url];
|
|
192
|
+
/******/ script.parentNode && script.parentNode.removeChild(script);
|
|
193
|
+
/******/ doneFns && doneFns.forEach((fn) => (fn(event)));
|
|
194
|
+
/******/ if(prev) return prev(event);
|
|
195
|
+
/******/ }
|
|
196
|
+
/******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
|
|
197
|
+
/******/ script.onerror = onScriptComplete.bind(null, script.onerror);
|
|
198
|
+
/******/ script.onload = onScriptComplete.bind(null, script.onload);
|
|
199
|
+
/******/ needAttach && document.head.appendChild(script);
|
|
200
|
+
/******/ };
|
|
201
|
+
/******/ })();
|
|
202
|
+
/******/
|
|
227
203
|
/******/ /* webpack/runtime/make namespace object */
|
|
228
204
|
/******/ (() => {
|
|
229
205
|
/******/ // define __esModule on exports
|
|
@@ -235,6 +211,119 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
|
|
|
235
211
|
/******/ };
|
|
236
212
|
/******/ })();
|
|
237
213
|
/******/
|
|
214
|
+
/******/ /* webpack/runtime/publicPath */
|
|
215
|
+
/******/ (() => {
|
|
216
|
+
/******/ var scriptUrl;
|
|
217
|
+
/******/ if (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + "";
|
|
218
|
+
/******/ var document = __webpack_require__.g.document;
|
|
219
|
+
/******/ if (!scriptUrl && document) {
|
|
220
|
+
/******/ if (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT')
|
|
221
|
+
/******/ scriptUrl = document.currentScript.src;
|
|
222
|
+
/******/ if (!scriptUrl) {
|
|
223
|
+
/******/ var scripts = document.getElementsByTagName("script");
|
|
224
|
+
/******/ if(scripts.length) {
|
|
225
|
+
/******/ var i = scripts.length - 1;
|
|
226
|
+
/******/ while (i > -1 && (!scriptUrl || !/^http(s?):/.test(scriptUrl))) scriptUrl = scripts[i--].src;
|
|
227
|
+
/******/ }
|
|
228
|
+
/******/ }
|
|
229
|
+
/******/ }
|
|
230
|
+
/******/ // When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration
|
|
231
|
+
/******/ // or pass an empty string ("") and set the __webpack_public_path__ variable from your code to use your own logic.
|
|
232
|
+
/******/ if (!scriptUrl) throw new Error("Automatic publicPath is not supported in this browser");
|
|
233
|
+
/******/ scriptUrl = scriptUrl.replace(/^blob:/, "").replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/");
|
|
234
|
+
/******/ __webpack_require__.p = scriptUrl;
|
|
235
|
+
/******/ })();
|
|
236
|
+
/******/
|
|
237
|
+
/******/ /* webpack/runtime/jsonp chunk loading */
|
|
238
|
+
/******/ (() => {
|
|
239
|
+
/******/ // no baseURI
|
|
240
|
+
/******/
|
|
241
|
+
/******/ // object to store loaded and loading chunks
|
|
242
|
+
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
|
|
243
|
+
/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
|
|
244
|
+
/******/ var installedChunks = {
|
|
245
|
+
/******/ "tsparticles.plugin.emitters": 0
|
|
246
|
+
/******/ };
|
|
247
|
+
/******/
|
|
248
|
+
/******/ __webpack_require__.f.j = (chunkId, promises) => {
|
|
249
|
+
/******/ // JSONP chunk loading for javascript
|
|
250
|
+
/******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
|
|
251
|
+
/******/ if(installedChunkData !== 0) { // 0 means "already installed".
|
|
252
|
+
/******/
|
|
253
|
+
/******/ // a Promise means "currently loading".
|
|
254
|
+
/******/ if(installedChunkData) {
|
|
255
|
+
/******/ promises.push(installedChunkData[2]);
|
|
256
|
+
/******/ } else {
|
|
257
|
+
/******/ if(true) { // all chunks have JS
|
|
258
|
+
/******/ // setup Promise in chunk cache
|
|
259
|
+
/******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));
|
|
260
|
+
/******/ promises.push(installedChunkData[2] = promise);
|
|
261
|
+
/******/
|
|
262
|
+
/******/ // start chunk loading
|
|
263
|
+
/******/ var url = __webpack_require__.p + __webpack_require__.u(chunkId);
|
|
264
|
+
/******/ // create error before stack unwound to get useful stacktrace later
|
|
265
|
+
/******/ var error = new Error();
|
|
266
|
+
/******/ var loadingEnded = (event) => {
|
|
267
|
+
/******/ if(__webpack_require__.o(installedChunks, chunkId)) {
|
|
268
|
+
/******/ installedChunkData = installedChunks[chunkId];
|
|
269
|
+
/******/ if(installedChunkData !== 0) installedChunks[chunkId] = undefined;
|
|
270
|
+
/******/ if(installedChunkData) {
|
|
271
|
+
/******/ var errorType = event && (event.type === 'load' ? 'missing' : event.type);
|
|
272
|
+
/******/ var realSrc = event && event.target && event.target.src;
|
|
273
|
+
/******/ error.message = 'Loading chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')';
|
|
274
|
+
/******/ error.name = 'ChunkLoadError';
|
|
275
|
+
/******/ error.type = errorType;
|
|
276
|
+
/******/ error.request = realSrc;
|
|
277
|
+
/******/ installedChunkData[1](error);
|
|
278
|
+
/******/ }
|
|
279
|
+
/******/ }
|
|
280
|
+
/******/ };
|
|
281
|
+
/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId);
|
|
282
|
+
/******/ }
|
|
283
|
+
/******/ }
|
|
284
|
+
/******/ }
|
|
285
|
+
/******/ };
|
|
286
|
+
/******/
|
|
287
|
+
/******/ // no prefetching
|
|
288
|
+
/******/
|
|
289
|
+
/******/ // no preloaded
|
|
290
|
+
/******/
|
|
291
|
+
/******/ // no HMR
|
|
292
|
+
/******/
|
|
293
|
+
/******/ // no HMR manifest
|
|
294
|
+
/******/
|
|
295
|
+
/******/ // no on chunks loaded
|
|
296
|
+
/******/
|
|
297
|
+
/******/ // install a JSONP callback for chunk loading
|
|
298
|
+
/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
|
|
299
|
+
/******/ var [chunkIds, moreModules, runtime] = data;
|
|
300
|
+
/******/ // add "moreModules" to the modules object,
|
|
301
|
+
/******/ // then flag all "chunkIds" as loaded and fire callback
|
|
302
|
+
/******/ var moduleId, chunkId, i = 0;
|
|
303
|
+
/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
|
|
304
|
+
/******/ for(moduleId in moreModules) {
|
|
305
|
+
/******/ if(__webpack_require__.o(moreModules, moduleId)) {
|
|
306
|
+
/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
|
|
307
|
+
/******/ }
|
|
308
|
+
/******/ }
|
|
309
|
+
/******/ if(runtime) var result = runtime(__webpack_require__);
|
|
310
|
+
/******/ }
|
|
311
|
+
/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
|
|
312
|
+
/******/ for(;i < chunkIds.length; i++) {
|
|
313
|
+
/******/ chunkId = chunkIds[i];
|
|
314
|
+
/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
|
|
315
|
+
/******/ installedChunks[chunkId][0]();
|
|
316
|
+
/******/ }
|
|
317
|
+
/******/ installedChunks[chunkId] = 0;
|
|
318
|
+
/******/ }
|
|
319
|
+
/******/
|
|
320
|
+
/******/ }
|
|
321
|
+
/******/
|
|
322
|
+
/******/ var chunkLoadingGlobal = this["webpackChunk_tsparticles_plugin_emitters"] = this["webpackChunk_tsparticles_plugin_emitters"] || [];
|
|
323
|
+
/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
|
|
324
|
+
/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
|
|
325
|
+
/******/ })();
|
|
326
|
+
/******/
|
|
238
327
|
/************************************************************************/
|
|
239
328
|
/******/
|
|
240
329
|
/******/ // startup
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see tsparticles.plugin.emitters.min.js.LICENSE.txt */
|
|
2
|
-
!function(t,i){if("object"==typeof exports&&"object"==typeof module)module.exports=i(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],i);else{var e="object"==typeof exports?i(require("@tsparticles/engine")):i(t.window);for(var s in e)("object"==typeof exports?exports:t)[s]=e[s]}}(this,(t=>(()=>{var i={303:i=>{i.exports=t}},e={};function s(t){var o=e[t];if(void 0!==o)return o.exports;var n=e[t]={exports:{}};return i[t](n,n.exports,s),n.exports}s.d=(t,i)=>{for(var e in i)s.o(i,e)&&!s.o(t,e)&&Object.defineProperty(t,e,{enumerable:!0,get:i[e]})},s.o=(t,i)=>Object.prototype.hasOwnProperty.call(t,i),s.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var o={};s.r(o),s.d(o,{EmitterClickMode:()=>n,EmitterShapeBase:()=>g,loadEmittersPlugin:()=>w});var n,a=s(303);class r{constructor(){this.wait=!1}load(t){(0,a.isNull)(t)||(void 0!==t.count&&(this.count=t.count),void 0!==t.delay&&(this.delay=(0,a.setRangeValue)(t.delay)),void 0!==t.duration&&(this.duration=(0,a.setRangeValue)(t.duration)),void 0!==t.wait&&(this.wait=t.wait))}}class h{constructor(){this.quantity=1,this.delay=.1}load(t){(0,a.isNull)(t)||(void 0!==t.quantity&&(this.quantity=(0,a.setRangeValue)(t.quantity)),void 0!==t.delay&&(this.delay=(0,a.setRangeValue)(t.delay)))}}class l{constructor(){this.color=!1,this.opacity=!1}load(t){(0,a.isNull)(t)||(void 0!==t.color&&(this.color=t.color),void 0!==t.opacity&&(this.opacity=t.opacity))}}class c{constructor(){this.options={},this.replace=new l,this.type="square"}load(t){(0,a.isNull)(t)||(void 0!==t.options&&(this.options=(0,a.deepExtend)({},t.options??{})),this.replace.load(t.replace),void 0!==t.type&&(this.type=t.type))}}class d{constructor(){this.mode=a.PixelMode.percent,this.height=0,this.width=0}load(t){(0,a.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 p{constructor(){this.autoPlay=!0,this.fill=!0,this.life=new r,this.rate=new h,this.shape=new c,this.startCount=0}load(t){(0,a.isNull)(t)||(void 0!==t.autoPlay&&(this.autoPlay=t.autoPlay),void 0!==t.size&&(this.size||(this.size=new d),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,a.executeOnSingleOrMultiple)(t.particles,(t=>(0,a.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,a.setRangeValue)(t.position.x)),void 0!==t.position.y&&(this.position.y=(0,a.setRangeValue)(t.position.y))),void 0!==t.spawnColor&&(void 0===this.spawnColor&&(this.spawnColor=new a.AnimatableColor),this.spawnColor.load(t.spawnColor)),void 0!==t.startCount&&(this.startCount=t.startCount))}}!function(t){t.emitter="emitter"}(n||(n={}));function u(t,i){t.color?t.color.value=i:t.color={value:i}}class m{constructor(t,i,e,s,o){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,a.getRangeValue)(this.options.life.duration):void 0;(this._lifeCount>0||this._immortal)&&void 0!==t&&t>0&&(this._duration=t*a.millisecondsToSeconds)},this._setColorAnimation=(t,i,e,s=1)=>{const o=this.container;if(!t.enable)return i;const n=(0,a.randomInRange)(t.offset),r=(0,a.getRangeValue)(this.options.rate.delay),h=o.retina.reduceFactor?r*a.millisecondsToSeconds/o.retina.reduceFactor:1/0;return(i+(0,a.getRangeValue)(t.speed??0)*o.fpsLimit/h+n*s)%e},this._engine=t,this._currentDuration=0,this._currentEmitDelay=0,this._currentSpawnDelay=0,this._initialPosition=o,s instanceof p?this.options=s:(this.options=new p,this.options.load(s)),this._spawnDelay=e.retina.reduceFactor?(0,a.getRangeValue)(this.options.life.delay??0)*a.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;let n=(0,a.deepExtend)({},this.options.particles);if(n??={},n.move??={},n.move.direction??=this.options.direction,this.options.spawnColor&&(this.spawnColor=(0,a.rangeColorToHsl)(this._engine,this.options.spawnColor)),this._paused=!this.options.autoPlay,this._particlesOptions=n,this._size=this._calcSize(),this.size=(0,a.getSize)(this._size,this.container.canvas.size),this._lifeCount=this.options.life.count??-1,this._immortal=this._lifeCount<=0,this.options.domId){const t=document.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,a.getRangeValue)(this.options.rate.delay);this._emitDelay=t.retina.reduceFactor?i*a.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,a.isPointInside)(t,i.canvas.size,a.Vector.origin)?t:this._calcPosition(),this._size=this._calcSize(),this.size=(0,a.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,a.getRangeValue)(this.options.life.delay??0)*a.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=document.getElementById(this.options.domId);if(i){const e=i.getBoundingClientRect(),s=t.retina.pixelRatio;return{x:(e.x+.5*e.width)*s,y:(e.y+.5*e.height)*s}}}return(0,a.calcPositionOrRandomFromSizeRanged)({size:t.canvas.size,position:this.options.position})}_calcSize(){const t=this.container;if(this.options.domId){const i=document.getElementById(this.options.domId);if(i){const e=i.getBoundingClientRect();return{width:e.width*t.retina.pixelRatio,height:e.height*t.retina.pixelRatio,mode:a.PixelMode.precise}}}return this.options.size??(()=>{const t=new d;return t.load({height:0,mode:a.PixelMode.percent,width:0}),t})()}_emit(){if(this._paused)return;const t=(0,a.getRangeValue)(this.options.rate.quantity);this._emitParticles(t)}_emitParticles(t){const i=(0,a.itemFromSingleOrMultiple)(this._particlesOptions),e=this.container.retina.reduceFactor;for(let s=0;s<t*e;s++){const t=(0,a.deepExtend)({},i);if(this.spawnColor){const i=this.options.spawnColor?.animation;if(i){const t={h:360,s:100,l:100},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)}u(t,this.spawnColor)}const e=this.options.shape;let s=this.position;if(this._shape){const i=this._shape.randomPosition();if(i){s=i.position;const o=e.replace;o.color&&i.color&&u(t,i.color),o.opacity&&(t.opacity?t.opacity.value=i.opacity:t.opacity={value:i.opacity})}else s=null}s&&this.container.particles.addParticle(s,t)}}}class y{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,a.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 p;e.load(t);const s=new m(this._engine,this,this.container,e,i);return await s.init(),this.array.push(s),s}handleClickMode(t){const i=this.emitters,e=this.interactivityEmitters;if(t!==n.emitter)return;let s;if(e&&(0,a.isArray)(e.value)){const t=0;if(e.value.length>t&&e.random.enable){s=[];const t=[];for(let i=0;i<e.random.count;i++){const o=(0,a.arrayRandomIndex)(e.value);t.includes(o)&&t.length<e.value.length?i--:(t.push(o),s.push((0,a.itemFromArray)(e.value,o)))}}else s=e.value}else s=e?.value;const o=s??i,r=this.container.interactivity.mouse.clickPosition;(0,a.executeOnSingleOrMultiple)(o,(async t=>{await this.addEmitter(t,r)}))}async init(){if(this.emitters=this.container.actualOptions.emitters,this.interactivityEmitters=this.container.actualOptions.interactivity.modes.emitters,this.emitters)if((0,a.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 _{constructor(t){this._engine=t,this.id="emitters"}getPlugin(t){return Promise.resolve(new y(this._engine,t))}loadOptions(t,i){if(!this.needsPlugin(t)&&!this.needsPlugin(i))return;i?.emitters&&(t.emitters=(0,a.executeOnSingleOrMultiple)(i.emitters,(t=>{const i=new p;return i.load(t),i})));const e=i?.interactivity?.modes?.emitters;if(e)if((0,a.isArray)(e))t.interactivity.modes.emitters={random:{count:1,enable:!0},value:e.map((t=>{const i=new p;return i.load(t),i}))};else{const i=e;if(void 0!==i.value){const e=1;if((0,a.isArray)(i.value))t.interactivity.modes.emitters={random:{count:i.random.count??e,enable:i.random.enable??!1},value:i.value.map((t=>{const i=new p;return i.load(t),i}))};else{const s=new p;s.load(i.value),t.interactivity.modes.emitters={random:{count:i.random.count??e,enable:i.random.enable??!1},value:s}}}else{(t.interactivity.modes.emitters={random:{count:1,enable:!1},value:new p}).value.load(e)}}}needsPlugin(t){if(!t)return!1;const i=t.emitters;return(0,a.isArray)(i)&&!!i.length||void 0!==i||!!t.interactivity?.events?.onClick?.mode&&(0,a.isInArray)(n.emitter,t.interactivity.events.onClick.mode)}}const v=new Map;class f{constructor(t){this._engine=t}addShapeGenerator(t,i){this.getShapeGenerator(t)||v.set(t,i)}getShapeGenerator(t){return v.get(t)}getSupportedShapeGenerators(){return v.keys()}}class g{constructor(t,i,e,s){this.position=t,this.size=i,this.fill=e,this.options=s}resize(t,i){this.position=t,this.size=i}}async function w(t,i=!0){t.checkVersion("3.9.1"),t.emitterShapeManager||(t.emitterShapeManager=new f(t)),t.addEmitterShapeGenerator||(t.addEmitterShapeGenerator=(i,e)=>{t.emitterShapeManager?.addShapeGenerator(i,e)});const e=new _(t);await t.addPlugin(e,i)}return o})()));
|
|
2
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],t);else{var r="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var i in r)("object"==typeof exports?exports:e)[i]=r[i]}}(this,(e=>(()=>{var t,r,i={271(e,t,r){var i;r.d(t,{c:()=>i}),function(e){e.emitter="emitter"}(i||(i={}))},303(t){t.exports=e}},o={};function n(e){var t=o[e];if(void 0!==t)return t.exports;var r=o[e]={exports:{}};return i[e](r,r.exports,n),r.exports}n.m=i,n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.f={},n.e=e=>Promise.all(Object.keys(n.f).reduce(((t,r)=>(n.f[r](e,t),t)),[])),n.u=e=>e+".min.js",n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),t={},r="@tsparticles/plugin-emitters:",n.l=(e,i,o,a)=>{if(t[e])t[e].push(i);else{var s,p;if(void 0!==o)for(var c=document.getElementsByTagName("script"),l=0;l<c.length;l++){var u=c[l];if(u.getAttribute("src")==e||u.getAttribute("data-webpack")==r+o){s=u;break}}s||(p=!0,(s=document.createElement("script")).charset="utf-8",n.nc&&s.setAttribute("nonce",n.nc),s.setAttribute("data-webpack",r+o),s.src=e),t[e]=[i];var d=(r,i)=>{s.onerror=s.onload=null,clearTimeout(f);var o=t[e];if(delete t[e],s.parentNode&&s.parentNode.removeChild(s),o&&o.forEach((e=>e(i))),r)return r(i)},f=setTimeout(d.bind(null,void 0,{type:"timeout",target:s}),12e4);s.onerror=d.bind(null,s.onerror),s.onload=d.bind(null,s.onload),p&&document.head.appendChild(s)}},n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;n.g.importScripts&&(e=n.g.location+"");var t=n.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var i=r.length-1;i>-1&&(!e||!/^http(s?):/.test(e));)e=r[i--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),n.p=e})(),(()=>{var e={833:0};n.f.j=(t,r)=>{var i=n.o(e,t)?e[t]:void 0;if(0!==i)if(i)r.push(i[2]);else{var o=new Promise(((r,o)=>i=e[t]=[r,o]));r.push(i[2]=o);var a=n.p+n.u(t),s=new Error;n.l(a,(r=>{if(n.o(e,t)&&(0!==(i=e[t])&&(e[t]=void 0),i)){var o=r&&("load"===r.type?"missing":r.type),a=r&&r.target&&r.target.src;s.message="Loading chunk "+t+" failed.\n("+o+": "+a+")",s.name="ChunkLoadError",s.type=o,s.request=a,i[1](s)}}),"chunk-"+t,t)}};var t=(t,r)=>{var i,o,[a,s,p]=r,c=0;if(a.some((t=>0!==e[t]))){for(i in s)n.o(s,i)&&(n.m[i]=s[i]);if(p)p(n)}for(t&&t(r);c<a.length;c++)o=a[c],n.o(e,o)&&e[o]&&e[o][0](),e[o]=0},r=this.webpackChunk_tsparticles_plugin_emitters=this.webpackChunk_tsparticles_plugin_emitters||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var a={};n.r(a),n.d(a,{EmitterClickMode:()=>p.c,EmitterShapeBase:()=>s,loadEmittersPlugin:()=>c});class s{constructor(e,t,r,i){this.position=e,this.size=t,this.fill=r,this.options=i}resize(e,t){this.position=e,this.size=t}}var p=n(271);function c(e){e.checkVersion("4.0.0-alpha.0"),e.register((async e=>{const{ShapeManager:t}=await n.e(921).then(n.bind(n,921)),{EmittersPlugin:r}=await n.e(214).then(n.bind(n,214));e.emitterShapeManager??=new t,e.addEmitterShapeGenerator??=(t,r)=>{e.emitterShapeManager?.addShapeGenerator(t,r)};const i=new r(e);e.addPlugin(i)}))}return a})()));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
/*! tsParticles Emitters Plugin
|
|
1
|
+
/*! tsParticles Emitters Plugin v4.0.0-alpha.0 by Matteo Bruni */
|
|
@@ -4,5 +4,5 @@ export declare class EmitterShapeReplace implements IEmitterShapeReplace, IOptio
|
|
|
4
4
|
color: boolean;
|
|
5
5
|
opacity: boolean;
|
|
6
6
|
constructor();
|
|
7
|
-
load(data?: RecursivePartial<IEmitterShapeReplace>
|
|
7
|
+
load(data?: RecursivePartial<IEmitterShapeReplace>): void;
|
|
8
8
|
}
|
package/types/ShapeManager.d.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import type { Engine } from "@tsparticles/engine";
|
|
2
1
|
import type { IEmitterShapeGenerator } from "./IEmitterShapeGenerator.js";
|
|
3
2
|
export declare class ShapeManager {
|
|
4
|
-
private readonly _engine;
|
|
5
|
-
constructor(engine: Engine);
|
|
6
3
|
addShapeGenerator(name: string, generator: IEmitterShapeGenerator): void;
|
|
7
4
|
getShapeGenerator(name: string): IEmitterShapeGenerator | undefined;
|
|
8
5
|
getSupportedShapeGenerators(): IterableIterator<string>;
|
package/types/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare function loadEmittersPlugin(engine:
|
|
3
|
-
export * from "./EmitterContainer.js";
|
|
1
|
+
import type { Engine } from "@tsparticles/engine";
|
|
2
|
+
export declare function loadEmittersPlugin(engine: Engine): void;
|
|
3
|
+
export type * from "./EmitterContainer.js";
|
|
4
4
|
export * from "./EmitterShapeBase.js";
|
|
5
|
-
export * from "./EmittersEngine.js";
|
|
6
|
-
export * from "./IEmitterShape.js";
|
|
7
|
-
export * from "./IEmitterShapeGenerator.js";
|
|
5
|
+
export type * from "./EmittersEngine.js";
|
|
6
|
+
export type * from "./IEmitterShape.js";
|
|
7
|
+
export type * from "./IEmitterShapeGenerator.js";
|
|
8
8
|
export * from "./Enums/EmitterClickMode.js";
|
|
9
|
-
export * from "./IRandomPositionData.js";
|
|
9
|
+
export type * from "./IRandomPositionData.js";
|