@tsparticles/preset-confetti 4.0.4 → 4.1.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,5 +1,5 @@
1
1
  (function(g){g.__tsParticlesInternals=g.__tsParticlesInternals||{};g.__tsParticlesInternals.bundles=g.__tsParticlesInternals.bundles||{};g.__tsParticlesInternals.effects=g.__tsParticlesInternals.effects||{};g.__tsParticlesInternals.engine=g.__tsParticlesInternals.engine||{};g.__tsParticlesInternals.interactions=g.__tsParticlesInternals.interactions||{};g.__tsParticlesInternals.palettes=g.__tsParticlesInternals.palettes||{};g.__tsParticlesInternals.paths=g.__tsParticlesInternals.paths||{};g.__tsParticlesInternals.plugins=g.__tsParticlesInternals.plugins||{};g.__tsParticlesInternals.plugins=g.__tsParticlesInternals.plugins||{};g.__tsParticlesInternals.plugins.emittersShapes=g.__tsParticlesInternals.plugins.emittersShapes||{};g.__tsParticlesInternals.presets=g.__tsParticlesInternals.presets||{};g.__tsParticlesInternals.shapes=g.__tsParticlesInternals.shapes||{};g.__tsParticlesInternals.updaters=g.__tsParticlesInternals.updaters||{};g.__tsParticlesInternals.utils=g.__tsParticlesInternals.utils||{};g.__tsParticlesInternals.canvas=g.__tsParticlesInternals.canvas||{};g.__tsParticlesInternals.canvas=g.__tsParticlesInternals.canvas||{};g.__tsParticlesInternals.canvas.utils=g.__tsParticlesInternals.canvas.utils||{};g.__tsParticlesInternals.path=g.__tsParticlesInternals.path||{};g.__tsParticlesInternals.path=g.__tsParticlesInternals.path||{};g.__tsParticlesInternals.path.utils=g.__tsParticlesInternals.path.utils||{};var __tsProxyFactory=typeof Proxy!=="undefined"?function(obj){return new Proxy(obj,{get:function(target,key){if(!(key in target)){target[key]={};}return target[key];}});}:function(obj){return obj;};g.__tsParticlesInternals.bundles=__tsProxyFactory(g.__tsParticlesInternals.bundles);g.__tsParticlesInternals.effects=__tsProxyFactory(g.__tsParticlesInternals.effects);g.__tsParticlesInternals.interactions=__tsProxyFactory(g.__tsParticlesInternals.interactions);g.__tsParticlesInternals.palettes=__tsProxyFactory(g.__tsParticlesInternals.palettes);g.__tsParticlesInternals.paths=__tsProxyFactory(g.__tsParticlesInternals.paths);g.__tsParticlesInternals.plugins=__tsProxyFactory(g.__tsParticlesInternals.plugins);g.__tsParticlesInternals.plugins.emittersShapes=__tsProxyFactory(g.__tsParticlesInternals.plugins.emittersShapes);g.__tsParticlesInternals.presets=__tsProxyFactory(g.__tsParticlesInternals.presets);g.__tsParticlesInternals.shapes=__tsProxyFactory(g.__tsParticlesInternals.shapes);g.__tsParticlesInternals.updaters=__tsProxyFactory(g.__tsParticlesInternals.updaters);g.__tsParticlesInternals.utils=__tsProxyFactory(g.__tsParticlesInternals.utils);g.__tsParticlesInternals.canvas=__tsProxyFactory(g.__tsParticlesInternals.canvas);g.__tsParticlesInternals.path=__tsProxyFactory(g.__tsParticlesInternals.path);g.tsparticlesInternalExports=g.tsparticlesInternalExports||{};})(typeof globalThis!=="undefined"?globalThis:typeof window!=="undefined"?window:this);
2
- /* Preset v4.0.4 */
2
+ /* Preset v4.1.0 */
3
3
  (function (global, factory) {
4
4
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
5
5
  typeof define === 'function' && define.amd ? define(['exports'], factory) :
@@ -51,13 +51,13 @@
51
51
  return Math.atan2(this.y, this.x);
52
52
  }
53
53
  set angle(angle) {
54
- this._updateFromAngle(angle, this.length);
54
+ this.#updateFromAngle(angle, this.length);
55
55
  }
56
56
  get length() {
57
57
  return Math.sqrt(this.getLengthSq());
58
58
  }
59
59
  set length(length) {
60
- this._updateFromAngle(this.angle, length);
60
+ this.#updateFromAngle(this.angle, length);
61
61
  }
62
62
  static clone(source) {
63
63
  return Vector3d.create(source.x, source.y, getZ(source));
@@ -120,7 +120,7 @@
120
120
  this.y -= v.y;
121
121
  this.z -= getZ(v);
122
122
  }
123
- _updateFromAngle(angle, length) {
123
+ #updateFromAngle(angle, length) {
124
124
  this.x = Math.cos(angle) * length;
125
125
  this.y = Math.sin(angle) * length;
126
126
  }
@@ -727,38 +727,38 @@
727
727
  }
728
728
 
729
729
  class EventDispatcher {
730
- _listeners;
730
+ #listeners;
731
731
  constructor() {
732
- this._listeners = new Map();
732
+ this.#listeners = new Map();
733
733
  }
734
734
  addEventListener(type, listener) {
735
735
  this.removeEventListener(type, listener);
736
- let arr = this._listeners.get(type);
736
+ let arr = this.#listeners.get(type);
737
737
  if (!arr) {
738
738
  arr = [];
739
- this._listeners.set(type, arr);
739
+ this.#listeners.set(type, arr);
740
740
  }
741
741
  arr.push(listener);
742
742
  }
743
743
  dispatchEvent(type, args) {
744
- const listeners = this._listeners.get(type);
744
+ const listeners = this.#listeners.get(type);
745
745
  listeners?.forEach(handler => {
746
746
  handler(args);
747
747
  });
748
748
  }
749
749
  hasEventListener(type) {
750
- return !!this._listeners.get(type);
750
+ return !!this.#listeners.get(type);
751
751
  }
752
752
  removeAllEventListeners(type) {
753
753
  if (!type) {
754
- this._listeners = new Map();
754
+ this.#listeners = new Map();
755
755
  }
756
756
  else {
757
- this._listeners.delete(type);
757
+ this.#listeners.delete(type);
758
758
  }
759
759
  }
760
760
  removeEventListener(type, listener) {
761
- const arr = this._listeners.get(type);
761
+ const arr = this.#listeners.get(type);
762
762
  if (!arr) {
763
763
  return;
764
764
  }
@@ -767,7 +767,7 @@
767
767
  return;
768
768
  }
769
769
  if (length === deleteCount) {
770
- this._listeners.delete(type);
770
+ this.#listeners.delete(type);
771
771
  }
772
772
  else {
773
773
  arr.splice(idx, deleteCount);
@@ -805,19 +805,19 @@
805
805
  presets = new Map();
806
806
  shapeDrawers = new Map();
807
807
  updaters = new Map();
808
- _allLoadersSet = new Set();
809
- _configs = new Map();
810
- _engine;
811
- _executedSet = new Set();
812
- _initialized = false;
813
- _isRunningLoaders = false;
814
- _loadPromises = new Set();
808
+ #allLoadersSet = new Set();
809
+ #configs = new Map();
810
+ #engine;
811
+ #executedSet = new Set();
812
+ #initialized = false;
813
+ #isRunningLoaders = false;
814
+ #loadPromises = new Set();
815
815
  constructor(engine) {
816
- this._engine = engine;
816
+ this.#engine = engine;
817
817
  }
818
818
  get configs() {
819
819
  const res = {};
820
- for (const [name, config] of this._configs) {
820
+ for (const [name, config] of this.#configs) {
821
821
  res[name] = config;
822
822
  }
823
823
  return res;
@@ -827,8 +827,8 @@
827
827
  }
828
828
  addConfig(config) {
829
829
  const key = config.key ?? config.name ?? "default";
830
- this._configs.set(key, config);
831
- this._engine.dispatchEvent(EventType.configAdded, { data: { name: key, config } });
830
+ this.#configs.set(key, config);
831
+ this.#engine.dispatchEvent(EventType.configAdded, { data: { name: key, config } });
832
832
  }
833
833
  addEasing(name, easing) {
834
834
  if (this.easingFunctions.get(name)) {
@@ -889,21 +889,21 @@
889
889
  return getItemsFromInitializer(container, this.updaters, this.initializers.updaters, force);
890
890
  }
891
891
  async init() {
892
- if (this._initialized || this._isRunningLoaders) {
892
+ if (this.#initialized || this.#isRunningLoaders) {
893
893
  return;
894
894
  }
895
- this._isRunningLoaders = true;
896
- this._executedSet = new Set();
897
- this._allLoadersSet = new Set(this._loadPromises);
895
+ this.#isRunningLoaders = true;
896
+ this.#executedSet = new Set();
897
+ this.#allLoadersSet = new Set(this.#loadPromises);
898
898
  try {
899
- for (const loader of this._allLoadersSet) {
900
- await this._runLoader(loader, this._executedSet, this._allLoadersSet);
899
+ for (const loader of this.#allLoadersSet) {
900
+ await this.#runLoader(loader, this.#executedSet, this.#allLoadersSet);
901
901
  }
902
902
  }
903
903
  finally {
904
- this._loadPromises.clear();
905
- this._isRunningLoaders = false;
906
- this._initialized = true;
904
+ this.#loadPromises.clear();
905
+ this.#isRunningLoaders = false;
906
+ this.#initialized = true;
907
907
  }
908
908
  }
909
909
  loadParticlesOptions(container, options, ...sourceOptions) {
@@ -914,24 +914,24 @@
914
914
  updaters.forEach(updater => updater.loadOptions?.(options, ...sourceOptions));
915
915
  }
916
916
  async register(...loaders) {
917
- if (this._initialized) {
917
+ if (this.#initialized) {
918
918
  throw new Error("Register plugins can only be done before calling tsParticles.load()");
919
919
  }
920
920
  for (const loader of loaders) {
921
- if (this._isRunningLoaders) {
922
- await this._runLoader(loader, this._executedSet, this._allLoadersSet);
921
+ if (this.#isRunningLoaders) {
922
+ await this.#runLoader(loader, this.#executedSet, this.#allLoadersSet);
923
923
  }
924
924
  else {
925
- this._loadPromises.add(loader);
925
+ this.#loadPromises.add(loader);
926
926
  }
927
927
  }
928
928
  }
929
- async _runLoader(loader, executed, allLoaders) {
929
+ async #runLoader(loader, executed, allLoaders) {
930
930
  if (executed.has(loader))
931
931
  return;
932
932
  executed.add(loader);
933
933
  allLoaders.add(loader);
934
- await loader(this._engine);
934
+ await loader(this.#engine);
935
935
  }
936
936
  }
937
937
 
@@ -1011,17 +1011,17 @@
1011
1011
  };
1012
1012
  class Engine {
1013
1013
  pluginManager = new PluginManager(this);
1014
- _domArray = [];
1015
- _eventDispatcher = new EventDispatcher();
1016
- _initialized = false;
1014
+ #domArray = [];
1015
+ #eventDispatcher = new EventDispatcher();
1016
+ #initialized = false;
1017
1017
  get items() {
1018
- return this._domArray;
1018
+ return this.#domArray;
1019
1019
  }
1020
1020
  get version() {
1021
- return "4.0.4";
1021
+ return "4.1.0";
1022
1022
  }
1023
1023
  addEventListener(type, listener) {
1024
- this._eventDispatcher.addEventListener(type, listener);
1024
+ this.#eventDispatcher.addEventListener(type, listener);
1025
1025
  }
1026
1026
  checkVersion(pluginVersion) {
1027
1027
  if (this.version === pluginVersion) {
@@ -1030,17 +1030,17 @@
1030
1030
  throw new Error(`The tsParticles version is different from the loaded plugins version. Engine version: ${this.version}. Plugin version: ${pluginVersion}`);
1031
1031
  }
1032
1032
  dispatchEvent(type, args) {
1033
- this._eventDispatcher.dispatchEvent(type, args);
1033
+ this.#eventDispatcher.dispatchEvent(type, args);
1034
1034
  }
1035
1035
  async init() {
1036
- if (this._initialized) {
1036
+ if (this.#initialized) {
1037
1037
  return;
1038
1038
  }
1039
1039
  await this.pluginManager.init();
1040
- this._initialized = true;
1040
+ this.#initialized = true;
1041
1041
  }
1042
1042
  item(index) {
1043
- const { items } = this, item = items[index];
1043
+ const items = this.items, item = items[index];
1044
1044
  if (item?.destroyed) {
1045
1045
  items.splice(index, removeDeleteCount);
1046
1046
  return;
@@ -1094,7 +1094,7 @@
1094
1094
  await Promise.all(this.items.map(t => t.refresh()));
1095
1095
  }
1096
1096
  removeEventListener(type, listener) {
1097
- this._eventDispatcher.removeEventListener(type, listener);
1097
+ this.#eventDispatcher.removeEventListener(type, listener);
1098
1098
  }
1099
1099
  }
1100
1100
 
@@ -1865,43 +1865,6 @@
1865
1865
  }
1866
1866
  }
1867
1867
 
1868
- class OpacityAnimation extends RangedAnimationOptions {
1869
- destroy;
1870
- constructor() {
1871
- super();
1872
- this.destroy = DestroyType.none;
1873
- this.speed = 2;
1874
- }
1875
- load(data) {
1876
- super.load(data);
1877
- if (isNull(data)) {
1878
- return;
1879
- }
1880
- if (data.destroy !== undefined) {
1881
- this.destroy = data.destroy;
1882
- }
1883
- }
1884
- }
1885
-
1886
- class Opacity extends RangedAnimationValueWithRandom {
1887
- animation;
1888
- constructor() {
1889
- super();
1890
- this.animation = new OpacityAnimation();
1891
- this.value = 1;
1892
- }
1893
- load(data) {
1894
- if (isNull(data)) {
1895
- return;
1896
- }
1897
- super.load(data);
1898
- const animation = data.animation;
1899
- if (animation !== undefined) {
1900
- this.animation.load(animation);
1901
- }
1902
- }
1903
- }
1904
-
1905
1868
  class Stroke {
1906
1869
  color;
1907
1870
  opacity;
@@ -2069,43 +2032,6 @@
2069
2032
  }
2070
2033
  }
2071
2034
 
2072
- class SizeAnimation extends RangedAnimationOptions {
2073
- destroy;
2074
- constructor() {
2075
- super();
2076
- this.destroy = DestroyType.none;
2077
- this.speed = 5;
2078
- }
2079
- load(data) {
2080
- super.load(data);
2081
- if (isNull(data)) {
2082
- return;
2083
- }
2084
- if (data.destroy !== undefined) {
2085
- this.destroy = data.destroy;
2086
- }
2087
- }
2088
- }
2089
-
2090
- class Size extends RangedAnimationValueWithRandom {
2091
- animation;
2092
- constructor() {
2093
- super();
2094
- this.animation = new SizeAnimation();
2095
- this.value = 3;
2096
- }
2097
- load(data) {
2098
- super.load(data);
2099
- if (isNull(data)) {
2100
- return;
2101
- }
2102
- const animation = data.animation;
2103
- if (animation !== undefined) {
2104
- this.animation.load(animation);
2105
- }
2106
- }
2107
- }
2108
-
2109
2035
  class ZIndex extends ValueWithRandom {
2110
2036
  opacityRate;
2111
2037
  sizeRate;
@@ -2139,24 +2065,21 @@
2139
2065
  groups;
2140
2066
  move;
2141
2067
  number;
2142
- opacity;
2143
2068
  paint;
2144
2069
  palette;
2145
2070
  reduceDuplicates;
2146
2071
  shape;
2147
- size;
2148
2072
  zIndex;
2149
- _container;
2150
- _pluginManager;
2073
+ #container;
2074
+ #pluginManager;
2151
2075
  constructor(pluginManager, container) {
2152
- this._pluginManager = pluginManager;
2153
- this._container = container;
2076
+ this.#pluginManager = pluginManager;
2077
+ this.#container = container;
2154
2078
  this.bounce = new ParticlesBounce();
2155
2079
  this.effect = new Effect();
2156
2080
  this.groups = {};
2157
2081
  this.move = new Move();
2158
2082
  this.number = new ParticlesNumber();
2159
- this.opacity = new Opacity();
2160
2083
  this.paint = new Paint();
2161
2084
  this.paint.color = new AnimatableColor();
2162
2085
  this.paint.color.value = "#fff";
@@ -2164,7 +2087,6 @@
2164
2087
  this.paint.fill.enable = true;
2165
2088
  this.reduceDuplicates = false;
2166
2089
  this.shape = new Shape();
2167
- this.size = new Size();
2168
2090
  this.zIndex = new ZIndex();
2169
2091
  }
2170
2092
  load(data) {
@@ -2173,7 +2095,7 @@
2173
2095
  }
2174
2096
  if (data.palette) {
2175
2097
  this.palette = data.palette;
2176
- this._importPalette(this.palette);
2098
+ this.#importPalette(this.palette);
2177
2099
  }
2178
2100
  if (data.groups !== undefined) {
2179
2101
  for (const group of Object.keys(data.groups)) {
@@ -2193,7 +2115,6 @@
2193
2115
  this.effect.load(data.effect);
2194
2116
  this.move.load(data.move);
2195
2117
  this.number.load(data.number);
2196
- this.opacity.load(data.opacity);
2197
2118
  const paintToLoad = data.paint;
2198
2119
  if (paintToLoad) {
2199
2120
  if (isArray(paintToLoad)) {
@@ -2212,15 +2133,14 @@
2212
2133
  }
2213
2134
  }
2214
2135
  this.shape.load(data.shape);
2215
- this.size.load(data.size);
2216
2136
  this.zIndex.load(data.zIndex);
2217
- if (this._container) {
2218
- for (const plugin of this._pluginManager.plugins) {
2137
+ if (this.#container) {
2138
+ for (const plugin of this.#pluginManager.plugins) {
2219
2139
  if (plugin.loadParticlesOptions) {
2220
- plugin.loadParticlesOptions(this._container, this, data);
2140
+ plugin.loadParticlesOptions(this.#container, this, data);
2221
2141
  }
2222
2142
  }
2223
- const updaters = this._pluginManager.updaters.get(this._container);
2143
+ const updaters = this.#pluginManager.updaters.get(this.#container);
2224
2144
  if (updaters) {
2225
2145
  for (const updater of updaters) {
2226
2146
  if (updater.loadOptions) {
@@ -2230,8 +2150,8 @@
2230
2150
  }
2231
2151
  }
2232
2152
  }
2233
- _importPalette = (palette) => {
2234
- const paletteData = this._pluginManager.getPalette(palette);
2153
+ #importPalette = (palette) => {
2154
+ const paletteData = this.#pluginManager.getPalette(palette);
2235
2155
  if (!paletteData) {
2236
2156
  return;
2237
2157
  }
@@ -2310,11 +2230,11 @@
2310
2230
  smooth;
2311
2231
  style;
2312
2232
  zLayers;
2313
- _container;
2314
- _pluginManager;
2233
+ #container;
2234
+ #pluginManager;
2315
2235
  constructor(pluginManager, container) {
2316
- this._pluginManager = pluginManager;
2317
- this._container = container;
2236
+ this.#pluginManager = pluginManager;
2237
+ this.#container = container;
2318
2238
  this.autoPlay = true;
2319
2239
  this.background = new Background();
2320
2240
  this.clear = true;
@@ -2325,7 +2245,7 @@
2325
2245
  this.duration = 0;
2326
2246
  this.fpsLimit = 120;
2327
2247
  this.hdr = true;
2328
- this.particles = loadParticlesOptions(this._pluginManager, this._container);
2248
+ this.particles = loadParticlesOptions(this.#pluginManager, this.#container);
2329
2249
  this.pauseOnBlur = true;
2330
2250
  this.pauseOnOutsideViewport = true;
2331
2251
  this.resize = new ResizeEvent();
@@ -2340,12 +2260,12 @@
2340
2260
  if (data.preset !== undefined) {
2341
2261
  this.preset = data.preset;
2342
2262
  executeOnSingleOrMultiple(this.preset, preset => {
2343
- this._importPreset(preset);
2263
+ this.#importPreset(preset);
2344
2264
  });
2345
2265
  }
2346
2266
  if (data.palette !== undefined) {
2347
2267
  this.palette = data.palette;
2348
- this._importPalette(this.palette);
2268
+ this.#importPalette(this.palette);
2349
2269
  }
2350
2270
  if (data.autoPlay !== undefined) {
2351
2271
  this.autoPlay = data.autoPlay;
@@ -2399,12 +2319,12 @@
2399
2319
  if (data.smooth !== undefined) {
2400
2320
  this.smooth = data.smooth;
2401
2321
  }
2402
- this._pluginManager.plugins.forEach(plugin => {
2403
- plugin.loadOptions(this._container, this, data);
2322
+ this.#pluginManager.plugins.forEach(plugin => {
2323
+ plugin.loadOptions(this.#container, this, data);
2404
2324
  });
2405
2325
  }
2406
- _importPalette = palette => {
2407
- const paletteData = this._pluginManager.getPalette(palette);
2326
+ #importPalette = palette => {
2327
+ const paletteData = this.#pluginManager.getPalette(palette);
2408
2328
  if (!paletteData) {
2409
2329
  return;
2410
2330
  }
@@ -2421,8 +2341,8 @@
2421
2341
  },
2422
2342
  });
2423
2343
  };
2424
- _importPreset = preset => {
2425
- this.load(this._pluginManager.getPreset(preset));
2344
+ #importPreset = preset => {
2345
+ this.load(this.#pluginManager.getPreset(preset));
2426
2346
  };
2427
2347
  }
2428
2348
 
@@ -2891,7 +2811,7 @@
2891
2811
  }
2892
2812
 
2893
2813
  async function loadBlendPlugin(engine) {
2894
- engine.checkVersion("4.0.4");
2814
+ engine.checkVersion("4.1.0");
2895
2815
  await engine.pluginManager.register(e => {
2896
2816
  e.pluginManager.addPlugin(new BlendPlugin());
2897
2817
  });
@@ -2928,7 +2848,7 @@
2928
2848
  }
2929
2849
 
2930
2850
  async function loadCircleShape(engine) {
2931
- engine.checkVersion("4.0.4");
2851
+ engine.checkVersion("4.1.0");
2932
2852
  await engine.pluginManager.register(e => {
2933
2853
  e.pluginManager.addShape(["circle"], () => {
2934
2854
  return Promise.resolve(new CircleDrawer());
@@ -2949,15 +2869,15 @@
2949
2869
  return input.startsWith("#");
2950
2870
  }
2951
2871
  handleColor(color) {
2952
- return this._parseString(color.value);
2872
+ return this.#parseString(color.value);
2953
2873
  }
2954
2874
  handleRangeColor(color) {
2955
- return this._parseString(color.value);
2875
+ return this.#parseString(color.value);
2956
2876
  }
2957
2877
  parseString(input) {
2958
- return this._parseString(input);
2878
+ return this.#parseString(input);
2959
2879
  }
2960
- _parseString(hexColor) {
2880
+ #parseString(hexColor) {
2961
2881
  if (typeof hexColor !== "string" || !this.accepts(hexColor)) {
2962
2882
  return;
2963
2883
  }
@@ -2976,7 +2896,7 @@
2976
2896
  }
2977
2897
 
2978
2898
  async function loadHexColorPlugin(engine) {
2979
- engine.checkVersion("4.0.4");
2899
+ engine.checkVersion("4.1.0");
2980
2900
  await engine.pluginManager.register(e => {
2981
2901
  e.pluginManager.addColorManager("hex", new HexColorManager());
2982
2902
  });
@@ -3029,7 +2949,7 @@
3029
2949
  }
3030
2950
 
3031
2951
  async function loadHslColorPlugin(engine) {
3032
- engine.checkVersion("4.0.4");
2952
+ engine.checkVersion("4.1.0");
3033
2953
  await engine.pluginManager.register(e => {
3034
2954
  e.pluginManager.addColorManager("hsl", new HslColorManager());
3035
2955
  });
@@ -3037,13 +2957,13 @@
3037
2957
 
3038
2958
  class MovePlugin {
3039
2959
  id = "move";
3040
- _pluginManager;
2960
+ #pluginManager;
3041
2961
  constructor(pluginManager) {
3042
- this._pluginManager = pluginManager;
2962
+ this.#pluginManager = pluginManager;
3043
2963
  }
3044
2964
  async getPlugin(container) {
3045
2965
  const { MovePluginInstance } = await Promise.resolve().then(function () { return MovePluginInstance$1; });
3046
- return new MovePluginInstance(this._pluginManager, container);
2966
+ return new MovePluginInstance(this.#pluginManager, container);
3047
2967
  }
3048
2968
  loadOptions() {
3049
2969
  }
@@ -3053,7 +2973,7 @@
3053
2973
  }
3054
2974
 
3055
2975
  async function loadMovePlugin(engine) {
3056
- engine.checkVersion("4.0.4");
2976
+ engine.checkVersion("4.1.0");
3057
2977
  await engine.pluginManager.register(e => {
3058
2978
  const moveEngine = e, movePluginManager = moveEngine.pluginManager;
3059
2979
  movePluginManager.initializers.pathGenerators ??= new Map();
@@ -3071,18 +2991,58 @@
3071
2991
  });
3072
2992
  }
3073
2993
 
2994
+ class OpacityAnimation extends RangedAnimationOptions {
2995
+ destroy;
2996
+ constructor() {
2997
+ super();
2998
+ this.destroy = DestroyType.none;
2999
+ this.speed = 2;
3000
+ }
3001
+ load(data) {
3002
+ super.load(data);
3003
+ if (isNull(data)) {
3004
+ return;
3005
+ }
3006
+ if (data.destroy !== undefined) {
3007
+ this.destroy = data.destroy;
3008
+ }
3009
+ }
3010
+ }
3011
+
3012
+ class Opacity extends RangedAnimationValueWithRandom {
3013
+ animation;
3014
+ constructor() {
3015
+ super();
3016
+ this.animation = new OpacityAnimation();
3017
+ this.value = 1;
3018
+ }
3019
+ load(data) {
3020
+ if (isNull(data)) {
3021
+ return;
3022
+ }
3023
+ super.load(data);
3024
+ const animation = data.animation;
3025
+ if (animation !== undefined) {
3026
+ this.animation.load(animation);
3027
+ }
3028
+ }
3029
+ }
3030
+
3074
3031
  class OpacityUpdater {
3075
- container;
3032
+ #container;
3076
3033
  constructor(container) {
3077
- this.container = container;
3034
+ this.#container = container;
3078
3035
  }
3079
3036
  init(particle) {
3080
3037
  const opacityOptions = particle.options.opacity, pxRatio = 1;
3038
+ if (!opacityOptions) {
3039
+ return;
3040
+ }
3081
3041
  particle.opacity = initParticleNumericAnimationValue(opacityOptions, pxRatio);
3082
3042
  const opacityAnimation = opacityOptions.animation;
3083
3043
  if (opacityAnimation.enable) {
3084
3044
  particle.opacity.velocity =
3085
- (getRangeValue(opacityAnimation.speed) / percentDenominator) * this.container.retina.reduceFactor;
3045
+ (getRangeValue(opacityAnimation.speed) / percentDenominator) * this.#container.retina.reduceFactor;
3086
3046
  if (!opacityAnimation.sync) {
3087
3047
  particle.opacity.velocity *= getRandom();
3088
3048
  }
@@ -3098,6 +3058,12 @@
3098
3058
  ((particle.opacity.maxLoops ?? none) > none &&
3099
3059
  (particle.opacity.loops ?? none) < (particle.opacity.maxLoops ?? none))));
3100
3060
  }
3061
+ loadOptions(options, ...sources) {
3062
+ options.opacity ??= new Opacity();
3063
+ for (const source of sources) {
3064
+ options.opacity.load(source?.opacity);
3065
+ }
3066
+ }
3101
3067
  reset(particle) {
3102
3068
  if (!particle.opacity) {
3103
3069
  return;
@@ -3106,7 +3072,7 @@
3106
3072
  particle.opacity.loops = 0;
3107
3073
  }
3108
3074
  update(particle, delta) {
3109
- if (!this.isEnabled(particle) || !particle.opacity) {
3075
+ if (!this.isEnabled(particle) || !particle.opacity || !particle.options.opacity) {
3110
3076
  return;
3111
3077
  }
3112
3078
  updateAnimation(particle, particle.opacity, true, particle.options.opacity.animation.destroy, delta);
@@ -3114,7 +3080,7 @@
3114
3080
  }
3115
3081
 
3116
3082
  async function loadOpacityUpdater(engine) {
3117
- engine.checkVersion("4.0.4");
3083
+ engine.checkVersion("4.1.0");
3118
3084
  await engine.pluginManager.register(e => {
3119
3085
  e.pluginManager.addParticleUpdater("opacity", container => {
3120
3086
  return Promise.resolve(new OpacityUpdater(container));
@@ -3136,10 +3102,9 @@
3136
3102
  }
3137
3103
  const velocity = data.particle.velocity.x;
3138
3104
  let bounced = false;
3139
- if ((data.direction === OutModeDirection.right &&
3140
- data.bounds.right >= data.canvasSize.width &&
3141
- velocity > minVelocity$4) ||
3142
- (data.direction === OutModeDirection.left && data.bounds.left <= boundsMin && velocity < minVelocity$4)) {
3105
+ if (data.outOfCanvas &&
3106
+ ((data.direction === OutModeDirection.right && velocity > minVelocity$4) ||
3107
+ (data.direction === OutModeDirection.left && velocity < minVelocity$4))) {
3143
3108
  const newVelocity = getRangeValue(data.particle.options.bounce.horizontal.value);
3144
3109
  data.particle.velocity.x *= -newVelocity;
3145
3110
  bounced = true;
@@ -3148,10 +3113,10 @@
3148
3113
  return;
3149
3114
  }
3150
3115
  const minPos = data.offset.x + data.size;
3151
- if (data.bounds.right >= data.canvasSize.width && data.direction === OutModeDirection.right) {
3116
+ if (data.outOfCanvas && data.direction === OutModeDirection.right) {
3152
3117
  data.particle.position.x = data.canvasSize.width - minPos;
3153
3118
  }
3154
- else if (data.bounds.left <= boundsMin && data.direction === OutModeDirection.left) {
3119
+ else if (data.outOfCanvas && data.direction === OutModeDirection.left) {
3155
3120
  data.particle.position.x = minPos;
3156
3121
  }
3157
3122
  if (data.outMode === OutMode.split) {
@@ -3171,10 +3136,9 @@
3171
3136
  }
3172
3137
  const velocity = data.particle.velocity.y;
3173
3138
  let bounced = false;
3174
- if ((data.direction === OutModeDirection.bottom &&
3175
- data.bounds.bottom >= data.canvasSize.height &&
3176
- velocity > minVelocity$4) ||
3177
- (data.direction === OutModeDirection.top && data.bounds.top <= boundsMin && velocity < minVelocity$4)) {
3139
+ if (data.outOfCanvas &&
3140
+ ((data.direction === OutModeDirection.bottom && velocity > minVelocity$4) ||
3141
+ (data.direction === OutModeDirection.top && velocity < minVelocity$4))) {
3178
3142
  const newVelocity = getRangeValue(data.particle.options.bounce.vertical.value);
3179
3143
  data.particle.velocity.y *= -newVelocity;
3180
3144
  bounced = true;
@@ -3183,10 +3147,10 @@
3183
3147
  return;
3184
3148
  }
3185
3149
  const minPos = data.offset.y + data.size;
3186
- if (data.bounds.bottom >= data.canvasSize.height && data.direction === OutModeDirection.bottom) {
3150
+ if (data.outOfCanvas && data.direction === OutModeDirection.bottom) {
3187
3151
  data.particle.position.y = data.canvasSize.height - minPos;
3188
3152
  }
3189
- else if (data.bounds.top <= boundsMin && data.direction === OutModeDirection.top) {
3153
+ else if (data.outOfCanvas && data.direction === OutModeDirection.top) {
3190
3154
  data.particle.position.y = minPos;
3191
3155
  }
3192
3156
  if (data.outMode === OutMode.split) {
@@ -3195,24 +3159,24 @@
3195
3159
  }
3196
3160
 
3197
3161
  class BounceOutMode {
3198
- container;
3199
3162
  modes;
3200
- _particleBouncePlugins;
3163
+ #container;
3164
+ #particleBouncePlugins;
3201
3165
  constructor(container) {
3202
- this.container = container;
3166
+ this.#container = container;
3203
3167
  this.modes = [
3204
3168
  OutMode.bounce,
3205
3169
  OutMode.split,
3206
3170
  ];
3207
- this._particleBouncePlugins = container.plugins.filter(p => p.particleBounce !== undefined);
3171
+ this.#particleBouncePlugins = container.plugins.filter(p => p.particleBounce !== undefined);
3208
3172
  }
3209
3173
  update(particle, direction, delta, outMode) {
3210
3174
  if (!this.modes.includes(outMode)) {
3211
3175
  return;
3212
3176
  }
3213
- const container = this.container;
3177
+ const container = this.#container;
3214
3178
  let handled = false;
3215
- for (const plugin of this._particleBouncePlugins) {
3179
+ for (const plugin of this.#particleBouncePlugins) {
3216
3180
  handled = plugin.particleBounce?.(particle, delta, direction) ?? false;
3217
3181
  if (handled) {
3218
3182
  break;
@@ -3221,29 +3185,26 @@
3221
3185
  if (handled) {
3222
3186
  return;
3223
3187
  }
3224
- const pos = particle.getPosition(), offset = particle.offset, size = particle.getRadius(), bounds = calculateBounds(pos, size), canvasSize = container.canvas.size;
3225
- bounceHorizontal({ particle, outMode, direction, bounds, canvasSize, offset, size });
3226
- bounceVertical({ particle, outMode, direction, bounds, canvasSize, offset, size });
3188
+ const pos = particle.getPosition(), offset = particle.offset, size = particle.getRadius(), bounds = calculateBounds(pos, size), canvasSize = container.canvas.size, outOfCanvas = !particle.isInsideCanvasForOutMode(outMode, direction);
3189
+ bounceHorizontal({ particle, outMode, direction, bounds, canvasSize, offset, outOfCanvas, size });
3190
+ bounceVertical({ particle, outMode, direction, bounds, canvasSize, offset, outOfCanvas, size });
3227
3191
  }
3228
3192
  }
3229
3193
 
3230
3194
  const minVelocity$3 = 0;
3231
3195
  class DestroyOutMode {
3232
- container;
3233
3196
  modes;
3234
- constructor(container) {
3235
- this.container = container;
3197
+ constructor(_container) {
3236
3198
  this.modes = [OutMode.destroy];
3237
3199
  }
3238
3200
  update(particle, direction, _delta, outMode) {
3239
3201
  if (!this.modes.includes(outMode)) {
3240
3202
  return;
3241
3203
  }
3242
- const container = this.container;
3243
3204
  switch (particle.outType) {
3244
3205
  case ParticleOutType.normal:
3245
3206
  case ParticleOutType.outside:
3246
- if (isPointInside(particle.position, container.canvas.size, originPoint, particle.getRadius(), direction)) {
3207
+ if (particle.isInsideCanvasForOutMode(outMode, direction)) {
3247
3208
  return;
3248
3209
  }
3249
3210
  break;
@@ -3264,10 +3225,10 @@
3264
3225
 
3265
3226
  const minVelocity$2 = 0;
3266
3227
  class NoneOutMode {
3267
- container;
3268
3228
  modes;
3229
+ #container;
3269
3230
  constructor(container) {
3270
- this.container = container;
3231
+ this.#container = container;
3271
3232
  this.modes = [OutMode.none];
3272
3233
  }
3273
3234
  update(particle, direction, _delta, outMode) {
@@ -3280,7 +3241,7 @@
3280
3241
  (direction === OutModeDirection.top || direction === OutModeDirection.bottom))) {
3281
3242
  return;
3282
3243
  }
3283
- const gravityOptions = particle.options.move.gravity, container = this.container, canvasSize = container.canvas.size, pRadius = particle.getRadius();
3244
+ const gravityOptions = particle.options.move.gravity, container = this.#container, canvasSize = container.canvas.size, pRadius = particle.getRadius();
3284
3245
  if (!gravityOptions.enable) {
3285
3246
  if ((particle.velocity.y > minVelocity$2 && particle.position.y <= canvasSize.height + pRadius) ||
3286
3247
  (particle.velocity.y < minVelocity$2 && particle.position.y >= -pRadius) ||
@@ -3306,17 +3267,17 @@
3306
3267
 
3307
3268
  const minVelocity$1 = 0, minDistance = 0, updateVector = Vector.origin;
3308
3269
  class OutOutMode {
3309
- container;
3310
3270
  modes;
3271
+ #container;
3311
3272
  constructor(container) {
3312
- this.container = container;
3273
+ this.#container = container;
3313
3274
  this.modes = [OutMode.out];
3314
3275
  }
3315
3276
  update(particle, direction, _delta, outMode) {
3316
3277
  if (!this.modes.includes(outMode)) {
3317
3278
  return;
3318
3279
  }
3319
- const container = this.container;
3280
+ const container = this.#container;
3320
3281
  switch (particle.outType) {
3321
3282
  case ParticleOutType.inside: {
3322
3283
  const { x: vx, y: vy } = particle.velocity;
@@ -3346,7 +3307,7 @@
3346
3307
  break;
3347
3308
  }
3348
3309
  default: {
3349
- if (isPointInside(particle.position, container.canvas.size, originPoint, particle.getRadius(), direction)) {
3310
+ if (particle.isInsideCanvasForOutMode(outMode, direction)) {
3350
3311
  return;
3351
3312
  }
3352
3313
  switch (particle.outType) {
@@ -3430,16 +3391,16 @@
3430
3391
  };
3431
3392
  class OutOfCanvasUpdater {
3432
3393
  updaters;
3433
- container;
3394
+ #container;
3434
3395
  constructor(container) {
3435
- this.container = container;
3396
+ this.#container = container;
3436
3397
  this.updaters = new Map();
3437
3398
  }
3438
3399
  init(particle) {
3439
- this._addUpdaterIfMissing(particle, OutMode.bounce, container => new BounceOutMode(container));
3440
- this._addUpdaterIfMissing(particle, OutMode.out, container => new OutOutMode(container));
3441
- this._addUpdaterIfMissing(particle, OutMode.destroy, container => new DestroyOutMode(container));
3442
- this._addUpdaterIfMissing(particle, OutMode.none, container => new NoneOutMode(container));
3400
+ this.#addUpdaterIfMissing(particle, OutMode.bounce, container => new BounceOutMode(container));
3401
+ this.#addUpdaterIfMissing(particle, OutMode.out, container => new OutOutMode(container));
3402
+ this.#addUpdaterIfMissing(particle, OutMode.destroy, container => new DestroyOutMode(container));
3403
+ this.#addUpdaterIfMissing(particle, OutMode.none, container => new NoneOutMode(container));
3443
3404
  }
3444
3405
  isEnabled(particle) {
3445
3406
  return !particle.destroyed && !particle.spawning;
@@ -3447,18 +3408,18 @@
3447
3408
  update(particle, delta) {
3448
3409
  const outModes = particle.options.move.outModes;
3449
3410
  particle.justWarped = false;
3450
- this._updateOutMode(particle, delta, outModes.bottom ?? outModes.default, OutModeDirection.bottom);
3451
- this._updateOutMode(particle, delta, outModes.left ?? outModes.default, OutModeDirection.left);
3452
- this._updateOutMode(particle, delta, outModes.right ?? outModes.default, OutModeDirection.right);
3453
- this._updateOutMode(particle, delta, outModes.top ?? outModes.default, OutModeDirection.top);
3411
+ this.#updateOutMode(particle, delta, outModes.bottom ?? outModes.default, OutModeDirection.bottom);
3412
+ this.#updateOutMode(particle, delta, outModes.left ?? outModes.default, OutModeDirection.left);
3413
+ this.#updateOutMode(particle, delta, outModes.right ?? outModes.default, OutModeDirection.right);
3414
+ this.#updateOutMode(particle, delta, outModes.top ?? outModes.default, OutModeDirection.top);
3454
3415
  }
3455
- _addUpdaterIfMissing = (particle, outMode, getUpdater) => {
3416
+ #addUpdaterIfMissing = (particle, outMode, getUpdater) => {
3456
3417
  const outModes = particle.options.move.outModes;
3457
3418
  if (!this.updaters.has(outMode) && checkOutMode(outModes, outMode)) {
3458
- this.updaters.set(outMode, getUpdater(this.container));
3419
+ this.updaters.set(outMode, getUpdater(this.#container));
3459
3420
  }
3460
3421
  };
3461
- _updateOutMode = (particle, delta, outMode, direction) => {
3422
+ #updateOutMode = (particle, delta, outMode, direction) => {
3462
3423
  for (const updater of this.updaters.values()) {
3463
3424
  updater.update(particle, direction, delta, outMode);
3464
3425
  }
@@ -3466,7 +3427,7 @@
3466
3427
  }
3467
3428
 
3468
3429
  async function loadOutModesUpdater(engine) {
3469
- engine.checkVersion("4.0.4");
3430
+ engine.checkVersion("4.1.0");
3470
3431
  await engine.pluginManager.register(e => {
3471
3432
  e.pluginManager.addParticleUpdater("outModes", container => {
3472
3433
  return Promise.resolve(new OutOfCanvasUpdater(container));
@@ -3476,20 +3437,20 @@
3476
3437
 
3477
3438
  const defaultOpacity = 1;
3478
3439
  class PaintUpdater {
3479
- _container;
3480
- _pluginManager;
3440
+ #container;
3441
+ #pluginManager;
3481
3442
  constructor(pluginManager, container) {
3482
- this._container = container;
3483
- this._pluginManager = pluginManager;
3443
+ this.#container = container;
3444
+ this.#pluginManager = pluginManager;
3484
3445
  }
3485
3446
  init(particle) {
3486
- const container = this._container, options = particle.options, paint = itemFromSingleOrMultiple(options.paint, particle.id, options.reduceDuplicates), color = paint?.color, paintColor = color ?? undefined, fill = paint?.fill, stroke = paint?.stroke;
3447
+ const container = this.#container, options = particle.options, paint = itemFromSingleOrMultiple(options.paint, particle.id, options.reduceDuplicates), color = paint?.color, paintColor = color ?? undefined, fill = paint?.fill, stroke = paint?.stroke;
3487
3448
  if (fill) {
3488
3449
  const fillColor = AnimatableColor.create(paintColor === undefined ? undefined : AnimatableColor.create(undefined, paintColor), fill.color);
3489
3450
  particle.fillEnabled = fill.enable;
3490
3451
  particle.fillOpacity = getRangeValue(fill.opacity);
3491
3452
  particle.fillAnimation = fillColor.animation;
3492
- const fillHslColor = rangeColorToHsl(this._pluginManager, fillColor);
3453
+ const fillHslColor = rangeColorToHsl(this.#pluginManager, fillColor);
3493
3454
  if (fillHslColor) {
3494
3455
  particle.fillColor = getHslAnimationFromHsl(fillHslColor, particle.fillAnimation, container.retina.reduceFactor);
3495
3456
  }
@@ -3505,7 +3466,7 @@
3505
3466
  particle.strokeWidth = getRangeValue(stroke.width) * container.retina.pixelRatio;
3506
3467
  particle.strokeOpacity = getRangeValue(stroke.opacity ?? defaultOpacity);
3507
3468
  particle.strokeAnimation = strokeColor.animation;
3508
- const strokeHslColor = rangeColorToHsl(this._pluginManager, strokeColor) ?? particle.getFillColor();
3469
+ const strokeHslColor = rangeColorToHsl(this.#pluginManager, strokeColor) ?? particle.getFillColor();
3509
3470
  if (strokeHslColor) {
3510
3471
  particle.strokeColor = getHslAnimationFromHsl(strokeHslColor, particle.strokeAnimation, container.retina.reduceFactor);
3511
3472
  }
@@ -3537,7 +3498,7 @@
3537
3498
  }
3538
3499
 
3539
3500
  async function loadPaintUpdater(engine) {
3540
- engine.checkVersion("4.0.4");
3501
+ engine.checkVersion("4.1.0");
3541
3502
  await engine.pluginManager.register(e => {
3542
3503
  e.pluginManager.addParticleUpdater("paint", container => {
3543
3504
  return Promise.resolve(new PaintUpdater(e.pluginManager, container));
@@ -3592,27 +3553,69 @@
3592
3553
  }
3593
3554
 
3594
3555
  async function loadRgbColorPlugin(engine) {
3595
- engine.checkVersion("4.0.4");
3556
+ engine.checkVersion("4.1.0");
3596
3557
  await engine.pluginManager.register(e => {
3597
3558
  e.pluginManager.addColorManager("rgb", new RgbColorManager());
3598
3559
  });
3599
3560
  }
3600
3561
 
3562
+ class SizeAnimation extends RangedAnimationOptions {
3563
+ destroy;
3564
+ constructor() {
3565
+ super();
3566
+ this.destroy = DestroyType.none;
3567
+ this.speed = 5;
3568
+ }
3569
+ load(data) {
3570
+ super.load(data);
3571
+ if (isNull(data)) {
3572
+ return;
3573
+ }
3574
+ if (data.destroy !== undefined) {
3575
+ this.destroy = data.destroy;
3576
+ }
3577
+ }
3578
+ }
3579
+
3580
+ class Size extends RangedAnimationValueWithRandom {
3581
+ animation;
3582
+ constructor() {
3583
+ super();
3584
+ this.animation = new SizeAnimation();
3585
+ this.value = 3;
3586
+ }
3587
+ load(data) {
3588
+ super.load(data);
3589
+ if (isNull(data)) {
3590
+ return;
3591
+ }
3592
+ const animation = data.animation;
3593
+ if (animation !== undefined) {
3594
+ this.animation.load(animation);
3595
+ }
3596
+ }
3597
+ }
3598
+
3601
3599
  const minLoops = 0;
3602
3600
  class SizeUpdater {
3603
- _container;
3601
+ #container;
3604
3602
  constructor(container) {
3605
- this._container = container;
3603
+ this.#container = container;
3606
3604
  }
3607
3605
  init(particle) {
3608
- const container = this._container, sizeOptions = particle.options.size, sizeAnimation = sizeOptions.animation;
3609
- if (sizeAnimation.enable) {
3610
- particle.size.velocity =
3611
- (particle.retina.sizeAnimationSpeed / percentDenominator) * container.retina.reduceFactor;
3612
- if (!sizeAnimation.sync) {
3613
- particle.size.velocity *= getRandom();
3614
- }
3606
+ const container = this.#container, sizeOptions = particle.options.size;
3607
+ if (!sizeOptions) {
3608
+ return;
3609
+ }
3610
+ const sizeAnimation = sizeOptions.animation;
3611
+ if (!sizeAnimation.enable) {
3612
+ return;
3613
+ }
3614
+ particle.size.velocity = (particle.retina.sizeAnimationSpeed / percentDenominator) * container.retina.reduceFactor;
3615
+ if (sizeAnimation.sync) {
3616
+ return;
3615
3617
  }
3618
+ particle.size.velocity *= getRandom();
3616
3619
  }
3617
3620
  isEnabled(particle) {
3618
3621
  return (!particle.destroyed &&
@@ -3622,12 +3625,26 @@
3622
3625
  ((particle.size.maxLoops ?? minLoops) > minLoops &&
3623
3626
  (particle.size.loops ?? minLoops) < (particle.size.maxLoops ?? minLoops))));
3624
3627
  }
3628
+ loadOptions(options, ...sources) {
3629
+ options.size ??= new Size();
3630
+ for (const source of sources) {
3631
+ options.size.load(source?.size);
3632
+ }
3633
+ }
3634
+ preInit(particle) {
3635
+ const pxRatio = this.#container.retina.pixelRatio, options = particle.options, sizeOptions = options.size;
3636
+ if (!sizeOptions) {
3637
+ return;
3638
+ }
3639
+ particle.size = initParticleNumericAnimationValue(sizeOptions, pxRatio);
3640
+ particle.retina.sizeAnimationSpeed = getRangeValue(sizeOptions.animation.speed) * pxRatio;
3641
+ }
3625
3642
  reset(particle) {
3626
3643
  particle.size.time = 0;
3627
3644
  particle.size.loops = 0;
3628
3645
  }
3629
3646
  update(particle, delta) {
3630
- if (!this.isEnabled(particle)) {
3647
+ if (!this.isEnabled(particle) || !particle.options.size) {
3631
3648
  return;
3632
3649
  }
3633
3650
  updateAnimation(particle, particle.size, true, particle.options.size.animation.destroy, delta);
@@ -3635,7 +3652,7 @@
3635
3652
  }
3636
3653
 
3637
3654
  async function loadSizeUpdater(engine) {
3638
- engine.checkVersion("4.0.4");
3655
+ engine.checkVersion("4.1.0");
3639
3656
  await engine.pluginManager.register(e => {
3640
3657
  e.pluginManager.addParticleUpdater("size", container => {
3641
3658
  return Promise.resolve(new SizeUpdater(container));
@@ -3644,7 +3661,7 @@
3644
3661
  }
3645
3662
 
3646
3663
  async function loadBasic(engine) {
3647
- engine.checkVersion("4.0.4");
3664
+ engine.checkVersion("4.1.0");
3648
3665
  await engine.pluginManager.register(async (e) => {
3649
3666
  await Promise.all([
3650
3667
  loadBlendPlugin(e),
@@ -3900,13 +3917,13 @@
3900
3917
 
3901
3918
  class EmittersPlugin {
3902
3919
  id = "emitters";
3903
- _instancesManager;
3920
+ #instancesManager;
3904
3921
  constructor(instancesManager) {
3905
- this._instancesManager = instancesManager;
3922
+ this.#instancesManager = instancesManager;
3906
3923
  }
3907
3924
  async getPlugin(container) {
3908
3925
  const { EmittersPluginInstance } = await Promise.resolve().then(function () { return EmittersPluginInstance$1; });
3909
- return new EmittersPluginInstance(this._instancesManager, container);
3926
+ return new EmittersPluginInstance(this.#instancesManager, container);
3910
3927
  }
3911
3928
  loadOptions(_container, options, source) {
3912
3929
  if (!this.needsPlugin(options) && !this.needsPlugin(source)) {
@@ -3959,7 +3976,7 @@
3959
3976
  })(EmitterClickMode || (EmitterClickMode = {}));
3960
3977
 
3961
3978
  async function loadEmittersPluginSimple(engine) {
3962
- engine.checkVersion("4.0.4");
3979
+ engine.checkVersion("4.1.0");
3963
3980
  await engine.pluginManager.register(async (e) => {
3964
3981
  const instancesManager = await getEmittersInstancesManager(e);
3965
3982
  await addEmittersShapesManager(e);
@@ -4077,12 +4094,12 @@
4077
4094
 
4078
4095
  const noTime = 0, identity$2 = 1, infiniteValue = -1;
4079
4096
  class LifeUpdater {
4080
- container;
4097
+ #container;
4081
4098
  constructor(container) {
4082
- this.container = container;
4099
+ this.#container = container;
4083
4100
  }
4084
4101
  init(particle) {
4085
- const container = this.container, particlesOptions = particle.options, lifeOptions = particlesOptions.life;
4102
+ const container = this.#container, particlesOptions = particle.options, lifeOptions = particlesOptions.life;
4086
4103
  if (!lifeOptions) {
4087
4104
  return;
4088
4105
  }
@@ -4121,12 +4138,12 @@
4121
4138
  if (!this.isEnabled(particle) || !particle.life) {
4122
4139
  return;
4123
4140
  }
4124
- updateLife(particle, delta, this.container.canvas.size);
4141
+ updateLife(particle, delta, this.#container.canvas.size);
4125
4142
  }
4126
4143
  }
4127
4144
 
4128
4145
  async function loadLifeUpdater(engine) {
4129
- engine.checkVersion("4.0.4");
4146
+ engine.checkVersion("4.1.0");
4130
4147
  await engine.pluginManager.register(e => {
4131
4148
  e.pluginManager.addParticleUpdater("life", container => {
4132
4149
  return Promise.resolve(new LifeUpdater(container));
@@ -4194,7 +4211,7 @@
4194
4211
  }
4195
4212
 
4196
4213
  async function loadMotionPlugin(engine) {
4197
- engine.checkVersion("4.0.4");
4214
+ engine.checkVersion("4.1.0");
4198
4215
  await engine.pluginManager.register(e => {
4199
4216
  e.pluginManager.addPlugin(new MotionPlugin());
4200
4217
  });
@@ -4318,9 +4335,9 @@
4318
4335
  }
4319
4336
 
4320
4337
  class RollUpdater {
4321
- _pluginManager;
4338
+ #pluginManager;
4322
4339
  constructor(pluginManager) {
4323
- this._pluginManager = pluginManager;
4340
+ this.#pluginManager = pluginManager;
4324
4341
  }
4325
4342
  getTransformValues(particle) {
4326
4343
  const roll = particle.roll?.enable && particle.roll, rollHorizontal = roll && roll.horizontal, rollVertical = roll && roll.vertical;
@@ -4330,7 +4347,7 @@
4330
4347
  };
4331
4348
  }
4332
4349
  init(particle) {
4333
- initParticle(this._pluginManager, particle);
4350
+ initParticle(this.#pluginManager, particle);
4334
4351
  }
4335
4352
  isEnabled(particle) {
4336
4353
  const roll = particle.options.roll;
@@ -4351,7 +4368,7 @@
4351
4368
  }
4352
4369
 
4353
4370
  async function loadRollUpdater(engine) {
4354
- engine.checkVersion("4.0.4");
4371
+ engine.checkVersion("4.1.0");
4355
4372
  await engine.pluginManager.register(e => {
4356
4373
  e.pluginManager.addParticleUpdater("roll", () => {
4357
4374
  return Promise.resolve(new RollUpdater(e.pluginManager));
@@ -4417,9 +4434,9 @@
4417
4434
 
4418
4435
  const doublePIDeg = 360;
4419
4436
  class RotateUpdater {
4420
- container;
4437
+ #container;
4421
4438
  constructor(container) {
4422
- this.container = container;
4439
+ this.#container = container;
4423
4440
  }
4424
4441
  init(particle) {
4425
4442
  const rotateOptions = particle.options.rotate;
@@ -4451,7 +4468,7 @@
4451
4468
  if (rotateAnimation.enable) {
4452
4469
  particle.rotate.decay = identity$3 - getRangeValue(rotateAnimation.decay);
4453
4470
  particle.rotate.velocity =
4454
- (getRangeValue(rotateAnimation.speed) / doublePIDeg) * this.container.retina.reduceFactor;
4471
+ (getRangeValue(rotateAnimation.speed) / doublePIDeg) * this.#container.retina.reduceFactor;
4455
4472
  if (!rotateAnimation.sync) {
4456
4473
  particle.rotate.velocity *= getRandom();
4457
4474
  }
@@ -4485,7 +4502,7 @@
4485
4502
  }
4486
4503
 
4487
4504
  async function loadRotateUpdater(engine) {
4488
- engine.checkVersion("4.0.4");
4505
+ engine.checkVersion("4.1.0");
4489
4506
  await engine.pluginManager.register(e => {
4490
4507
  e.pluginManager.addParticleUpdater("rotate", container => {
4491
4508
  return Promise.resolve(new RotateUpdater(container));
@@ -4509,7 +4526,7 @@
4509
4526
  }
4510
4527
 
4511
4528
  async function loadSquareShape(engine) {
4512
- engine.checkVersion("4.0.4");
4529
+ engine.checkVersion("4.1.0");
4513
4530
  await engine.pluginManager.register(e => {
4514
4531
  e.pluginManager.addShape(["edge", "square"], () => Promise.resolve(new SquareDrawer()));
4515
4532
  });
@@ -4580,9 +4597,9 @@
4580
4597
 
4581
4598
  const maxAngle$1 = 360;
4582
4599
  class TiltUpdater {
4583
- container;
4600
+ #container;
4584
4601
  constructor(container) {
4585
- this.container = container;
4602
+ this.#container = container;
4586
4603
  }
4587
4604
  getTransformValues(particle) {
4588
4605
  const tilt = particle.tilt?.enable && particle.tilt;
@@ -4621,7 +4638,7 @@
4621
4638
  const tiltAnimation = particle.options.tilt?.animation;
4622
4639
  if (tiltAnimation?.enable) {
4623
4640
  particle.tilt.decay = identity$3 - getRangeValue(tiltAnimation.decay);
4624
- particle.tilt.velocity = (getRangeValue(tiltAnimation.speed) / maxAngle$1) * this.container.retina.reduceFactor;
4641
+ particle.tilt.velocity = (getRangeValue(tiltAnimation.speed) / maxAngle$1) * this.#container.retina.reduceFactor;
4625
4642
  if (!tiltAnimation.sync) {
4626
4643
  particle.tilt.velocity *= getRandom();
4627
4644
  }
@@ -4646,7 +4663,7 @@
4646
4663
  }
4647
4664
 
4648
4665
  async function loadTiltUpdater(engine) {
4649
- engine.checkVersion("4.0.4");
4666
+ engine.checkVersion("4.1.0");
4650
4667
  await engine.pluginManager.register(e => {
4651
4668
  e.pluginManager.addParticleUpdater("tilt", container => {
4652
4669
  return Promise.resolve(new TiltUpdater(container));
@@ -4727,9 +4744,9 @@
4727
4744
 
4728
4745
  const maxAngle = 360, moveSpeedFactor$1 = 10, defaultDistance = 0;
4729
4746
  class WobbleUpdater {
4730
- _container;
4747
+ #container;
4731
4748
  constructor(container) {
4732
- this._container = container;
4749
+ this.#container = container;
4733
4750
  }
4734
4751
  init(particle) {
4735
4752
  const wobbleOpt = particle.options.wobble;
@@ -4748,7 +4765,7 @@
4748
4765
  };
4749
4766
  }
4750
4767
  particle.retina.wobbleDistance =
4751
- getRangeValue(wobbleOpt?.distance ?? defaultDistance) * this._container.retina.pixelRatio;
4768
+ getRangeValue(wobbleOpt?.distance ?? defaultDistance) * this.#container.retina.pixelRatio;
4752
4769
  }
4753
4770
  isEnabled(particle) {
4754
4771
  return !particle.destroyed && !particle.spawning && !!particle.options.wobble?.enable;
@@ -4763,12 +4780,12 @@
4763
4780
  if (!this.isEnabled(particle)) {
4764
4781
  return;
4765
4782
  }
4766
- updateWobble(this._container, particle, delta);
4783
+ updateWobble(this.#container, particle, delta);
4767
4784
  }
4768
4785
  }
4769
4786
 
4770
4787
  async function loadWobbleUpdater(engine) {
4771
- engine.checkVersion("4.0.4");
4788
+ engine.checkVersion("4.1.0");
4772
4789
  await engine.pluginManager.register(e => {
4773
4790
  e.pluginManager.addParticleUpdater("wobble", container => {
4774
4791
  return Promise.resolve(new WobbleUpdater(container));
@@ -4937,58 +4954,58 @@
4937
4954
  }
4938
4955
  }
4939
4956
  class RenderManager {
4940
- _canvasClearPlugins;
4941
- _canvasManager;
4942
- _canvasPaintPlugins;
4943
- _clearDrawPlugins;
4944
- _colorPlugins;
4945
- _container;
4946
- _context;
4947
- _contextSettings;
4948
- _drawParticlePlugins;
4949
- _drawParticlesCleanupPlugins;
4950
- _drawParticlesSetupPlugins;
4951
- _drawPlugins;
4952
- _drawSettingsCleanupPlugins;
4953
- _drawSettingsSetupPlugins;
4954
- _pluginManager;
4955
- _postDrawUpdaters;
4956
- _preDrawUpdaters;
4957
- _reusableColorStyles = {};
4958
- _reusablePluginColors = [undefined, undefined];
4959
- _reusableTransform = {};
4957
+ #canvasClearPlugins;
4958
+ #canvasManager;
4959
+ #canvasPaintPlugins;
4960
+ #clearDrawPlugins;
4961
+ #colorPlugins;
4962
+ #container;
4963
+ #context;
4964
+ #contextSettings;
4965
+ #drawParticlePlugins;
4966
+ #drawParticlesCleanupPlugins;
4967
+ #drawParticlesSetupPlugins;
4968
+ #drawPlugins;
4969
+ #drawSettingsCleanupPlugins;
4970
+ #drawSettingsSetupPlugins;
4971
+ #pluginManager;
4972
+ #postDrawUpdaters;
4973
+ #preDrawUpdaters;
4974
+ #reusableColorStyles = {};
4975
+ #reusablePluginColors = [undefined, undefined];
4976
+ #reusableTransform = {};
4960
4977
  constructor(pluginManager, container, canvasManager) {
4961
- this._pluginManager = pluginManager;
4962
- this._container = container;
4963
- this._canvasManager = canvasManager;
4964
- this._context = null;
4965
- this._preDrawUpdaters = [];
4966
- this._postDrawUpdaters = [];
4967
- this._colorPlugins = [];
4968
- this._canvasClearPlugins = [];
4969
- this._canvasPaintPlugins = [];
4970
- this._clearDrawPlugins = [];
4971
- this._drawParticlePlugins = [];
4972
- this._drawParticlesCleanupPlugins = [];
4973
- this._drawParticlesSetupPlugins = [];
4974
- this._drawPlugins = [];
4975
- this._drawSettingsSetupPlugins = [];
4976
- this._drawSettingsCleanupPlugins = [];
4978
+ this.#pluginManager = pluginManager;
4979
+ this.#container = container;
4980
+ this.#canvasManager = canvasManager;
4981
+ this.#context = null;
4982
+ this.#preDrawUpdaters = [];
4983
+ this.#postDrawUpdaters = [];
4984
+ this.#colorPlugins = [];
4985
+ this.#canvasClearPlugins = [];
4986
+ this.#canvasPaintPlugins = [];
4987
+ this.#clearDrawPlugins = [];
4988
+ this.#drawParticlePlugins = [];
4989
+ this.#drawParticlesCleanupPlugins = [];
4990
+ this.#drawParticlesSetupPlugins = [];
4991
+ this.#drawPlugins = [];
4992
+ this.#drawSettingsSetupPlugins = [];
4993
+ this.#drawSettingsCleanupPlugins = [];
4977
4994
  }
4978
4995
  get settings() {
4979
- return this._contextSettings;
4996
+ return this.#contextSettings;
4980
4997
  }
4981
4998
  canvasClear() {
4982
- if (!this._container.actualOptions.clear) {
4999
+ if (!this.#container.actualOptions.clear) {
4983
5000
  return;
4984
5001
  }
4985
5002
  this.draw(ctx => {
4986
- clear(ctx, this._canvasManager.size);
5003
+ clear(ctx, this.#canvasManager.size);
4987
5004
  });
4988
5005
  }
4989
5006
  clear() {
4990
5007
  let pluginHandled = false;
4991
- for (const plugin of this._canvasClearPlugins) {
5008
+ for (const plugin of this.#canvasClearPlugins) {
4992
5009
  pluginHandled = plugin.canvasClear?.() ?? false;
4993
5010
  if (pluginHandled) {
4994
5011
  break;
@@ -5001,21 +5018,21 @@
5001
5018
  }
5002
5019
  destroy() {
5003
5020
  this.stop();
5004
- this._preDrawUpdaters = [];
5005
- this._postDrawUpdaters = [];
5006
- this._colorPlugins = [];
5007
- this._canvasClearPlugins = [];
5008
- this._canvasPaintPlugins = [];
5009
- this._clearDrawPlugins = [];
5010
- this._drawParticlePlugins = [];
5011
- this._drawParticlesCleanupPlugins = [];
5012
- this._drawParticlesSetupPlugins = [];
5013
- this._drawPlugins = [];
5014
- this._drawSettingsSetupPlugins = [];
5015
- this._drawSettingsCleanupPlugins = [];
5021
+ this.#preDrawUpdaters = [];
5022
+ this.#postDrawUpdaters = [];
5023
+ this.#colorPlugins = [];
5024
+ this.#canvasClearPlugins = [];
5025
+ this.#canvasPaintPlugins = [];
5026
+ this.#clearDrawPlugins = [];
5027
+ this.#drawParticlePlugins = [];
5028
+ this.#drawParticlesCleanupPlugins = [];
5029
+ this.#drawParticlesSetupPlugins = [];
5030
+ this.#drawPlugins = [];
5031
+ this.#drawSettingsSetupPlugins = [];
5032
+ this.#drawSettingsCleanupPlugins = [];
5016
5033
  }
5017
5034
  draw(cb) {
5018
- const ctx = this._context;
5035
+ const ctx = this.#context;
5019
5036
  if (!ctx) {
5020
5037
  return;
5021
5038
  }
@@ -5030,21 +5047,21 @@
5030
5047
  return;
5031
5048
  }
5032
5049
  const pfColor = particle.getFillColor(), psColor = particle.getStrokeColor();
5033
- let [fColor, sColor] = this._getPluginParticleColors(particle);
5050
+ let [fColor, sColor] = this.#getPluginParticleColors(particle);
5034
5051
  fColor ??= pfColor;
5035
5052
  sColor ??= psColor;
5036
5053
  if (!fColor && !sColor) {
5037
5054
  return;
5038
5055
  }
5039
- const container = this._container, zIndexOptions = particle.options.zIndex, zIndexFactor = zIndexFactorOffset - particle.zIndexFactor, { fillOpacity, opacity, strokeOpacity } = particle.getOpacity(), transform = this._reusableTransform, colorStyles = this._reusableColorStyles, fill = fColor ? getStyleFromHsl(fColor, container.hdr, fillOpacity * opacity) : undefined, stroke = sColor ? getStyleFromHsl(sColor, container.hdr, strokeOpacity * opacity) : fill;
5056
+ const container = this.#container, zIndexOptions = particle.options.zIndex, zIndexFactor = zIndexFactorOffset - particle.zIndexFactor, { fillOpacity, opacity, strokeOpacity } = particle.getOpacity(), transform = this.#reusableTransform, colorStyles = this.#reusableColorStyles, fill = fColor ? getStyleFromHsl(fColor, container.hdr, fillOpacity * opacity) : undefined, stroke = sColor ? getStyleFromHsl(sColor, container.hdr, strokeOpacity * opacity) : fill;
5040
5057
  transform.a = transform.b = transform.c = transform.d = undefined;
5041
5058
  colorStyles.fill = fill;
5042
5059
  colorStyles.stroke = stroke;
5043
5060
  this.draw((context) => {
5044
- for (const plugin of this._drawParticlesSetupPlugins) {
5061
+ for (const plugin of this.#drawParticlesSetupPlugins) {
5045
5062
  plugin.drawParticleSetup?.(context, particle, delta);
5046
5063
  }
5047
- this._applyPreDrawUpdaters(context, particle, radius, opacity, colorStyles, transform);
5064
+ this.#applyPreDrawUpdaters(context, particle, radius, opacity, colorStyles, transform);
5048
5065
  drawParticle({
5049
5066
  container,
5050
5067
  context,
@@ -5055,35 +5072,35 @@
5055
5072
  opacity: opacity,
5056
5073
  transform,
5057
5074
  });
5058
- this._applyPostDrawUpdaters(particle);
5059
- for (const plugin of this._drawParticlesCleanupPlugins) {
5075
+ this.#applyPostDrawUpdaters(particle);
5076
+ for (const plugin of this.#drawParticlesCleanupPlugins) {
5060
5077
  plugin.drawParticleCleanup?.(context, particle, delta);
5061
5078
  }
5062
5079
  });
5063
5080
  }
5064
5081
  drawParticlePlugins(particle, delta) {
5065
5082
  this.draw(ctx => {
5066
- for (const plugin of this._drawParticlePlugins) {
5083
+ for (const plugin of this.#drawParticlePlugins) {
5067
5084
  drawParticlePlugin(ctx, plugin, particle, delta);
5068
5085
  }
5069
5086
  });
5070
5087
  }
5071
5088
  drawParticles(delta) {
5072
- const { particles } = this._container;
5089
+ const { particles } = this.#container;
5073
5090
  this.clear();
5074
5091
  particles.update(delta);
5075
5092
  this.draw(ctx => {
5076
- for (const plugin of this._drawSettingsSetupPlugins) {
5093
+ for (const plugin of this.#drawSettingsSetupPlugins) {
5077
5094
  plugin.drawSettingsSetup?.(ctx, delta);
5078
5095
  }
5079
- for (const plugin of this._drawPlugins) {
5096
+ for (const plugin of this.#drawPlugins) {
5080
5097
  plugin.draw?.(ctx, delta);
5081
5098
  }
5082
5099
  particles.drawParticles(delta);
5083
- for (const plugin of this._clearDrawPlugins) {
5100
+ for (const plugin of this.#clearDrawPlugins) {
5084
5101
  plugin.clearDraw?.(ctx, delta);
5085
5102
  }
5086
- for (const plugin of this._drawSettingsCleanupPlugins) {
5103
+ for (const plugin of this.#drawSettingsCleanupPlugins) {
5087
5104
  plugin.drawSettingsCleanup?.(ctx, delta);
5088
5105
  }
5089
5106
  });
@@ -5094,64 +5111,64 @@
5094
5111
  this.paint();
5095
5112
  }
5096
5113
  initPlugins() {
5097
- this._colorPlugins = [];
5098
- this._canvasClearPlugins = [];
5099
- this._canvasPaintPlugins = [];
5100
- this._clearDrawPlugins = [];
5101
- this._drawParticlePlugins = [];
5102
- this._drawParticlesSetupPlugins = [];
5103
- this._drawParticlesCleanupPlugins = [];
5104
- this._drawPlugins = [];
5105
- this._drawSettingsSetupPlugins = [];
5106
- this._drawSettingsCleanupPlugins = [];
5107
- for (const plugin of this._container.plugins) {
5114
+ this.#colorPlugins = [];
5115
+ this.#canvasClearPlugins = [];
5116
+ this.#canvasPaintPlugins = [];
5117
+ this.#clearDrawPlugins = [];
5118
+ this.#drawParticlePlugins = [];
5119
+ this.#drawParticlesSetupPlugins = [];
5120
+ this.#drawParticlesCleanupPlugins = [];
5121
+ this.#drawPlugins = [];
5122
+ this.#drawSettingsSetupPlugins = [];
5123
+ this.#drawSettingsCleanupPlugins = [];
5124
+ for (const plugin of this.#container.plugins) {
5108
5125
  if (plugin.particleFillColor ?? plugin.particleStrokeColor) {
5109
- this._colorPlugins.push(plugin);
5126
+ this.#colorPlugins.push(plugin);
5110
5127
  }
5111
5128
  if (plugin.canvasClear) {
5112
- this._canvasClearPlugins.push(plugin);
5129
+ this.#canvasClearPlugins.push(plugin);
5113
5130
  }
5114
5131
  if (plugin.canvasPaint) {
5115
- this._canvasPaintPlugins.push(plugin);
5132
+ this.#canvasPaintPlugins.push(plugin);
5116
5133
  }
5117
5134
  if (plugin.drawParticle) {
5118
- this._drawParticlePlugins.push(plugin);
5135
+ this.#drawParticlePlugins.push(plugin);
5119
5136
  }
5120
5137
  if (plugin.drawParticleSetup) {
5121
- this._drawParticlesSetupPlugins.push(plugin);
5138
+ this.#drawParticlesSetupPlugins.push(plugin);
5122
5139
  }
5123
5140
  if (plugin.drawParticleCleanup) {
5124
- this._drawParticlesCleanupPlugins.push(plugin);
5141
+ this.#drawParticlesCleanupPlugins.push(plugin);
5125
5142
  }
5126
5143
  if (plugin.draw) {
5127
- this._drawPlugins.push(plugin);
5144
+ this.#drawPlugins.push(plugin);
5128
5145
  }
5129
5146
  if (plugin.drawSettingsSetup) {
5130
- this._drawSettingsSetupPlugins.push(plugin);
5147
+ this.#drawSettingsSetupPlugins.push(plugin);
5131
5148
  }
5132
5149
  if (plugin.drawSettingsCleanup) {
5133
- this._drawSettingsCleanupPlugins.push(plugin);
5150
+ this.#drawSettingsCleanupPlugins.push(plugin);
5134
5151
  }
5135
5152
  if (plugin.clearDraw) {
5136
- this._clearDrawPlugins.push(plugin);
5153
+ this.#clearDrawPlugins.push(plugin);
5137
5154
  }
5138
5155
  }
5139
5156
  }
5140
5157
  initUpdaters() {
5141
- this._preDrawUpdaters = [];
5142
- this._postDrawUpdaters = [];
5143
- for (const updater of this._container.particleUpdaters) {
5158
+ this.#preDrawUpdaters = [];
5159
+ this.#postDrawUpdaters = [];
5160
+ for (const updater of this.#container.particleUpdaters) {
5144
5161
  if (updater.afterDraw) {
5145
- this._postDrawUpdaters.push(updater);
5162
+ this.#postDrawUpdaters.push(updater);
5146
5163
  }
5147
5164
  if (updater.getColorStyles ?? updater.getTransformValues ?? updater.beforeDraw) {
5148
- this._preDrawUpdaters.push(updater);
5165
+ this.#preDrawUpdaters.push(updater);
5149
5166
  }
5150
5167
  }
5151
5168
  }
5152
5169
  paint() {
5153
5170
  let handled = false;
5154
- for (const plugin of this._canvasPaintPlugins) {
5171
+ for (const plugin of this.#canvasPaintPlugins) {
5155
5172
  handled = plugin.canvasPaint?.() ?? false;
5156
5173
  if (handled) {
5157
5174
  break;
@@ -5164,35 +5181,35 @@
5164
5181
  }
5165
5182
  paintBase(baseColor) {
5166
5183
  this.draw(ctx => {
5167
- paintBase(ctx, this._canvasManager.size, baseColor);
5184
+ paintBase(ctx, this.#canvasManager.size, baseColor);
5168
5185
  });
5169
5186
  }
5170
5187
  paintImage(image, opacity) {
5171
5188
  this.draw(ctx => {
5172
- paintImage(ctx, this._canvasManager.size, image, opacity);
5189
+ paintImage(ctx, this.#canvasManager.size, image, opacity);
5173
5190
  });
5174
5191
  }
5175
5192
  setContext(context) {
5176
- this._context = context;
5177
- if (this._context) {
5178
- this._context.globalCompositeOperation = defaultCompositeValue;
5193
+ this.#context = context;
5194
+ if (this.#context) {
5195
+ this.#context.globalCompositeOperation = defaultCompositeValue;
5179
5196
  }
5180
5197
  }
5181
5198
  setContextSettings(settings) {
5182
- this._contextSettings = settings;
5199
+ this.#contextSettings = settings;
5183
5200
  }
5184
5201
  stop() {
5185
5202
  this.draw(ctx => {
5186
- clear(ctx, this._canvasManager.size);
5203
+ clear(ctx, this.#canvasManager.size);
5187
5204
  });
5188
5205
  }
5189
- _applyPostDrawUpdaters = particle => {
5190
- for (const updater of this._postDrawUpdaters) {
5206
+ #applyPostDrawUpdaters = particle => {
5207
+ for (const updater of this.#postDrawUpdaters) {
5191
5208
  updater.afterDraw?.(particle);
5192
5209
  }
5193
5210
  };
5194
- _applyPreDrawUpdaters = (ctx, particle, radius, zOpacity, colorStyles, transform) => {
5195
- for (const updater of this._preDrawUpdaters) {
5211
+ #applyPreDrawUpdaters = (ctx, particle, radius, zOpacity, colorStyles, transform) => {
5212
+ for (const updater of this.#preDrawUpdaters) {
5196
5213
  if (updater.getColorStyles) {
5197
5214
  const { fill, stroke } = updater.getColorStyles(particle, ctx, radius, zOpacity);
5198
5215
  if (fill) {
@@ -5211,22 +5228,22 @@
5211
5228
  updater.beforeDraw?.(particle);
5212
5229
  }
5213
5230
  };
5214
- _getPluginParticleColors = particle => {
5231
+ #getPluginParticleColors = particle => {
5215
5232
  let fColor, sColor;
5216
- for (const plugin of this._colorPlugins) {
5233
+ for (const plugin of this.#colorPlugins) {
5217
5234
  if (!fColor && plugin.particleFillColor) {
5218
- fColor = rangeColorToHsl(this._pluginManager, plugin.particleFillColor(particle));
5235
+ fColor = rangeColorToHsl(this.#pluginManager, plugin.particleFillColor(particle));
5219
5236
  }
5220
5237
  if (!sColor && plugin.particleStrokeColor) {
5221
- sColor = rangeColorToHsl(this._pluginManager, plugin.particleStrokeColor(particle));
5238
+ sColor = rangeColorToHsl(this.#pluginManager, plugin.particleStrokeColor(particle));
5222
5239
  }
5223
5240
  if (fColor && sColor) {
5224
5241
  break;
5225
5242
  }
5226
5243
  }
5227
- this._reusablePluginColors[fColorIndex] = fColor;
5228
- this._reusablePluginColors[sColorIndex] = sColor;
5229
- return this._reusablePluginColors;
5244
+ this.#reusablePluginColors[fColorIndex] = fColor;
5245
+ this.#reusablePluginColors[sColorIndex] = sColor;
5246
+ return this.#reusablePluginColors;
5230
5247
  };
5231
5248
  }
5232
5249
 
@@ -5284,53 +5301,53 @@
5284
5301
  renderCanvas;
5285
5302
  size;
5286
5303
  zoom = defaultZoom;
5287
- _container;
5288
- _generated;
5289
- _mutationObserver;
5290
- _originalStyle;
5291
- _pluginManager;
5292
- _pointerEvents;
5293
- _resizePlugins;
5294
- _standardSize;
5295
- _zoomCenter;
5304
+ #container;
5305
+ #generated;
5306
+ #mutationObserver;
5307
+ #originalStyle;
5308
+ #pluginManager;
5309
+ #pointerEvents;
5310
+ #resizePlugins;
5311
+ #standardSize;
5312
+ #zoomCenter;
5296
5313
  constructor(pluginManager, container) {
5297
- this._pluginManager = pluginManager;
5298
- this._container = container;
5314
+ this.#pluginManager = pluginManager;
5315
+ this.#container = container;
5299
5316
  this.render = new RenderManager(pluginManager, container, this);
5300
- this._standardSize = {
5317
+ this.#standardSize = {
5301
5318
  height: 0,
5302
5319
  width: 0,
5303
5320
  };
5304
- const pxRatio = container.retina.pixelRatio, stdSize = this._standardSize;
5321
+ const pxRatio = container.retina.pixelRatio, stdSize = this.#standardSize;
5305
5322
  this.size = {
5306
5323
  height: stdSize.height * pxRatio,
5307
5324
  width: stdSize.width * pxRatio,
5308
5325
  };
5309
- this._generated = false;
5310
- this._resizePlugins = [];
5311
- this._pointerEvents = "none";
5326
+ this.#generated = false;
5327
+ this.#resizePlugins = [];
5328
+ this.#pointerEvents = "none";
5312
5329
  }
5313
- get _fullScreen() {
5314
- return this._container.actualOptions.fullScreen.enable;
5330
+ get #fullScreen() {
5331
+ return this.#container.actualOptions.fullScreen.enable;
5315
5332
  }
5316
5333
  destroy() {
5317
5334
  this.stop();
5318
- if (this._generated) {
5335
+ if (this.#generated) {
5319
5336
  const element = this.domElement;
5320
5337
  element?.remove();
5321
5338
  this.domElement = undefined;
5322
5339
  this.renderCanvas = undefined;
5323
5340
  }
5324
5341
  else {
5325
- this._resetOriginalStyle();
5342
+ this.#resetOriginalStyle();
5326
5343
  }
5327
5344
  this.render.destroy();
5328
- this._resizePlugins = [];
5345
+ this.#resizePlugins = [];
5329
5346
  }
5330
5347
  getZoomCenter() {
5331
- const pxRatio = this._container.retina.pixelRatio, { width, height } = this.size;
5332
- if (this._zoomCenter) {
5333
- return this._zoomCenter;
5348
+ const pxRatio = this.#container.retina.pixelRatio, { width, height } = this.size;
5349
+ if (this.#zoomCenter) {
5350
+ return this.#zoomCenter;
5334
5351
  }
5335
5352
  return {
5336
5353
  x: (width * half) / pxRatio,
@@ -5338,20 +5355,20 @@
5338
5355
  };
5339
5356
  }
5340
5357
  init() {
5341
- this._safeMutationObserver(obs => {
5358
+ this.#safeMutationObserver(obs => {
5342
5359
  obs.disconnect();
5343
5360
  });
5344
- this._mutationObserver = safeMutationObserver(records => {
5361
+ this.#mutationObserver = safeMutationObserver(records => {
5345
5362
  for (const record of records) {
5346
5363
  if (record.type === "attributes" && record.attributeName === "style") {
5347
- this._repairStyle();
5364
+ this.#repairStyle();
5348
5365
  }
5349
5366
  }
5350
5367
  });
5351
5368
  this.resize();
5352
- this._initStyle();
5369
+ this.#initStyle();
5353
5370
  this.initBackground();
5354
- this._safeMutationObserver(obs => {
5371
+ this.#safeMutationObserver(obs => {
5355
5372
  const element = this.domElement;
5356
5373
  if (!element || !(element instanceof Node)) {
5357
5374
  return;
@@ -5362,13 +5379,13 @@
5362
5379
  this.render.init();
5363
5380
  }
5364
5381
  initBackground() {
5365
- const { _container } = this, options = _container.actualOptions, background = options.background, element = this.domElement;
5382
+ const container = this.#container, options = container.actualOptions, background = options.background, element = this.domElement;
5366
5383
  if (!element) {
5367
5384
  return;
5368
5385
  }
5369
- const elementStyle = element.style, color = rangeColorToRgb(this._pluginManager, background.color);
5386
+ const elementStyle = element.style, color = rangeColorToRgb(this.#pluginManager, background.color);
5370
5387
  if (color) {
5371
- elementStyle.backgroundColor = getStyleFromRgb(color, _container.hdr, background.opacity);
5388
+ elementStyle.backgroundColor = getStyleFromRgb(color, container.hdr, background.opacity);
5372
5389
  }
5373
5390
  else {
5374
5391
  elementStyle.backgroundColor = "";
@@ -5379,27 +5396,27 @@
5379
5396
  elementStyle.backgroundSize = background.size || "";
5380
5397
  }
5381
5398
  initPlugins() {
5382
- this._resizePlugins = [];
5383
- for (const plugin of this._container.plugins) {
5399
+ this.#resizePlugins = [];
5400
+ for (const plugin of this.#container.plugins) {
5384
5401
  if (plugin.resize) {
5385
- this._resizePlugins.push(plugin);
5402
+ this.#resizePlugins.push(plugin);
5386
5403
  }
5387
5404
  }
5388
5405
  }
5389
5406
  loadCanvas(canvas) {
5390
- if (this._generated && this.domElement) {
5407
+ if (this.#generated && this.domElement) {
5391
5408
  this.domElement.remove();
5392
5409
  }
5393
- const container = this._container, domCanvas = isHtmlCanvasElement(canvas) ? canvas : undefined;
5410
+ const container = this.#container, domCanvas = isHtmlCanvasElement(canvas) ? canvas : undefined;
5394
5411
  this.domElement = domCanvas;
5395
- this._generated = domCanvas ? domCanvas.dataset[generatedAttribute] === "true" : false;
5412
+ this.#generated = domCanvas ? domCanvas.dataset[generatedAttribute] === "true" : false;
5396
5413
  this.renderCanvas = domCanvas ? getTransferredCanvas(domCanvas) : canvas;
5397
5414
  const domElement = this.domElement;
5398
5415
  if (domElement) {
5399
5416
  domElement.ariaHidden = "true";
5400
- this._originalStyle = cloneStyle(domElement.style);
5417
+ this.#originalStyle = cloneStyle(domElement.style);
5401
5418
  }
5402
- const standardSize = this._standardSize, renderCanvas = this.renderCanvas;
5419
+ const standardSize = this.#standardSize, renderCanvas = this.renderCanvas;
5403
5420
  if (domElement) {
5404
5421
  standardSize.height = domElement.offsetHeight;
5405
5422
  standardSize.width = domElement.offsetWidth;
@@ -5408,7 +5425,7 @@
5408
5425
  standardSize.height = renderCanvas.height;
5409
5426
  standardSize.width = renderCanvas.width;
5410
5427
  }
5411
- const pxRatio = this._container.retina.pixelRatio, retinaSize = this.size;
5428
+ const pxRatio = this.#container.retina.pixelRatio, retinaSize = this.size;
5412
5429
  renderCanvas.height = retinaSize.height = standardSize.height * pxRatio;
5413
5430
  renderCanvas.width = retinaSize.width = standardSize.width * pxRatio;
5414
5431
  const canSupportHdrQuery = safeMatchMedia("(color-gamut: p3)");
@@ -5419,12 +5436,12 @@
5419
5436
  willReadFrequently: false,
5420
5437
  });
5421
5438
  this.render.setContext(renderCanvas.getContext("2d", this.render.settings));
5422
- this._safeMutationObserver(obs => {
5439
+ this.#safeMutationObserver(obs => {
5423
5440
  obs.disconnect();
5424
5441
  });
5425
5442
  container.retina.init();
5426
5443
  this.initBackground();
5427
- this._safeMutationObserver(obs => {
5444
+ this.#safeMutationObserver(obs => {
5428
5445
  const element = this.domElement;
5429
5446
  if (!element || !(element instanceof Node)) {
5430
5447
  return;
@@ -5437,11 +5454,11 @@
5437
5454
  if (!element) {
5438
5455
  return false;
5439
5456
  }
5440
- const container = this._container, renderCanvas = this.renderCanvas;
5457
+ const container = this.#container, renderCanvas = this.renderCanvas;
5441
5458
  if (renderCanvas === undefined) {
5442
5459
  return false;
5443
5460
  }
5444
- const currentSize = container.canvas._standardSize, newSize = {
5461
+ const currentSize = container.canvas.#standardSize, newSize = {
5445
5462
  width: element.offsetWidth,
5446
5463
  height: element.offsetHeight,
5447
5464
  }, pxRatio = container.retina.pixelRatio, retinaSize = {
@@ -5460,7 +5477,7 @@
5460
5477
  const canvasSize = this.size;
5461
5478
  renderCanvas.width = canvasSize.width = retinaSize.width;
5462
5479
  renderCanvas.height = canvasSize.height = retinaSize.height;
5463
- if (this._container.started) {
5480
+ if (this.#container.started) {
5464
5481
  container.particles.setResizeFactor({
5465
5482
  width: currentSize.width / oldSize.width,
5466
5483
  height: currentSize.height / oldSize.height,
@@ -5473,46 +5490,46 @@
5473
5490
  if (!element) {
5474
5491
  return;
5475
5492
  }
5476
- this._pointerEvents = type;
5477
- this._repairStyle();
5493
+ this.#pointerEvents = type;
5494
+ this.#repairStyle();
5478
5495
  }
5479
5496
  setZoom(zoomLevel, center) {
5480
5497
  this.zoom = zoomLevel;
5481
- this._zoomCenter = center;
5498
+ this.#zoomCenter = center;
5482
5499
  }
5483
5500
  stop() {
5484
- this._safeMutationObserver(obs => {
5501
+ this.#safeMutationObserver(obs => {
5485
5502
  obs.disconnect();
5486
5503
  });
5487
- this._mutationObserver = undefined;
5504
+ this.#mutationObserver = undefined;
5488
5505
  this.render.stop();
5489
5506
  }
5490
5507
  async windowResize() {
5491
5508
  if (!this.domElement || !this.resize()) {
5492
5509
  return;
5493
5510
  }
5494
- const container = this._container, needsRefresh = container.updateActualOptions();
5511
+ const container = this.#container, needsRefresh = container.updateActualOptions();
5495
5512
  container.particles.setDensity();
5496
- this._applyResizePlugins();
5513
+ this.#applyResizePlugins();
5497
5514
  if (needsRefresh) {
5498
5515
  await container.refresh();
5499
5516
  }
5500
5517
  }
5501
- _applyResizePlugins = () => {
5502
- for (const plugin of this._resizePlugins) {
5518
+ #applyResizePlugins = () => {
5519
+ for (const plugin of this.#resizePlugins) {
5503
5520
  plugin.resize?.();
5504
5521
  }
5505
5522
  };
5506
- _initStyle = () => {
5507
- const element = this.domElement, options = this._container.actualOptions;
5523
+ #initStyle = () => {
5524
+ const element = this.domElement, options = this.#container.actualOptions;
5508
5525
  if (!element) {
5509
5526
  return;
5510
5527
  }
5511
- if (this._fullScreen) {
5512
- this._setFullScreenStyle();
5528
+ if (this.#fullScreen) {
5529
+ this.#setFullScreenStyle();
5513
5530
  }
5514
5531
  else {
5515
- this._resetOriginalStyle();
5532
+ this.#resetOriginalStyle();
5516
5533
  }
5517
5534
  for (const key in options.style) {
5518
5535
  if (!key || !(key in options.style)) {
@@ -5525,72 +5542,72 @@
5525
5542
  element.style.setProperty(key, value, "important");
5526
5543
  }
5527
5544
  };
5528
- _repairStyle = () => {
5545
+ #repairStyle = () => {
5529
5546
  const element = this.domElement;
5530
5547
  if (!element) {
5531
5548
  return;
5532
5549
  }
5533
- this._safeMutationObserver(observer => {
5550
+ this.#safeMutationObserver(observer => {
5534
5551
  observer.disconnect();
5535
5552
  });
5536
- this._initStyle();
5553
+ this.#initStyle();
5537
5554
  this.initBackground();
5538
- const pointerEvents = this._pointerEvents;
5555
+ const pointerEvents = this.#pointerEvents;
5539
5556
  element.style.pointerEvents = pointerEvents;
5540
5557
  element.style.setProperty("pointer-events", pointerEvents);
5541
- this._safeMutationObserver(observer => {
5558
+ this.#safeMutationObserver(observer => {
5542
5559
  if (!(element instanceof Node)) {
5543
5560
  return;
5544
5561
  }
5545
5562
  observer.observe(element, { attributes: true });
5546
5563
  });
5547
5564
  };
5548
- _resetOriginalStyle = () => {
5549
- const element = this.domElement, originalStyle = this._originalStyle;
5565
+ #resetOriginalStyle = () => {
5566
+ const element = this.domElement, originalStyle = this.#originalStyle;
5550
5567
  if (!element || !originalStyle) {
5551
5568
  return;
5552
5569
  }
5553
5570
  setStyle(element, originalStyle, true);
5554
5571
  };
5555
- _safeMutationObserver = callback => {
5556
- if (!this._mutationObserver) {
5572
+ #safeMutationObserver = callback => {
5573
+ if (!this.#mutationObserver) {
5557
5574
  return;
5558
5575
  }
5559
- callback(this._mutationObserver);
5576
+ callback(this.#mutationObserver);
5560
5577
  };
5561
- _setFullScreenStyle = () => {
5578
+ #setFullScreenStyle = () => {
5562
5579
  const element = this.domElement;
5563
5580
  if (!element) {
5564
5581
  return;
5565
5582
  }
5566
- setStyle(element, getFullScreenStyle(this._container.actualOptions.fullScreen.zIndex), true);
5583
+ setStyle(element, getFullScreenStyle(this.#container.actualOptions.fullScreen.zIndex), true);
5567
5584
  };
5568
5585
  }
5569
5586
 
5570
5587
  class EventListeners {
5571
- container;
5572
- _handlers;
5573
- _resizeObserver;
5574
- _resizeTimeout;
5588
+ #container;
5589
+ #handlers;
5590
+ #resizeObserver;
5591
+ #resizeTimeout;
5575
5592
  constructor(container) {
5576
- this.container = container;
5577
- this._handlers = {
5593
+ this.#container = container;
5594
+ this.#handlers = {
5578
5595
  visibilityChange: () => {
5579
- this._handleVisibilityChange();
5596
+ this.#handleVisibilityChange();
5580
5597
  },
5581
5598
  resize: () => {
5582
- this._handleWindowResize();
5599
+ this.#handleWindowResize();
5583
5600
  },
5584
5601
  };
5585
5602
  }
5586
5603
  addListeners() {
5587
- this._manageListeners(true);
5604
+ this.#manageListeners(true);
5588
5605
  }
5589
5606
  removeListeners() {
5590
- this._manageListeners(false);
5607
+ this.#manageListeners(false);
5591
5608
  }
5592
- _handleVisibilityChange = () => {
5593
- const container = this.container, options = container.actualOptions;
5609
+ #handleVisibilityChange = () => {
5610
+ const container = this.#container, options = container.actualOptions;
5594
5611
  if (!options.pauseOnBlur) {
5595
5612
  return;
5596
5613
  }
@@ -5608,24 +5625,24 @@
5608
5625
  }
5609
5626
  }
5610
5627
  };
5611
- _handleWindowResize = () => {
5612
- if (this._resizeTimeout) {
5613
- clearTimeout(this._resizeTimeout);
5614
- delete this._resizeTimeout;
5628
+ #handleWindowResize = () => {
5629
+ if (this.#resizeTimeout) {
5630
+ clearTimeout(this.#resizeTimeout);
5631
+ this.#resizeTimeout = undefined;
5615
5632
  }
5616
5633
  const handleResize = async () => {
5617
- const canvas = this.container.canvas;
5634
+ const canvas = this.#container.canvas;
5618
5635
  await canvas.windowResize();
5619
5636
  };
5620
- this._resizeTimeout = setTimeout(() => void handleResize(), this.container.actualOptions.resize.delay * millisecondsToSeconds);
5637
+ this.#resizeTimeout = setTimeout(() => void handleResize(), this.#container.actualOptions.resize.delay * millisecondsToSeconds);
5621
5638
  };
5622
- _manageListeners = add => {
5623
- const handlers = this._handlers;
5624
- this._manageResize(add);
5639
+ #manageListeners = add => {
5640
+ const handlers = this.#handlers;
5641
+ this.#manageResize(add);
5625
5642
  manageListener(document, visibilityChangeEvent, handlers.visibilityChange, add, false);
5626
5643
  };
5627
- _manageResize = add => {
5628
- const handlers = this._handlers, container = this.container, options = container.actualOptions;
5644
+ #manageResize = add => {
5645
+ const handlers = this.#handlers, container = this.#container, options = container.actualOptions;
5629
5646
  if (!options.resize.enable) {
5630
5647
  return;
5631
5648
  }
@@ -5634,22 +5651,22 @@
5634
5651
  return;
5635
5652
  }
5636
5653
  const canvasEl = container.canvas.domElement;
5637
- if (this._resizeObserver && !add) {
5654
+ if (this.#resizeObserver && !add) {
5638
5655
  if (canvasEl) {
5639
- this._resizeObserver.unobserve(canvasEl);
5656
+ this.#resizeObserver.unobserve(canvasEl);
5640
5657
  }
5641
- this._resizeObserver.disconnect();
5642
- delete this._resizeObserver;
5658
+ this.#resizeObserver.disconnect();
5659
+ this.#resizeObserver = undefined;
5643
5660
  }
5644
- else if (!this._resizeObserver && add && canvasEl) {
5645
- this._resizeObserver = new ResizeObserver((entries) => {
5661
+ else if (!this.#resizeObserver && add && canvasEl) {
5662
+ this.#resizeObserver = new ResizeObserver((entries) => {
5646
5663
  const entry = entries.find(e => e.target === canvasEl);
5647
5664
  if (!entry) {
5648
5665
  return;
5649
5666
  }
5650
- this._handleWindowResize();
5667
+ this.#handleWindowResize();
5651
5668
  });
5652
- this._resizeObserver.observe(canvasEl);
5669
+ this.#resizeObserver.observe(canvasEl);
5653
5670
  }
5654
5671
  };
5655
5672
  }
@@ -5722,24 +5739,24 @@
5722
5739
  unbreakable;
5723
5740
  velocity;
5724
5741
  zIndexFactor;
5725
- _cachedOpacityData = {
5742
+ #cachedOpacityData = {
5726
5743
  fillOpacity: defaultOpacity$1,
5727
5744
  opacity: defaultOpacity$1,
5728
5745
  strokeOpacity: defaultOpacity$1,
5729
5746
  };
5730
- _cachedPosition = Vector3d.origin;
5731
- _cachedRotateData = { sin: 0, cos: 0 };
5732
- _cachedTransform = {
5747
+ #cachedPosition = Vector3d.origin;
5748
+ #cachedRotateData = { sin: 0, cos: 0 };
5749
+ #cachedTransform = {
5733
5750
  a: 1,
5734
5751
  b: 0,
5735
5752
  c: 0,
5736
5753
  d: 1,
5737
5754
  };
5738
- _container;
5739
- _pluginManager;
5755
+ #container;
5756
+ #pluginManager;
5740
5757
  constructor(pluginManager, container) {
5741
- this._pluginManager = pluginManager;
5742
- this._container = container;
5758
+ this.#pluginManager = pluginManager;
5759
+ this.#container = container;
5743
5760
  }
5744
5761
  destroy(override) {
5745
5762
  if (this.unbreakable || this.destroyed) {
@@ -5748,7 +5765,7 @@
5748
5765
  this.destroyed = true;
5749
5766
  this.bubble.inRange = false;
5750
5767
  this.slow.inRange = false;
5751
- const container = this._container, shapeDrawer = this.shape ? container.shapeDrawers.get(this.shape) : undefined;
5768
+ const container = this.#container, shapeDrawer = this.shape ? container.shapeDrawers.get(this.shape) : undefined;
5752
5769
  shapeDrawer?.particleDestroy?.(this);
5753
5770
  for (const plugin of container.particleDestroyedPlugins) {
5754
5771
  plugin.particleDestroyed?.(this, override);
@@ -5756,12 +5773,12 @@
5756
5773
  for (const updater of container.particleUpdaters) {
5757
5774
  updater.particleDestroyed?.(this, override);
5758
5775
  }
5759
- this._container.dispatchEvent(EventType.particleDestroyed, {
5776
+ this.#container.dispatchEvent(EventType.particleDestroyed, {
5760
5777
  particle: this,
5761
5778
  });
5762
5779
  }
5763
5780
  draw(delta) {
5764
- const container = this._container, render = container.canvas.render;
5781
+ const container = this.#container, render = container.canvas.render;
5765
5782
  render.drawParticlePlugins(this, delta);
5766
5783
  render.drawParticle(this, delta);
5767
5784
  }
@@ -5769,50 +5786,50 @@
5769
5786
  return this.rotation + (this.pathRotation ? this.velocity.angle : defaultAngle);
5770
5787
  }
5771
5788
  getFillColor() {
5772
- return this._getRollColor(this.bubble.color ?? getHslFromAnimation(this.fillColor));
5789
+ return this.#getRollColor(this.bubble.color ?? getHslFromAnimation(this.fillColor));
5773
5790
  }
5774
5791
  getMass() {
5775
5792
  return this.getRadius() ** squareExp * Math.PI * half;
5776
5793
  }
5777
5794
  getOpacity() {
5778
5795
  const zIndexOptions = this.options.zIndex, zIndexFactor = zIndexFactorOffset - this.zIndexFactor, zOpacityFactor = zIndexFactor ** zIndexOptions.opacityRate, opacity = this.bubble.opacity ?? getRangeValue(this.opacity?.value ?? defaultOpacity$1), fillOpacity = this.fillOpacity ?? defaultOpacity$1, strokeOpacity = this.strokeOpacity ?? defaultOpacity$1;
5779
- this._cachedOpacityData.fillOpacity = opacity * fillOpacity * zOpacityFactor;
5780
- this._cachedOpacityData.opacity = opacity * zOpacityFactor;
5781
- this._cachedOpacityData.strokeOpacity = opacity * strokeOpacity * zOpacityFactor;
5782
- return this._cachedOpacityData;
5796
+ this.#cachedOpacityData.fillOpacity = opacity * fillOpacity * zOpacityFactor;
5797
+ this.#cachedOpacityData.opacity = opacity * zOpacityFactor;
5798
+ this.#cachedOpacityData.strokeOpacity = opacity * strokeOpacity * zOpacityFactor;
5799
+ return this.#cachedOpacityData;
5783
5800
  }
5784
5801
  getPosition() {
5785
- this._cachedPosition.x = this.position.x + this.offset.x;
5786
- this._cachedPosition.y = this.position.y + this.offset.y;
5787
- this._cachedPosition.z = this.position.z;
5788
- return this._cachedPosition;
5802
+ this.#cachedPosition.x = this.position.x + this.offset.x;
5803
+ this.#cachedPosition.y = this.position.y + this.offset.y;
5804
+ this.#cachedPosition.z = this.position.z;
5805
+ return this.#cachedPosition;
5789
5806
  }
5790
5807
  getRadius() {
5791
5808
  return this.bubble.radius ?? this.size.value;
5792
5809
  }
5793
5810
  getRotateData() {
5794
5811
  const angle = this.getAngle();
5795
- this._cachedRotateData.sin = Math.sin(angle);
5796
- this._cachedRotateData.cos = Math.cos(angle);
5797
- return this._cachedRotateData;
5812
+ this.#cachedRotateData.sin = Math.sin(angle);
5813
+ this.#cachedRotateData.cos = Math.cos(angle);
5814
+ return this.#cachedRotateData;
5798
5815
  }
5799
5816
  getStrokeColor() {
5800
- return this._getRollColor(this.bubble.color ?? getHslFromAnimation(this.strokeColor));
5817
+ return this.#getRollColor(this.bubble.color ?? getHslFromAnimation(this.strokeColor));
5801
5818
  }
5802
5819
  getTransformData(externalTransform) {
5803
5820
  const rotateData = this.getRotateData(), rotating = this.isRotating;
5804
- this._cachedTransform.a = rotateData.cos * (externalTransform.a ?? defaultTransform.a);
5805
- this._cachedTransform.b = rotating
5821
+ this.#cachedTransform.a = rotateData.cos * (externalTransform.a ?? defaultTransform.a);
5822
+ this.#cachedTransform.b = rotating
5806
5823
  ? rotateData.sin * (externalTransform.b ?? identity$3)
5807
5824
  : (externalTransform.b ?? defaultTransform.b);
5808
- this._cachedTransform.c = rotating
5825
+ this.#cachedTransform.c = rotating
5809
5826
  ? -rotateData.sin * (externalTransform.c ?? identity$3)
5810
5827
  : (externalTransform.c ?? defaultTransform.c);
5811
- this._cachedTransform.d = rotateData.cos * (externalTransform.d ?? defaultTransform.d);
5812
- return this._cachedTransform;
5828
+ this.#cachedTransform.d = rotateData.cos * (externalTransform.d ?? defaultTransform.d);
5829
+ return this.#cachedTransform;
5813
5830
  }
5814
5831
  init(id, position, overrideOptions, group) {
5815
- const container = this._container;
5832
+ const container = this.#container;
5816
5833
  this.id = id;
5817
5834
  this.group = group;
5818
5835
  this.justWarped = false;
@@ -5832,21 +5849,27 @@
5832
5849
  moveSpeed: 0,
5833
5850
  sizeAnimationSpeed: 0,
5834
5851
  };
5852
+ this.size = {
5853
+ value: 1,
5854
+ max: 1,
5855
+ min: 1,
5856
+ enable: false,
5857
+ };
5835
5858
  this.outType = ParticleOutType.normal;
5836
5859
  this.ignoresResizeRatio = true;
5837
- const pxRatio = container.retina.pixelRatio, mainOptions = container.actualOptions, particlesOptions = loadParticlesOptions(this._pluginManager, container, mainOptions.particles), reduceDuplicates = particlesOptions.reduceDuplicates, effectType = particlesOptions.effect.type, shapeType = particlesOptions.shape.type;
5860
+ const mainOptions = container.actualOptions, particlesOptions = loadParticlesOptions(this.#pluginManager, container, mainOptions.particles), reduceDuplicates = particlesOptions.reduceDuplicates, effectType = particlesOptions.effect.type, shapeType = particlesOptions.shape.type;
5838
5861
  this.effect = itemFromSingleOrMultiple(effectType, this.id, reduceDuplicates);
5839
5862
  this.shape = itemFromSingleOrMultiple(shapeType, this.id, reduceDuplicates);
5840
5863
  const effectOptions = particlesOptions.effect, shapeOptions = particlesOptions.shape;
5841
5864
  if (overrideOptions) {
5842
- if (overrideOptions.effect?.type) {
5865
+ if (overrideOptions.effect?.type && overrideOptions.effect.type !== this.effect) {
5843
5866
  const overrideEffectType = overrideOptions.effect.type, effect = itemFromSingleOrMultiple(overrideEffectType, this.id, reduceDuplicates);
5844
5867
  if (effect) {
5845
5868
  this.effect = effect;
5846
5869
  effectOptions.load(overrideOptions.effect);
5847
5870
  }
5848
5871
  }
5849
- if (overrideOptions.shape?.type) {
5872
+ if (overrideOptions.shape?.type && overrideOptions.shape.type !== this.shape) {
5850
5873
  const overrideShapeType = overrideOptions.shape.type, shape = itemFromSingleOrMultiple(overrideShapeType, this.id, reduceDuplicates);
5851
5874
  if (shape) {
5852
5875
  this.shape = shape;
@@ -5855,21 +5878,20 @@
5855
5878
  }
5856
5879
  }
5857
5880
  if (this.effect === randomColorValue) {
5858
- const availableEffects = [...this._container.effectDrawers.keys()];
5881
+ const availableEffects = [...this.#container.effectDrawers.keys()];
5859
5882
  this.effect = availableEffects[Math.floor(getRandom() * availableEffects.length)];
5860
5883
  }
5861
5884
  if (this.shape === randomColorValue) {
5862
- const availableShapes = [...this._container.shapeDrawers.keys()];
5885
+ const availableShapes = [...this.#container.shapeDrawers.keys()];
5863
5886
  this.shape = availableShapes[Math.floor(getRandom() * availableShapes.length)];
5864
5887
  }
5865
5888
  this.effectData = this.effect ? loadEffectData(this.effect, effectOptions, this.id, reduceDuplicates) : undefined;
5866
5889
  this.shapeData = this.shape ? loadShapeData(this.shape, shapeOptions, this.id, reduceDuplicates) : undefined;
5867
5890
  particlesOptions.load(overrideOptions);
5868
- const effectData = this.effectData;
5891
+ const effectData = this.effectData, shapeData = this.shapeData;
5869
5892
  if (effectData) {
5870
5893
  particlesOptions.load(effectData.particles);
5871
5894
  }
5872
- const shapeData = this.shapeData;
5873
5895
  if (shapeData) {
5874
5896
  particlesOptions.load(shapeData.particles);
5875
5897
  }
@@ -5877,7 +5899,9 @@
5877
5899
  this.shapeClose = shapeData?.close ?? particlesOptions.shape.close;
5878
5900
  this.options = particlesOptions;
5879
5901
  container.retina.initParticle(this);
5880
- this.size = initParticleNumericAnimationValue(this.options.size, pxRatio);
5902
+ for (const updater of container.particleUpdaters) {
5903
+ updater.preInit?.(this);
5904
+ }
5881
5905
  this.bubble = {
5882
5906
  inRange: false,
5883
5907
  };
@@ -5885,8 +5909,8 @@
5885
5909
  inRange: false,
5886
5910
  factor: 1,
5887
5911
  };
5888
- this._initPosition(position);
5889
- this.initialVelocity = this._calculateVelocity();
5912
+ this.#initPosition(position);
5913
+ this.initialVelocity = this.#calculateVelocity();
5890
5914
  this.velocity = this.initialVelocity.copy();
5891
5915
  this.zIndexFactor = this.position.z / container.zLayers;
5892
5916
  this.sides = 24;
@@ -5917,12 +5941,11 @@
5917
5941
  plugin.particleCreated?.(this);
5918
5942
  }
5919
5943
  }
5920
- isInsideCanvas() {
5921
- const radius = this.getRadius(), canvasSize = this._container.canvas.size, position = this.position;
5922
- return (position.x >= -radius &&
5923
- position.y >= -radius &&
5924
- position.y <= canvasSize.height + radius &&
5925
- position.x <= canvasSize.width + radius);
5944
+ isInsideCanvas(direction) {
5945
+ return this.#getInsideCanvasResult({ direction }).inside;
5946
+ }
5947
+ isInsideCanvasForOutMode(outMode, direction) {
5948
+ return this.#getInsideCanvasResult({ direction, outMode }).inside;
5926
5949
  }
5927
5950
  isShowingBack() {
5928
5951
  if (!this.roll) {
@@ -5947,13 +5970,13 @@
5947
5970
  return !this.destroyed && !this.spawning && this.isInsideCanvas();
5948
5971
  }
5949
5972
  reset() {
5950
- for (const updater of this._container.particleUpdaters) {
5973
+ for (const updater of this.#container.particleUpdaters) {
5951
5974
  updater.reset?.(this);
5952
5975
  }
5953
5976
  }
5954
- _calcPosition = (position, zIndex) => {
5977
+ #calcPosition = (position, zIndex) => {
5955
5978
  let tryCount = defaultRetryCount, posVec = position ? Vector3d.create(position.x, position.y, zIndex) : undefined;
5956
- const container = this._container, plugins = container.particlePositionPlugins, outModes = this.options.move.outModes, radius = this.getRadius(), canvasSize = container.canvas.size, abortController = new AbortController(), { signal } = abortController;
5979
+ const container = this.#container, plugins = container.particlePositionPlugins, outModes = this.options.move.outModes, radius = this.getRadius(), canvasSize = container.canvas.size, abortController = new AbortController(), { signal } = abortController;
5957
5980
  while (!signal.aborted) {
5958
5981
  for (const plugin of plugins) {
5959
5982
  const pluginPos = plugin.particlePosition?.(posVec, this);
@@ -5965,10 +5988,10 @@
5965
5988
  size: canvasSize,
5966
5989
  position: posVec,
5967
5990
  }), pos = Vector3d.create(exactPosition.x, exactPosition.y, zIndex);
5968
- this._fixHorizontal(pos, radius, outModes.left ?? outModes.default);
5969
- this._fixHorizontal(pos, radius, outModes.right ?? outModes.default);
5970
- this._fixVertical(pos, radius, outModes.top ?? outModes.default);
5971
- this._fixVertical(pos, radius, outModes.bottom ?? outModes.default);
5991
+ this.#fixHorizontal(pos, radius, outModes.left ?? outModes.default);
5992
+ this.#fixHorizontal(pos, radius, outModes.right ?? outModes.default);
5993
+ this.#fixVertical(pos, radius, outModes.top ?? outModes.default);
5994
+ this.#fixVertical(pos, radius, outModes.bottom ?? outModes.default);
5972
5995
  let isValidPosition = true;
5973
5996
  for (const plugin of container.particles.checkParticlePositionPlugins) {
5974
5997
  isValidPosition = plugin.checkParticlePosition?.(this, pos, tryCount) ?? true;
@@ -5984,8 +6007,8 @@
5984
6007
  }
5985
6008
  return posVec;
5986
6009
  };
5987
- _calculateVelocity = () => {
5988
- const baseVelocity = getParticleBaseVelocity(this.direction), res = baseVelocity.copy(), moveOptions = this.options.move;
6010
+ #calculateVelocity = () => {
6011
+ const moveOptions = this.options.move, baseVelocity = getParticleBaseVelocity(this.direction), res = baseVelocity.copy();
5989
6012
  if (moveOptions.direction === MoveDirection.inside || moveOptions.direction === MoveDirection.outside) {
5990
6013
  return res;
5991
6014
  }
@@ -6001,27 +6024,86 @@
6001
6024
  }
6002
6025
  return res;
6003
6026
  };
6004
- _fixHorizontal = (pos, radius, outMode) => {
6027
+ #fixHorizontal = (pos, radius, outMode) => {
6005
6028
  fixOutMode({
6006
6029
  outMode,
6007
6030
  checkModes: [OutMode.bounce],
6008
6031
  coord: pos.x,
6009
- maxCoord: this._container.canvas.size.width,
6032
+ maxCoord: this.#container.canvas.size.width,
6010
6033
  setCb: (value) => (pos.x += value),
6011
6034
  radius,
6012
6035
  });
6013
6036
  };
6014
- _fixVertical = (pos, radius, outMode) => {
6037
+ #fixVertical = (pos, radius, outMode) => {
6015
6038
  fixOutMode({
6016
6039
  outMode,
6017
6040
  checkModes: [OutMode.bounce],
6018
6041
  coord: pos.y,
6019
- maxCoord: this._container.canvas.size.height,
6042
+ maxCoord: this.#container.canvas.size.height,
6020
6043
  setCb: (value) => (pos.y += value),
6021
6044
  radius,
6022
6045
  });
6023
6046
  };
6024
- _getRollColor = color => {
6047
+ #getDefaultInsideCanvasResult = (direction, outMode) => {
6048
+ const radius = this.getRadius(), canvasSize = this.#container.canvas.size, position = this.position, isBounce = outMode === OutMode.bounce;
6049
+ if (direction === OutModeDirection.bottom) {
6050
+ return {
6051
+ inside: isBounce ? position.y + radius < canvasSize.height : position.y - radius < canvasSize.height,
6052
+ reason: "default",
6053
+ };
6054
+ }
6055
+ if (direction === OutModeDirection.left) {
6056
+ return {
6057
+ inside: isBounce ? position.x - radius > defaultAngle : position.x + radius > defaultAngle,
6058
+ reason: "default",
6059
+ };
6060
+ }
6061
+ if (direction === OutModeDirection.right) {
6062
+ return {
6063
+ inside: isBounce ? position.x + radius < canvasSize.width : position.x - radius < canvasSize.width,
6064
+ reason: "default",
6065
+ };
6066
+ }
6067
+ if (direction === OutModeDirection.top) {
6068
+ return {
6069
+ inside: isBounce ? position.y - radius > defaultAngle : position.y + radius > defaultAngle,
6070
+ reason: "default",
6071
+ };
6072
+ }
6073
+ return {
6074
+ inside: position.x >= -radius &&
6075
+ position.y >= -radius &&
6076
+ position.y <= canvasSize.height + radius &&
6077
+ position.x <= canvasSize.width + radius,
6078
+ reason: "default",
6079
+ };
6080
+ };
6081
+ #getInsideCanvasCallbackData = (direction, outMode) => {
6082
+ return {
6083
+ canvasSize: this.#container.canvas.size,
6084
+ direction,
6085
+ outMode,
6086
+ particle: this,
6087
+ radius: this.getRadius(),
6088
+ };
6089
+ };
6090
+ #getInsideCanvasResult = (data) => {
6091
+ const defaultResult = this.#getDefaultInsideCanvasResult(data.direction, data.outMode), container = this.#container, shapeDrawer = this.shape ? container.shapeDrawers.get(this.shape) : undefined, effectDrawer = this.effect ? container.effectDrawers.get(this.effect) : undefined, shapeCheck = shapeDrawer?.isInsideCanvas, effectCheck = effectDrawer?.isInsideCanvas;
6092
+ if (!shapeCheck && !effectCheck) {
6093
+ return defaultResult;
6094
+ }
6095
+ const callbackData = this.#getInsideCanvasCallbackData(data.direction, data.outMode), shapeResult = shapeCheck ? this.#normalizeInsideCanvasResult(shapeCheck(callbackData), "shape") : undefined, effectResult = effectCheck ? this.#normalizeInsideCanvasResult(effectCheck(callbackData), "effect") : undefined;
6096
+ if (shapeResult && effectResult) {
6097
+ const margin = Math.max(shapeResult.margin ?? defaultAngle, effectResult.margin ?? defaultAngle);
6098
+ return {
6099
+ inside: shapeResult.inside && effectResult.inside,
6100
+ margin: margin > defaultAngle ? margin : undefined,
6101
+ reason: "combined",
6102
+ };
6103
+ }
6104
+ return shapeResult ?? effectResult ?? defaultResult;
6105
+ };
6106
+ #getRollColor = color => {
6025
6107
  if (!color || !this.roll || (!this.backColor && !this.roll.alter)) {
6026
6108
  return color;
6027
6109
  }
@@ -6036,8 +6118,8 @@
6036
6118
  }
6037
6119
  return color;
6038
6120
  };
6039
- _initPosition = position => {
6040
- const container = this._container, zIndexValue = Math.floor(getRangeValue(this.options.zIndex.value)), initialPosition = this._calcPosition(position, clamp(zIndexValue, minZ, container.zLayers));
6121
+ #initPosition = position => {
6122
+ const container = this.#container, zIndexValue = Math.floor(getRangeValue(this.options.zIndex.value)), initialPosition = this.#calcPosition(position, clamp(zIndexValue, minZ, container.zLayers));
6041
6123
  if (!initialPosition) {
6042
6124
  throw new Error("a valid position cannot be found for particle");
6043
6125
  }
@@ -6060,45 +6142,58 @@
6060
6142
  }
6061
6143
  this.offset = Vector.origin;
6062
6144
  };
6145
+ #normalizeInsideCanvasResult = (result, reason) => {
6146
+ if (typeof result === "boolean") {
6147
+ return {
6148
+ inside: result,
6149
+ reason,
6150
+ };
6151
+ }
6152
+ return {
6153
+ inside: result.inside,
6154
+ margin: result.margin,
6155
+ reason: result.reason ?? reason,
6156
+ };
6157
+ };
6063
6158
  }
6064
6159
 
6065
6160
  class SpatialHashGrid {
6066
- _cellSize;
6067
- _cells = new Map();
6068
- _circlePool = [];
6069
- _circlePoolIdx;
6070
- _pendingCellSize;
6071
- _rectanglePool = [];
6072
- _rectanglePoolIdx;
6161
+ #cellSize;
6162
+ #cells = new Map();
6163
+ #circlePool = [];
6164
+ #circlePoolIdx;
6165
+ #pendingCellSize;
6166
+ #rectanglePool = [];
6167
+ #rectanglePoolIdx;
6073
6168
  constructor(cellSize) {
6074
- this._cellSize = cellSize;
6075
- this._circlePoolIdx = 0;
6076
- this._rectanglePoolIdx = 0;
6169
+ this.#cellSize = cellSize;
6170
+ this.#circlePoolIdx = 0;
6171
+ this.#rectanglePoolIdx = 0;
6077
6172
  }
6078
6173
  clear() {
6079
- this._cells.clear();
6080
- const pendingCellSize = this._pendingCellSize;
6174
+ this.#cells.clear();
6175
+ const pendingCellSize = this.#pendingCellSize;
6081
6176
  if (pendingCellSize) {
6082
- this._cellSize = pendingCellSize;
6177
+ this.#cellSize = pendingCellSize;
6083
6178
  }
6084
- this._pendingCellSize = undefined;
6179
+ this.#pendingCellSize = undefined;
6085
6180
  }
6086
6181
  insert(particle) {
6087
- const { x, y } = particle.getPosition(), key = this._cellKeyFromCoords(x, y);
6088
- if (!this._cells.has(key)) {
6089
- this._cells.set(key, []);
6182
+ const { x, y } = particle.getPosition(), key = this.#cellKeyFromCoords(x, y);
6183
+ if (!this.#cells.has(key)) {
6184
+ this.#cells.set(key, []);
6090
6185
  }
6091
- this._cells.get(key)?.push(particle);
6186
+ this.#cells.get(key)?.push(particle);
6092
6187
  }
6093
6188
  query(range, check, out = []) {
6094
- const bounds = this._getRangeBounds(range);
6189
+ const bounds = this.#getRangeBounds(range);
6095
6190
  if (!bounds) {
6096
6191
  return out;
6097
6192
  }
6098
- const minCellX = Math.floor(bounds.minX / this._cellSize), maxCellX = Math.floor(bounds.maxX / this._cellSize), minCellY = Math.floor(bounds.minY / this._cellSize), maxCellY = Math.floor(bounds.maxY / this._cellSize);
6193
+ const minCellX = Math.floor(bounds.minX / this.#cellSize), maxCellX = Math.floor(bounds.maxX / this.#cellSize), minCellY = Math.floor(bounds.minY / this.#cellSize), maxCellY = Math.floor(bounds.maxY / this.#cellSize);
6099
6194
  for (let cx = minCellX; cx <= maxCellX; cx++) {
6100
6195
  for (let cy = minCellY; cy <= maxCellY; cy++) {
6101
- const key = `${cx}_${cy}`, cellParticles = this._cells.get(key);
6196
+ const key = `${cx}_${cy}`, cellParticles = this.#cells.get(key);
6102
6197
  if (!cellParticles) {
6103
6198
  continue;
6104
6199
  }
@@ -6115,29 +6210,29 @@
6115
6210
  return out;
6116
6211
  }
6117
6212
  queryCircle(position, radius, check, out = []) {
6118
- const circle = this._acquireCircle(position.x, position.y, radius), result = this.query(circle, check, out);
6119
- this._releaseShapes();
6213
+ const circle = this.#acquireCircle(position.x, position.y, radius), result = this.query(circle, check, out);
6214
+ this.#releaseShapes();
6120
6215
  return result;
6121
6216
  }
6122
6217
  queryRectangle(position, size, check, out = []) {
6123
- const rect = this._acquireRectangle(position.x, position.y, size.width, size.height), result = this.query(rect, check, out);
6124
- this._releaseShapes();
6218
+ const rect = this.#acquireRectangle(position.x, position.y, size.width, size.height), result = this.query(rect, check, out);
6219
+ this.#releaseShapes();
6125
6220
  return result;
6126
6221
  }
6127
6222
  setCellSize(cellSize) {
6128
- this._pendingCellSize = cellSize;
6223
+ this.#pendingCellSize = cellSize;
6129
6224
  }
6130
- _acquireCircle(x, y, r) {
6131
- return (this._circlePool[this._circlePoolIdx++] ??= new Circle(x, y, r)).reset(x, y, r);
6225
+ #acquireCircle(x, y, r) {
6226
+ return (this.#circlePool[this.#circlePoolIdx++] ??= new Circle(x, y, r)).reset(x, y, r);
6132
6227
  }
6133
- _acquireRectangle(x, y, w, h) {
6134
- return (this._rectanglePool[this._rectanglePoolIdx++] ??= new Rectangle(x, y, w, h)).reset(x, y, w, h);
6228
+ #acquireRectangle(x, y, w, h) {
6229
+ return (this.#rectanglePool[this.#rectanglePoolIdx++] ??= new Rectangle(x, y, w, h)).reset(x, y, w, h);
6135
6230
  }
6136
- _cellKeyFromCoords(x, y) {
6137
- const cellX = Math.floor(x / this._cellSize), cellY = Math.floor(y / this._cellSize);
6231
+ #cellKeyFromCoords(x, y) {
6232
+ const cellX = Math.floor(x / this.#cellSize), cellY = Math.floor(y / this.#cellSize);
6138
6233
  return `${cellX}_${cellY}`;
6139
6234
  }
6140
- _getRangeBounds(range) {
6235
+ #getRangeBounds(range) {
6141
6236
  if (range instanceof Circle) {
6142
6237
  const r = range.radius, { x, y } = range.position;
6143
6238
  return {
@@ -6158,53 +6253,53 @@
6158
6253
  }
6159
6254
  return null;
6160
6255
  }
6161
- _releaseShapes() {
6162
- this._circlePoolIdx = 0;
6163
- this._rectanglePoolIdx = 0;
6256
+ #releaseShapes() {
6257
+ this.#circlePoolIdx = 0;
6258
+ this.#rectanglePoolIdx = 0;
6164
6259
  }
6165
6260
  }
6166
6261
 
6167
6262
  class ParticlesManager {
6168
6263
  checkParticlePositionPlugins;
6169
6264
  grid;
6170
- _array;
6171
- _container;
6172
- _groupLimits;
6173
- _limit;
6174
- _nextId;
6175
- _particleBuckets;
6176
- _particleResetPlugins;
6177
- _particleUpdatePlugins;
6178
- _pluginManager;
6179
- _pool;
6180
- _postParticleUpdatePlugins;
6181
- _postUpdatePlugins;
6182
- _resizeFactor;
6183
- _updatePlugins;
6184
- _zBuckets;
6265
+ #array;
6266
+ #container;
6267
+ #groupLimits;
6268
+ #limit;
6269
+ #nextId;
6270
+ #particleBuckets;
6271
+ #particleResetPlugins;
6272
+ #particleUpdatePlugins;
6273
+ #pluginManager;
6274
+ #pool;
6275
+ #postParticleUpdatePlugins;
6276
+ #postUpdatePlugins;
6277
+ #resizeFactor;
6278
+ #updatePlugins;
6279
+ #zBuckets;
6185
6280
  constructor(pluginManager, container) {
6186
- this._pluginManager = pluginManager;
6187
- this._container = container;
6188
- this._nextId = 0;
6189
- this._array = [];
6190
- this._pool = [];
6191
- this._limit = 0;
6192
- this._groupLimits = new Map();
6193
- this._particleBuckets = new Map();
6194
- this._zBuckets = this._createBuckets(this._container.zLayers);
6281
+ this.#pluginManager = pluginManager;
6282
+ this.#container = container;
6283
+ this.#nextId = 0;
6284
+ this.#array = [];
6285
+ this.#pool = [];
6286
+ this.#limit = 0;
6287
+ this.#groupLimits = new Map();
6288
+ this.#particleBuckets = new Map();
6289
+ this.#zBuckets = this.#createBuckets(this.#container.zLayers);
6195
6290
  this.grid = new SpatialHashGrid(spatialHashGridCellSize);
6196
6291
  this.checkParticlePositionPlugins = [];
6197
- this._particleResetPlugins = [];
6198
- this._particleUpdatePlugins = [];
6199
- this._postUpdatePlugins = [];
6200
- this._postParticleUpdatePlugins = [];
6201
- this._updatePlugins = [];
6292
+ this.#particleResetPlugins = [];
6293
+ this.#particleUpdatePlugins = [];
6294
+ this.#postUpdatePlugins = [];
6295
+ this.#postParticleUpdatePlugins = [];
6296
+ this.#updatePlugins = [];
6202
6297
  }
6203
6298
  get count() {
6204
- return this._array.length;
6299
+ return this.#array.length;
6205
6300
  }
6206
6301
  addParticle(position, overrideOptions, group, initializer) {
6207
- const limitMode = this._container.actualOptions.particles.number.limit.mode, limit = group === undefined ? this._limit : (this._groupLimits.get(group) ?? this._limit), currentCount = this.count;
6302
+ const limitMode = this.#container.actualOptions.particles.number.limit.mode, limit = group === undefined ? this.#limit : (this.#groupLimits.get(group) ?? this.#limit), currentCount = this.count;
6208
6303
  if (limit > minLimit) {
6209
6304
  switch (limitMode) {
6210
6305
  case LimitMode.delete: {
@@ -6222,20 +6317,20 @@
6222
6317
  }
6223
6318
  }
6224
6319
  try {
6225
- const particle = this._pool.pop() ?? new Particle(this._pluginManager, this._container);
6226
- particle.init(this._nextId, position, overrideOptions, group);
6320
+ const particle = this.#pool.pop() ?? new Particle(this.#pluginManager, this.#container);
6321
+ particle.init(this.#nextId, position, overrideOptions, group);
6227
6322
  let canAdd = true;
6228
6323
  if (initializer) {
6229
6324
  canAdd = initializer(particle);
6230
6325
  }
6231
6326
  if (!canAdd) {
6232
- this._pool.push(particle);
6327
+ this.#pool.push(particle);
6233
6328
  return;
6234
6329
  }
6235
- this._array.push(particle);
6236
- this._insertParticleIntoBucket(particle);
6237
- this._nextId++;
6238
- this._container.dispatchEvent(EventType.particleAdded, {
6330
+ this.#array.push(particle);
6331
+ this.#insertParticleIntoBucket(particle);
6332
+ this.#nextId++;
6333
+ this.#container.dispatchEvent(EventType.particleAdded, {
6239
6334
  particle,
6240
6335
  });
6241
6336
  return particle;
@@ -6246,25 +6341,25 @@
6246
6341
  return undefined;
6247
6342
  }
6248
6343
  clear() {
6249
- this._array = [];
6250
- this._particleBuckets.clear();
6251
- this._resetBuckets(this._container.zLayers);
6344
+ this.#array = [];
6345
+ this.#particleBuckets.clear();
6346
+ this.#resetBuckets(this.#container.zLayers);
6252
6347
  }
6253
6348
  destroy() {
6254
- this._array = [];
6255
- this._pool.length = 0;
6256
- this._particleBuckets.clear();
6257
- this._zBuckets = [];
6349
+ this.#array = [];
6350
+ this.#pool.length = 0;
6351
+ this.#particleBuckets.clear();
6352
+ this.#zBuckets = [];
6258
6353
  this.checkParticlePositionPlugins = [];
6259
- this._particleResetPlugins = [];
6260
- this._particleUpdatePlugins = [];
6261
- this._postUpdatePlugins = [];
6262
- this._postParticleUpdatePlugins = [];
6263
- this._updatePlugins = [];
6354
+ this.#particleResetPlugins = [];
6355
+ this.#particleUpdatePlugins = [];
6356
+ this.#postUpdatePlugins = [];
6357
+ this.#postParticleUpdatePlugins = [];
6358
+ this.#updatePlugins = [];
6264
6359
  }
6265
6360
  drawParticles(delta) {
6266
- for (let i = this._zBuckets.length - one; i >= minIndex; i--) {
6267
- const bucket = this._zBuckets[i];
6361
+ for (let i = this.#zBuckets.length - one; i >= minIndex; i--) {
6362
+ const bucket = this.#zBuckets[i];
6268
6363
  if (!bucket) {
6269
6364
  continue;
6270
6365
  }
@@ -6274,24 +6369,24 @@
6274
6369
  }
6275
6370
  }
6276
6371
  filter(condition) {
6277
- return this._array.filter(condition);
6372
+ return this.#array.filter(condition);
6278
6373
  }
6279
6374
  find(condition) {
6280
- return this._array.find(condition);
6375
+ return this.#array.find(condition);
6281
6376
  }
6282
6377
  get(index) {
6283
- return this._array[index];
6378
+ return this.#array[index];
6284
6379
  }
6285
6380
  async init() {
6286
- const container = this._container, options = container.actualOptions;
6381
+ const container = this.#container, options = container.actualOptions;
6287
6382
  this.checkParticlePositionPlugins = [];
6288
- this._updatePlugins = [];
6289
- this._particleUpdatePlugins = [];
6290
- this._postUpdatePlugins = [];
6291
- this._particleResetPlugins = [];
6292
- this._postParticleUpdatePlugins = [];
6293
- this._particleBuckets.clear();
6294
- this._resetBuckets(container.zLayers);
6383
+ this.#updatePlugins = [];
6384
+ this.#particleUpdatePlugins = [];
6385
+ this.#postUpdatePlugins = [];
6386
+ this.#particleResetPlugins = [];
6387
+ this.#postParticleUpdatePlugins = [];
6388
+ this.#particleBuckets.clear();
6389
+ this.#resetBuckets(container.zLayers);
6295
6390
  this.grid = new SpatialHashGrid(spatialHashGridCellSize * container.retina.pixelRatio);
6296
6391
  for (const plugin of container.plugins) {
6297
6392
  if (plugin.redrawInit) {
@@ -6301,26 +6396,26 @@
6301
6396
  this.checkParticlePositionPlugins.push(plugin);
6302
6397
  }
6303
6398
  if (plugin.update) {
6304
- this._updatePlugins.push(plugin);
6399
+ this.#updatePlugins.push(plugin);
6305
6400
  }
6306
6401
  if (plugin.particleUpdate) {
6307
- this._particleUpdatePlugins.push(plugin);
6402
+ this.#particleUpdatePlugins.push(plugin);
6308
6403
  }
6309
6404
  if (plugin.postUpdate) {
6310
- this._postUpdatePlugins.push(plugin);
6405
+ this.#postUpdatePlugins.push(plugin);
6311
6406
  }
6312
6407
  if (plugin.particleReset) {
6313
- this._particleResetPlugins.push(plugin);
6408
+ this.#particleResetPlugins.push(plugin);
6314
6409
  }
6315
6410
  if (plugin.postParticleUpdate) {
6316
- this._postParticleUpdatePlugins.push(plugin);
6411
+ this.#postParticleUpdatePlugins.push(plugin);
6317
6412
  }
6318
6413
  }
6319
- await this._container.initDrawersAndUpdaters();
6320
- for (const drawer of this._container.effectDrawers.values()) {
6414
+ await this.#container.initDrawersAndUpdaters();
6415
+ for (const drawer of this.#container.effectDrawers.values()) {
6321
6416
  await drawer.init?.(container);
6322
6417
  }
6323
- for (const drawer of this._container.shapeDrawers.values()) {
6418
+ for (const drawer of this.#container.shapeDrawers.values()) {
6324
6419
  await drawer.init?.(container);
6325
6420
  }
6326
6421
  let handled = false;
@@ -6354,10 +6449,10 @@
6354
6449
  async redraw() {
6355
6450
  this.clear();
6356
6451
  await this.init();
6357
- this._container.canvas.render.drawParticles({ value: 0, factor: 0 });
6452
+ this.#container.canvas.render.drawParticles({ value: 0, factor: 0 });
6358
6453
  }
6359
6454
  remove(particle, group, override) {
6360
- this.removeAt(this._array.indexOf(particle), undefined, group, override);
6455
+ this.removeAt(this.#array.indexOf(particle), undefined, group, override);
6361
6456
  }
6362
6457
  removeAt(index, quantity = defaultRemoveQuantity, group, override) {
6363
6458
  if (index < minIndex || index > this.count) {
@@ -6365,7 +6460,7 @@
6365
6460
  }
6366
6461
  let deleted = 0;
6367
6462
  for (let i = index; deleted < quantity && i < this.count; i++) {
6368
- if (this._removeParticle(i, group, override)) {
6463
+ if (this.#removeParticle(i, group, override)) {
6369
6464
  i--;
6370
6465
  deleted++;
6371
6466
  }
@@ -6375,9 +6470,9 @@
6375
6470
  this.removeAt(minIndex, quantity, group);
6376
6471
  }
6377
6472
  setDensity() {
6378
- const options = this._container.actualOptions, groups = options.particles.groups;
6473
+ const options = this.#container.actualOptions, groups = options.particles.groups;
6379
6474
  let pluginsCount = 0;
6380
- for (const plugin of this._container.plugins) {
6475
+ for (const plugin of this.#container.plugins) {
6381
6476
  if (plugin.particlesDensityCount) {
6382
6477
  pluginsCount += plugin.particlesDensityCount();
6383
6478
  }
@@ -6387,51 +6482,51 @@
6387
6482
  if (!groupData) {
6388
6483
  continue;
6389
6484
  }
6390
- const groupDataOptions = loadParticlesOptions(this._pluginManager, this._container, groupData);
6391
- this._applyDensity(groupDataOptions, pluginsCount, group);
6485
+ const groupDataOptions = loadParticlesOptions(this.#pluginManager, this.#container, groupData);
6486
+ this.#applyDensity(groupDataOptions, pluginsCount, group);
6392
6487
  }
6393
- this._applyDensity(options.particles, pluginsCount);
6488
+ this.#applyDensity(options.particles, pluginsCount);
6394
6489
  }
6395
6490
  setResizeFactor(factor) {
6396
- this._resizeFactor = factor;
6491
+ this.#resizeFactor = factor;
6397
6492
  }
6398
6493
  update(delta) {
6399
6494
  this.grid.clear();
6400
- for (const plugin of this._updatePlugins) {
6495
+ for (const plugin of this.#updatePlugins) {
6401
6496
  plugin.update?.(delta);
6402
6497
  }
6403
- const particlesToDelete = this._updateParticlesPhase1(delta);
6404
- for (const plugin of this._postUpdatePlugins) {
6498
+ const particlesToDelete = this.#updateParticlesPhase1(delta);
6499
+ for (const plugin of this.#postUpdatePlugins) {
6405
6500
  plugin.postUpdate?.(delta);
6406
6501
  }
6407
- this._updateParticlesPhase2(delta, particlesToDelete);
6502
+ this.#updateParticlesPhase2(delta, particlesToDelete);
6408
6503
  if (particlesToDelete.size) {
6409
6504
  for (const particle of particlesToDelete) {
6410
6505
  this.remove(particle);
6411
6506
  }
6412
6507
  }
6413
- delete this._resizeFactor;
6508
+ this.#resizeFactor = undefined;
6414
6509
  }
6415
- _addToPool = (...particles) => {
6416
- this._pool.push(...particles);
6510
+ #addToPool = (...particles) => {
6511
+ this.#pool.push(...particles);
6417
6512
  };
6418
- _applyDensity = (options, pluginsCount, group, groupOptions) => {
6513
+ #applyDensity = (options, pluginsCount, group, groupOptions) => {
6419
6514
  const numberOptions = options.number;
6420
6515
  if (!numberOptions.density.enable) {
6421
6516
  if (group === undefined) {
6422
- this._limit = numberOptions.limit.value;
6517
+ this.#limit = numberOptions.limit.value;
6423
6518
  }
6424
6519
  else if (groupOptions?.number.limit.value ?? numberOptions.limit.value) {
6425
- this._groupLimits.set(group, groupOptions?.number.limit.value ?? numberOptions.limit.value);
6520
+ this.#groupLimits.set(group, groupOptions?.number.limit.value ?? numberOptions.limit.value);
6426
6521
  }
6427
6522
  return;
6428
6523
  }
6429
- const densityFactor = this._initDensityFactor(numberOptions.density), optParticlesNumber = numberOptions.value, optParticlesLimit = numberOptions.limit.value > minLimit ? numberOptions.limit.value : optParticlesNumber, particlesNumber = Math.min(optParticlesNumber, optParticlesLimit) * densityFactor + pluginsCount, particlesCount = Math.min(this.count, this.filter(t => t.group === group).length);
6524
+ const densityFactor = this.#initDensityFactor(numberOptions.density), optParticlesNumber = numberOptions.value, optParticlesLimit = numberOptions.limit.value > minLimit ? numberOptions.limit.value : optParticlesNumber, particlesNumber = Math.min(optParticlesNumber, optParticlesLimit) * densityFactor + pluginsCount, particlesCount = Math.min(this.count, this.filter(t => t.group === group).length);
6430
6525
  if (group === undefined) {
6431
- this._limit = numberOptions.limit.value * densityFactor;
6526
+ this.#limit = numberOptions.limit.value * densityFactor;
6432
6527
  }
6433
6528
  else {
6434
- this._groupLimits.set(group, numberOptions.limit.value * densityFactor);
6529
+ this.#groupLimits.set(group, numberOptions.limit.value * densityFactor);
6435
6530
  }
6436
6531
  if (particlesCount < particlesNumber) {
6437
6532
  this.push(Math.abs(particlesNumber - particlesCount), undefined, options, group);
@@ -6440,18 +6535,18 @@
6440
6535
  this.removeQuantity(particlesCount - particlesNumber, group);
6441
6536
  }
6442
6537
  };
6443
- _createBuckets = (zLayers) => {
6538
+ #createBuckets = (zLayers) => {
6444
6539
  const bucketCount = Math.max(Math.floor(zLayers), one);
6445
6540
  return Array.from({ length: bucketCount }, () => []);
6446
6541
  };
6447
- _getBucketIndex = (zIndex) => {
6448
- const maxBucketIndex = this._zBuckets.length - one;
6542
+ #getBucketIndex = (zIndex) => {
6543
+ const maxBucketIndex = this.#zBuckets.length - one;
6449
6544
  if (maxBucketIndex <= minIndex) {
6450
6545
  return minIndex;
6451
6546
  }
6452
6547
  return Math.min(Math.max(Math.floor(zIndex), minIndex), maxBucketIndex);
6453
6548
  };
6454
- _getParticleInsertIndex = (bucket, particleId) => {
6549
+ #getParticleInsertIndex = (bucket, particleId) => {
6455
6550
  let start = minIndex, end = bucket.length;
6456
6551
  while (start < end) {
6457
6552
  const middle = Math.floor((start + end) / double), middleParticle = bucket[middle];
@@ -6468,8 +6563,8 @@
6468
6563
  }
6469
6564
  return start;
6470
6565
  };
6471
- _initDensityFactor = densityOptions => {
6472
- const container = this._container;
6566
+ #initDensityFactor = densityOptions => {
6567
+ const container = this.#container;
6473
6568
  if (!densityOptions.enable) {
6474
6569
  return defaultDensityFactor;
6475
6570
  }
@@ -6479,82 +6574,82 @@
6479
6574
  }
6480
6575
  return ((canvasSize.width * canvasSize.height) / (densityOptions.height * densityOptions.width * pxRatio ** squareExp));
6481
6576
  };
6482
- _insertParticleIntoBucket = (particle) => {
6483
- const bucketIndex = this._getBucketIndex(particle.position.z), bucket = this._zBuckets[bucketIndex];
6577
+ #insertParticleIntoBucket = (particle) => {
6578
+ const bucketIndex = this.#getBucketIndex(particle.position.z), bucket = this.#zBuckets[bucketIndex];
6484
6579
  if (!bucket) {
6485
6580
  return;
6486
6581
  }
6487
- bucket.splice(this._getParticleInsertIndex(bucket, particle.id), empty, particle);
6488
- this._particleBuckets.set(particle.id, bucketIndex);
6582
+ bucket.splice(this.#getParticleInsertIndex(bucket, particle.id), empty, particle);
6583
+ this.#particleBuckets.set(particle.id, bucketIndex);
6489
6584
  };
6490
- _removeParticle = (index, group, override) => {
6491
- const particle = this._array[index];
6585
+ #removeParticle = (index, group, override) => {
6586
+ const particle = this.#array[index];
6492
6587
  if (!particle) {
6493
6588
  return false;
6494
6589
  }
6495
6590
  if (particle.group !== group) {
6496
6591
  return false;
6497
6592
  }
6498
- this._array.splice(index, deleteCount);
6499
- this._removeParticleFromBucket(particle);
6593
+ this.#array.splice(index, deleteCount);
6594
+ this.#removeParticleFromBucket(particle);
6500
6595
  particle.destroy(override);
6501
- this._container.dispatchEvent(EventType.particleRemoved, {
6596
+ this.#container.dispatchEvent(EventType.particleRemoved, {
6502
6597
  particle,
6503
6598
  });
6504
- this._addToPool(particle);
6599
+ this.#addToPool(particle);
6505
6600
  return true;
6506
6601
  };
6507
- _removeParticleFromBucket = (particle) => {
6508
- const bucketIndex = this._particleBuckets.get(particle.id) ?? this._getBucketIndex(particle.position.z), bucket = this._zBuckets[bucketIndex];
6602
+ #removeParticleFromBucket = (particle) => {
6603
+ const bucketIndex = this.#particleBuckets.get(particle.id) ?? this.#getBucketIndex(particle.position.z), bucket = this.#zBuckets[bucketIndex];
6509
6604
  if (!bucket) {
6510
- this._particleBuckets.delete(particle.id);
6605
+ this.#particleBuckets.delete(particle.id);
6511
6606
  return;
6512
6607
  }
6513
- const particleIndex = this._getParticleInsertIndex(bucket, particle.id);
6608
+ const particleIndex = this.#getParticleInsertIndex(bucket, particle.id);
6514
6609
  if (bucket[particleIndex]?.id !== particle.id) {
6515
- this._particleBuckets.delete(particle.id);
6610
+ this.#particleBuckets.delete(particle.id);
6516
6611
  return;
6517
6612
  }
6518
6613
  bucket.splice(particleIndex, deleteCount);
6519
- this._particleBuckets.delete(particle.id);
6614
+ this.#particleBuckets.delete(particle.id);
6520
6615
  };
6521
- _resetBuckets = (zLayers) => {
6616
+ #resetBuckets = (zLayers) => {
6522
6617
  const bucketCount = Math.max(Math.floor(zLayers), one);
6523
- if (this._zBuckets.length !== bucketCount) {
6524
- this._zBuckets = this._createBuckets(bucketCount);
6618
+ if (this.#zBuckets.length !== bucketCount) {
6619
+ this.#zBuckets = this.#createBuckets(bucketCount);
6525
6620
  return;
6526
6621
  }
6527
- for (const bucket of this._zBuckets) {
6622
+ for (const bucket of this.#zBuckets) {
6528
6623
  bucket.length = minIndex;
6529
6624
  }
6530
6625
  };
6531
- _updateParticleBucket = (particle) => {
6532
- const newBucketIndex = this._getBucketIndex(particle.position.z), currentBucketIndex = this._particleBuckets.get(particle.id);
6626
+ #updateParticleBucket = (particle) => {
6627
+ const newBucketIndex = this.#getBucketIndex(particle.position.z), currentBucketIndex = this.#particleBuckets.get(particle.id);
6533
6628
  if (currentBucketIndex === undefined) {
6534
- this._insertParticleIntoBucket(particle);
6629
+ this.#insertParticleIntoBucket(particle);
6535
6630
  return;
6536
6631
  }
6537
6632
  if (currentBucketIndex === newBucketIndex) {
6538
6633
  return;
6539
6634
  }
6540
- const currentBucket = this._zBuckets[currentBucketIndex];
6635
+ const currentBucket = this.#zBuckets[currentBucketIndex];
6541
6636
  if (currentBucket) {
6542
- const particleIndex = this._getParticleInsertIndex(currentBucket, particle.id);
6637
+ const particleIndex = this.#getParticleInsertIndex(currentBucket, particle.id);
6543
6638
  if (currentBucket[particleIndex]?.id === particle.id) {
6544
6639
  currentBucket.splice(particleIndex, deleteCount);
6545
6640
  }
6546
6641
  }
6547
- const newBucket = this._zBuckets[newBucketIndex];
6642
+ const newBucket = this.#zBuckets[newBucketIndex];
6548
6643
  if (!newBucket) {
6549
- this._particleBuckets.set(particle.id, newBucketIndex);
6644
+ this.#particleBuckets.set(particle.id, newBucketIndex);
6550
6645
  return;
6551
6646
  }
6552
- newBucket.splice(this._getParticleInsertIndex(newBucket, particle.id), empty, particle);
6553
- this._particleBuckets.set(particle.id, newBucketIndex);
6647
+ newBucket.splice(this.#getParticleInsertIndex(newBucket, particle.id), empty, particle);
6648
+ this.#particleBuckets.set(particle.id, newBucketIndex);
6554
6649
  };
6555
- _updateParticlesPhase1 = (delta) => {
6556
- const particlesToDelete = new Set(), resizeFactor = this._resizeFactor;
6557
- for (const particle of this._array) {
6650
+ #updateParticlesPhase1 = (delta) => {
6651
+ const particlesToDelete = new Set(), resizeFactor = this.#resizeFactor;
6652
+ for (const particle of this.#array) {
6558
6653
  if (resizeFactor && !particle.ignoresResizeRatio) {
6559
6654
  particle.position.x *= resizeFactor.width;
6560
6655
  particle.position.y *= resizeFactor.height;
@@ -6562,10 +6657,10 @@
6562
6657
  particle.initialPosition.y *= resizeFactor.height;
6563
6658
  }
6564
6659
  particle.ignoresResizeRatio = false;
6565
- for (const plugin of this._particleResetPlugins) {
6660
+ for (const plugin of this.#particleResetPlugins) {
6566
6661
  plugin.particleReset?.(particle);
6567
6662
  }
6568
- for (const plugin of this._particleUpdatePlugins) {
6663
+ for (const plugin of this.#particleUpdatePlugins) {
6569
6664
  if (particle.destroyed) {
6570
6665
  break;
6571
6666
  }
@@ -6579,36 +6674,36 @@
6579
6674
  }
6580
6675
  return particlesToDelete;
6581
6676
  };
6582
- _updateParticlesPhase2 = (delta, particlesToDelete) => {
6583
- for (const particle of this._array) {
6677
+ #updateParticlesPhase2 = (delta, particlesToDelete) => {
6678
+ for (const particle of this.#array) {
6584
6679
  if (particle.destroyed) {
6585
6680
  particlesToDelete.add(particle);
6586
6681
  continue;
6587
6682
  }
6588
- for (const updater of this._container.particleUpdaters) {
6683
+ for (const updater of this.#container.particleUpdaters) {
6589
6684
  updater.update(particle, delta);
6590
6685
  }
6591
6686
  if (!particle.spawning) {
6592
- for (const plugin of this._postParticleUpdatePlugins) {
6687
+ for (const plugin of this.#postParticleUpdatePlugins) {
6593
6688
  plugin.postParticleUpdate?.(particle, delta);
6594
6689
  }
6595
6690
  }
6596
- this._updateParticleBucket(particle);
6691
+ this.#updateParticleBucket(particle);
6597
6692
  }
6598
6693
  };
6599
6694
  }
6600
6695
 
6601
6696
  class Retina {
6602
- container;
6603
6697
  pixelRatio;
6604
6698
  reduceFactor;
6699
+ #container;
6605
6700
  constructor(container) {
6606
- this.container = container;
6701
+ this.#container = container;
6607
6702
  this.pixelRatio = defaultRatio;
6608
6703
  this.reduceFactor = defaultReduceFactor;
6609
6704
  }
6610
6705
  init() {
6611
- const container = this.container, options = container.actualOptions;
6706
+ const container = this.#container, options = container.actualOptions;
6612
6707
  this.pixelRatio = options.detectRetina ? devicePixelRatio : defaultRatio;
6613
6708
  this.reduceFactor = defaultReduceFactor;
6614
6709
  const ratio = this.pixelRatio, canvas = container.canvas, element = canvas.domElement;
@@ -6622,7 +6717,6 @@
6622
6717
  props.maxSpeed = getRangeValue(moveOptions.gravity.maxSpeed) * ratio;
6623
6718
  props.moveDrift = getRangeValue(moveOptions.drift) * ratio;
6624
6719
  props.moveSpeed = getRangeValue(moveOptions.speed) * ratio;
6625
- props.sizeAnimationSpeed = getRangeValue(options.size.animation.speed) * ratio;
6626
6720
  const maxDistance = props.maxDistance;
6627
6721
  maxDistance.horizontal = moveDistance.horizontal === undefined ? undefined : moveDistance.horizontal * ratio;
6628
6722
  maxDistance.vertical = moveDistance.vertical === undefined ? undefined : moveDistance.vertical * ratio;
@@ -6660,73 +6754,73 @@
6660
6754
  shapeDrawers;
6661
6755
  started;
6662
6756
  zLayers;
6663
- _delay;
6664
- _delayTimeout;
6665
- _delta = { value: 0, factor: 0 };
6666
- _dispatchCallback;
6667
- _drawAnimationFrame;
6668
- _duration;
6669
- _eventListeners;
6670
- _firstStart;
6671
- _initialSourceOptions;
6672
- _lastFrameTime;
6673
- _lifeTime;
6674
- _onDestroy;
6675
- _options;
6676
- _paused;
6677
- _pluginManager;
6678
- _smooth;
6679
- _sourceOptions;
6757
+ #delay;
6758
+ #delayTimeout;
6759
+ #delta = { value: 0, factor: 0 };
6760
+ #dispatchCallback;
6761
+ #drawAnimationFrame;
6762
+ #duration;
6763
+ #eventListeners;
6764
+ #firstStart;
6765
+ #initialSourceOptions;
6766
+ #lastFrameTime;
6767
+ #lifeTime;
6768
+ #onDestroy;
6769
+ #options;
6770
+ #paused;
6771
+ #pluginManager;
6772
+ #smooth;
6773
+ #sourceOptions;
6680
6774
  constructor(params) {
6681
6775
  const { dispatchCallback, pluginManager, id, onDestroy, sourceOptions } = params;
6682
- this._pluginManager = pluginManager;
6683
- this._dispatchCallback = dispatchCallback;
6684
- this._onDestroy = onDestroy;
6776
+ this.#pluginManager = pluginManager;
6777
+ this.#dispatchCallback = dispatchCallback;
6778
+ this.#onDestroy = onDestroy;
6685
6779
  this.id = Symbol(id);
6686
6780
  this.fpsLimit = 120;
6687
6781
  this.hdr = false;
6688
- this._smooth = false;
6689
- this._delay = 0;
6690
- this._duration = 0;
6691
- this._lifeTime = 0;
6692
- this._firstStart = true;
6782
+ this.#smooth = false;
6783
+ this.#delay = 0;
6784
+ this.#duration = 0;
6785
+ this.#lifeTime = 0;
6786
+ this.#firstStart = true;
6693
6787
  this.started = false;
6694
6788
  this.destroyed = false;
6695
- this._paused = true;
6696
- this._lastFrameTime = 0;
6789
+ this.#paused = true;
6790
+ this.#lastFrameTime = 0;
6697
6791
  this.zLayers = 100;
6698
6792
  this.pageHidden = false;
6699
- this._sourceOptions = sourceOptions;
6700
- this._initialSourceOptions = sourceOptions;
6793
+ this.#sourceOptions = sourceOptions;
6794
+ this.#initialSourceOptions = sourceOptions;
6701
6795
  this.effectDrawers = new Map();
6702
6796
  this.shapeDrawers = new Map();
6703
6797
  this.particleUpdaters = [];
6704
6798
  this.retina = new Retina(this);
6705
- this.canvas = new CanvasManager(this._pluginManager, this);
6706
- this.particles = new ParticlesManager(this._pluginManager, this);
6799
+ this.canvas = new CanvasManager(this.#pluginManager, this);
6800
+ this.particles = new ParticlesManager(this.#pluginManager, this);
6707
6801
  this.plugins = [];
6708
6802
  this.particleDestroyedPlugins = [];
6709
6803
  this.particleCreatedPlugins = [];
6710
6804
  this.particlePositionPlugins = [];
6711
- this._options = loadContainerOptions(this._pluginManager, this);
6712
- this.actualOptions = loadContainerOptions(this._pluginManager, this);
6713
- this._eventListeners = new EventListeners(this);
6805
+ this.#options = loadContainerOptions(this.#pluginManager, this);
6806
+ this.actualOptions = loadContainerOptions(this.#pluginManager, this);
6807
+ this.#eventListeners = new EventListeners(this);
6714
6808
  this.dispatchEvent(EventType.containerBuilt);
6715
6809
  }
6716
6810
  get animationStatus() {
6717
- return !this._paused && !this.pageHidden && guardCheck(this);
6811
+ return !this.#paused && !this.pageHidden && guardCheck(this);
6718
6812
  }
6719
6813
  get options() {
6720
- return this._options;
6814
+ return this.#options;
6721
6815
  }
6722
6816
  get sourceOptions() {
6723
- return this._sourceOptions;
6817
+ return this.#sourceOptions;
6724
6818
  }
6725
6819
  addLifeTime(value) {
6726
- this._lifeTime += value;
6820
+ this.#lifeTime += value;
6727
6821
  }
6728
6822
  alive() {
6729
- return !this._duration || this._lifeTime <= this._duration;
6823
+ return !this.#duration || this.#lifeTime <= this.#duration;
6730
6824
  }
6731
6825
  destroy(remove = true) {
6732
6826
  if (!guardCheck(this)) {
@@ -6748,13 +6842,13 @@
6748
6842
  this.shapeDrawers = new Map();
6749
6843
  this.particleUpdaters = [];
6750
6844
  this.plugins.length = 0;
6751
- this._pluginManager.clearPlugins(this);
6845
+ this.#pluginManager.clearPlugins(this);
6752
6846
  this.destroyed = true;
6753
- this._onDestroy(remove);
6847
+ this.#onDestroy(remove);
6754
6848
  this.dispatchEvent(EventType.containerDestroyed);
6755
6849
  }
6756
6850
  dispatchEvent(type, data) {
6757
- this._dispatchCallback(type, {
6851
+ this.#dispatchCallback(type, {
6758
6852
  container: this,
6759
6853
  data,
6760
6854
  });
@@ -6764,12 +6858,12 @@
6764
6858
  return;
6765
6859
  }
6766
6860
  let refreshTime = force;
6767
- this._drawAnimationFrame = animate((timestamp) => {
6861
+ this.#drawAnimationFrame = animate((timestamp) => {
6768
6862
  if (refreshTime) {
6769
- this._lastFrameTime = undefined;
6863
+ this.#lastFrameTime = undefined;
6770
6864
  refreshTime = false;
6771
6865
  }
6772
- this._nextFrame(timestamp);
6866
+ this.#nextFrame(timestamp);
6773
6867
  });
6774
6868
  }
6775
6869
  async export(type, options = {}) {
@@ -6791,7 +6885,7 @@
6791
6885
  return;
6792
6886
  }
6793
6887
  const allContainerPlugins = new Map();
6794
- for (const plugin of this._pluginManager.plugins) {
6888
+ for (const plugin of this.#pluginManager.plugins) {
6795
6889
  const containerPlugin = await plugin.getPlugin(this);
6796
6890
  if (containerPlugin.preInit) {
6797
6891
  await containerPlugin.preInit();
@@ -6799,8 +6893,8 @@
6799
6893
  allContainerPlugins.set(plugin, containerPlugin);
6800
6894
  }
6801
6895
  await this.initDrawersAndUpdaters();
6802
- this._options = loadContainerOptions(this._pluginManager, this, this._initialSourceOptions, this.sourceOptions);
6803
- this.actualOptions = loadContainerOptions(this._pluginManager, this, this._options);
6896
+ this.#options = loadContainerOptions(this.#pluginManager, this, this.#initialSourceOptions, this.sourceOptions);
6897
+ this.actualOptions = loadContainerOptions(this.#pluginManager, this, this.#options);
6804
6898
  this.plugins.length = 0;
6805
6899
  this.particleDestroyedPlugins.length = 0;
6806
6900
  this.particleCreatedPlugins.length = 0;
@@ -6827,11 +6921,11 @@
6827
6921
  const { delay, duration, fpsLimit, hdr, smooth, zLayers } = this.actualOptions;
6828
6922
  this.hdr = hdr;
6829
6923
  this.zLayers = zLayers;
6830
- this._duration = getRangeValue(duration) * millisecondsToSeconds;
6831
- this._delay = getRangeValue(delay) * millisecondsToSeconds;
6832
- this._lifeTime = 0;
6924
+ this.#duration = getRangeValue(duration) * millisecondsToSeconds;
6925
+ this.#delay = getRangeValue(delay) * millisecondsToSeconds;
6926
+ this.#lifeTime = 0;
6833
6927
  this.fpsLimit = fpsLimit > minFpsLimit ? fpsLimit : defaultFpsLimit;
6834
- this._smooth = smooth;
6928
+ this.#smooth = smooth;
6835
6929
  for (const plugin of this.plugins) {
6836
6930
  await plugin.init?.();
6837
6931
  }
@@ -6844,7 +6938,7 @@
6844
6938
  this.dispatchEvent(EventType.particlesSetup);
6845
6939
  }
6846
6940
  async initDrawersAndUpdaters() {
6847
- const pluginManager = this._pluginManager;
6941
+ const pluginManager = this.#pluginManager;
6848
6942
  this.effectDrawers = await pluginManager.getEffectDrawers(this, true);
6849
6943
  this.shapeDrawers = await pluginManager.getShapeDrawers(this, true);
6850
6944
  this.particleUpdaters = await pluginManager.getUpdaters(this, true);
@@ -6853,18 +6947,18 @@
6853
6947
  if (!guardCheck(this)) {
6854
6948
  return;
6855
6949
  }
6856
- if (this._drawAnimationFrame !== undefined) {
6857
- cancelAnimation(this._drawAnimationFrame);
6858
- delete this._drawAnimationFrame;
6950
+ if (this.#drawAnimationFrame !== undefined) {
6951
+ cancelAnimation(this.#drawAnimationFrame);
6952
+ this.#drawAnimationFrame = undefined;
6859
6953
  }
6860
- if (this._paused) {
6954
+ if (this.#paused) {
6861
6955
  return;
6862
6956
  }
6863
6957
  for (const plugin of this.plugins) {
6864
6958
  plugin.pause?.();
6865
6959
  }
6866
6960
  if (!this.pageHidden) {
6867
- this._paused = true;
6961
+ this.#paused = true;
6868
6962
  }
6869
6963
  this.dispatchEvent(EventType.containerPaused);
6870
6964
  }
@@ -6872,13 +6966,13 @@
6872
6966
  if (!guardCheck(this)) {
6873
6967
  return;
6874
6968
  }
6875
- const needsUpdate = this._paused || force;
6876
- if (this._firstStart && !this.actualOptions.autoPlay) {
6877
- this._firstStart = false;
6969
+ const needsUpdate = this.#paused || force;
6970
+ if (this.#firstStart && !this.actualOptions.autoPlay) {
6971
+ this.#firstStart = false;
6878
6972
  return;
6879
6973
  }
6880
- if (this._paused) {
6881
- this._paused = false;
6974
+ if (this.#paused) {
6975
+ this.#paused = false;
6882
6976
  }
6883
6977
  if (needsUpdate) {
6884
6978
  for (const plugin of this.plugins) {
@@ -6901,10 +6995,10 @@
6901
6995
  if (!guardCheck(this)) {
6902
6996
  return;
6903
6997
  }
6904
- this._initialSourceOptions = sourceOptions;
6905
- this._sourceOptions = sourceOptions;
6906
- this._options = loadContainerOptions(this._pluginManager, this, this._initialSourceOptions, this.sourceOptions);
6907
- this.actualOptions = loadContainerOptions(this._pluginManager, this, this._options);
6998
+ this.#initialSourceOptions = sourceOptions;
6999
+ this.#sourceOptions = sourceOptions;
7000
+ this.#options = loadContainerOptions(this.#pluginManager, this, this.#initialSourceOptions, this.sourceOptions);
7001
+ this.actualOptions = loadContainerOptions(this.#pluginManager, this, this.#options);
6908
7002
  return this.refresh();
6909
7003
  }
6910
7004
  async start() {
@@ -6915,7 +7009,7 @@
6915
7009
  this.started = true;
6916
7010
  await new Promise(resolve => {
6917
7011
  const start = async () => {
6918
- this._eventListeners.addListeners();
7012
+ this.#eventListeners.addListeners();
6919
7013
  for (const plugin of this.plugins) {
6920
7014
  await plugin.start?.();
6921
7015
  }
@@ -6923,20 +7017,20 @@
6923
7017
  this.play();
6924
7018
  resolve();
6925
7019
  };
6926
- this._delayTimeout = setTimeout(() => void start(), this._delay);
7020
+ this.#delayTimeout = setTimeout(() => void start(), this.#delay);
6927
7021
  });
6928
7022
  }
6929
7023
  stop() {
6930
7024
  if (!guardCheck(this) || !this.started) {
6931
7025
  return;
6932
7026
  }
6933
- if (this._delayTimeout) {
6934
- clearTimeout(this._delayTimeout);
6935
- delete this._delayTimeout;
7027
+ if (this.#delayTimeout) {
7028
+ clearTimeout(this.#delayTimeout);
7029
+ this.#delayTimeout = undefined;
6936
7030
  }
6937
- this._firstStart = true;
7031
+ this.#firstStart = true;
6938
7032
  this.started = false;
6939
- this._eventListeners.removeListeners();
7033
+ this.#eventListeners.removeListeners();
6940
7034
  this.pause();
6941
7035
  this.particles.clear();
6942
7036
  this.canvas.stop();
@@ -6946,7 +7040,7 @@
6946
7040
  this.particleCreatedPlugins.length = 0;
6947
7041
  this.particleDestroyedPlugins.length = 0;
6948
7042
  this.particlePositionPlugins.length = 0;
6949
- this._sourceOptions = this._options;
7043
+ this.#sourceOptions = this.#options;
6950
7044
  this.dispatchEvent(EventType.containerStopped);
6951
7045
  }
6952
7046
  updateActualOptions() {
@@ -6958,23 +7052,23 @@
6958
7052
  }
6959
7053
  return refresh;
6960
7054
  }
6961
- _nextFrame = (timestamp) => {
7055
+ #nextFrame = (timestamp) => {
6962
7056
  try {
6963
- if (!this._smooth &&
6964
- this._lastFrameTime !== undefined &&
6965
- timestamp < this._lastFrameTime + millisecondsToSeconds / this.fpsLimit) {
7057
+ if (!this.#smooth &&
7058
+ this.#lastFrameTime !== undefined &&
7059
+ timestamp < this.#lastFrameTime + millisecondsToSeconds / this.fpsLimit) {
6966
7060
  this.draw(false);
6967
7061
  return;
6968
7062
  }
6969
- this._lastFrameTime ??= timestamp;
6970
- updateDelta(this._delta, timestamp - this._lastFrameTime, this.fpsLimit, this._smooth);
6971
- this.addLifeTime(this._delta.value);
6972
- this._lastFrameTime = timestamp;
6973
- if (this._delta.value > millisecondsToSeconds) {
7063
+ this.#lastFrameTime ??= timestamp;
7064
+ updateDelta(this.#delta, timestamp - this.#lastFrameTime, this.fpsLimit, this.#smooth);
7065
+ this.addLifeTime(this.#delta.value);
7066
+ this.#lastFrameTime = timestamp;
7067
+ if (this.#delta.value > millisecondsToSeconds) {
6974
7068
  this.draw(false);
6975
7069
  return;
6976
7070
  }
6977
- this.canvas.render.drawParticles(this._delta);
7071
+ this.canvas.render.drawParticles(this.#delta);
6978
7072
  if (!this.alive()) {
6979
7073
  this.destroy();
6980
7074
  return;
@@ -6995,10 +7089,10 @@
6995
7089
  });
6996
7090
 
6997
7091
  class BlendPluginInstance {
6998
- _container;
6999
- _defaultCompositeValue;
7092
+ #container;
7093
+ #defaultCompositeValue;
7000
7094
  constructor(container) {
7001
- this._container = container;
7095
+ this.#container = container;
7002
7096
  }
7003
7097
  drawParticleCleanup(context, particle) {
7004
7098
  if (!particle.options.blend?.enable) {
@@ -7015,14 +7109,14 @@
7015
7109
  context.globalCompositeOperation = particle.options.blend.mode;
7016
7110
  }
7017
7111
  drawSettingsCleanup(context) {
7018
- if (!this._defaultCompositeValue) {
7112
+ if (!this.#defaultCompositeValue) {
7019
7113
  return;
7020
7114
  }
7021
- context.globalCompositeOperation = this._defaultCompositeValue;
7115
+ context.globalCompositeOperation = this.#defaultCompositeValue;
7022
7116
  }
7023
7117
  drawSettingsSetup(context) {
7024
- const previousComposite = context.globalCompositeOperation, blend = this._container.actualOptions.blend;
7025
- this._defaultCompositeValue = previousComposite;
7118
+ const previousComposite = context.globalCompositeOperation, blend = this.#container.actualOptions.blend;
7119
+ this.#defaultCompositeValue = previousComposite;
7026
7120
  context.globalCompositeOperation = blend?.enable ? blend.mode : previousComposite;
7027
7121
  }
7028
7122
  }
@@ -7165,11 +7259,11 @@
7165
7259
  class MovePluginInstance {
7166
7260
  availablePathGenerators;
7167
7261
  pathGenerators;
7168
- _container;
7169
- _pluginManager;
7262
+ #container;
7263
+ #pluginManager;
7170
7264
  constructor(pluginManager, container) {
7171
- this._pluginManager = pluginManager;
7172
- this._container = container;
7265
+ this.#pluginManager = pluginManager;
7266
+ this.#container = container;
7173
7267
  this.availablePathGenerators = new Map();
7174
7268
  this.pathGenerators = new Map();
7175
7269
  }
@@ -7200,7 +7294,7 @@
7200
7294
  acceleration: getRangeValue(gravityOptions.acceleration),
7201
7295
  inverse: gravityOptions.inverse,
7202
7296
  };
7203
- initSpin(this._container, particle);
7297
+ initSpin(this.#container, particle);
7204
7298
  }
7205
7299
  particleDestroyed(particle) {
7206
7300
  const pathGenerator = particle.pathGenerator;
@@ -7211,7 +7305,7 @@
7211
7305
  if (!moveOptions.enable) {
7212
7306
  return;
7213
7307
  }
7214
- const container = this._container, pxRatio = container.retina.pixelRatio, slowFactor = getProximitySpeedFactor(particle), reduceFactor = container.retina.reduceFactor, baseSpeed = particle.retina.moveSpeed, moveDrift = particle.retina.moveDrift, maxSize = getRangeMax(particleOptions.size.value) * pxRatio, sizeFactor = moveOptions.size ? particle.getRadius() / maxSize : defaultSizeFactor, deltaFactor = delta.factor || defaultDeltaFactor, moveSpeed = baseSpeed * sizeFactor * slowFactor * deltaFactor * half, maxSpeed = particle.retina.maxSpeed;
7308
+ const container = this.#container, slowFactor = getProximitySpeedFactor(particle), reduceFactor = container.retina.reduceFactor, baseSpeed = particle.retina.moveSpeed, moveDrift = particle.retina.moveDrift, maxSize = particle.size.max, sizeFactor = moveOptions.size ? particle.getRadius() / maxSize : defaultSizeFactor, deltaFactor = delta.factor || defaultDeltaFactor, moveSpeed = baseSpeed * sizeFactor * slowFactor * deltaFactor * half, maxSpeed = particle.retina.maxSpeed;
7215
7309
  if (moveOptions.spin.enable) {
7216
7310
  spin(container, particle, moveSpeed, reduceFactor);
7217
7311
  }
@@ -7221,18 +7315,18 @@
7221
7315
  applyDistance(particle);
7222
7316
  }
7223
7317
  preInit() {
7224
- return this._init();
7318
+ return this.#init();
7225
7319
  }
7226
7320
  redrawInit() {
7227
- return this._init();
7321
+ return this.#init();
7228
7322
  }
7229
7323
  update() {
7230
7324
  for (const pathGenerator of this.pathGenerators.values()) {
7231
7325
  pathGenerator.update();
7232
7326
  }
7233
7327
  }
7234
- async _init() {
7235
- const availablePathGenerators = await this._pluginManager.getPathGenerators?.(this._container, true);
7328
+ async #init() {
7329
+ const availablePathGenerators = await this.#pluginManager.getPathGenerators?.(this.#container, true);
7236
7330
  if (!availablePathGenerators) {
7237
7331
  return;
7238
7332
  }
@@ -7250,44 +7344,44 @@
7250
7344
  });
7251
7345
 
7252
7346
  class EmittersPluginInstance {
7253
- container;
7254
- _instancesManager;
7347
+ #container;
7348
+ #instancesManager;
7255
7349
  constructor(instancesManager, container) {
7256
- this.container = container;
7257
- this._instancesManager = instancesManager;
7258
- this._instancesManager.initContainer(container);
7350
+ this.#instancesManager = instancesManager;
7351
+ this.#container = container;
7352
+ this.#instancesManager.initContainer(container);
7259
7353
  }
7260
7354
  async init() {
7261
- const emittersOptions = this.container.actualOptions.emitters;
7355
+ const emittersOptions = this.#container.actualOptions.emitters;
7262
7356
  if (isArray(emittersOptions)) {
7263
7357
  for (const emitterOptions of emittersOptions) {
7264
- await this._instancesManager.addEmitter(this.container, emitterOptions);
7358
+ await this.#instancesManager.addEmitter(this.#container, emitterOptions);
7265
7359
  }
7266
7360
  }
7267
7361
  else {
7268
- await this._instancesManager.addEmitter(this.container, emittersOptions);
7362
+ await this.#instancesManager.addEmitter(this.#container, emittersOptions);
7269
7363
  }
7270
7364
  }
7271
7365
  pause() {
7272
- for (const emitter of this._instancesManager.getArray(this.container)) {
7366
+ for (const emitter of this.#instancesManager.getArray(this.#container)) {
7273
7367
  emitter.pause();
7274
7368
  }
7275
7369
  }
7276
7370
  play() {
7277
- for (const emitter of this._instancesManager.getArray(this.container)) {
7371
+ for (const emitter of this.#instancesManager.getArray(this.#container)) {
7278
7372
  emitter.play();
7279
7373
  }
7280
7374
  }
7281
7375
  resize() {
7282
- for (const emitter of this._instancesManager.getArray(this.container)) {
7376
+ for (const emitter of this.#instancesManager.getArray(this.#container)) {
7283
7377
  emitter.resize();
7284
7378
  }
7285
7379
  }
7286
7380
  stop() {
7287
- this._instancesManager.clear(this.container);
7381
+ this.#instancesManager.clear(this.#container);
7288
7382
  }
7289
7383
  update(delta) {
7290
- this._instancesManager.getArray(this.container).forEach(emitter => {
7384
+ this.#instancesManager.getArray(this.#container).forEach(emitter => {
7291
7385
  emitter.update(delta);
7292
7386
  });
7293
7387
  }
@@ -7320,16 +7414,16 @@
7320
7414
 
7321
7415
  const defaultIndex = 0;
7322
7416
  class EmittersInstancesManager {
7323
- _containerArrays;
7324
- _pluginManager;
7417
+ #containerArrays;
7418
+ #pluginManager;
7325
7419
  constructor(pluginManager) {
7326
- this._containerArrays = new Map();
7327
- this._pluginManager = pluginManager;
7420
+ this.#containerArrays = new Map();
7421
+ this.#pluginManager = pluginManager;
7328
7422
  }
7329
7423
  async addEmitter(container, options, position) {
7330
7424
  const emitterOptions = new Emitter();
7331
7425
  emitterOptions.load(options);
7332
- const { EmitterInstance } = await Promise.resolve().then(function () { return EmitterInstance$1; }), emitter = new EmitterInstance(this._pluginManager, container, (emitter) => {
7426
+ const { EmitterInstance } = await Promise.resolve().then(function () { return EmitterInstance$1; }), emitter = new EmitterInstance(this.#pluginManager, container, (emitter) => {
7333
7427
  this.removeEmitter(container, emitter);
7334
7428
  }, emitterOptions, position);
7335
7429
  await emitter.init();
@@ -7338,22 +7432,22 @@
7338
7432
  }
7339
7433
  clear(container) {
7340
7434
  this.initContainer(container);
7341
- this._containerArrays.set(container, []);
7435
+ this.#containerArrays.set(container, []);
7342
7436
  }
7343
7437
  getArray(container) {
7344
7438
  this.initContainer(container);
7345
- let array = this._containerArrays.get(container);
7439
+ let array = this.#containerArrays.get(container);
7346
7440
  if (!array) {
7347
7441
  array = [];
7348
- this._containerArrays.set(container, array);
7442
+ this.#containerArrays.set(container, array);
7349
7443
  }
7350
7444
  return array;
7351
7445
  }
7352
7446
  initContainer(container) {
7353
- if (this._containerArrays.has(container)) {
7447
+ if (this.#containerArrays.has(container)) {
7354
7448
  return;
7355
7449
  }
7356
- this._containerArrays.set(container, []);
7450
+ this.#containerArrays.set(container, []);
7357
7451
  container.getEmitter = (idxOrName) => {
7358
7452
  const array = this.getArray(container);
7359
7453
  return idxOrName === undefined || isNumber(idxOrName)
@@ -7395,12 +7489,12 @@
7395
7489
 
7396
7490
  const defaultFactor = 1, defaultReduce = 1, disableReduce = 0, identity = 1;
7397
7491
  class MotionPluginInstance {
7398
- _container;
7492
+ #container;
7399
7493
  constructor(container) {
7400
- this._container = container;
7494
+ this.#container = container;
7401
7495
  }
7402
7496
  async init() {
7403
- const container = this._container, options = container.actualOptions.motion;
7497
+ const container = this.#container, options = container.actualOptions.motion;
7404
7498
  if (!(options && (options.disable || options.reduce.value))) {
7405
7499
  container.retina.reduceFactor = 1;
7406
7500
  return;
@@ -7410,10 +7504,10 @@
7410
7504
  container.retina.reduceFactor = defaultFactor;
7411
7505
  return;
7412
7506
  }
7413
- this._handleMotionChange(mediaQuery);
7507
+ this.#handleMotionChange(mediaQuery);
7414
7508
  const handleChange = () => {
7415
7509
  void (async () => {
7416
- this._handleMotionChange(mediaQuery);
7510
+ this.#handleMotionChange(mediaQuery);
7417
7511
  try {
7418
7512
  await container.refresh();
7419
7513
  }
@@ -7424,8 +7518,8 @@
7424
7518
  mediaQuery.addEventListener("change", handleChange);
7425
7519
  await Promise.resolve();
7426
7520
  }
7427
- _handleMotionChange = mediaQuery => {
7428
- const container = this._container, motion = container.actualOptions.motion;
7521
+ #handleMotionChange = mediaQuery => {
7522
+ const container = this.#container, motion = container.actualOptions.motion;
7429
7523
  if (!motion) {
7430
7524
  return;
7431
7525
  }
@@ -7477,34 +7571,34 @@
7477
7571
  spawnStrokeColor;
7478
7572
  spawnStrokeOpacity;
7479
7573
  spawnStrokeWidth;
7480
- _container;
7481
- _currentDuration;
7482
- _currentEmitDelay;
7483
- _currentSpawnDelay;
7484
- _duration;
7485
- _emitDelay;
7486
- _firstSpawn;
7487
- _immortal;
7488
- _initialPosition;
7489
- _lifeCount;
7490
- _mutationObserver;
7491
- _particlesOptions;
7492
- _paused;
7493
- _pluginManager;
7494
- _removeCallback;
7495
- _resizeObserver;
7496
- _shape;
7497
- _size;
7498
- _spawnDelay;
7499
- _startParticlesAdded;
7574
+ #container;
7575
+ #currentDuration;
7576
+ #currentEmitDelay;
7577
+ #currentSpawnDelay;
7578
+ #duration;
7579
+ #emitDelay;
7580
+ #firstSpawn;
7581
+ #immortal;
7582
+ #initialPosition;
7583
+ #lifeCount;
7584
+ #mutationObserver;
7585
+ #particlesOptions;
7586
+ #paused;
7587
+ #pluginManager;
7588
+ #removeCallback;
7589
+ #resizeObserver;
7590
+ #shape;
7591
+ #size;
7592
+ #spawnDelay;
7593
+ #startParticlesAdded;
7500
7594
  constructor(pluginManager, container, removeCallback, options, position) {
7501
- this._pluginManager = pluginManager;
7502
- this._container = container;
7503
- this._removeCallback = removeCallback;
7504
- this._currentDuration = 0;
7505
- this._currentEmitDelay = 0;
7506
- this._currentSpawnDelay = 0;
7507
- this._initialPosition = position;
7595
+ this.#pluginManager = pluginManager;
7596
+ this.#container = container;
7597
+ this.#removeCallback = removeCallback;
7598
+ this.#currentDuration = 0;
7599
+ this.#currentEmitDelay = 0;
7600
+ this.#currentSpawnDelay = 0;
7601
+ this.#initialPosition = position;
7508
7602
  if (options instanceof Emitter) {
7509
7603
  this.options = options;
7510
7604
  }
@@ -7512,159 +7606,159 @@
7512
7606
  this.options = new Emitter();
7513
7607
  this.options.load(options);
7514
7608
  }
7515
- this._spawnDelay = container.retina.reduceFactor
7609
+ this.#spawnDelay = container.retina.reduceFactor
7516
7610
  ? (getRangeValue(this.options.life.delay ?? defaultLifeDelay) * millisecondsToSeconds) /
7517
7611
  container.retina.reduceFactor
7518
7612
  : Infinity;
7519
- this.position = this._initialPosition ?? this._calcPosition();
7613
+ this.position = this.#initialPosition ?? this.#calcPosition();
7520
7614
  this.name = this.options.name;
7521
7615
  this.fill = this.options.fill;
7522
- this._firstSpawn = !this.options.life.wait;
7523
- this._startParticlesAdded = false;
7616
+ this.#firstSpawn = !this.options.life.wait;
7617
+ this.#startParticlesAdded = false;
7524
7618
  const particlesOptions = deepExtend({}, this.options.particles);
7525
7619
  particlesOptions.move ??= {};
7526
7620
  particlesOptions.move.direction ??= this.options.direction;
7527
7621
  if (this.options.spawn.fill?.color) {
7528
- this.spawnFillColor = rangeColorToHsl(this._pluginManager, this.options.spawn.fill.color);
7622
+ this.spawnFillColor = rangeColorToHsl(this.#pluginManager, this.options.spawn.fill.color);
7529
7623
  }
7530
7624
  if (this.options.spawn.stroke?.color) {
7531
- this.spawnStrokeColor = rangeColorToHsl(this._pluginManager, this.options.spawn.stroke.color);
7532
- }
7533
- this._paused = !this.options.autoPlay;
7534
- this._particlesOptions = particlesOptions;
7535
- this._size = this._calcSize();
7536
- this.size = getSize(this._size, this._container.canvas.size);
7537
- this._lifeCount = this.options.life.count ?? defaultLifeCount;
7538
- this._immortal = this._lifeCount <= minLifeCount;
7625
+ this.spawnStrokeColor = rangeColorToHsl(this.#pluginManager, this.options.spawn.stroke.color);
7626
+ }
7627
+ this.#paused = !this.options.autoPlay;
7628
+ this.#particlesOptions = particlesOptions;
7629
+ this.#size = this.#calcSize();
7630
+ this.size = getSize(this.#size, this.#container.canvas.size);
7631
+ this.#lifeCount = this.options.life.count ?? defaultLifeCount;
7632
+ this.#immortal = this.#lifeCount <= minLifeCount;
7539
7633
  if (this.options.domId) {
7540
7634
  const element = safeDocument().getElementById(this.options.domId);
7541
7635
  if (element) {
7542
- this._mutationObserver = new MutationObserver(() => {
7636
+ this.#mutationObserver = new MutationObserver(() => {
7543
7637
  this.resize();
7544
7638
  });
7545
- this._resizeObserver = new ResizeObserver(() => {
7639
+ this.#resizeObserver = new ResizeObserver(() => {
7546
7640
  this.resize();
7547
7641
  });
7548
- this._mutationObserver.observe(element, {
7642
+ this.#mutationObserver.observe(element, {
7549
7643
  attributes: true,
7550
7644
  attributeFilter: ["style", "width", "height"],
7551
7645
  });
7552
- this._resizeObserver.observe(element);
7646
+ this.#resizeObserver.observe(element);
7553
7647
  }
7554
7648
  }
7555
- const shapeOptions = this.options.shape, shapeGenerator = this._pluginManager.emitterShapeManager?.getShapeGenerator(shapeOptions.type);
7649
+ const shapeOptions = this.options.shape, shapeGenerator = this.#pluginManager.emitterShapeManager?.getShapeGenerator(shapeOptions.type);
7556
7650
  if (shapeGenerator) {
7557
- this._shape = shapeGenerator.generate(this._container, this.position, this.size, this.fill, shapeOptions.options);
7651
+ this.#shape = shapeGenerator.generate(this.#container, this.position, this.size, this.fill, shapeOptions.options);
7558
7652
  }
7559
- this._container.dispatchEvent("emitterCreated", {
7653
+ this.#container.dispatchEvent("emitterCreated", {
7560
7654
  emitter: this,
7561
7655
  });
7562
7656
  this.play();
7563
7657
  }
7564
7658
  externalPause() {
7565
- this._paused = true;
7659
+ this.#paused = true;
7566
7660
  this.pause();
7567
7661
  }
7568
7662
  externalPlay() {
7569
- this._paused = false;
7663
+ this.#paused = false;
7570
7664
  this.play();
7571
7665
  }
7572
7666
  async init() {
7573
- await this._shape?.init();
7667
+ await this.#shape?.init();
7574
7668
  }
7575
7669
  pause() {
7576
- if (this._paused) {
7670
+ if (this.#paused) {
7577
7671
  return;
7578
7672
  }
7579
- delete this._emitDelay;
7673
+ this.#emitDelay = undefined;
7580
7674
  }
7581
7675
  play() {
7582
- if (this._paused) {
7676
+ if (this.#paused) {
7583
7677
  return;
7584
7678
  }
7585
- if (!((this._lifeCount > minLifeCount || this._immortal || !this.options.life.count) &&
7586
- (this._firstSpawn || this._currentSpawnDelay >= (this._spawnDelay ?? defaultSpawnDelay)))) {
7679
+ if (!((this.#lifeCount > minLifeCount || this.#immortal || !this.options.life.count) &&
7680
+ (this.#firstSpawn || this.#currentSpawnDelay >= (this.#spawnDelay ?? defaultSpawnDelay)))) {
7587
7681
  return;
7588
7682
  }
7589
- const container = this._container;
7590
- if (this._emitDelay === undefined) {
7683
+ const container = this.#container;
7684
+ if (this.#emitDelay === undefined) {
7591
7685
  const delay = getRangeValue(this.options.rate.delay);
7592
- this._emitDelay = container.retina.reduceFactor
7686
+ this.#emitDelay = container.retina.reduceFactor
7593
7687
  ? (delay * millisecondsToSeconds) / container.retina.reduceFactor
7594
7688
  : Infinity;
7595
7689
  }
7596
- if (this._lifeCount > minLifeCount || this._immortal) {
7597
- this._prepareToDie();
7690
+ if (this.#lifeCount > minLifeCount || this.#immortal) {
7691
+ this.#prepareToDie();
7598
7692
  }
7599
7693
  }
7600
7694
  resize() {
7601
- const initialPosition = this._initialPosition, container = this._container;
7695
+ const initialPosition = this.#initialPosition, container = this.#container;
7602
7696
  this.position =
7603
7697
  initialPosition && isPointInside(initialPosition, container.canvas.size, Vector.origin)
7604
7698
  ? initialPosition
7605
- : this._calcPosition();
7606
- this._size = this._calcSize();
7607
- this.size = getSize(this._size, container.canvas.size);
7608
- this._shape?.resize(this.position, this.size);
7699
+ : this.#calcPosition();
7700
+ this.#size = this.#calcSize();
7701
+ this.size = getSize(this.#size, container.canvas.size);
7702
+ this.#shape?.resize(this.position, this.size);
7609
7703
  }
7610
7704
  update(delta) {
7611
- if (this._paused) {
7705
+ if (this.#paused) {
7612
7706
  return;
7613
7707
  }
7614
- const container = this._container;
7615
- if (this._firstSpawn) {
7616
- this._firstSpawn = false;
7617
- this._currentSpawnDelay = this._spawnDelay ?? defaultSpawnDelay;
7618
- this._currentEmitDelay = this._emitDelay ?? defaultEmitDelay;
7708
+ const container = this.#container;
7709
+ if (this.#firstSpawn) {
7710
+ this.#firstSpawn = false;
7711
+ this.#currentSpawnDelay = this.#spawnDelay ?? defaultSpawnDelay;
7712
+ this.#currentEmitDelay = this.#emitDelay ?? defaultEmitDelay;
7619
7713
  }
7620
- if (!this._startParticlesAdded) {
7621
- this._startParticlesAdded = true;
7622
- this._emitParticles(this.options.startCount);
7714
+ if (!this.#startParticlesAdded) {
7715
+ this.#startParticlesAdded = true;
7716
+ this.#emitParticles(this.options.startCount);
7623
7717
  }
7624
- if (this._duration !== undefined) {
7625
- this._currentDuration += delta.value;
7626
- if (this._currentDuration >= this._duration) {
7718
+ if (this.#duration !== undefined) {
7719
+ this.#currentDuration += delta.value;
7720
+ if (this.#currentDuration >= this.#duration) {
7627
7721
  this.pause();
7628
- if (this._spawnDelay !== undefined) {
7629
- delete this._spawnDelay;
7722
+ if (this.#spawnDelay !== undefined) {
7723
+ this.#spawnDelay = undefined;
7630
7724
  }
7631
- if (!this._immortal) {
7632
- this._lifeCount--;
7725
+ if (!this.#immortal) {
7726
+ this.#lifeCount--;
7633
7727
  }
7634
- if (this._lifeCount > minLifeCount || this._immortal) {
7635
- this.position = this._calcPosition();
7636
- this._shape?.resize(this.position, this.size);
7637
- this._spawnDelay = container.retina.reduceFactor
7728
+ if (this.#lifeCount > minLifeCount || this.#immortal) {
7729
+ this.position = this.#calcPosition();
7730
+ this.#shape?.resize(this.position, this.size);
7731
+ this.#spawnDelay = container.retina.reduceFactor
7638
7732
  ? (getRangeValue(this.options.life.delay ?? defaultLifeDelay) * millisecondsToSeconds) /
7639
7733
  container.retina.reduceFactor
7640
7734
  : Infinity;
7641
7735
  }
7642
7736
  else {
7643
- this._destroy();
7737
+ this.#destroy();
7644
7738
  }
7645
- this._currentDuration -= this._duration;
7646
- delete this._duration;
7739
+ this.#currentDuration -= this.#duration;
7740
+ this.#duration = undefined;
7647
7741
  }
7648
7742
  }
7649
- if (this._spawnDelay !== undefined) {
7650
- this._currentSpawnDelay += delta.value;
7651
- if (this._currentSpawnDelay >= this._spawnDelay) {
7652
- this._container.dispatchEvent("emitterPlay");
7743
+ if (this.#spawnDelay !== undefined) {
7744
+ this.#currentSpawnDelay += delta.value;
7745
+ if (this.#currentSpawnDelay >= this.#spawnDelay) {
7746
+ this.#container.dispatchEvent("emitterPlay");
7653
7747
  this.play();
7654
- this._currentSpawnDelay -= this._spawnDelay;
7655
- delete this._spawnDelay;
7748
+ this.#currentSpawnDelay -= this.#spawnDelay;
7749
+ this.#spawnDelay = undefined;
7656
7750
  }
7657
7751
  }
7658
- if (this._emitDelay !== undefined) {
7659
- this._currentEmitDelay += delta.value;
7660
- if (this._currentEmitDelay >= this._emitDelay) {
7661
- this._emit();
7662
- this._currentEmitDelay -= this._emitDelay;
7752
+ if (this.#emitDelay !== undefined) {
7753
+ this.#currentEmitDelay += delta.value;
7754
+ if (this.#currentEmitDelay >= this.#emitDelay) {
7755
+ this.#emit();
7756
+ this.#currentEmitDelay -= this.#emitDelay;
7663
7757
  }
7664
7758
  }
7665
7759
  }
7666
- _calcPosition() {
7667
- const container = this._container;
7760
+ #calcPosition() {
7761
+ const container = this.#container;
7668
7762
  if (this.options.domId) {
7669
7763
  const element = safeDocument().getElementById(this.options.domId);
7670
7764
  if (element) {
@@ -7680,8 +7774,8 @@
7680
7774
  position: this.options.position,
7681
7775
  });
7682
7776
  }
7683
- _calcSize() {
7684
- const container = this._container;
7777
+ #calcSize() {
7778
+ const container = this.#container;
7685
7779
  if (this.options.domId) {
7686
7780
  const element = safeDocument().getElementById(this.options.domId);
7687
7781
  if (element) {
@@ -7704,32 +7798,32 @@
7704
7798
  return size;
7705
7799
  })());
7706
7800
  }
7707
- _destroy = () => {
7708
- this._mutationObserver?.disconnect();
7709
- this._mutationObserver = undefined;
7710
- this._resizeObserver?.disconnect();
7711
- this._resizeObserver = undefined;
7712
- this._removeCallback(this);
7713
- this._container.dispatchEvent("emitterDestroyed", {
7801
+ #destroy = () => {
7802
+ this.#mutationObserver?.disconnect();
7803
+ this.#mutationObserver = undefined;
7804
+ this.#resizeObserver?.disconnect();
7805
+ this.#resizeObserver = undefined;
7806
+ this.#removeCallback(this);
7807
+ this.#container.dispatchEvent("emitterDestroyed", {
7714
7808
  emitter: this,
7715
7809
  });
7716
7810
  };
7717
- _emit() {
7718
- if (this._paused) {
7811
+ #emit() {
7812
+ if (this.#paused) {
7719
7813
  return;
7720
7814
  }
7721
7815
  const quantity = getRangeValue(this.options.rate.quantity);
7722
- this._emitParticles(quantity);
7816
+ this.#emitParticles(quantity);
7723
7817
  }
7724
- _emitParticles(quantity) {
7725
- const singleParticlesOptions = (itemFromSingleOrMultiple(this._particlesOptions) ??
7818
+ #emitParticles(quantity) {
7819
+ const singleParticlesOptions = (itemFromSingleOrMultiple(this.#particlesOptions) ??
7726
7820
  {}), fillHslAnimation = this.options.spawn.fill?.color?.animation, fillEnabled = this.options.spawn.fill?.enable ?? !!this.options.spawn.fill?.color, fillOpacity = this.options.spawn.fill?.opacity === undefined
7727
7821
  ? defaultOpacity$1
7728
7822
  : getRangeValue(this.options.spawn.fill.opacity), strokeHslAnimation = this.options.spawn.stroke?.color?.animation, strokeOpacity = this.options.spawn.stroke?.opacity === undefined
7729
7823
  ? defaultOpacity$1
7730
7824
  : getRangeValue(this.options.spawn.stroke.opacity), strokeWidth = this.options.spawn.stroke?.width === undefined
7731
7825
  ? defaultStrokeWidth
7732
- : getRangeValue(this.options.spawn.stroke.width), reduceFactor = this._container.retina.reduceFactor, needsFillColorAnimation = !!fillHslAnimation, needsStrokeColorAnimation = !!strokeHslAnimation, needsShapeData = !!this._shape, needsColorAnimation = needsFillColorAnimation || needsStrokeColorAnimation, needsCopy = needsColorAnimation || needsShapeData, maxValues = needsColorAnimation ? { h: hMax, s: sMax, l: lMax } : null, shapeOptions = this.options.shape;
7826
+ : getRangeValue(this.options.spawn.stroke.width), reduceFactor = this.#container.retina.reduceFactor, needsFillColorAnimation = !!fillHslAnimation, needsStrokeColorAnimation = !!strokeHslAnimation, needsShapeData = !!this.#shape, needsColorAnimation = needsFillColorAnimation || needsStrokeColorAnimation, needsCopy = needsColorAnimation || needsShapeData, maxValues = needsColorAnimation ? { h: hMax, s: sMax, l: lMax } : null, shapeOptions = this.options.shape;
7733
7827
  for (let i = 0; i < quantity * reduceFactor; i++) {
7734
7828
  const particlesOptions = needsCopy
7735
7829
  ? deepExtend({}, singleParticlesOptions)
@@ -7740,23 +7834,23 @@
7740
7834
  this.spawnStrokeWidth = strokeWidth;
7741
7835
  if (this.spawnFillColor) {
7742
7836
  if (fillHslAnimation && maxValues) {
7743
- this.spawnFillColor.h = this._setColorAnimation(fillHslAnimation.h, this.spawnFillColor.h, maxValues.h, colorFactor);
7744
- this.spawnFillColor.s = this._setColorAnimation(fillHslAnimation.s, this.spawnFillColor.s, maxValues.s);
7745
- this.spawnFillColor.l = this._setColorAnimation(fillHslAnimation.l, this.spawnFillColor.l, maxValues.l);
7837
+ this.spawnFillColor.h = this.#setColorAnimation(fillHslAnimation.h, this.spawnFillColor.h, maxValues.h, colorFactor);
7838
+ this.spawnFillColor.s = this.#setColorAnimation(fillHslAnimation.s, this.spawnFillColor.s, maxValues.s);
7839
+ this.spawnFillColor.l = this.#setColorAnimation(fillHslAnimation.l, this.spawnFillColor.l, maxValues.l);
7746
7840
  }
7747
7841
  setParticlesOptionsFillColor(particlesOptions, this.spawnFillColor, this.spawnFillOpacity, this.spawnFillEnabled);
7748
7842
  }
7749
7843
  if (this.spawnStrokeColor) {
7750
7844
  if (strokeHslAnimation && maxValues) {
7751
- this.spawnStrokeColor.h = this._setColorAnimation(strokeHslAnimation.h, this.spawnStrokeColor.h, maxValues.h, colorFactor);
7752
- this.spawnStrokeColor.s = this._setColorAnimation(strokeHslAnimation.s, this.spawnStrokeColor.s, maxValues.s);
7753
- this.spawnStrokeColor.l = this._setColorAnimation(strokeHslAnimation.l, this.spawnStrokeColor.l, maxValues.l);
7845
+ this.spawnStrokeColor.h = this.#setColorAnimation(strokeHslAnimation.h, this.spawnStrokeColor.h, maxValues.h, colorFactor);
7846
+ this.spawnStrokeColor.s = this.#setColorAnimation(strokeHslAnimation.s, this.spawnStrokeColor.s, maxValues.s);
7847
+ this.spawnStrokeColor.l = this.#setColorAnimation(strokeHslAnimation.l, this.spawnStrokeColor.l, maxValues.l);
7754
7848
  }
7755
7849
  setParticlesOptionsStrokeColor(particlesOptions, this.spawnStrokeColor, this.spawnStrokeOpacity, this.spawnStrokeWidth);
7756
7850
  }
7757
7851
  let position = this.position;
7758
- if (this._shape) {
7759
- const shapePosData = this._shape.randomPosition();
7852
+ if (this.#shape) {
7853
+ const shapePosData = this.#shape.randomPosition();
7760
7854
  if (shapePosData) {
7761
7855
  position = shapePosData.position;
7762
7856
  const replaceData = shapeOptions.replace;
@@ -7769,21 +7863,21 @@
7769
7863
  }
7770
7864
  }
7771
7865
  if (position) {
7772
- this._container.particles.addParticle(position, particlesOptions);
7866
+ this.#container.particles.addParticle(position, particlesOptions);
7773
7867
  }
7774
7868
  }
7775
7869
  }
7776
- _prepareToDie = () => {
7777
- if (this._paused) {
7870
+ #prepareToDie = () => {
7871
+ if (this.#paused) {
7778
7872
  return;
7779
7873
  }
7780
7874
  const duration = this.options.life.duration !== undefined ? getRangeValue(this.options.life.duration) : undefined, minDuration = 0, minLifeCount = 0;
7781
- if ((this._lifeCount > minLifeCount || this._immortal) && duration !== undefined && duration > minDuration) {
7782
- this._duration = duration * millisecondsToSeconds;
7875
+ if ((this.#lifeCount > minLifeCount || this.#immortal) && duration !== undefined && duration > minDuration) {
7876
+ this.#duration = duration * millisecondsToSeconds;
7783
7877
  }
7784
7878
  };
7785
- _setColorAnimation = (animation, initValue, maxValue, factor = defaultColorAnimationFactor) => {
7786
- const container = this._container;
7879
+ #setColorAnimation = (animation, initValue, maxValue, factor = defaultColorAnimationFactor) => {
7880
+ const container = this.#container;
7787
7881
  if (!animation.enable) {
7788
7882
  return initValue;
7789
7883
  }