@tsparticles/plugin-emitters
Advanced tools
Comparing version 3.3.0 to 3.4.0
@@ -1,2 +0,2 @@ | ||
import { Vector, calcPositionOrRandomFromSizeRanged, deepExtend, getRangeValue, getSize, isPointInside, itemFromSingleOrMultiple, millisecondsToSeconds, randomInRange, rangeColorToHsl, } from "@tsparticles/engine"; | ||
import { PixelMode, Vector, calcPositionOrRandomFromSizeRanged, deepExtend, getRangeValue, getSize, isPointInside, itemFromSingleOrMultiple, millisecondsToSeconds, randomInRange, rangeColorToHsl, } from "@tsparticles/engine"; | ||
import { Emitter } from "./Options/Classes/Emitter.js"; | ||
@@ -238,3 +238,3 @@ import { EmitterSize } from "./Options/Classes/EmitterSize.js"; | ||
height: elRect.height * container.retina.pixelRatio, | ||
mode: "precise", | ||
mode: PixelMode.precise, | ||
}; | ||
@@ -248,3 +248,3 @@ } | ||
height: 0, | ||
mode: "percent", | ||
mode: PixelMode.percent, | ||
width: 0, | ||
@@ -251,0 +251,0 @@ }); |
import { arrayRandomIndex, executeOnSingleOrMultiple, isArray, isNumber, itemFromArray, } from "@tsparticles/engine"; | ||
import { Emitter } from "./Options/Classes/Emitter.js"; | ||
import { EmitterClickMode } from "./Enums/EmitterClickMode.js"; | ||
import { EmitterInstance } from "./EmitterInstance.js"; | ||
export class Emitters { | ||
@@ -18,3 +21,3 @@ constructor(engine, container) { | ||
? this.array[idxOrName ?? defaultIndex] | ||
: this.array.find((t) => t.name === idxOrName); | ||
: this.array.find(t => t.name === idxOrName); | ||
container.addEmitter = async (options, position) => this.addEmitter(options, position); | ||
@@ -41,3 +44,3 @@ container.removeEmitter = (idxOrName) => { | ||
async addEmitter(options, position) { | ||
const { Emitter } = await import("./Options/Classes/Emitter.js"), { EmitterInstance } = await import("./EmitterInstance.js"), emitterOptions = new Emitter(); | ||
const emitterOptions = new Emitter(); | ||
emitterOptions.load(options); | ||
@@ -51,3 +54,3 @@ const emitter = new EmitterInstance(this._engine, this, this.container, emitterOptions, position); | ||
const emitterOptions = this.emitters, modeEmitters = this.interactivityEmitters; | ||
if (mode !== "emitter") { | ||
if (mode !== EmitterClickMode.emitter) { | ||
return; | ||
@@ -54,0 +57,0 @@ } |
import { executeOnSingleOrMultiple, isArray, isInArray, } from "@tsparticles/engine"; | ||
import { Emitter } from "./Options/Classes/Emitter.js"; | ||
import { EmitterClickMode } from "./Enums/EmitterClickMode.js"; | ||
import { Emitters } from "./Emitters.js"; | ||
export class EmittersPlugin { | ||
@@ -8,5 +10,4 @@ constructor(engine) { | ||
} | ||
async getPlugin(container) { | ||
const { Emitters } = await import("./Emitters.js"); | ||
return new Emitters(this._engine, container); | ||
getPlugin(container) { | ||
return Promise.resolve(new Emitters(this._engine, container)); | ||
} | ||
@@ -18,3 +19,3 @@ loadOptions(options, source) { | ||
if (source?.emitters) { | ||
options.emitters = executeOnSingleOrMultiple(source.emitters, (emitter) => { | ||
options.emitters = executeOnSingleOrMultiple(source.emitters, emitter => { | ||
const tmp = new Emitter(); | ||
@@ -33,3 +34,3 @@ tmp.load(emitter); | ||
}, | ||
value: interactivityEmitters.map((s) => { | ||
value: interactivityEmitters.map(s => { | ||
const tmp = new Emitter(); | ||
@@ -51,3 +52,3 @@ tmp.load(s); | ||
}, | ||
value: emitterMode.value.map((s) => { | ||
value: emitterMode.value.map(s => { | ||
const tmp = new Emitter(); | ||
@@ -92,4 +93,4 @@ tmp.load(s); | ||
(!!options.interactivity?.events?.onClick?.mode && | ||
isInArray("emitter", options.interactivity.events.onClick.mode))); | ||
isInArray(EmitterClickMode.emitter, options.interactivity.events.onClick.mode))); | ||
} | ||
} |
@@ -1,1 +0,4 @@ | ||
export {}; | ||
export var EmitterClickMode; | ||
(function (EmitterClickMode) { | ||
EmitterClickMode["emitter"] = "emitter"; | ||
})(EmitterClickMode || (EmitterClickMode = {})); |
@@ -0,4 +1,5 @@ | ||
import { EmittersPlugin } from "./EmittersPlugin.js"; | ||
import { ShapeManager } from "./ShapeManager.js"; | ||
export async function loadEmittersPlugin(engine, refresh = true) { | ||
if (!engine.emitterShapeManager) { | ||
const { ShapeManager } = await import("./ShapeManager.js"); | ||
engine.emitterShapeManager = new ShapeManager(engine); | ||
@@ -11,3 +12,3 @@ } | ||
} | ||
const { EmittersPlugin } = await import("./EmittersPlugin.js"), plugin = new EmittersPlugin(engine); | ||
const plugin = new EmittersPlugin(engine); | ||
await engine.addPlugin(plugin, refresh); | ||
@@ -14,0 +15,0 @@ } |
@@ -37,3 +37,3 @@ import { AnimatableColor, deepExtend, executeOnSingleOrMultiple, setRangeValue, } from "@tsparticles/engine"; | ||
this.name = data.name; | ||
this.particles = executeOnSingleOrMultiple(data.particles, (particles) => { | ||
this.particles = executeOnSingleOrMultiple(data.particles, particles => { | ||
return deepExtend({}, particles); | ||
@@ -40,0 +40,0 @@ }); |
@@ -0,4 +1,5 @@ | ||
import { PixelMode } from "@tsparticles/engine"; | ||
export class EmitterSize { | ||
constructor() { | ||
this.mode = "percent"; | ||
this.mode = PixelMode.percent; | ||
this.height = 0; | ||
@@ -5,0 +6,0 @@ this.width = 0; |
@@ -241,3 +241,3 @@ "use strict"; | ||
height: elRect.height * container.retina.pixelRatio, | ||
mode: "precise", | ||
mode: engine_1.PixelMode.precise, | ||
}; | ||
@@ -251,3 +251,3 @@ } | ||
height: 0, | ||
mode: "percent", | ||
mode: engine_1.PixelMode.percent, | ||
width: 0, | ||
@@ -254,0 +254,0 @@ }); |
@@ -5,2 +5,5 @@ "use strict"; | ||
const engine_1 = require("@tsparticles/engine"); | ||
const Emitter_js_1 = require("./Options/Classes/Emitter.js"); | ||
const EmitterClickMode_js_1 = require("./Enums/EmitterClickMode.js"); | ||
const EmitterInstance_js_1 = require("./EmitterInstance.js"); | ||
class Emitters { | ||
@@ -22,3 +25,3 @@ constructor(engine, container) { | ||
? this.array[idxOrName ?? defaultIndex] | ||
: this.array.find((t) => t.name === idxOrName); | ||
: this.array.find(t => t.name === idxOrName); | ||
container.addEmitter = async (options, position) => this.addEmitter(options, position); | ||
@@ -45,5 +48,5 @@ container.removeEmitter = (idxOrName) => { | ||
async addEmitter(options, position) { | ||
const { Emitter } = await import("./Options/Classes/Emitter.js"), { EmitterInstance } = await import("./EmitterInstance.js"), emitterOptions = new Emitter(); | ||
const emitterOptions = new Emitter_js_1.Emitter(); | ||
emitterOptions.load(options); | ||
const emitter = new EmitterInstance(this._engine, this, this.container, emitterOptions, position); | ||
const emitter = new EmitterInstance_js_1.EmitterInstance(this._engine, this, this.container, emitterOptions, position); | ||
await emitter.init(); | ||
@@ -55,3 +58,3 @@ this.array.push(emitter); | ||
const emitterOptions = this.emitters, modeEmitters = this.interactivityEmitters; | ||
if (mode !== "emitter") { | ||
if (mode !== EmitterClickMode_js_1.EmitterClickMode.emitter) { | ||
return; | ||
@@ -58,0 +61,0 @@ } |
@@ -6,2 +6,4 @@ "use strict"; | ||
const Emitter_js_1 = require("./Options/Classes/Emitter.js"); | ||
const EmitterClickMode_js_1 = require("./Enums/EmitterClickMode.js"); | ||
const Emitters_js_1 = require("./Emitters.js"); | ||
class EmittersPlugin { | ||
@@ -12,5 +14,4 @@ constructor(engine) { | ||
} | ||
async getPlugin(container) { | ||
const { Emitters } = await import("./Emitters.js"); | ||
return new Emitters(this._engine, container); | ||
getPlugin(container) { | ||
return Promise.resolve(new Emitters_js_1.Emitters(this._engine, container)); | ||
} | ||
@@ -22,3 +23,3 @@ loadOptions(options, source) { | ||
if (source?.emitters) { | ||
options.emitters = (0, engine_1.executeOnSingleOrMultiple)(source.emitters, (emitter) => { | ||
options.emitters = (0, engine_1.executeOnSingleOrMultiple)(source.emitters, emitter => { | ||
const tmp = new Emitter_js_1.Emitter(); | ||
@@ -37,3 +38,3 @@ tmp.load(emitter); | ||
}, | ||
value: interactivityEmitters.map((s) => { | ||
value: interactivityEmitters.map(s => { | ||
const tmp = new Emitter_js_1.Emitter(); | ||
@@ -55,3 +56,3 @@ tmp.load(s); | ||
}, | ||
value: emitterMode.value.map((s) => { | ||
value: emitterMode.value.map(s => { | ||
const tmp = new Emitter_js_1.Emitter(); | ||
@@ -96,5 +97,5 @@ tmp.load(s); | ||
(!!options.interactivity?.events?.onClick?.mode && | ||
(0, engine_1.isInArray)("emitter", options.interactivity.events.onClick.mode))); | ||
(0, engine_1.isInArray)(EmitterClickMode_js_1.EmitterClickMode.emitter, options.interactivity.events.onClick.mode))); | ||
} | ||
} | ||
exports.EmittersPlugin = EmittersPlugin; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.EmitterClickMode = void 0; | ||
var EmitterClickMode; | ||
(function (EmitterClickMode) { | ||
EmitterClickMode["emitter"] = "emitter"; | ||
})(EmitterClickMode || (exports.EmitterClickMode = EmitterClickMode = {})); |
@@ -18,6 +18,7 @@ "use strict"; | ||
exports.loadEmittersPlugin = void 0; | ||
const EmittersPlugin_js_1 = require("./EmittersPlugin.js"); | ||
const ShapeManager_js_1 = require("./ShapeManager.js"); | ||
async function loadEmittersPlugin(engine, refresh = true) { | ||
if (!engine.emitterShapeManager) { | ||
const { ShapeManager } = await import("./ShapeManager.js"); | ||
engine.emitterShapeManager = new ShapeManager(engine); | ||
engine.emitterShapeManager = new ShapeManager_js_1.ShapeManager(engine); | ||
} | ||
@@ -29,3 +30,3 @@ if (!engine.addEmitterShapeGenerator) { | ||
} | ||
const { EmittersPlugin } = await import("./EmittersPlugin.js"), plugin = new EmittersPlugin(engine); | ||
const plugin = new EmittersPlugin_js_1.EmittersPlugin(engine); | ||
await engine.addPlugin(plugin, refresh); | ||
@@ -32,0 +33,0 @@ } |
@@ -40,3 +40,3 @@ "use strict"; | ||
this.name = data.name; | ||
this.particles = (0, engine_1.executeOnSingleOrMultiple)(data.particles, (particles) => { | ||
this.particles = (0, engine_1.executeOnSingleOrMultiple)(data.particles, particles => { | ||
return (0, engine_1.deepExtend)({}, particles); | ||
@@ -43,0 +43,0 @@ }); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.EmitterSize = void 0; | ||
const engine_1 = require("@tsparticles/engine"); | ||
class EmitterSize { | ||
constructor() { | ||
this.mode = "percent"; | ||
this.mode = engine_1.PixelMode.percent; | ||
this.height = 0; | ||
@@ -8,0 +9,0 @@ this.width = 0; |
@@ -1,2 +0,2 @@ | ||
import { Vector, calcPositionOrRandomFromSizeRanged, deepExtend, getRangeValue, getSize, isPointInside, itemFromSingleOrMultiple, millisecondsToSeconds, randomInRange, rangeColorToHsl, } from "@tsparticles/engine"; | ||
import { PixelMode, Vector, calcPositionOrRandomFromSizeRanged, deepExtend, getRangeValue, getSize, isPointInside, itemFromSingleOrMultiple, millisecondsToSeconds, randomInRange, rangeColorToHsl, } from "@tsparticles/engine"; | ||
import { Emitter } from "./Options/Classes/Emitter.js"; | ||
@@ -238,3 +238,3 @@ import { EmitterSize } from "./Options/Classes/EmitterSize.js"; | ||
height: elRect.height * container.retina.pixelRatio, | ||
mode: "precise", | ||
mode: PixelMode.precise, | ||
}; | ||
@@ -248,3 +248,3 @@ } | ||
height: 0, | ||
mode: "percent", | ||
mode: PixelMode.percent, | ||
width: 0, | ||
@@ -251,0 +251,0 @@ }); |
import { arrayRandomIndex, executeOnSingleOrMultiple, isArray, isNumber, itemFromArray, } from "@tsparticles/engine"; | ||
import { Emitter } from "./Options/Classes/Emitter.js"; | ||
import { EmitterClickMode } from "./Enums/EmitterClickMode.js"; | ||
import { EmitterInstance } from "./EmitterInstance.js"; | ||
export class Emitters { | ||
@@ -18,3 +21,3 @@ constructor(engine, container) { | ||
? this.array[idxOrName ?? defaultIndex] | ||
: this.array.find((t) => t.name === idxOrName); | ||
: this.array.find(t => t.name === idxOrName); | ||
container.addEmitter = async (options, position) => this.addEmitter(options, position); | ||
@@ -41,3 +44,3 @@ container.removeEmitter = (idxOrName) => { | ||
async addEmitter(options, position) { | ||
const { Emitter } = await import("./Options/Classes/Emitter.js"), { EmitterInstance } = await import("./EmitterInstance.js"), emitterOptions = new Emitter(); | ||
const emitterOptions = new Emitter(); | ||
emitterOptions.load(options); | ||
@@ -51,3 +54,3 @@ const emitter = new EmitterInstance(this._engine, this, this.container, emitterOptions, position); | ||
const emitterOptions = this.emitters, modeEmitters = this.interactivityEmitters; | ||
if (mode !== "emitter") { | ||
if (mode !== EmitterClickMode.emitter) { | ||
return; | ||
@@ -54,0 +57,0 @@ } |
import { executeOnSingleOrMultiple, isArray, isInArray, } from "@tsparticles/engine"; | ||
import { Emitter } from "./Options/Classes/Emitter.js"; | ||
import { EmitterClickMode } from "./Enums/EmitterClickMode.js"; | ||
import { Emitters } from "./Emitters.js"; | ||
export class EmittersPlugin { | ||
@@ -8,5 +10,4 @@ constructor(engine) { | ||
} | ||
async getPlugin(container) { | ||
const { Emitters } = await import("./Emitters.js"); | ||
return new Emitters(this._engine, container); | ||
getPlugin(container) { | ||
return Promise.resolve(new Emitters(this._engine, container)); | ||
} | ||
@@ -18,3 +19,3 @@ loadOptions(options, source) { | ||
if (source?.emitters) { | ||
options.emitters = executeOnSingleOrMultiple(source.emitters, (emitter) => { | ||
options.emitters = executeOnSingleOrMultiple(source.emitters, emitter => { | ||
const tmp = new Emitter(); | ||
@@ -33,3 +34,3 @@ tmp.load(emitter); | ||
}, | ||
value: interactivityEmitters.map((s) => { | ||
value: interactivityEmitters.map(s => { | ||
const tmp = new Emitter(); | ||
@@ -51,3 +52,3 @@ tmp.load(s); | ||
}, | ||
value: emitterMode.value.map((s) => { | ||
value: emitterMode.value.map(s => { | ||
const tmp = new Emitter(); | ||
@@ -92,4 +93,4 @@ tmp.load(s); | ||
(!!options.interactivity?.events?.onClick?.mode && | ||
isInArray("emitter", options.interactivity.events.onClick.mode))); | ||
isInArray(EmitterClickMode.emitter, options.interactivity.events.onClick.mode))); | ||
} | ||
} |
@@ -1,1 +0,4 @@ | ||
export {}; | ||
export var EmitterClickMode; | ||
(function (EmitterClickMode) { | ||
EmitterClickMode["emitter"] = "emitter"; | ||
})(EmitterClickMode || (EmitterClickMode = {})); |
@@ -0,4 +1,5 @@ | ||
import { EmittersPlugin } from "./EmittersPlugin.js"; | ||
import { ShapeManager } from "./ShapeManager.js"; | ||
export async function loadEmittersPlugin(engine, refresh = true) { | ||
if (!engine.emitterShapeManager) { | ||
const { ShapeManager } = await import("./ShapeManager.js"); | ||
engine.emitterShapeManager = new ShapeManager(engine); | ||
@@ -11,3 +12,3 @@ } | ||
} | ||
const { EmittersPlugin } = await import("./EmittersPlugin.js"), plugin = new EmittersPlugin(engine); | ||
const plugin = new EmittersPlugin(engine); | ||
await engine.addPlugin(plugin, refresh); | ||
@@ -14,0 +15,0 @@ } |
@@ -37,3 +37,3 @@ import { AnimatableColor, deepExtend, executeOnSingleOrMultiple, setRangeValue, } from "@tsparticles/engine"; | ||
this.name = data.name; | ||
this.particles = executeOnSingleOrMultiple(data.particles, (particles) => { | ||
this.particles = executeOnSingleOrMultiple(data.particles, particles => { | ||
return deepExtend({}, particles); | ||
@@ -40,0 +40,0 @@ }); |
@@ -0,4 +1,5 @@ | ||
import { PixelMode } from "@tsparticles/engine"; | ||
export class EmitterSize { | ||
constructor() { | ||
this.mode = "percent"; | ||
this.mode = PixelMode.percent; | ||
this.height = 0; | ||
@@ -5,0 +6,0 @@ this.width = 0; |
{ | ||
"name": "@tsparticles/plugin-emitters", | ||
"version": "3.3.0", | ||
"version": "3.4.0", | ||
"description": "tsParticles emitters plugin", | ||
@@ -89,3 +89,3 @@ "homepage": "https://particles.js.org", | ||
"dependencies": { | ||
"@tsparticles/engine": "^3.3.0" | ||
"@tsparticles/engine": "^3.4.0" | ||
}, | ||
@@ -92,0 +92,0 @@ "publishConfig": { |
@@ -7,3 +7,3 @@ /*! | ||
* How to use? : Check the GitHub README | ||
* v3.3.0 | ||
* v3.4.0 | ||
*/ | ||
@@ -32,2 +32,12 @@ /* | ||
/***/ "./dist/browser/EmitterInstance.js": | ||
/*!*****************************************!*\ | ||
!*** ./dist/browser/EmitterInstance.js ***! | ||
\*****************************************/ | ||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | ||
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.container.retina.reduceFactor && (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 = delay * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.millisecondsToSeconds / container.retina.reduceFactor,\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 = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(this.options.life.delay ?? defaultLifeDelay) * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.millisecondsToSeconds / this.container.retina.reduceFactor;\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.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.container.retina.reduceFactor && (this._lifeCount > minLifeCount || this._immortal || !this.options.life.count) && (this._firstSpawn || this._currentSpawnDelay >= (this._spawnDelay ?? defaultSpawnDelay)))) {\n return;\n }\n if (this._emitDelay === undefined) {\n const delay = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(this.options.rate.delay);\n this._emitDelay = delay * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.millisecondsToSeconds / this.container.retina.reduceFactor;\n }\n if (this._lifeCount > minLifeCount || this._immortal) {\n this._prepareToDie();\n }\n }\n resize() {\n const initialPosition = this._initialPosition;\n this.position = initialPosition && (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isPointInside)(initialPosition, this.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, this.container.canvas.size);\n this._shape?.resize(this.position, this.size);\n }\n update(delta) {\n if (this._paused) {\n return;\n }\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 = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(this.options.life.delay ?? defaultLifeDelay) * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.millisecondsToSeconds / this.container.retina.reduceFactor;\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 if (this.options.domId) {\n const element = document.getElementById(this.options.domId);\n if (element) {\n const elRect = element.getBoundingClientRect(),\n pxRatio = this.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: this.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 for (let i = 0; i < quantity; 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?"); | ||
/***/ }), | ||
/***/ "./dist/browser/EmitterShapeBase.js": | ||
@@ -43,2 +53,102 @@ /*!******************************************!*\ | ||
/***/ "./dist/browser/Emitters.js": | ||
/*!**********************************!*\ | ||
!*** ./dist/browser/Emitters.js ***! | ||
\**********************************/ | ||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | ||
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_3__ = __webpack_require__(/*! ./Enums/EmitterClickMode.js */ \"./dist/browser/Enums/EmitterClickMode.js\");\n/* harmony import */ var _EmitterInstance_js__WEBPACK_IMPORTED_MODULE_2__ = __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_2__.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_3__.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?"); | ||
/***/ }), | ||
/***/ "./dist/browser/EmittersPlugin.js": | ||
/*!****************************************!*\ | ||
!*** ./dist/browser/EmittersPlugin.js ***! | ||
\****************************************/ | ||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | ||
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_2__ = __webpack_require__(/*! ./Options/Classes/Emitter.js */ \"./dist/browser/Options/Classes/Emitter.js\");\n/* harmony import */ var _Enums_EmitterClickMode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Enums/EmitterClickMode.js */ \"./dist/browser/Enums/EmitterClickMode.js\");\n/* harmony import */ var _Emitters_js__WEBPACK_IMPORTED_MODULE_1__ = __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_1__.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_2__.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_2__.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_2__.Emitter();\n tmp.load(s);\n return tmp;\n })\n };\n } else {\n const tmp = new _Options_Classes_Emitter_js__WEBPACK_IMPORTED_MODULE_2__.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_2__.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_3__.EmitterClickMode.emitter, options.interactivity.events.onClick.mode);\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-emitters/./dist/browser/EmittersPlugin.js?"); | ||
/***/ }), | ||
/***/ "./dist/browser/Enums/EmitterClickMode.js": | ||
/*!************************************************!*\ | ||
!*** ./dist/browser/Enums/EmitterClickMode.js ***! | ||
\************************************************/ | ||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | ||
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?"); | ||
/***/ }), | ||
/***/ "./dist/browser/Options/Classes/Emitter.js": | ||
/*!*************************************************!*\ | ||
!*** ./dist/browser/Options/Classes/Emitter.js ***! | ||
\*************************************************/ | ||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | ||
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 (!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?"); | ||
/***/ }), | ||
/***/ "./dist/browser/Options/Classes/EmitterLife.js": | ||
/*!*****************************************************!*\ | ||
!*** ./dist/browser/Options/Classes/EmitterLife.js ***! | ||
\*****************************************************/ | ||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | ||
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 (!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?"); | ||
/***/ }), | ||
/***/ "./dist/browser/Options/Classes/EmitterRate.js": | ||
/*!*****************************************************!*\ | ||
!*** ./dist/browser/Options/Classes/EmitterRate.js ***! | ||
\*****************************************************/ | ||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | ||
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 (data === undefined) {\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?"); | ||
/***/ }), | ||
/***/ "./dist/browser/Options/Classes/EmitterShape.js": | ||
/*!******************************************************!*\ | ||
!*** ./dist/browser/Options/Classes/EmitterShape.js ***! | ||
\******************************************************/ | ||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | ||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ EmitterShape: () => (/* binding */ EmitterShape)\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 _EmitterShapeReplace_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./EmitterShapeReplace.js */ \"./dist/browser/Options/Classes/EmitterShapeReplace.js\");\n\n\nclass EmitterShape {\n constructor() {\n this.options = {};\n this.replace = new _EmitterShapeReplace_js__WEBPACK_IMPORTED_MODULE_1__.EmitterShapeReplace();\n this.type = \"square\";\n }\n load(data) {\n if (!data) {\n return;\n }\n if (data.options !== undefined) {\n this.options = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.deepExtend)({}, data.options ?? {});\n }\n this.replace.load(data.replace);\n if (data.type !== undefined) {\n this.type = data.type;\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-emitters/./dist/browser/Options/Classes/EmitterShape.js?"); | ||
/***/ }), | ||
/***/ "./dist/browser/Options/Classes/EmitterShapeReplace.js": | ||
/*!*************************************************************!*\ | ||
!*** ./dist/browser/Options/Classes/EmitterShapeReplace.js ***! | ||
\*************************************************************/ | ||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | ||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ EmitterShapeReplace: () => (/* binding */ EmitterShapeReplace)\n/* harmony export */ });\nclass EmitterShapeReplace {\n constructor() {\n this.color = false;\n this.opacity = false;\n }\n load(data) {\n if (!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?"); | ||
/***/ }), | ||
/***/ "./dist/browser/Options/Classes/EmitterSize.js": | ||
/*!*****************************************************!*\ | ||
!*** ./dist/browser/Options/Classes/EmitterSize.js ***! | ||
\*****************************************************/ | ||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | ||
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 (data === undefined) {\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?"); | ||
/***/ }), | ||
/***/ "./dist/browser/ShapeManager.js": | ||
/*!**************************************!*\ | ||
!*** ./dist/browser/ShapeManager.js ***! | ||
\**************************************/ | ||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | ||
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?"); | ||
/***/ }), | ||
/***/ "./dist/browser/index.js": | ||
@@ -50,3 +160,3 @@ /*!*******************************!*\ | ||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\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\");\nasync function loadEmittersPlugin(engine, refresh = true) {\n if (!engine.emitterShapeManager) {\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 engine.emitterShapeManager = new ShapeManager(engine);\n }\n if (!engine.addEmitterShapeGenerator) {\n engine.addEmitterShapeGenerator = (name, generator) => {\n engine.emitterShapeManager?.addShapeGenerator(name, generator);\n };\n }\n const {\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 plugin = new EmittersPlugin(engine);\n await engine.addPlugin(plugin, refresh);\n}\n\n\n\n\n\n\n\n\n//# sourceURL=webpack://@tsparticles/plugin-emitters/./dist/browser/index.js?"); | ||
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_3__.EmitterClickMode),\n/* harmony export */ EmitterShapeBase: () => (/* reexport safe */ _EmitterShapeBase_js__WEBPACK_IMPORTED_MODULE_2__.EmitterShapeBase),\n/* harmony export */ loadEmittersPlugin: () => (/* binding */ loadEmittersPlugin)\n/* harmony export */ });\n/* harmony import */ var _EmittersPlugin_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./EmittersPlugin.js */ \"./dist/browser/EmittersPlugin.js\");\n/* harmony import */ var _ShapeManager_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ShapeManager.js */ \"./dist/browser/ShapeManager.js\");\n/* harmony import */ var _EmitterShapeBase_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./EmitterShapeBase.js */ \"./dist/browser/EmitterShapeBase.js\");\n/* harmony import */ var _Enums_EmitterClickMode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Enums/EmitterClickMode.js */ \"./dist/browser/Enums/EmitterClickMode.js\");\n\n\nasync function loadEmittersPlugin(engine, refresh = true) {\n if (!engine.emitterShapeManager) {\n engine.emitterShapeManager = new _ShapeManager_js__WEBPACK_IMPORTED_MODULE_0__.ShapeManager(engine);\n }\n if (!engine.addEmitterShapeGenerator) {\n engine.addEmitterShapeGenerator = (name, generator) => {\n engine.emitterShapeManager?.addShapeGenerator(name, generator);\n };\n }\n const plugin = new _EmittersPlugin_js__WEBPACK_IMPORTED_MODULE_1__.EmittersPlugin(engine);\n await engine.addPlugin(plugin, refresh);\n}\n\n\n\n\n\n\n\n\n//# sourceURL=webpack://@tsparticles/plugin-emitters/./dist/browser/index.js?"); | ||
@@ -91,5 +201,2 @@ /***/ }), | ||
/******/ | ||
/******/ // expose the modules object (__webpack_modules__) | ||
/******/ __webpack_require__.m = __webpack_modules__; | ||
/******/ | ||
/************************************************************************/ | ||
@@ -120,36 +227,2 @@ /******/ /* webpack/runtime/compat get default export */ | ||
/******/ | ||
/******/ /* webpack/runtime/ensure chunk */ | ||
/******/ (() => { | ||
/******/ __webpack_require__.f = {}; | ||
/******/ // This file contains only the entry chunk. | ||
/******/ // The chunk loading function for additional chunks | ||
/******/ __webpack_require__.e = (chunkId) => { | ||
/******/ return Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => { | ||
/******/ __webpack_require__.f[key](chunkId, promises); | ||
/******/ return promises; | ||
/******/ }, [])); | ||
/******/ }; | ||
/******/ })(); | ||
/******/ | ||
/******/ /* webpack/runtime/get javascript chunk filename */ | ||
/******/ (() => { | ||
/******/ // This function allow to reference async chunks | ||
/******/ __webpack_require__.u = (chunkId) => { | ||
/******/ // return url for filenames based on template | ||
/******/ return "" + chunkId + ".js"; | ||
/******/ }; | ||
/******/ })(); | ||
/******/ | ||
/******/ /* webpack/runtime/global */ | ||
/******/ (() => { | ||
/******/ __webpack_require__.g = (function() { | ||
/******/ if (typeof globalThis === 'object') return globalThis; | ||
/******/ try { | ||
/******/ return this || new Function('return this')(); | ||
/******/ } catch (e) { | ||
/******/ if (typeof window === 'object') return window; | ||
/******/ } | ||
/******/ })(); | ||
/******/ })(); | ||
/******/ | ||
/******/ /* webpack/runtime/hasOwnProperty shorthand */ | ||
@@ -160,48 +233,2 @@ /******/ (() => { | ||
/******/ | ||
/******/ /* webpack/runtime/load script */ | ||
/******/ (() => { | ||
/******/ var inProgress = {}; | ||
/******/ var dataWebpackPrefix = "@tsparticles/plugin-emitters:"; | ||
/******/ // loadScript function to load a script via script tag | ||
/******/ __webpack_require__.l = (url, done, key, chunkId) => { | ||
/******/ if(inProgress[url]) { inProgress[url].push(done); return; } | ||
/******/ var script, needAttach; | ||
/******/ if(key !== undefined) { | ||
/******/ var scripts = document.getElementsByTagName("script"); | ||
/******/ for(var i = 0; i < scripts.length; i++) { | ||
/******/ var s = scripts[i]; | ||
/******/ if(s.getAttribute("src") == url || s.getAttribute("data-webpack") == dataWebpackPrefix + key) { script = s; break; } | ||
/******/ } | ||
/******/ } | ||
/******/ if(!script) { | ||
/******/ needAttach = true; | ||
/******/ script = document.createElement('script'); | ||
/******/ | ||
/******/ script.charset = 'utf-8'; | ||
/******/ script.timeout = 120; | ||
/******/ if (__webpack_require__.nc) { | ||
/******/ script.setAttribute("nonce", __webpack_require__.nc); | ||
/******/ } | ||
/******/ script.setAttribute("data-webpack", dataWebpackPrefix + key); | ||
/******/ | ||
/******/ script.src = url; | ||
/******/ } | ||
/******/ inProgress[url] = [done]; | ||
/******/ var onScriptComplete = (prev, event) => { | ||
/******/ // avoid mem leaks in IE. | ||
/******/ script.onerror = script.onload = null; | ||
/******/ clearTimeout(timeout); | ||
/******/ var doneFns = inProgress[url]; | ||
/******/ delete inProgress[url]; | ||
/******/ script.parentNode && script.parentNode.removeChild(script); | ||
/******/ doneFns && doneFns.forEach((fn) => (fn(event))); | ||
/******/ if(prev) return prev(event); | ||
/******/ } | ||
/******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000); | ||
/******/ script.onerror = onScriptComplete.bind(null, script.onerror); | ||
/******/ script.onload = onScriptComplete.bind(null, script.onload); | ||
/******/ needAttach && document.head.appendChild(script); | ||
/******/ }; | ||
/******/ })(); | ||
/******/ | ||
/******/ /* webpack/runtime/make namespace object */ | ||
@@ -218,117 +245,2 @@ /******/ (() => { | ||
/******/ | ||
/******/ /* webpack/runtime/publicPath */ | ||
/******/ (() => { | ||
/******/ var scriptUrl; | ||
/******/ if (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + ""; | ||
/******/ var document = __webpack_require__.g.document; | ||
/******/ if (!scriptUrl && document) { | ||
/******/ if (document.currentScript) | ||
/******/ scriptUrl = document.currentScript.src; | ||
/******/ if (!scriptUrl) { | ||
/******/ var scripts = document.getElementsByTagName("script"); | ||
/******/ if(scripts.length) { | ||
/******/ var i = scripts.length - 1; | ||
/******/ while (i > -1 && (!scriptUrl || !/^http(s?):/.test(scriptUrl))) scriptUrl = scripts[i--].src; | ||
/******/ } | ||
/******/ } | ||
/******/ } | ||
/******/ // When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration | ||
/******/ // or pass an empty string ("") and set the __webpack_public_path__ variable from your code to use your own logic. | ||
/******/ if (!scriptUrl) throw new Error("Automatic publicPath is not supported in this browser"); | ||
/******/ scriptUrl = scriptUrl.replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/"); | ||
/******/ __webpack_require__.p = scriptUrl; | ||
/******/ })(); | ||
/******/ | ||
/******/ /* webpack/runtime/jsonp chunk loading */ | ||
/******/ (() => { | ||
/******/ // no baseURI | ||
/******/ | ||
/******/ // object to store loaded and loading chunks | ||
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched | ||
/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded | ||
/******/ var installedChunks = { | ||
/******/ "tsparticles.plugin.emitters": 0 | ||
/******/ }; | ||
/******/ | ||
/******/ __webpack_require__.f.j = (chunkId, promises) => { | ||
/******/ // JSONP chunk loading for javascript | ||
/******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined; | ||
/******/ if(installedChunkData !== 0) { // 0 means "already installed". | ||
/******/ | ||
/******/ // a Promise means "currently loading". | ||
/******/ if(installedChunkData) { | ||
/******/ promises.push(installedChunkData[2]); | ||
/******/ } else { | ||
/******/ if(true) { // all chunks have JS | ||
/******/ // setup Promise in chunk cache | ||
/******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject])); | ||
/******/ promises.push(installedChunkData[2] = promise); | ||
/******/ | ||
/******/ // start chunk loading | ||
/******/ var url = __webpack_require__.p + __webpack_require__.u(chunkId); | ||
/******/ // create error before stack unwound to get useful stacktrace later | ||
/******/ var error = new Error(); | ||
/******/ var loadingEnded = (event) => { | ||
/******/ if(__webpack_require__.o(installedChunks, chunkId)) { | ||
/******/ installedChunkData = installedChunks[chunkId]; | ||
/******/ if(installedChunkData !== 0) installedChunks[chunkId] = undefined; | ||
/******/ if(installedChunkData) { | ||
/******/ var errorType = event && (event.type === 'load' ? 'missing' : event.type); | ||
/******/ var realSrc = event && event.target && event.target.src; | ||
/******/ error.message = 'Loading chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')'; | ||
/******/ error.name = 'ChunkLoadError'; | ||
/******/ error.type = errorType; | ||
/******/ error.request = realSrc; | ||
/******/ installedChunkData[1](error); | ||
/******/ } | ||
/******/ } | ||
/******/ }; | ||
/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId); | ||
/******/ } | ||
/******/ } | ||
/******/ } | ||
/******/ }; | ||
/******/ | ||
/******/ // no prefetching | ||
/******/ | ||
/******/ // no preloaded | ||
/******/ | ||
/******/ // no HMR | ||
/******/ | ||
/******/ // no HMR manifest | ||
/******/ | ||
/******/ // no on chunks loaded | ||
/******/ | ||
/******/ // install a JSONP callback for chunk loading | ||
/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => { | ||
/******/ var chunkIds = data[0]; | ||
/******/ var moreModules = data[1]; | ||
/******/ var runtime = data[2]; | ||
/******/ // add "moreModules" to the modules object, | ||
/******/ // then flag all "chunkIds" as loaded and fire callback | ||
/******/ var moduleId, chunkId, i = 0; | ||
/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) { | ||
/******/ for(moduleId in moreModules) { | ||
/******/ if(__webpack_require__.o(moreModules, moduleId)) { | ||
/******/ __webpack_require__.m[moduleId] = moreModules[moduleId]; | ||
/******/ } | ||
/******/ } | ||
/******/ if(runtime) var result = runtime(__webpack_require__); | ||
/******/ } | ||
/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data); | ||
/******/ for(;i < chunkIds.length; i++) { | ||
/******/ chunkId = chunkIds[i]; | ||
/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) { | ||
/******/ installedChunks[chunkId][0](); | ||
/******/ } | ||
/******/ installedChunks[chunkId] = 0; | ||
/******/ } | ||
/******/ | ||
/******/ } | ||
/******/ | ||
/******/ var chunkLoadingGlobal = this["webpackChunk_tsparticles_plugin_emitters"] = this["webpackChunk_tsparticles_plugin_emitters"] || []; | ||
/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0)); | ||
/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal)); | ||
/******/ })(); | ||
/******/ | ||
/************************************************************************/ | ||
@@ -335,0 +247,0 @@ /******/ |
/*! For license information please see tsparticles.plugin.emitters.min.js.LICENSE.txt */ | ||
!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={303:t=>{t.exports=e}},n={};function o(e){var t=n[e];if(void 0!==t)return t.exports;var r=n[e]={exports:{}};return i[e](r,r.exports,o),r.exports}o.m=i,o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.f={},o.e=e=>Promise.all(Object.keys(o.f).reduce(((t,r)=>(o.f[r](e,t),t)),[])),o.u=e=>e+".min.js",o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),t={},r="@tsparticles/plugin-emitters:",o.l=(e,i,n,a)=>{if(t[e])t[e].push(i);else{var s,p;if(void 0!==n)for(var l=document.getElementsByTagName("script"),u=0;u<l.length;u++){var c=l[u];if(c.getAttribute("src")==e||c.getAttribute("data-webpack")==r+n){s=c;break}}s||(p=!0,(s=document.createElement("script")).charset="utf-8",s.timeout=120,o.nc&&s.setAttribute("nonce",o.nc),s.setAttribute("data-webpack",r+n),s.src=e),t[e]=[i];var d=(r,i)=>{s.onerror=s.onload=null,clearTimeout(f);var n=t[e];if(delete t[e],s.parentNode&&s.parentNode.removeChild(s),n&&n.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)}},o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;o.g.importScripts&&(e=o.g.location+"");var t=o.g.document;if(!e&&t&&(t.currentScript&&(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(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),o.p=e})(),(()=>{var e={833:0};o.f.j=(t,r)=>{var i=o.o(e,t)?e[t]:void 0;if(0!==i)if(i)r.push(i[2]);else{var n=new Promise(((r,n)=>i=e[t]=[r,n]));r.push(i[2]=n);var a=o.p+o.u(t),s=new Error;o.l(a,(r=>{if(o.o(e,t)&&(0!==(i=e[t])&&(e[t]=void 0),i)){var n=r&&("load"===r.type?"missing":r.type),a=r&&r.target&&r.target.src;s.message="Loading chunk "+t+" failed.\n("+n+": "+a+")",s.name="ChunkLoadError",s.type=n,s.request=a,i[1](s)}}),"chunk-"+t,t)}};var t=(t,r)=>{var i,n,a=r[0],s=r[1],p=r[2],l=0;if(a.some((t=>0!==e[t]))){for(i in s)o.o(s,i)&&(o.m[i]=s[i]);if(p)p(o)}for(t&&t(r);l<a.length;l++)n=a[l],o.o(e,n)&&e[n]&&e[n][0](),e[n]=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={};return(()=>{o.r(a),o.d(a,{EmitterShapeBase:()=>e,loadEmittersPlugin:()=>t});class e{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}}async function t(e,t=!0){if(!e.emitterShapeManager){const{ShapeManager:t}=await o.e(737).then(o.bind(o,737));e.emitterShapeManager=new t(e)}e.addEmitterShapeGenerator||(e.addEmitterShapeGenerator=(t,r)=>{e.emitterShapeManager?.addShapeGenerator(t,r)});const{EmittersPlugin:r}=await o.e(121).then(o.bind(o,121)),i=new r(e);await e.addPlugin(i,t)}})(),a})())); | ||
!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={};return(()=>{s.r(o),s.d(o,{EmitterClickMode:()=>t,EmitterShapeBase:()=>_,loadEmittersPlugin:()=>v});var t,i=s(303);class e{constructor(){this.wait=!1}load(t){t&&(void 0!==t.count&&(this.count=t.count),void 0!==t.delay&&(this.delay=(0,i.setRangeValue)(t.delay)),void 0!==t.duration&&(this.duration=(0,i.setRangeValue)(t.duration)),void 0!==t.wait&&(this.wait=t.wait))}}class n{constructor(){this.quantity=1,this.delay=.1}load(t){void 0!==t&&(void 0!==t.quantity&&(this.quantity=(0,i.setRangeValue)(t.quantity)),void 0!==t.delay&&(this.delay=(0,i.setRangeValue)(t.delay)))}}class a{constructor(){this.color=!1,this.opacity=!1}load(t){t&&(void 0!==t.color&&(this.color=t.color),void 0!==t.opacity&&(this.opacity=t.opacity))}}class r{constructor(){this.options={},this.replace=new a,this.type="square"}load(t){t&&(void 0!==t.options&&(this.options=(0,i.deepExtend)({},t.options??{})),this.replace.load(t.replace),void 0!==t.type&&(this.type=t.type))}}class h{constructor(){this.mode=i.PixelMode.percent,this.height=0,this.width=0}load(t){void 0!==t&&(void 0!==t.mode&&(this.mode=t.mode),void 0!==t.height&&(this.height=t.height),void 0!==t.width&&(this.width=t.width))}}class l{constructor(){this.autoPlay=!0,this.fill=!0,this.life=new e,this.rate=new n,this.shape=new r,this.startCount=0}load(t){t&&(void 0!==t.autoPlay&&(this.autoPlay=t.autoPlay),void 0!==t.size&&(this.size||(this.size=new h),this.size.load(t.size)),void 0!==t.direction&&(this.direction=t.direction),this.domId=t.domId,void 0!==t.fill&&(this.fill=t.fill),this.life.load(t.life),this.name=t.name,this.particles=(0,i.executeOnSingleOrMultiple)(t.particles,(t=>(0,i.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,i.setRangeValue)(t.position.x)),void 0!==t.position.y&&(this.position.y=(0,i.setRangeValue)(t.position.y))),void 0!==t.spawnColor&&(void 0===this.spawnColor&&(this.spawnColor=new i.AnimatableColor),this.spawnColor.load(t.spawnColor)),void 0!==t.startCount&&(this.startCount=t.startCount))}}!function(t){t.emitter="emitter"}(t||(t={}));function c(t,i){t.color?t.color.value=i:t.color={value:i}}class d{constructor(t,e,s,o,n){this.emitters=e,this.container=s,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,i.getRangeValue)(this.options.life.duration):void 0;this.container.retina.reduceFactor&&(this._lifeCount>0||this._immortal)&&void 0!==t&&t>0&&(this._duration=t*i.millisecondsToSeconds)},this._setColorAnimation=(t,e,s,o=1)=>{const n=this.container;if(!t.enable)return e;const a=(0,i.randomInRange)(t.offset),r=(0,i.getRangeValue)(this.options.rate.delay)*i.millisecondsToSeconds/n.retina.reduceFactor;return(e+(0,i.getRangeValue)(t.speed??0)*n.fpsLimit/r+a*o)%s},this._engine=t,this._currentDuration=0,this._currentEmitDelay=0,this._currentSpawnDelay=0,this._initialPosition=n,o instanceof l?this.options=o:(this.options=new l,this.options.load(o)),this._spawnDelay=(0,i.getRangeValue)(this.options.life.delay??0)*i.millisecondsToSeconds/this.container.retina.reduceFactor,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 a=(0,i.deepExtend)({},this.options.particles);if(a??={},a.move??={},a.move.direction??=this.options.direction,this.options.spawnColor&&(this.spawnColor=(0,i.rangeColorToHsl)(this.options.spawnColor)),this._paused=!this.options.autoPlay,this._particlesOptions=a,this._size=this._calcSize(),this.size=(0,i.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:s,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&&this.container.retina.reduceFactor&&(this._lifeCount>0||this._immortal||!this.options.life.count)&&(this._firstSpawn||this._currentSpawnDelay>=(this._spawnDelay??0))){if(void 0===this._emitDelay){const t=(0,i.getRangeValue)(this.options.rate.delay);this._emitDelay=t*i.millisecondsToSeconds/this.container.retina.reduceFactor}(this._lifeCount>0||this._immortal)&&this._prepareToDie()}}resize(){const t=this._initialPosition;this.position=t&&(0,i.isPointInside)(t,this.container.canvas.size,i.Vector.origin)?t:this._calcPosition(),this._size=this._calcSize(),this.size=(0,i.getSize)(this._size,this.container.canvas.size),this._shape?.resize(this.position,this.size)}update(t){this._paused||(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=(0,i.getRangeValue)(this.options.life.delay??0)*i.millisecondsToSeconds/this.container.retina.reduceFactor):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(){if(this.options.domId){const t=document.getElementById(this.options.domId);if(t){const i=t.getBoundingClientRect(),e=this.container.retina.pixelRatio;return{x:(i.x+.5*i.width)*e,y:(i.y+.5*i.height)*e}}}return(0,i.calcPositionOrRandomFromSizeRanged)({size:this.container.canvas.size,position:this.options.position})}_calcSize(){const t=this.container;if(this.options.domId){const e=document.getElementById(this.options.domId);if(e){const s=e.getBoundingClientRect();return{width:s.width*t.retina.pixelRatio,height:s.height*t.retina.pixelRatio,mode:i.PixelMode.precise}}}return this.options.size??(()=>{const t=new h;return t.load({height:0,mode:i.PixelMode.percent,width:0}),t})()}_emit(){if(this._paused)return;const t=(0,i.getRangeValue)(this.options.rate.quantity);this._emitParticles(t)}_emitParticles(t){const e=(0,i.itemFromSingleOrMultiple)(this._particlesOptions);for(let s=0;s<t;s++){const t=(0,i.deepExtend)({},e);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)}c(t,this.spawnColor)}const s=this.options.shape;let o=this.position;if(this._shape){const i=this._shape.randomPosition();if(i){o=i.position;const e=s.replace;e.color&&i.color&&c(t,i.color),e.opacity&&(t.opacity?t.opacity.value=i.opacity:t.opacity={value:i.opacity})}else o=null}o&&this.container.particles.addParticle(o,t)}}}class p{constructor(t,e){this.container=e,this._engine=t,this.array=[],this.emitters=[],this.interactivityEmitters={random:{count:1,enable:!1},value:[]};e.getEmitter=t=>void 0===t||(0,i.isNumber)(t)?this.array[t??0]:this.array.find((i=>i.name===t)),e.addEmitter=async(t,i)=>this.addEmitter(t,i),e.removeEmitter=t=>{const i=e.getEmitter(t);i&&this.removeEmitter(i)},e.playEmitter=t=>{const i=e.getEmitter(t);i&&i.externalPlay()},e.pauseEmitter=t=>{const i=e.getEmitter(t);i&&i.externalPause()}}async addEmitter(t,i){const e=new l;e.load(t);const s=new d(this._engine,this,this.container,e,i);return await s.init(),this.array.push(s),s}handleClickMode(e){const s=this.emitters,o=this.interactivityEmitters;if(e!==t.emitter)return;let n;if(o&&(0,i.isArray)(o.value)){const t=0;if(o.value.length>t&&o.random.enable){n=[];const t=[];for(let e=0;e<o.random.count;e++){const s=(0,i.arrayRandomIndex)(o.value);t.includes(s)&&t.length<o.value.length?e--:(t.push(s),n.push((0,i.itemFromArray)(o.value,s)))}}else n=o.value}else n=o?.value;const a=n??s,r=this.container.interactivity.mouse.clickPosition;(0,i.executeOnSingleOrMultiple)(a,(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,i.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 u{constructor(t){this._engine=t,this.id="emitters"}getPlugin(t){return Promise.resolve(new p(this._engine,t))}loadOptions(t,e){if(!this.needsPlugin(t)&&!this.needsPlugin(e))return;e?.emitters&&(t.emitters=(0,i.executeOnSingleOrMultiple)(e.emitters,(t=>{const i=new l;return i.load(t),i})));const s=e?.interactivity?.modes?.emitters;if(s)if((0,i.isArray)(s))t.interactivity.modes.emitters={random:{count:1,enable:!0},value:s.map((t=>{const i=new l;return i.load(t),i}))};else{const e=s;if(void 0!==e.value){const s=1;if((0,i.isArray)(e.value))t.interactivity.modes.emitters={random:{count:e.random.count??s,enable:e.random.enable??!1},value:e.value.map((t=>{const i=new l;return i.load(t),i}))};else{const i=new l;i.load(e.value),t.interactivity.modes.emitters={random:{count:e.random.count??s,enable:e.random.enable??!1},value:i}}}else{(t.interactivity.modes.emitters={random:{count:1,enable:!1},value:new l}).value.load(s)}}}needsPlugin(e){if(!e)return!1;const s=e.emitters;return(0,i.isArray)(s)&&!!s.length||void 0!==s||!!e.interactivity?.events?.onClick?.mode&&(0,i.isInArray)(t.emitter,e.interactivity.events.onClick.mode)}}const m=new Map;class y{constructor(t){this._engine=t}addShapeGenerator(t,i){this.getShapeGenerator(t)||m.set(t,i)}getShapeGenerator(t){return m.get(t)}getSupportedShapeGenerators(){return m.keys()}}class _{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 v(t,i=!0){t.emitterShapeManager||(t.emitterShapeManager=new y(t)),t.addEmitterShapeGenerator||(t.addEmitterShapeGenerator=(i,e)=>{t.emitterShapeManager?.addShapeGenerator(i,e)});const e=new u(t);await t.addPlugin(e,i)}})(),o})())); |
@@ -1,1 +0,1 @@ | ||
/*! tsParticles Emitters Plugin v3.3.0 by Matteo Bruni */ | ||
/*! tsParticles Emitters Plugin v3.4.0 by Matteo Bruni */ |
import { type IContainerPlugin, type ICoordinates, type IDelta, type RecursivePartial, type SingleOrMultiple } from "@tsparticles/engine"; | ||
import type { Emitter } from "./Options/Classes/Emitter.js"; | ||
import { Emitter } from "./Options/Classes/Emitter.js"; | ||
import type { EmitterContainer } from "./EmitterContainer.js"; | ||
import type { EmitterInstance } from "./EmitterInstance.js"; | ||
import { EmitterInstance } from "./EmitterInstance.js"; | ||
import type { EmitterModeOptions } from "./types.js"; | ||
@@ -6,0 +6,0 @@ import type { EmittersEngine } from "./EmittersEngine.js"; |
import type { EmitterOptions, IEmitterOptions } from "./types.js"; | ||
import { type IOptions, type IPlugin, type RecursivePartial } from "@tsparticles/engine"; | ||
import type { EmitterContainer } from "./EmitterContainer.js"; | ||
import type { Emitters } from "./Emitters.js"; | ||
import { Emitters } from "./Emitters.js"; | ||
import type { EmittersEngine } from "./EmittersEngine.js"; | ||
@@ -6,0 +6,0 @@ export declare class EmittersPlugin implements IPlugin { |
@@ -1,3 +0,3 @@ | ||
export declare const enum EmitterClickMode { | ||
export declare enum EmitterClickMode { | ||
emitter = "emitter" | ||
} |
@@ -250,3 +250,3 @@ (function (factory) { | ||
height: elRect.height * container.retina.pixelRatio, | ||
mode: "precise", | ||
mode: engine_1.PixelMode.precise, | ||
}; | ||
@@ -260,3 +260,3 @@ } | ||
height: 0, | ||
mode: "percent", | ||
mode: engine_1.PixelMode.percent, | ||
width: 0, | ||
@@ -263,0 +263,0 @@ }); |
@@ -1,24 +0,1 @@ | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
(function (factory) { | ||
@@ -30,10 +7,12 @@ if (typeof module === "object" && typeof module.exports === "object") { | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports", "@tsparticles/engine"], factory); | ||
define(["require", "exports", "@tsparticles/engine", "./Options/Classes/Emitter.js", "./Enums/EmitterClickMode.js", "./EmitterInstance.js"], factory); | ||
} | ||
})(function (require, exports) { | ||
"use strict"; | ||
var __syncRequire = typeof module === "object" && typeof module.exports === "object"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Emitters = void 0; | ||
const engine_1 = require("@tsparticles/engine"); | ||
const Emitter_js_1 = require("./Options/Classes/Emitter.js"); | ||
const EmitterClickMode_js_1 = require("./Enums/EmitterClickMode.js"); | ||
const EmitterInstance_js_1 = require("./EmitterInstance.js"); | ||
class Emitters { | ||
@@ -55,3 +34,3 @@ constructor(engine, container) { | ||
? this.array[idxOrName ?? defaultIndex] | ||
: this.array.find((t) => t.name === idxOrName); | ||
: this.array.find(t => t.name === idxOrName); | ||
container.addEmitter = async (options, position) => this.addEmitter(options, position); | ||
@@ -78,5 +57,5 @@ container.removeEmitter = (idxOrName) => { | ||
async addEmitter(options, position) { | ||
const { Emitter } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./Options/Classes/Emitter.js"))) : new Promise((resolve_1, reject_1) => { require(["./Options/Classes/Emitter.js"], resolve_1, reject_1); }).then(__importStar)), { EmitterInstance } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./EmitterInstance.js"))) : new Promise((resolve_2, reject_2) => { require(["./EmitterInstance.js"], resolve_2, reject_2); }).then(__importStar)), emitterOptions = new Emitter(); | ||
const emitterOptions = new Emitter_js_1.Emitter(); | ||
emitterOptions.load(options); | ||
const emitter = new EmitterInstance(this._engine, this, this.container, emitterOptions, position); | ||
const emitter = new EmitterInstance_js_1.EmitterInstance(this._engine, this, this.container, emitterOptions, position); | ||
await emitter.init(); | ||
@@ -88,3 +67,3 @@ this.array.push(emitter); | ||
const emitterOptions = this.emitters, modeEmitters = this.interactivityEmitters; | ||
if (mode !== "emitter") { | ||
if (mode !== EmitterClickMode_js_1.EmitterClickMode.emitter) { | ||
return; | ||
@@ -91,0 +70,0 @@ } |
@@ -1,24 +0,1 @@ | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
(function (factory) { | ||
@@ -30,7 +7,6 @@ if (typeof module === "object" && typeof module.exports === "object") { | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports", "@tsparticles/engine", "./Options/Classes/Emitter.js"], factory); | ||
define(["require", "exports", "@tsparticles/engine", "./Options/Classes/Emitter.js", "./Enums/EmitterClickMode.js", "./Emitters.js"], factory); | ||
} | ||
})(function (require, exports) { | ||
"use strict"; | ||
var __syncRequire = typeof module === "object" && typeof module.exports === "object"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -40,2 +16,4 @@ exports.EmittersPlugin = void 0; | ||
const Emitter_js_1 = require("./Options/Classes/Emitter.js"); | ||
const EmitterClickMode_js_1 = require("./Enums/EmitterClickMode.js"); | ||
const Emitters_js_1 = require("./Emitters.js"); | ||
class EmittersPlugin { | ||
@@ -46,5 +24,4 @@ constructor(engine) { | ||
} | ||
async getPlugin(container) { | ||
const { Emitters } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./Emitters.js"))) : new Promise((resolve_1, reject_1) => { require(["./Emitters.js"], resolve_1, reject_1); }).then(__importStar)); | ||
return new Emitters(this._engine, container); | ||
getPlugin(container) { | ||
return Promise.resolve(new Emitters_js_1.Emitters(this._engine, container)); | ||
} | ||
@@ -56,3 +33,3 @@ loadOptions(options, source) { | ||
if (source?.emitters) { | ||
options.emitters = (0, engine_1.executeOnSingleOrMultiple)(source.emitters, (emitter) => { | ||
options.emitters = (0, engine_1.executeOnSingleOrMultiple)(source.emitters, emitter => { | ||
const tmp = new Emitter_js_1.Emitter(); | ||
@@ -71,3 +48,3 @@ tmp.load(emitter); | ||
}, | ||
value: interactivityEmitters.map((s) => { | ||
value: interactivityEmitters.map(s => { | ||
const tmp = new Emitter_js_1.Emitter(); | ||
@@ -89,3 +66,3 @@ tmp.load(s); | ||
}, | ||
value: emitterMode.value.map((s) => { | ||
value: emitterMode.value.map(s => { | ||
const tmp = new Emitter_js_1.Emitter(); | ||
@@ -130,3 +107,3 @@ tmp.load(s); | ||
(!!options.interactivity?.events?.onClick?.mode && | ||
(0, engine_1.isInArray)("emitter", options.interactivity.events.onClick.mode))); | ||
(0, engine_1.isInArray)(EmitterClickMode_js_1.EmitterClickMode.emitter, options.interactivity.events.onClick.mode))); | ||
} | ||
@@ -133,0 +110,0 @@ } |
@@ -12,2 +12,7 @@ (function (factory) { | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.EmitterClickMode = void 0; | ||
var EmitterClickMode; | ||
(function (EmitterClickMode) { | ||
EmitterClickMode["emitter"] = "emitter"; | ||
})(EmitterClickMode || (exports.EmitterClickMode = EmitterClickMode = {})); | ||
}); |
@@ -12,14 +12,2 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
@@ -34,13 +22,13 @@ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports", "./EmitterContainer.js", "./EmitterShapeBase.js", "./EmittersEngine.js", "./IEmitterShape.js", "./IEmitterShapeGenerator.js", "./Enums/EmitterClickMode.js", "./IRandomPositionData.js"], factory); | ||
define(["require", "exports", "./EmittersPlugin.js", "./ShapeManager.js", "./EmitterContainer.js", "./EmitterShapeBase.js", "./EmittersEngine.js", "./IEmitterShape.js", "./IEmitterShapeGenerator.js", "./Enums/EmitterClickMode.js", "./IRandomPositionData.js"], factory); | ||
} | ||
})(function (require, exports) { | ||
"use strict"; | ||
var __syncRequire = typeof module === "object" && typeof module.exports === "object"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.loadEmittersPlugin = void 0; | ||
const EmittersPlugin_js_1 = require("./EmittersPlugin.js"); | ||
const ShapeManager_js_1 = require("./ShapeManager.js"); | ||
async function loadEmittersPlugin(engine, refresh = true) { | ||
if (!engine.emitterShapeManager) { | ||
const { ShapeManager } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./ShapeManager.js"))) : new Promise((resolve_1, reject_1) => { require(["./ShapeManager.js"], resolve_1, reject_1); }).then(__importStar)); | ||
engine.emitterShapeManager = new ShapeManager(engine); | ||
engine.emitterShapeManager = new ShapeManager_js_1.ShapeManager(engine); | ||
} | ||
@@ -52,3 +40,3 @@ if (!engine.addEmitterShapeGenerator) { | ||
} | ||
const { EmittersPlugin } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./EmittersPlugin.js"))) : new Promise((resolve_2, reject_2) => { require(["./EmittersPlugin.js"], resolve_2, reject_2); }).then(__importStar)), plugin = new EmittersPlugin(engine); | ||
const plugin = new EmittersPlugin_js_1.EmittersPlugin(engine); | ||
await engine.addPlugin(plugin, refresh); | ||
@@ -55,0 +43,0 @@ } |
@@ -49,3 +49,3 @@ (function (factory) { | ||
this.name = data.name; | ||
this.particles = (0, engine_1.executeOnSingleOrMultiple)(data.particles, (particles) => { | ||
this.particles = (0, engine_1.executeOnSingleOrMultiple)(data.particles, particles => { | ||
return (0, engine_1.deepExtend)({}, particles); | ||
@@ -52,0 +52,0 @@ }); |
@@ -7,3 +7,3 @@ (function (factory) { | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports"], factory); | ||
define(["require", "exports", "@tsparticles/engine"], factory); | ||
} | ||
@@ -14,5 +14,6 @@ })(function (require, exports) { | ||
exports.EmitterSize = void 0; | ||
const engine_1 = require("@tsparticles/engine"); | ||
class EmitterSize { | ||
constructor() { | ||
this.mode = "percent"; | ||
this.mode = engine_1.PixelMode.percent; | ||
this.height = 0; | ||
@@ -19,0 +20,0 @@ this.width = 0; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
480226
135
4039
9
13
Updated@tsparticles/engine@^3.4.0