@tsparticles/plugin-emitters 3.2.2 → 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- /*! For license information please see 964.min.js.LICENSE.txt */
2
- (this.webpackChunk_tsparticles_plugin_emitters=this.webpackChunk_tsparticles_plugin_emitters||[]).push([[964],{964:(t,i,e)=>{e.d(i,{EmittersPlugin:()=>a});var o=e(533),s=e(177);class a{constructor(t){this._engine=t,this.id="emitters"}async getPlugin(t){const{Emitters:i}=await e.e(973).then(e.bind(e,973));return new i(this._engine,t)}loadOptions(t,i){if(!this.needsPlugin(t)&&!this.needsPlugin(i))return;i?.emitters&&(t.emitters=(0,o.executeOnSingleOrMultiple)(i.emitters,(t=>{const i=new s.Emitter;return i.load(t),i})));const e=i?.interactivity?.modes?.emitters;if(e)if((0,o.isArray)(e))t.interactivity.modes.emitters={random:{count:1,enable:!0},value:e.map((t=>{const i=new s.Emitter;return i.load(t),i}))};else{const i=e;if(void 0!==i.value){const e=1;if((0,o.isArray)(i.value))t.interactivity.modes.emitters={random:{count:i.random.count??e,enable:i.random.enable??!1},value:i.value.map((t=>{const i=new s.Emitter;return i.load(t),i}))};else{const o=new s.Emitter;o.load(i.value),t.interactivity.modes.emitters={random:{count:i.random.count??e,enable:i.random.enable??!1},value:o}}}else{(t.interactivity.modes.emitters={random:{count:1,enable:!1},value:new s.Emitter}).value.load(e)}}}needsPlugin(t){if(!t)return!1;const i=t.emitters;return(0,o.isArray)(i)&&!!i.length||void 0!==i||!!t.interactivity?.events?.onClick?.mode&&(0,o.isInArray)("emitter",t.interactivity.events.onClick.mode)}}},177:(t,i,e)=>{e.d(i,{Emitter:()=>d});var o=e(533);class s{constructor(){this.wait=!1}load(t){t&&(void 0!==t.count&&(this.count=t.count),void 0!==t.delay&&(this.delay=(0,o.setRangeValue)(t.delay)),void 0!==t.duration&&(this.duration=(0,o.setRangeValue)(t.duration)),void 0!==t.wait&&(this.wait=t.wait))}}class a{constructor(){this.quantity=1,this.delay=.1}load(t){void 0!==t&&(void 0!==t.quantity&&(this.quantity=(0,o.setRangeValue)(t.quantity)),void 0!==t.delay&&(this.delay=(0,o.setRangeValue)(t.delay)))}}class n{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 n,this.type="square"}load(t){t&&(void 0!==t.options&&(this.options=(0,o.deepExtend)({},t.options??{})),this.replace.load(t.replace),void 0!==t.type&&(this.type=t.type))}}var l=e(518);class d{constructor(){this.autoPlay=!0,this.fill=!0,this.life=new s,this.rate=new a,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 l.r),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,o.executeOnSingleOrMultiple)(t.particles,(t=>(0,o.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,o.setRangeValue)(t.position.x)),void 0!==t.position.y&&(this.position.y=(0,o.setRangeValue)(t.position.y))),void 0!==t.spawnColor&&(void 0===this.spawnColor&&(this.spawnColor=new o.AnimatableColor),this.spawnColor.load(t.spawnColor)),void 0!==t.startCount&&(this.startCount=t.startCount))}}},518:(t,i,e)=>{e.d(i,{r:()=>o});class o{constructor(){this.mode="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))}}}}]);
1
+ /*! For license information please see 121.min.js.LICENSE.txt */
2
+ (this.webpackChunk_tsparticles_plugin_emitters=this.webpackChunk_tsparticles_plugin_emitters||[]).push([[121],{121:(t,i,e)=>{e.d(i,{EmittersPlugin:()=>a});var o=e(303),s=e(123);class a{constructor(t){this._engine=t,this.id="emitters"}async getPlugin(t){const{Emitters:i}=await e.e(922).then(e.bind(e,922));return new i(this._engine,t)}loadOptions(t,i){if(!this.needsPlugin(t)&&!this.needsPlugin(i))return;i?.emitters&&(t.emitters=(0,o.executeOnSingleOrMultiple)(i.emitters,(t=>{const i=new s.Emitter;return i.load(t),i})));const e=i?.interactivity?.modes?.emitters;if(e)if((0,o.isArray)(e))t.interactivity.modes.emitters={random:{count:1,enable:!0},value:e.map((t=>{const i=new s.Emitter;return i.load(t),i}))};else{const i=e;if(void 0!==i.value){const e=1;if((0,o.isArray)(i.value))t.interactivity.modes.emitters={random:{count:i.random.count??e,enable:i.random.enable??!1},value:i.value.map((t=>{const i=new s.Emitter;return i.load(t),i}))};else{const o=new s.Emitter;o.load(i.value),t.interactivity.modes.emitters={random:{count:i.random.count??e,enable:i.random.enable??!1},value:o}}}else{(t.interactivity.modes.emitters={random:{count:1,enable:!1},value:new s.Emitter}).value.load(e)}}}needsPlugin(t){if(!t)return!1;const i=t.emitters;return(0,o.isArray)(i)&&!!i.length||void 0!==i||!!t.interactivity?.events?.onClick?.mode&&(0,o.isInArray)("emitter",t.interactivity.events.onClick.mode)}}},123:(t,i,e)=>{e.d(i,{Emitter:()=>d});var o=e(303);class s{constructor(){this.wait=!1}load(t){t&&(void 0!==t.count&&(this.count=t.count),void 0!==t.delay&&(this.delay=(0,o.setRangeValue)(t.delay)),void 0!==t.duration&&(this.duration=(0,o.setRangeValue)(t.duration)),void 0!==t.wait&&(this.wait=t.wait))}}class a{constructor(){this.quantity=1,this.delay=.1}load(t){void 0!==t&&(void 0!==t.quantity&&(this.quantity=(0,o.setRangeValue)(t.quantity)),void 0!==t.delay&&(this.delay=(0,o.setRangeValue)(t.delay)))}}class n{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 n,this.type="square"}load(t){t&&(void 0!==t.options&&(this.options=(0,o.deepExtend)({},t.options??{})),this.replace.load(t.replace),void 0!==t.type&&(this.type=t.type))}}var l=e(104);class d{constructor(){this.autoPlay=!0,this.fill=!0,this.life=new s,this.rate=new a,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 l.G),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,o.executeOnSingleOrMultiple)(t.particles,(t=>(0,o.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,o.setRangeValue)(t.position.x)),void 0!==t.position.y&&(this.position.y=(0,o.setRangeValue)(t.position.y))),void 0!==t.spawnColor&&(void 0===this.spawnColor&&(this.spawnColor=new o.AnimatableColor),this.spawnColor.load(t.spawnColor)),void 0!==t.startCount&&(this.startCount=t.startCount))}}},104:(t,i,e)=>{e.d(i,{G:()=>o});class o{constructor(){this.mode="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))}}}}]);
@@ -0,0 +1 @@
1
+ /*! tsParticles Emitters Plugin v3.3.0 by Matteo Bruni */
@@ -1,2 +1,2 @@
1
- /*! For license information please see 113.min.js.LICENSE.txt */
2
- (this.webpackChunk_tsparticles_plugin_emitters=this.webpackChunk_tsparticles_plugin_emitters||[]).push([[113],{113:(e,t,r)=>{r.d(t,{ShapeManager:()=>s});const a=new Map;class s{constructor(e){this._engine=e}addShapeGenerator(e,t){this.getShapeGenerator(e)||a.set(e,t)}getShapeGenerator(e){return a.get(e)}getSupportedShapeGenerators(){return a.keys()}}}}]);
1
+ /*! For license information please see 737.min.js.LICENSE.txt */
2
+ (this.webpackChunk_tsparticles_plugin_emitters=this.webpackChunk_tsparticles_plugin_emitters||[]).push([[737],{737:(e,t,r)=>{r.d(t,{ShapeManager:()=>s});const a=new Map;class s{constructor(e){this._engine=e}addShapeGenerator(e,t){this.getShapeGenerator(e)||a.set(e,t)}getShapeGenerator(e){return a.get(e)}getSupportedShapeGenerators(){return a.keys()}}}}]);
@@ -0,0 +1 @@
1
+ /*! tsParticles Emitters Plugin v3.3.0 by Matteo Bruni */
package/800.min.js ADDED
@@ -0,0 +1,2 @@
1
+ /*! For license information please see 800.min.js.LICENSE.txt */
2
+ (this.webpackChunk_tsparticles_plugin_emitters=this.webpackChunk_tsparticles_plugin_emitters||[]).push([[800],{800:(t,i,e)=>{e.d(i,{EmitterInstance:()=>r});var s=e(303),o=e(123),n=e(104);function a(t,i){t.color?t.color.value=i:t.color={value:i}}class r{constructor(t,i,e,n,a){this.emitters=i,this.container=e,this._destroy=()=>{this._mutationObserver?.disconnect(),this._mutationObserver=void 0,this._resizeObserver?.disconnect(),this._resizeObserver=void 0,this.emitters.removeEmitter(this),this._engine.dispatchEvent("emitterDestroyed",{container:this.container,data:{emitter:this}})},this._prepareToDie=()=>{if(this._paused)return;const t=void 0!==this.options.life?.duration?(0,s.getRangeValue)(this.options.life.duration):void 0;this.container.retina.reduceFactor&&(this._lifeCount>0||this._immortal)&&void 0!==t&&t>0&&(this._duration=t*s.millisecondsToSeconds)},this._setColorAnimation=(t,i,e,o=1)=>{const n=this.container;if(!t.enable)return i;const a=(0,s.randomInRange)(t.offset),r=(0,s.getRangeValue)(this.options.rate.delay)*s.millisecondsToSeconds/n.retina.reduceFactor;return(i+(0,s.getRangeValue)(t.speed??0)*n.fpsLimit/r+a*o)%e},this._engine=t,this._currentDuration=0,this._currentEmitDelay=0,this._currentSpawnDelay=0,this._initialPosition=a,n instanceof o.Emitter?this.options=n:(this.options=new o.Emitter,this.options.load(n)),this._spawnDelay=(0,s.getRangeValue)(this.options.life.delay??0)*s.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 r=(0,s.deepExtend)({},this.options.particles);if(r??={},r.move??={},r.move.direction??=this.options.direction,this.options.spawnColor&&(this.spawnColor=(0,s.rangeColorToHsl)(this.options.spawnColor)),this._paused=!this.options.autoPlay,this._particlesOptions=r,this._size=this._calcSize(),this.size=(0,s.getSize)(this._size,this.container.canvas.size),this._lifeCount=this.options.life.count??-1,this._immortal=this._lifeCount<=0,this.options.domId){const t=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 h=this.options.shape,l=this._engine.emitterShapeManager?.getShapeGenerator(h.type);l&&(this._shape=l.generate(this.position,this.size,this.fill,h.options)),this._engine.dispatchEvent("emitterCreated",{container:e,data:{emitter:this}}),this.play()}externalPause(){this._paused=!0,this.pause()}externalPlay(){this._paused=!1,this.play()}async init(){await(this._shape?.init())}pause(){this._paused||delete this._emitDelay}play(){if(!this._paused&&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,s.getRangeValue)(this.options.rate.delay);this._emitDelay=t*s.millisecondsToSeconds/this.container.retina.reduceFactor}(this._lifeCount>0||this._immortal)&&this._prepareToDie()}}resize(){const t=this._initialPosition;this.position=t&&(0,s.isPointInside)(t,this.container.canvas.size,s.Vector.origin)?t:this._calcPosition(),this._size=this._calcSize(),this.size=(0,s.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,s.getRangeValue)(this.options.life.delay??0)*s.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,s.calcPositionOrRandomFromSizeRanged)({size:this.container.canvas.size,position:this.options.position})}_calcSize(){const t=this.container;if(this.options.domId){const i=document.getElementById(this.options.domId);if(i){const e=i.getBoundingClientRect();return{width:e.width*t.retina.pixelRatio,height:e.height*t.retina.pixelRatio,mode:"precise"}}}return this.options.size??(()=>{const t=new n.G;return t.load({height:0,mode:"percent",width:0}),t})()}_emit(){if(this._paused)return;const t=(0,s.getRangeValue)(this.options.rate.quantity);this._emitParticles(t)}_emitParticles(t){const i=(0,s.itemFromSingleOrMultiple)(this._particlesOptions);for(let e=0;e<t;e++){const t=(0,s.deepExtend)({},i);if(this.spawnColor){const i=this.options.spawnColor?.animation;if(i){const t={h:360,s:100,l:100},e=3.6;this.spawnColor.h=this._setColorAnimation(i.h,this.spawnColor.h,t.h,e),this.spawnColor.s=this._setColorAnimation(i.s,this.spawnColor.s,t.s),this.spawnColor.l=this._setColorAnimation(i.l,this.spawnColor.l,t.l)}a(t,this.spawnColor)}const e=this.options.shape;let o=this.position;if(this._shape){const i=this._shape.randomPosition();if(i){o=i.position;const s=e.replace;s.color&&i.color&&a(t,i.color),s.opacity&&(t.opacity?t.opacity.value=i.opacity:t.opacity={value:i.opacity})}else o=null}o&&this.container.particles.addParticle(o,t)}}}}}]);
@@ -0,0 +1 @@
1
+ /*! tsParticles Emitters Plugin v3.3.0 by Matteo Bruni */
@@ -1,2 +1,2 @@
1
- /*! For license information please see 973.min.js.LICENSE.txt */
2
- (this.webpackChunk_tsparticles_plugin_emitters=this.webpackChunk_tsparticles_plugin_emitters||[]).push([[973],{973:(t,e,i)=>{i.d(e,{Emitters:()=>r});var s=i(533);class r{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,s.isNumber)(t)?this.array[t??0]:this.array.find((e=>e.name===t)),e.addEmitter=async(t,e)=>this.addEmitter(t,e),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,e){const{Emitter:s}=await Promise.resolve().then(i.bind(i,177)),{EmitterInstance:r}=await i.e(927).then(i.bind(i,927)),a=new s;a.load(t);const n=new r(this._engine,this,this.container,a,e);return await n.init(),this.array.push(n),n}handleClickMode(t){const e=this.emitters,i=this.interactivityEmitters;if("emitter"!==t)return;let r;if(i&&(0,s.isArray)(i.value)){const t=0;if(i.value.length>t&&i.random.enable){r=[];const t=[];for(let e=0;e<i.random.count;e++){const a=(0,s.arrayRandomIndex)(i.value);t.includes(a)&&t.length<i.value.length?e--:(t.push(a),r.push((0,s.itemFromArray)(i.value,a)))}}else r=i.value}else r=i?.value;const a=r??e,n=this.container.interactivity.mouse.clickPosition;(0,s.executeOnSingleOrMultiple)(a,(async t=>{await this.addEmitter(t,n)}))}async init(){if(this.emitters=this.container.actualOptions.emitters,this.interactivityEmitters=this.container.actualOptions.interactivity.modes.emitters,this.emitters)if((0,s.isArray)(this.emitters))for(const t of this.emitters)await this.addEmitter(t);else await this.addEmitter(this.emitters)}pause(){for(const t of this.array)t.pause()}play(){for(const t of this.array)t.play()}removeEmitter(t){const e=this.array.indexOf(t);e>=0&&this.array.splice(e,1)}resize(){for(const t of this.array)t.resize()}stop(){this.array=[]}async update(t){for(const e of this.array)await e.update(t)}}}}]);
1
+ /*! For license information please see 922.min.js.LICENSE.txt */
2
+ (this.webpackChunk_tsparticles_plugin_emitters=this.webpackChunk_tsparticles_plugin_emitters||[]).push([[922],{922:(t,e,i)=>{i.d(e,{Emitters:()=>r});var s=i(303);class r{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,s.isNumber)(t)?this.array[t??0]:this.array.find((e=>e.name===t)),e.addEmitter=async(t,e)=>this.addEmitter(t,e),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,e){const{Emitter:s}=await Promise.resolve().then(i.bind(i,123)),{EmitterInstance:r}=await i.e(800).then(i.bind(i,800)),a=new s;a.load(t);const n=new r(this._engine,this,this.container,a,e);return await n.init(),this.array.push(n),n}handleClickMode(t){const e=this.emitters,i=this.interactivityEmitters;if("emitter"!==t)return;let r;if(i&&(0,s.isArray)(i.value)){const t=0;if(i.value.length>t&&i.random.enable){r=[];const t=[];for(let e=0;e<i.random.count;e++){const a=(0,s.arrayRandomIndex)(i.value);t.includes(a)&&t.length<i.value.length?e--:(t.push(a),r.push((0,s.itemFromArray)(i.value,a)))}}else r=i.value}else r=i?.value;const a=r??e,n=this.container.interactivity.mouse.clickPosition;(0,s.executeOnSingleOrMultiple)(a,(async t=>{await this.addEmitter(t,n)}))}async init(){if(this.emitters=this.container.actualOptions.emitters,this.interactivityEmitters=this.container.actualOptions.interactivity.modes.emitters,this.emitters)if((0,s.isArray)(this.emitters))for(const t of this.emitters)await this.addEmitter(t);else await this.addEmitter(this.emitters)}pause(){for(const t of this.array)t.pause()}play(){for(const t of this.array)t.play()}removeEmitter(t){const e=this.array.indexOf(t);e>=0&&this.array.splice(e,1)}resize(){for(const t of this.array)t.resize()}stop(){this.array=[]}update(t){for(const e of this.array)e.update(t)}}}}]);
@@ -0,0 +1 @@
1
+ /*! tsParticles Emitters Plugin v3.3.0 by Matteo Bruni */
@@ -154,7 +154,7 @@ export class EmitterInstance {
154
154
  this.size = getSize(this._size, this.container.canvas.size);
155
155
  this._shape?.resize(this.position, this.size);
156
156
  }
157
- async update(delta) {
157
+ update(delta) {
158
158
  if (this._paused) {
159
159
  return;
160
160
  }
@@ -165,7 +165,7 @@ export class EmitterInstance {
165
165
  }
166
166
  if (!this._startParticlesAdded) {
167
167
  this._startParticlesAdded = true;
168
- await this._emitParticles(this.options.startCount);
168
+ this._emitParticles(this.options.startCount);
169
169
  }
170
170
  if (this._duration !== undefined) {
171
171
  this._currentDuration += delta.value;
@@ -205,7 +205,7 @@ export class EmitterInstance {
205
205
  if (this._emitDelay !== undefined) {
206
206
  this._currentEmitDelay += delta.value;
207
207
  if (this._currentEmitDelay >= this._emitDelay) {
208
- await this._emit();
208
+ this._emit();
209
209
  this._currentEmitDelay -= this._emitDelay;
210
210
  }
211
211
  }
@@ -250,14 +250,14 @@ export class EmitterInstance {
250
250
  return size;
251
251
  })());
252
252
  }
253
- async _emit() {
253
+ _emit() {
254
254
  if (this._paused) {
255
255
  return;
256
256
  }
257
257
  const quantity = getRangeValue(this.options.rate.quantity);
258
- await this._emitParticles(quantity);
258
+ this._emitParticles(quantity);
259
259
  }
260
- async _emitParticles(quantity) {
260
+ _emitParticles(quantity) {
261
261
  const singleParticlesOptions = itemFromSingleOrMultiple(this._particlesOptions);
262
262
  for (let i = 0; i < quantity; i++) {
263
263
  const particlesOptions = deepExtend({}, singleParticlesOptions);
@@ -278,7 +278,7 @@ export class EmitterInstance {
278
278
  const shapeOptions = this.options.shape;
279
279
  let position = this.position;
280
280
  if (this._shape) {
281
- const shapePosData = await this._shape.randomPosition();
281
+ const shapePosData = this._shape.randomPosition();
282
282
  if (shapePosData) {
283
283
  position = shapePosData.position;
284
284
  const replaceData = shapeOptions.replace;
@@ -301,7 +301,7 @@ export class EmitterInstance {
301
301
  }
302
302
  }
303
303
  if (position) {
304
- await this.container.particles.addParticle(position, particlesOptions);
304
+ this.container.particles.addParticle(position, particlesOptions);
305
305
  }
306
306
  }
307
307
  }
@@ -116,9 +116,9 @@ export class Emitters {
116
116
  stop() {
117
117
  this.array = [];
118
118
  }
119
- async update(delta) {
119
+ update(delta) {
120
120
  for (const emitter of this.array) {
121
- await emitter.update(delta);
121
+ emitter.update(delta);
122
122
  }
123
123
  }
124
124
  }
@@ -157,7 +157,7 @@ class EmitterInstance {
157
157
  this.size = (0, engine_1.getSize)(this._size, this.container.canvas.size);
158
158
  this._shape?.resize(this.position, this.size);
159
159
  }
160
- async update(delta) {
160
+ update(delta) {
161
161
  if (this._paused) {
162
162
  return;
163
163
  }
@@ -168,7 +168,7 @@ class EmitterInstance {
168
168
  }
169
169
  if (!this._startParticlesAdded) {
170
170
  this._startParticlesAdded = true;
171
- await this._emitParticles(this.options.startCount);
171
+ this._emitParticles(this.options.startCount);
172
172
  }
173
173
  if (this._duration !== undefined) {
174
174
  this._currentDuration += delta.value;
@@ -208,7 +208,7 @@ class EmitterInstance {
208
208
  if (this._emitDelay !== undefined) {
209
209
  this._currentEmitDelay += delta.value;
210
210
  if (this._currentEmitDelay >= this._emitDelay) {
211
- await this._emit();
211
+ this._emit();
212
212
  this._currentEmitDelay -= this._emitDelay;
213
213
  }
214
214
  }
@@ -253,14 +253,14 @@ class EmitterInstance {
253
253
  return size;
254
254
  })());
255
255
  }
256
- async _emit() {
256
+ _emit() {
257
257
  if (this._paused) {
258
258
  return;
259
259
  }
260
260
  const quantity = (0, engine_1.getRangeValue)(this.options.rate.quantity);
261
- await this._emitParticles(quantity);
261
+ this._emitParticles(quantity);
262
262
  }
263
- async _emitParticles(quantity) {
263
+ _emitParticles(quantity) {
264
264
  const singleParticlesOptions = (0, engine_1.itemFromSingleOrMultiple)(this._particlesOptions);
265
265
  for (let i = 0; i < quantity; i++) {
266
266
  const particlesOptions = (0, engine_1.deepExtend)({}, singleParticlesOptions);
@@ -281,7 +281,7 @@ class EmitterInstance {
281
281
  const shapeOptions = this.options.shape;
282
282
  let position = this.position;
283
283
  if (this._shape) {
284
- const shapePosData = await this._shape.randomPosition();
284
+ const shapePosData = this._shape.randomPosition();
285
285
  if (shapePosData) {
286
286
  position = shapePosData.position;
287
287
  const replaceData = shapeOptions.replace;
@@ -304,7 +304,7 @@ class EmitterInstance {
304
304
  }
305
305
  }
306
306
  if (position) {
307
- await this.container.particles.addParticle(position, particlesOptions);
307
+ this.container.particles.addParticle(position, particlesOptions);
308
308
  }
309
309
  }
310
310
  }
package/cjs/Emitters.js CHANGED
@@ -1,27 +1,4 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
2
  Object.defineProperty(exports, "__esModule", { value: true });
26
3
  exports.Emitters = void 0;
27
4
  const engine_1 = require("@tsparticles/engine");
@@ -63,7 +40,7 @@ class Emitters {
63
40
  };
64
41
  }
65
42
  async addEmitter(options, position) {
66
- const { Emitter } = await Promise.resolve().then(() => __importStar(require("./Options/Classes/Emitter.js"))), { EmitterInstance } = await Promise.resolve().then(() => __importStar(require("./EmitterInstance.js"))), emitterOptions = new Emitter();
43
+ const { Emitter } = await import("./Options/Classes/Emitter.js"), { EmitterInstance } = await import("./EmitterInstance.js"), emitterOptions = new Emitter();
67
44
  emitterOptions.load(options);
68
45
  const emitter = new EmitterInstance(this._engine, this, this.container, emitterOptions, position);
69
46
  await emitter.init();
@@ -142,9 +119,9 @@ class Emitters {
142
119
  stop() {
143
120
  this.array = [];
144
121
  }
145
- async update(delta) {
122
+ update(delta) {
146
123
  for (const emitter of this.array) {
147
- await emitter.update(delta);
124
+ emitter.update(delta);
148
125
  }
149
126
  }
150
127
  }
@@ -1,27 +1,4 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
2
  Object.defineProperty(exports, "__esModule", { value: true });
26
3
  exports.EmittersPlugin = void 0;
27
4
  const engine_1 = require("@tsparticles/engine");
@@ -32,7 +9,7 @@ class EmittersPlugin {
32
9
  this.id = "emitters";
33
10
  }
34
11
  async getPlugin(container) {
35
- const { Emitters } = await Promise.resolve().then(() => __importStar(require("./Emitters.js")));
12
+ const { Emitters } = await import("./Emitters.js");
36
13
  return new Emitters(this._engine, container);
37
14
  }
38
15
  loadOptions(options, source) {
package/cjs/index.js CHANGED
@@ -10,18 +10,6 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
10
10
  if (k2 === undefined) k2 = k;
11
11
  o[k2] = m[k];
12
12
  }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
13
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
26
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
27
15
  };
@@ -29,7 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
29
17
  exports.loadEmittersPlugin = void 0;
30
18
  async function loadEmittersPlugin(engine, refresh = true) {
31
19
  if (!engine.emitterShapeManager) {
32
- const { ShapeManager } = await Promise.resolve().then(() => __importStar(require("./ShapeManager.js")));
20
+ const { ShapeManager } = await import("./ShapeManager.js");
33
21
  engine.emitterShapeManager = new ShapeManager(engine);
34
22
  }
35
23
  if (!engine.addEmitterShapeGenerator) {
@@ -37,7 +25,7 @@ async function loadEmittersPlugin(engine, refresh = true) {
37
25
  engine.emitterShapeManager?.addShapeGenerator(name, generator);
38
26
  };
39
27
  }
40
- const { EmittersPlugin } = await Promise.resolve().then(() => __importStar(require("./EmittersPlugin.js"))), plugin = new EmittersPlugin(engine);
28
+ const { EmittersPlugin } = await import("./EmittersPlugin.js"), plugin = new EmittersPlugin(engine);
41
29
  await engine.addPlugin(plugin, refresh);
42
30
  }
43
31
  exports.loadEmittersPlugin = loadEmittersPlugin;
@@ -4,7 +4,7 @@
4
4
  * Demo / Generator : https://particles.js.org/
5
5
  * GitHub : https://www.github.com/matteobruni/tsparticles
6
6
  * How to use? : Check the GitHub README
7
- * v3.2.2
7
+ * v3.3.0
8
8
  */
9
9
  "use strict";
10
10
  /*
@@ -23,7 +23,7 @@
23
23
  \*****************************************/
24
24
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
25
25
 
26
- 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 async 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 await 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 await 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: \"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: \"percent\",\n width: 0\n });\n return size;\n })();\n }\n async _emit() {\n if (this._paused) {\n return;\n }\n const quantity = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(this.options.rate.quantity);\n await this._emitParticles(quantity);\n }\n async _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 = await 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 await this.container.particles.addParticle(position, particlesOptions);\n }\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-emitters/./dist/browser/EmitterInstance.js?");
26
+ 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: \"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: \"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?");
27
27
 
28
28
  /***/ })
29
29
 
@@ -4,7 +4,7 @@
4
4
  * Demo / Generator : https://particles.js.org/
5
5
  * GitHub : https://www.github.com/matteobruni/tsparticles
6
6
  * How to use? : Check the GitHub README
7
- * v3.2.2
7
+ * v3.3.0
8
8
  */
9
9
  "use strict";
10
10
  /*
@@ -4,7 +4,7 @@
4
4
  * Demo / Generator : https://particles.js.org/
5
5
  * GitHub : https://www.github.com/matteobruni/tsparticles
6
6
  * How to use? : Check the GitHub README
7
- * v3.2.2
7
+ * v3.3.0
8
8
  */
9
9
  "use strict";
10
10
  /*
@@ -23,7 +23,7 @@
23
23
  \**********************************/
24
24
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
25
25
 
26
- 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\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 {\n Emitter\n } = await Promise.resolve(/*! import() */).then(__webpack_require__.bind(__webpack_require__, /*! ./Options/Classes/Emitter.js */ \"./dist/browser/Options/Classes/Emitter.js\")),\n {\n EmitterInstance\n } = await __webpack_require__.e(/*! import() */ \"dist_browser_EmitterInstance_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./EmitterInstance.js */ \"./dist/browser/EmitterInstance.js\")),\n emitterOptions = new Emitter();\n emitterOptions.load(options);\n const emitter = new 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 !== \"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 async update(delta) {\n for (const emitter of this.array) {\n await emitter.update(delta);\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-emitters/./dist/browser/Emitters.js?");
26
+ 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\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 {\n Emitter\n } = await Promise.resolve(/*! import() */).then(__webpack_require__.bind(__webpack_require__, /*! ./Options/Classes/Emitter.js */ \"./dist/browser/Options/Classes/Emitter.js\")),\n {\n EmitterInstance\n } = await __webpack_require__.e(/*! import() */ \"dist_browser_EmitterInstance_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./EmitterInstance.js */ \"./dist/browser/EmitterInstance.js\")),\n emitterOptions = new Emitter();\n emitterOptions.load(options);\n const emitter = new 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 !== \"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?");
27
27
 
28
28
  /***/ })
29
29
 
@@ -4,7 +4,7 @@
4
4
  * Demo / Generator : https://particles.js.org/
5
5
  * GitHub : https://www.github.com/matteobruni/tsparticles
6
6
  * How to use? : Check the GitHub README
7
- * v3.2.2
7
+ * v3.3.0
8
8
  */
9
9
  "use strict";
10
10
  /*
@@ -154,7 +154,7 @@ export class EmitterInstance {
154
154
  this.size = getSize(this._size, this.container.canvas.size);
155
155
  this._shape?.resize(this.position, this.size);
156
156
  }
157
- async update(delta) {
157
+ update(delta) {
158
158
  if (this._paused) {
159
159
  return;
160
160
  }
@@ -165,7 +165,7 @@ export class EmitterInstance {
165
165
  }
166
166
  if (!this._startParticlesAdded) {
167
167
  this._startParticlesAdded = true;
168
- await this._emitParticles(this.options.startCount);
168
+ this._emitParticles(this.options.startCount);
169
169
  }
170
170
  if (this._duration !== undefined) {
171
171
  this._currentDuration += delta.value;
@@ -205,7 +205,7 @@ export class EmitterInstance {
205
205
  if (this._emitDelay !== undefined) {
206
206
  this._currentEmitDelay += delta.value;
207
207
  if (this._currentEmitDelay >= this._emitDelay) {
208
- await this._emit();
208
+ this._emit();
209
209
  this._currentEmitDelay -= this._emitDelay;
210
210
  }
211
211
  }
@@ -250,14 +250,14 @@ export class EmitterInstance {
250
250
  return size;
251
251
  })());
252
252
  }
253
- async _emit() {
253
+ _emit() {
254
254
  if (this._paused) {
255
255
  return;
256
256
  }
257
257
  const quantity = getRangeValue(this.options.rate.quantity);
258
- await this._emitParticles(quantity);
258
+ this._emitParticles(quantity);
259
259
  }
260
- async _emitParticles(quantity) {
260
+ _emitParticles(quantity) {
261
261
  const singleParticlesOptions = itemFromSingleOrMultiple(this._particlesOptions);
262
262
  for (let i = 0; i < quantity; i++) {
263
263
  const particlesOptions = deepExtend({}, singleParticlesOptions);
@@ -278,7 +278,7 @@ export class EmitterInstance {
278
278
  const shapeOptions = this.options.shape;
279
279
  let position = this.position;
280
280
  if (this._shape) {
281
- const shapePosData = await this._shape.randomPosition();
281
+ const shapePosData = this._shape.randomPosition();
282
282
  if (shapePosData) {
283
283
  position = shapePosData.position;
284
284
  const replaceData = shapeOptions.replace;
@@ -301,7 +301,7 @@ export class EmitterInstance {
301
301
  }
302
302
  }
303
303
  if (position) {
304
- await this.container.particles.addParticle(position, particlesOptions);
304
+ this.container.particles.addParticle(position, particlesOptions);
305
305
  }
306
306
  }
307
307
  }
package/esm/Emitters.js CHANGED
@@ -116,9 +116,9 @@ export class Emitters {
116
116
  stop() {
117
117
  this.array = [];
118
118
  }
119
- async update(delta) {
119
+ update(delta) {
120
120
  for (const emitter of this.array) {
121
- await emitter.update(delta);
121
+ emitter.update(delta);
122
122
  }
123
123
  }
124
124
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/plugin-emitters",
3
- "version": "3.2.2",
3
+ "version": "3.3.0",
4
4
  "description": "tsParticles emitters plugin",
5
5
  "homepage": "https://particles.js.org",
6
6
  "repository": {
@@ -86,7 +86,7 @@
86
86
  "./package.json": "./package.json"
87
87
  },
88
88
  "dependencies": {
89
- "@tsparticles/engine": "^3.2.2"
89
+ "@tsparticles/engine": "^3.3.0"
90
90
  },
91
91
  "publishConfig": {
92
92
  "access": "public"
package/report.html CHANGED
@@ -3,7 +3,7 @@
3
3
  <head>
4
4
  <meta charset="UTF-8"/>
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1"/>
6
- <title>@tsparticles/plugin-emitters [20 Feb 2024 at 01:36]</title>
6
+ <title>@tsparticles/plugin-emitters [27 Feb 2024 at 12:18]</title>
7
7
  <link rel="shortcut icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAABrVBMVEUAAAD///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////+O1foceMD///+J0/qK1Pr7/v8Xdr/9///W8P4UdL7L7P0Scr2r4Pyj3vwad8D5/f/2/f+55f3E6f34+/2H0/ojfMKpzOd0rNgQcb3F3O/j9f7c8v6g3Pz0/P/w+v/q+P7n9v6T1/uQ1vuE0vqLut/y+v+Z2fvt+f+15Pzv9fuc2/vR7v2V2Pvd6/bg9P7I6/285/2y4/yp3/zp8vk8i8kqgMT7/P31+fyv4vxGkcz6/P6/6P3j7vfS5PNnpNUxhcbO7f7F6v3O4vHK3/DA2u631Ouy0eqXweKJud5wqthfoNMMbLvY8f73+v2dxeR8sNtTmdDx9/zX6PSjyeaCtd1YnNGX2PuQveCGt95Nls42h8dLlM3F4vBtAAAAM3RSTlMAAyOx0/sKBvik8opWGBMOAe3l1snDm2E9LSb06eHcu5JpHbarfHZCN9CBb08zzkdNS0kYaptYAAAFV0lEQVRYw92X51/aYBDHHS2O2qqttVbrqNq9m+TJIAYIShBkWwqIiCgoWvfeq7Z2/s29hyQNyUcR7LveGwVyXy6XH8/9rqxglLfUPLxVduUor3h0rfp2TYvpivk37929TkG037hffoX0+peVtZQc1589rigVUdXS/ABSAyEmGIO/1XfvldSK8vs3OqB6u3m0nxmIrvgB0dj7rr7Y9IbuF68hnfFaiHA/sxqm0wciIG43P60qKv9WXWc1RXGh/mFESFABTSBi0sNAKzqet17eCtOb3kZIDwxEEU0oAIJGYxNBDhBND29e0rtXXbcpuPmED9IhEAAQ/AXEaF8EPmnrrKsv0LvWR3fg5sWDNAFZOgAgaKvZDogHNU9MFwnnYROkc56RD5CjAbQX9Ow4g7upCsvYu55aSI/Nj0H1akgKQEUM94dwK65hYRmFU9MIcH/fqJYOZYcnuJSU/waKDgTOEVaVKhwrTRP5XzgSpAITYzom7UvkhFX5VutmxeNnWDjjswTKTyfgluNDGbUpWissXhF3s7mlSml+czWkg3D0l1nNjGNjz3myOQOa1KM/jOS6ebdbAVTCi4gljHSFrviza7tOgRWcS0MOUX9zdNgag5w7rRqA44Lzw0hr1WqES36dFliSJFlh2rXIae3FFcDDgKdxrUIDePr8jGcSClV1u7A9xeN0ModY/pHMxmR1EzRh8TJiwqsHmKW0l4FCEZI+jHio+JdPPE9qwQtTRxku2D8sIeRL2LnxWSllANCQGOIiqVHAz2ye2JR0DcH+HoxDkaADLjgxjKQ+AwCX/g0+DNgdG0ukYCONAe+dbc2IAc6fwt1ARoDSezNHxV2Cmzwv3O6lDMV55edBGwGK9n1+x2F8EDfAGCxug8MhpsMEcTEAWf3rx2vZhe/LAmtIn/6apE6PN0ULKgywD9mmdxbmFl3OvD5AS5fW5zLbv/YHmcsBTjf/afDz3MaZTVCfAP9z6/Bw6ycv8EUBWJIn9zYcoAWWlW9+OzO3vkTy8H+RANLmdrpOuYWdZYEXpo+TlCJrW5EARb7fF+bWdqf3hhyZI1nWJQHgznErZhbjoEsWqi8dQNoE294aldzFurwSABL2XXMf9+H1VQGke9exw5P/AnA5Pv5ngMul7LOvO922iwACu8WkCwLCafvM4CeWPxfA8lNHcWZSoi8EwMAIciKX2Z4SWCMAa3snCZ/G4EA8D6CMLNFsGQhkkz/gQNEBbPCbWsxGUpYVu3z8IyNAknwJkfPMEhLyrdi5RTyUVACkw4GSFRNWJNEW+fgPGwHD8/JxnRuLabN4CGNRkAE23na2+VmEAUmrYymSGjMAYqH84YUIyzgzs3XC7gNgH36Vcc4zKY9o9fgPBXUAiHHwVboBHGLiX6Zcjp1f2wu4tvzZKo0ecPnDtQYDQvJXaBeNzce45Fp28ZQLrEZVuFqgBwOalArKXnW1UzlnSusQKJqKYNuz4tOnI6sZG4zanpemv+7ySU2jbA9h6uhcgpfy6G2PahirDZ6zvq6zDduMVFTKvzw8wgyEdelwY9in3XkEPs3osJuwRQ4qTkfzifndg9Gfc4pdsu82+tTnHZTBa2EAMrqr2t43pguc8tNm7JQVQ2S0ukj2d22dhXYP0/veWtwKrCkNoNimAN5+Xr/oLrxswKbVJjteWrX7eR63o4j9q0GxnaBdWgGA5VStpanIjQmEhV0/nVt5VOFUvix6awJhPcAaTEShgrG+iGyvb5a0Ndb1YGHFPEwoqAinoaykaID1o1pdPNu7XsnCKQ3R+hwWIIhGvORcJUBYXe3Xa3vq/mF/N9V13ugufMkfXn+KHsRD0B8AAAAASUVORK5CYII=" type="image/x-icon" />
8
8
 
9
9
  <script>
@@ -4,7 +4,7 @@
4
4
  * Demo / Generator : https://particles.js.org/
5
5
  * GitHub : https://www.github.com/matteobruni/tsparticles
6
6
  * How to use? : Check the GitHub README
7
- * v3.2.2
7
+ * v3.3.0
8
8
  */
9
9
  /*
10
10
  * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
@@ -220,7 +220,7 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
220
220
  /******/ var scripts = document.getElementsByTagName("script");
221
221
  /******/ if(scripts.length) {
222
222
  /******/ var i = scripts.length - 1;
223
- /******/ while (i > -1 && !scriptUrl) scriptUrl = scripts[i--].src;
223
+ /******/ while (i > -1 && (!scriptUrl || !/^http(s?):/.test(scriptUrl))) scriptUrl = scripts[i--].src;
224
224
  /******/ }
225
225
  /******/ }
226
226
  /******/ }
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see tsparticles.plugin.emitters.min.js.LICENSE.txt */
2
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],t);else{var r="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var i in r)("object"==typeof exports?exports:e)[i]=r[i]}}(this,(e=>(()=>{var t,r,i={533: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;)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={606: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(113).then(o.bind(o,113));e.emitterShapeManager=new t(e)}e.addEmitterShapeGenerator||(e.addEmitterShapeGenerator=(t,r)=>{e.emitterShapeManager?.addShapeGenerator(t,r)});const{EmittersPlugin:r}=await o.e(964).then(o.bind(o,964)),i=new r(e);await e.addPlugin(i,t)}})(),a})()));
2
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],t);else{var r="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var i in r)("object"==typeof exports?exports:e)[i]=r[i]}}(this,(e=>(()=>{var t,r,i={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})()));
@@ -1 +1 @@
1
- /*! tsParticles Emitters Plugin v3.2.2 by Matteo Bruni */
1
+ /*! tsParticles Emitters Plugin v3.3.0 by Matteo Bruni */
@@ -37,7 +37,7 @@ export declare class EmitterInstance {
37
37
  pause(): void;
38
38
  play(): void;
39
39
  resize(): void;
40
- update(delta: IDelta): Promise<void>;
40
+ update(delta: IDelta): void;
41
41
  private _calcPosition;
42
42
  private _calcSize;
43
43
  private readonly _destroy;
@@ -9,5 +9,5 @@ export declare abstract class EmitterShapeBase<TOptions = unknown> implements IE
9
9
  protected constructor(position: ICoordinates, size: IDimension, fill: boolean, options: TOptions);
10
10
  resize(position: ICoordinates, size: IDimension): void;
11
11
  abstract init(): Promise<void>;
12
- abstract randomPosition(): Promise<IRandomPositionData | null>;
12
+ abstract randomPosition(): IRandomPositionData | null;
13
13
  }
@@ -20,5 +20,5 @@ export declare class Emitters implements IContainerPlugin {
20
20
  removeEmitter(emitter: EmitterInstance): void;
21
21
  resize(): void;
22
22
  stop(): void;
23
- update(delta: IDelta): Promise<void>;
23
+ update(delta: IDelta): void;
24
24
  }
@@ -2,6 +2,6 @@ import type { ICoordinates, IDimension } from "@tsparticles/engine";
2
2
  import type { IRandomPositionData } from "./IRandomPositionData.js";
3
3
  export interface IEmitterShape {
4
4
  init(): Promise<void>;
5
- randomPosition(): Promise<IRandomPositionData | null>;
5
+ randomPosition(): IRandomPositionData | null;
6
6
  resize(position: ICoordinates, size: IDimension): void;
7
7
  }
@@ -166,7 +166,7 @@
166
166
  this.size = (0, engine_1.getSize)(this._size, this.container.canvas.size);
167
167
  this._shape?.resize(this.position, this.size);
168
168
  }
169
- async update(delta) {
169
+ update(delta) {
170
170
  if (this._paused) {
171
171
  return;
172
172
  }
@@ -177,7 +177,7 @@
177
177
  }
178
178
  if (!this._startParticlesAdded) {
179
179
  this._startParticlesAdded = true;
180
- await this._emitParticles(this.options.startCount);
180
+ this._emitParticles(this.options.startCount);
181
181
  }
182
182
  if (this._duration !== undefined) {
183
183
  this._currentDuration += delta.value;
@@ -217,7 +217,7 @@
217
217
  if (this._emitDelay !== undefined) {
218
218
  this._currentEmitDelay += delta.value;
219
219
  if (this._currentEmitDelay >= this._emitDelay) {
220
- await this._emit();
220
+ this._emit();
221
221
  this._currentEmitDelay -= this._emitDelay;
222
222
  }
223
223
  }
@@ -262,14 +262,14 @@
262
262
  return size;
263
263
  })());
264
264
  }
265
- async _emit() {
265
+ _emit() {
266
266
  if (this._paused) {
267
267
  return;
268
268
  }
269
269
  const quantity = (0, engine_1.getRangeValue)(this.options.rate.quantity);
270
- await this._emitParticles(quantity);
270
+ this._emitParticles(quantity);
271
271
  }
272
- async _emitParticles(quantity) {
272
+ _emitParticles(quantity) {
273
273
  const singleParticlesOptions = (0, engine_1.itemFromSingleOrMultiple)(this._particlesOptions);
274
274
  for (let i = 0; i < quantity; i++) {
275
275
  const particlesOptions = (0, engine_1.deepExtend)({}, singleParticlesOptions);
@@ -290,7 +290,7 @@
290
290
  const shapeOptions = this.options.shape;
291
291
  let position = this.position;
292
292
  if (this._shape) {
293
- const shapePosData = await this._shape.randomPosition();
293
+ const shapePosData = this._shape.randomPosition();
294
294
  if (shapePosData) {
295
295
  position = shapePosData.position;
296
296
  const replaceData = shapeOptions.replace;
@@ -313,7 +313,7 @@
313
313
  }
314
314
  }
315
315
  if (position) {
316
- await this.container.particles.addParticle(position, particlesOptions);
316
+ this.container.particles.addParticle(position, particlesOptions);
317
317
  }
318
318
  }
319
319
  }
package/umd/Emitters.js CHANGED
@@ -152,9 +152,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
152
152
  stop() {
153
153
  this.array = [];
154
154
  }
155
- async update(delta) {
155
+ update(delta) {
156
156
  for (const emitter of this.array) {
157
- await emitter.update(delta);
157
+ emitter.update(delta);
158
158
  }
159
159
  }
160
160
  }
@@ -1 +0,0 @@
1
- /*! tsParticles Emitters Plugin v3.2.2 by Matteo Bruni */
package/927.min.js DELETED
@@ -1,2 +0,0 @@
1
- /*! For license information please see 927.min.js.LICENSE.txt */
2
- (this.webpackChunk_tsparticles_plugin_emitters=this.webpackChunk_tsparticles_plugin_emitters||[]).push([[927],{927:(t,i,s)=>{s.d(i,{EmitterInstance:()=>r});var e=s(533),n=s(177),o=s(518);function a(t,i){t.color?t.color.value=i:t.color={value:i}}class r{constructor(t,i,s,o,a){this.emitters=i,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,e.getRangeValue)(this.options.life.duration):void 0;this.container.retina.reduceFactor&&(this._lifeCount>0||this._immortal)&&void 0!==t&&t>0&&(this._duration=t*e.millisecondsToSeconds)},this._setColorAnimation=(t,i,s,n=1)=>{const o=this.container;if(!t.enable)return i;const a=(0,e.randomInRange)(t.offset),r=(0,e.getRangeValue)(this.options.rate.delay)*e.millisecondsToSeconds/o.retina.reduceFactor;return(i+(0,e.getRangeValue)(t.speed??0)*o.fpsLimit/r+a*n)%s},this._engine=t,this._currentDuration=0,this._currentEmitDelay=0,this._currentSpawnDelay=0,this._initialPosition=a,o instanceof n.Emitter?this.options=o:(this.options=new n.Emitter,this.options.load(o)),this._spawnDelay=(0,e.getRangeValue)(this.options.life.delay??0)*e.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 r=(0,e.deepExtend)({},this.options.particles);if(r??={},r.move??={},r.move.direction??=this.options.direction,this.options.spawnColor&&(this.spawnColor=(0,e.rangeColorToHsl)(this.options.spawnColor)),this._paused=!this.options.autoPlay,this._particlesOptions=r,this._size=this._calcSize(),this.size=(0,e.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 h=this.options.shape,l=this._engine.emitterShapeManager?.getShapeGenerator(h.type);l&&(this._shape=l.generate(this.position,this.size,this.fill,h.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,e.getRangeValue)(this.options.rate.delay);this._emitDelay=t*e.millisecondsToSeconds/this.container.retina.reduceFactor}(this._lifeCount>0||this._immortal)&&this._prepareToDie()}}resize(){const t=this._initialPosition;this.position=t&&(0,e.isPointInside)(t,this.container.canvas.size,e.Vector.origin)?t:this._calcPosition(),this._size=this._calcSize(),this.size=(0,e.getSize)(this._size,this.container.canvas.size),this._shape?.resize(this.position,this.size)}async update(t){this._paused||(this._firstSpawn&&(this._firstSpawn=!1,this._currentSpawnDelay=this._spawnDelay??0,this._currentEmitDelay=this._emitDelay??0),this._startParticlesAdded||(this._startParticlesAdded=!0,await 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,e.getRangeValue)(this.options.life.delay??0)*e.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&&(await this._emit(),this._currentEmitDelay-=this._emitDelay)))}_calcPosition(){if(this.options.domId){const t=document.getElementById(this.options.domId);if(t){const i=t.getBoundingClientRect(),s=this.container.retina.pixelRatio;return{x:(i.x+.5*i.width)*s,y:(i.y+.5*i.height)*s}}}return(0,e.calcPositionOrRandomFromSizeRanged)({size:this.container.canvas.size,position:this.options.position})}_calcSize(){const t=this.container;if(this.options.domId){const i=document.getElementById(this.options.domId);if(i){const s=i.getBoundingClientRect();return{width:s.width*t.retina.pixelRatio,height:s.height*t.retina.pixelRatio,mode:"precise"}}}return this.options.size??(()=>{const t=new o.r;return t.load({height:0,mode:"percent",width:0}),t})()}async _emit(){if(this._paused)return;const t=(0,e.getRangeValue)(this.options.rate.quantity);await this._emitParticles(t)}async _emitParticles(t){const i=(0,e.itemFromSingleOrMultiple)(this._particlesOptions);for(let s=0;s<t;s++){const t=(0,e.deepExtend)({},i);if(this.spawnColor){const i=this.options.spawnColor?.animation;if(i){const t={h:360,s:100,l:100},s=3.6;this.spawnColor.h=this._setColorAnimation(i.h,this.spawnColor.h,t.h,s),this.spawnColor.s=this._setColorAnimation(i.s,this.spawnColor.s,t.s),this.spawnColor.l=this._setColorAnimation(i.l,this.spawnColor.l,t.l)}a(t,this.spawnColor)}const s=this.options.shape;let n=this.position;if(this._shape){const i=await this._shape.randomPosition();if(i){n=i.position;const e=s.replace;e.color&&i.color&&a(t,i.color),e.opacity&&(t.opacity?t.opacity.value=i.opacity:t.opacity={value:i.opacity})}else n=null}n&&await this.container.particles.addParticle(n,t)}}}}}]);
@@ -1 +0,0 @@
1
- /*! tsParticles Emitters Plugin v3.2.2 by Matteo Bruni */
@@ -1 +0,0 @@
1
- /*! tsParticles Emitters Plugin v3.2.2 by Matteo Bruni */
@@ -1 +0,0 @@
1
- /*! tsParticles Emitters Plugin v3.2.2 by Matteo Bruni */