@tsparticles/engine 3.5.0 → 3.6.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -18,8 +18,6 @@ React.js, Vue.js (2.x and 3.x), Angular, Svelte, jQuery, Preact, Inferno, Riot.j
18
18
  [![Run on Repl.it](https://repl.it/badge/github/tsparticles/tsparticles)](https://repl.it/github/tsparticles/tsparticles)
19
19
 
20
20
  [![Discord](https://img.shields.io/discord/872061157379301416?label=discord&logo=discord&logoColor=white&style=for-the-badge)](https://discord.gg/hACwv45Hme)
21
- [![Slack](https://particles.js.org/images/slack.png)](https://join.slack.com/t/tsparticles/shared_invite/enQtOTcxNTQxNjQ4NzkxLWE2MTZhZWExMWRmOWI5MTMxNjczOGE1Yjk0MjViYjdkYTUzODM3OTc5MGQ5MjFlODc4MzE0N2Q1OWQxZDc1YzI)
22
- [![WhatsApp](https://particles.js.org/images/WhatsApp.png)](https://chat.whatsapp.com/KQyHc9UEbRc2qlqNQR2J5c)
23
21
  [![Telegram](https://particles.js.org/images/telegram.png)](https://t.me/tsparticles)
24
22
  [![Reddit](https://img.shields.io/reddit/subreddit-subscribers/tsParticles?style=for-the-badge)](https://www.reddit.com/r/tsParticles/)
25
23
 
@@ -22,9 +22,6 @@ function setStyle(canvas, style, important = false) {
22
22
  }
23
23
  for (const key in style) {
24
24
  const value = style[key];
25
- if (!value) {
26
- continue;
27
- }
28
25
  elementStyle.setProperty(key, value, important ? "important" : "");
29
26
  }
30
27
  }
@@ -208,10 +205,11 @@ export class Canvas {
208
205
  if (!element) {
209
206
  return;
210
207
  }
211
- const radix = 10;
208
+ const radix = 10, zIndex = this.container.actualOptions.fullScreen.zIndex.toString(radix);
212
209
  setStyle(element, {
213
210
  position: "fixed",
214
- zIndex: this.container.actualOptions.fullScreen.zIndex.toString(radix),
211
+ "z-index": zIndex,
212
+ zIndex: zIndex,
215
213
  top: "0",
216
214
  left: "0",
217
215
  width: "100%",
@@ -378,7 +376,7 @@ export class Canvas {
378
376
  }
379
377
  initPlugins() {
380
378
  this._resizePlugins = [];
381
- for (const [, plugin] of this.container.plugins) {
379
+ for (const plugin of this.container.plugins.values()) {
382
380
  if (plugin.resize) {
383
381
  this._resizePlugins.push(plugin);
384
382
  }
@@ -220,10 +220,10 @@ export class Container {
220
220
  this.clearClickHandlers();
221
221
  this.particles.destroy();
222
222
  this.canvas.destroy();
223
- for (const [, effectDrawer] of this.effectDrawers) {
223
+ for (const effectDrawer of this.effectDrawers.values()) {
224
224
  effectDrawer.destroy?.(this);
225
225
  }
226
- for (const [, shapeDrawer] of this.shapeDrawers) {
226
+ for (const shapeDrawer of this.shapeDrawers.values()) {
227
227
  shapeDrawer.destroy?.(this);
228
228
  }
229
229
  for (const key of this.effectDrawers.keys()) {
@@ -258,7 +258,7 @@ export class Container {
258
258
  this._drawAnimationFrame = animate(timestamp => frame(timestamp));
259
259
  }
260
260
  async export(type, options = {}) {
261
- for (const [, plugin] of this.plugins) {
261
+ for (const plugin of this.plugins.values()) {
262
262
  if (!plugin.export) {
263
263
  continue;
264
264
  }
@@ -275,7 +275,7 @@ export class Container {
275
275
  return;
276
276
  }
277
277
  this.particles.handleClickMode(mode);
278
- for (const [, plugin] of this.plugins) {
278
+ for (const plugin of this.plugins.values()) {
279
279
  plugin.handleClickMode?.(mode);
280
280
  }
281
281
  }
@@ -317,19 +317,19 @@ export class Container {
317
317
  const defaultFpsLimit = 120, minFpsLimit = 0;
318
318
  this.fpsLimit = fpsLimit > minFpsLimit ? fpsLimit : defaultFpsLimit;
319
319
  this._smooth = smooth;
320
- for (const [, drawer] of this.effectDrawers) {
320
+ for (const drawer of this.effectDrawers.values()) {
321
321
  await drawer.init?.(this);
322
322
  }
323
- for (const [, drawer] of this.shapeDrawers) {
323
+ for (const drawer of this.shapeDrawers.values()) {
324
324
  await drawer.init?.(this);
325
325
  }
326
- for (const [, plugin] of this.plugins) {
326
+ for (const plugin of this.plugins.values()) {
327
327
  await plugin.init?.();
328
328
  }
329
329
  this._engine.dispatchEvent(EventType.containerInit, { container: this });
330
330
  await this.particles.init();
331
331
  this.particles.setDensity();
332
- for (const [, plugin] of this.plugins) {
332
+ for (const plugin of this.plugins.values()) {
333
333
  plugin.particlesSetup?.();
334
334
  }
335
335
  this._engine.dispatchEvent(EventType.particlesSetup, { container: this });
@@ -352,7 +352,7 @@ export class Container {
352
352
  if (this._paused) {
353
353
  return;
354
354
  }
355
- for (const [, plugin] of this.plugins) {
355
+ for (const plugin of this.plugins.values()) {
356
356
  plugin.pause?.();
357
357
  }
358
358
  if (!this.pageHidden) {
@@ -373,7 +373,7 @@ export class Container {
373
373
  this._paused = false;
374
374
  }
375
375
  if (needsUpdate) {
376
- for (const [, plugin] of this.plugins) {
376
+ for (const plugin of this.plugins.values()) {
377
377
  if (plugin.play) {
378
378
  plugin.play();
379
379
  }
@@ -411,7 +411,7 @@ export class Container {
411
411
  if (this.interactivity.element instanceof HTMLElement && this._intersectionObserver) {
412
412
  this._intersectionObserver.observe(this.interactivity.element);
413
413
  }
414
- for (const [, plugin] of this.plugins) {
414
+ for (const plugin of this.plugins.values()) {
415
415
  await plugin.start?.();
416
416
  }
417
417
  this._engine.dispatchEvent(EventType.containerStarted, { container: this });
@@ -438,7 +438,7 @@ export class Container {
438
438
  if (this.interactivity.element instanceof HTMLElement && this._intersectionObserver) {
439
439
  this._intersectionObserver.unobserve(this.interactivity.element);
440
440
  }
441
- for (const [, plugin] of this.plugins) {
441
+ for (const plugin of this.plugins.values()) {
442
442
  plugin.stop?.();
443
443
  }
444
444
  for (const key of this.plugins.keys()) {
@@ -95,7 +95,7 @@ export class Engine {
95
95
  return this._domArray;
96
96
  }
97
97
  get version() {
98
- return "3.5.0";
98
+ return "3.6.0-beta.0";
99
99
  }
100
100
  addConfig(config) {
101
101
  const key = config.key ?? config.name ?? "default";
@@ -48,7 +48,7 @@ export class Particle {
48
48
  constructor(engine, container) {
49
49
  this.container = container;
50
50
  this._calcPosition = (container, position, zIndex, tryCount = defaultRetryCount) => {
51
- for (const [, plugin] of container.plugins) {
51
+ for (const plugin of container.plugins.values()) {
52
52
  const pluginPos = plugin.particlePosition !== undefined ? plugin.particlePosition(position, this) : undefined;
53
53
  if (pluginPos) {
54
54
  return Vector3d.create(pluginPos.x, pluginPos.y, zIndex);
@@ -166,7 +166,7 @@ export class Particle {
166
166
  this.slow.inRange = false;
167
167
  const container = this.container, pathGenerator = this.pathGenerator, shapeDrawer = container.shapeDrawers.get(this.shape);
168
168
  shapeDrawer?.particleDestroy?.(this);
169
- for (const [, plugin] of container.plugins) {
169
+ for (const plugin of container.plugins.values()) {
170
170
  plugin.particleDestroyed?.(this, override);
171
171
  }
172
172
  for (const updater of container.particles.updaters) {
@@ -182,7 +182,7 @@ export class Particle {
182
182
  }
183
183
  draw(delta) {
184
184
  const container = this.container, canvas = container.canvas;
185
- for (const [, plugin] of container.plugins) {
185
+ for (const plugin of container.plugins.values()) {
186
186
  canvas.drawParticlePlugin(plugin, this, delta);
187
187
  }
188
188
  canvas.drawParticle(this, delta);
@@ -334,7 +334,7 @@ export class Particle {
334
334
  }
335
335
  effectDrawer?.particleInit?.(container, this);
336
336
  shapeDrawer?.particleInit?.(container, this);
337
- for (const [, plugin] of container.plugins) {
337
+ for (const plugin of container.plugins.values()) {
338
338
  plugin.particleCreated?.(this);
339
339
  }
340
340
  }
@@ -122,7 +122,7 @@ export class Particles {
122
122
  options.manualParticles.forEach(p => this.addParticle(p.position ? getPosition(p.position, container.canvas.size) : undefined, p.options));
123
123
  }
124
124
  addParticle(position, overrideOptions, group, initializer) {
125
- const limitMode = this._container.actualOptions.particles.number.limit.mode, limit = group === undefined ? this._limit : this._groupLimits.get(group) ?? this._limit, currentCount = this.count, minLimit = 0;
125
+ const limitMode = this._container.actualOptions.particles.number.limit.mode, limit = group === undefined ? this._limit : (this._groupLimits.get(group) ?? this._limit), currentCount = this.count, minLimit = 0;
126
126
  if (limit > minLimit) {
127
127
  switch (limitMode) {
128
128
  case LimitMode.delete: {
@@ -156,7 +156,7 @@ export class Particles {
156
156
  const container = this._container, canvas = container.canvas;
157
157
  canvas.clear();
158
158
  this.update(delta);
159
- for (const [, plugin] of container.plugins) {
159
+ for (const plugin of container.plugins.values()) {
160
160
  canvas.drawPlugin(plugin, delta);
161
161
  }
162
162
  for (const p of this._zArray) {
@@ -181,7 +181,7 @@ export class Particles {
181
181
  this._needsSort = false;
182
182
  await this.initPlugins();
183
183
  let handled = false;
184
- for (const [, plugin] of container.plugins) {
184
+ for (const plugin of container.plugins.values()) {
185
185
  handled = plugin.particlesInitialization?.() ?? handled;
186
186
  if (handled) {
187
187
  break;
@@ -209,7 +209,7 @@ export class Particles {
209
209
  this.movers = await this._engine.getMovers(container, true);
210
210
  this.updaters = await this._engine.getUpdaters(container, true);
211
211
  await this._interactionManager.init();
212
- for (const [, pathGenerator] of container.pathGenerators) {
212
+ for (const pathGenerator of container.pathGenerators.values()) {
213
213
  pathGenerator.init(container);
214
214
  }
215
215
  }
@@ -233,7 +233,8 @@ export class Particles {
233
233
  }
234
234
  let deleted = 0;
235
235
  for (let i = index; deleted < quantity && i < this.count; i++) {
236
- if (this._removeParticle(i--, group, override)) {
236
+ if (this._removeParticle(i, group, override)) {
237
+ i--;
237
238
  deleted++;
238
239
  }
239
240
  }
@@ -259,10 +260,10 @@ export class Particles {
259
260
  update(delta) {
260
261
  const container = this._container, particlesToDelete = new Set();
261
262
  this.quadTree = new QuadTree(qTreeRectangle(container.canvas.size), qTreeCapacity);
262
- for (const [, pathGenerator] of container.pathGenerators) {
263
+ for (const pathGenerator of container.pathGenerators.values()) {
263
264
  pathGenerator.update();
264
265
  }
265
- for (const [, plugin] of container.plugins) {
266
+ for (const plugin of container.plugins.values()) {
266
267
  plugin.update?.(delta);
267
268
  }
268
269
  const resizeFactor = this._resizeFactor;
@@ -275,7 +276,7 @@ export class Particles {
275
276
  }
276
277
  particle.ignoresResizeRatio = false;
277
278
  this._interactionManager.reset(particle);
278
- for (const [, plugin] of this._container.plugins) {
279
+ for (const plugin of this._container.plugins.values()) {
279
280
  if (particle.destroyed) {
280
281
  break;
281
282
  }
@@ -187,7 +187,7 @@ export class EventListeners {
187
187
  if (!mousePosition || !options.interactivity.events.onClick.enable) {
188
188
  return;
189
189
  }
190
- for (const [, plugin] of container.plugins) {
190
+ for (const plugin of container.plugins.values()) {
191
191
  if (!plugin.clickPositionValid) {
192
192
  continue;
193
193
  }
@@ -33,8 +33,8 @@ export function drawParticle(data) {
33
33
  cos: Math.cos(angle),
34
34
  }, rotating = !!angle, identity = 1, transformData = {
35
35
  a: rotateData.cos * (transform.a ?? defaultTransform.a),
36
- b: rotating ? rotateData.sin * (transform.b ?? identity) : transform.b ?? defaultTransform.b,
37
- c: rotating ? -rotateData.sin * (transform.c ?? identity) : transform.c ?? defaultTransform.c,
36
+ b: rotating ? rotateData.sin * (transform.b ?? identity) : (transform.b ?? defaultTransform.b),
37
+ c: rotating ? -rotateData.sin * (transform.c ?? identity) : (transform.c ?? defaultTransform.c),
38
38
  d: rotateData.cos * (transform.d ?? defaultTransform.d),
39
39
  };
40
40
  context.setTransform(transformData.a, transformData.b, transformData.c, transformData.d, pos.x, pos.y);
@@ -15,7 +15,7 @@ export function addColorManager(manager) {
15
15
  colorManagers.set(manager.key, manager);
16
16
  }
17
17
  function stringToRgba(input) {
18
- for (const [, manager] of colorManagers) {
18
+ for (const manager of colorManagers.values()) {
19
19
  if (input.startsWith(manager.stringPrefix)) {
20
20
  return manager.parseString(input);
21
21
  }
@@ -47,7 +47,7 @@ export function rangeColorToRgb(input, index, useIndex = true) {
47
47
  value: itemFromArray(color.value, index, useIndex),
48
48
  });
49
49
  }
50
- for (const [, manager] of colorManagers) {
50
+ for (const manager of colorManagers.values()) {
51
51
  const res = manager.handleRangeColor(color);
52
52
  if (res) {
53
53
  return res;
@@ -67,7 +67,7 @@ export function colorToRgb(input, index, useIndex = true) {
67
67
  value: itemFromArray(color.value, index, useIndex),
68
68
  });
69
69
  }
70
- for (const [, manager] of colorManagers) {
70
+ for (const manager of colorManagers.values()) {
71
71
  const res = manager.handleColor(color);
72
72
  if (res) {
73
73
  return res;
@@ -25,9 +25,6 @@ function setStyle(canvas, style, important = false) {
25
25
  }
26
26
  for (const key in style) {
27
27
  const value = style[key];
28
- if (!value) {
29
- continue;
30
- }
31
28
  elementStyle.setProperty(key, value, important ? "important" : "");
32
29
  }
33
30
  }
@@ -211,10 +208,11 @@ class Canvas {
211
208
  if (!element) {
212
209
  return;
213
210
  }
214
- const radix = 10;
211
+ const radix = 10, zIndex = this.container.actualOptions.fullScreen.zIndex.toString(radix);
215
212
  setStyle(element, {
216
213
  position: "fixed",
217
- zIndex: this.container.actualOptions.fullScreen.zIndex.toString(radix),
214
+ "z-index": zIndex,
215
+ zIndex: zIndex,
218
216
  top: "0",
219
217
  left: "0",
220
218
  width: "100%",
@@ -381,7 +379,7 @@ class Canvas {
381
379
  }
382
380
  initPlugins() {
383
381
  this._resizePlugins = [];
384
- for (const [, plugin] of this.container.plugins) {
382
+ for (const plugin of this.container.plugins.values()) {
385
383
  if (plugin.resize) {
386
384
  this._resizePlugins.push(plugin);
387
385
  }
@@ -223,10 +223,10 @@ class Container {
223
223
  this.clearClickHandlers();
224
224
  this.particles.destroy();
225
225
  this.canvas.destroy();
226
- for (const [, effectDrawer] of this.effectDrawers) {
226
+ for (const effectDrawer of this.effectDrawers.values()) {
227
227
  effectDrawer.destroy?.(this);
228
228
  }
229
- for (const [, shapeDrawer] of this.shapeDrawers) {
229
+ for (const shapeDrawer of this.shapeDrawers.values()) {
230
230
  shapeDrawer.destroy?.(this);
231
231
  }
232
232
  for (const key of this.effectDrawers.keys()) {
@@ -261,7 +261,7 @@ class Container {
261
261
  this._drawAnimationFrame = (0, NumberUtils_js_1.animate)(timestamp => frame(timestamp));
262
262
  }
263
263
  async export(type, options = {}) {
264
- for (const [, plugin] of this.plugins) {
264
+ for (const plugin of this.plugins.values()) {
265
265
  if (!plugin.export) {
266
266
  continue;
267
267
  }
@@ -278,7 +278,7 @@ class Container {
278
278
  return;
279
279
  }
280
280
  this.particles.handleClickMode(mode);
281
- for (const [, plugin] of this.plugins) {
281
+ for (const plugin of this.plugins.values()) {
282
282
  plugin.handleClickMode?.(mode);
283
283
  }
284
284
  }
@@ -320,19 +320,19 @@ class Container {
320
320
  const defaultFpsLimit = 120, minFpsLimit = 0;
321
321
  this.fpsLimit = fpsLimit > minFpsLimit ? fpsLimit : defaultFpsLimit;
322
322
  this._smooth = smooth;
323
- for (const [, drawer] of this.effectDrawers) {
323
+ for (const drawer of this.effectDrawers.values()) {
324
324
  await drawer.init?.(this);
325
325
  }
326
- for (const [, drawer] of this.shapeDrawers) {
326
+ for (const drawer of this.shapeDrawers.values()) {
327
327
  await drawer.init?.(this);
328
328
  }
329
- for (const [, plugin] of this.plugins) {
329
+ for (const plugin of this.plugins.values()) {
330
330
  await plugin.init?.();
331
331
  }
332
332
  this._engine.dispatchEvent(EventType_js_1.EventType.containerInit, { container: this });
333
333
  await this.particles.init();
334
334
  this.particles.setDensity();
335
- for (const [, plugin] of this.plugins) {
335
+ for (const plugin of this.plugins.values()) {
336
336
  plugin.particlesSetup?.();
337
337
  }
338
338
  this._engine.dispatchEvent(EventType_js_1.EventType.particlesSetup, { container: this });
@@ -355,7 +355,7 @@ class Container {
355
355
  if (this._paused) {
356
356
  return;
357
357
  }
358
- for (const [, plugin] of this.plugins) {
358
+ for (const plugin of this.plugins.values()) {
359
359
  plugin.pause?.();
360
360
  }
361
361
  if (!this.pageHidden) {
@@ -376,7 +376,7 @@ class Container {
376
376
  this._paused = false;
377
377
  }
378
378
  if (needsUpdate) {
379
- for (const [, plugin] of this.plugins) {
379
+ for (const plugin of this.plugins.values()) {
380
380
  if (plugin.play) {
381
381
  plugin.play();
382
382
  }
@@ -414,7 +414,7 @@ class Container {
414
414
  if (this.interactivity.element instanceof HTMLElement && this._intersectionObserver) {
415
415
  this._intersectionObserver.observe(this.interactivity.element);
416
416
  }
417
- for (const [, plugin] of this.plugins) {
417
+ for (const plugin of this.plugins.values()) {
418
418
  await plugin.start?.();
419
419
  }
420
420
  this._engine.dispatchEvent(EventType_js_1.EventType.containerStarted, { container: this });
@@ -441,7 +441,7 @@ class Container {
441
441
  if (this.interactivity.element instanceof HTMLElement && this._intersectionObserver) {
442
442
  this._intersectionObserver.unobserve(this.interactivity.element);
443
443
  }
444
- for (const [, plugin] of this.plugins) {
444
+ for (const plugin of this.plugins.values()) {
445
445
  plugin.stop?.();
446
446
  }
447
447
  for (const key of this.plugins.keys()) {
@@ -98,7 +98,7 @@ class Engine {
98
98
  return this._domArray;
99
99
  }
100
100
  get version() {
101
- return "3.5.0";
101
+ return "3.6.0-beta.0";
102
102
  }
103
103
  addConfig(config) {
104
104
  const key = config.key ?? config.name ?? "default";
@@ -51,7 +51,7 @@ class Particle {
51
51
  constructor(engine, container) {
52
52
  this.container = container;
53
53
  this._calcPosition = (container, position, zIndex, tryCount = defaultRetryCount) => {
54
- for (const [, plugin] of container.plugins) {
54
+ for (const plugin of container.plugins.values()) {
55
55
  const pluginPos = plugin.particlePosition !== undefined ? plugin.particlePosition(position, this) : undefined;
56
56
  if (pluginPos) {
57
57
  return Vectors_js_1.Vector3d.create(pluginPos.x, pluginPos.y, zIndex);
@@ -169,7 +169,7 @@ class Particle {
169
169
  this.slow.inRange = false;
170
170
  const container = this.container, pathGenerator = this.pathGenerator, shapeDrawer = container.shapeDrawers.get(this.shape);
171
171
  shapeDrawer?.particleDestroy?.(this);
172
- for (const [, plugin] of container.plugins) {
172
+ for (const plugin of container.plugins.values()) {
173
173
  plugin.particleDestroyed?.(this, override);
174
174
  }
175
175
  for (const updater of container.particles.updaters) {
@@ -185,7 +185,7 @@ class Particle {
185
185
  }
186
186
  draw(delta) {
187
187
  const container = this.container, canvas = container.canvas;
188
- for (const [, plugin] of container.plugins) {
188
+ for (const plugin of container.plugins.values()) {
189
189
  canvas.drawParticlePlugin(plugin, this, delta);
190
190
  }
191
191
  canvas.drawParticle(this, delta);
@@ -337,7 +337,7 @@ class Particle {
337
337
  }
338
338
  effectDrawer?.particleInit?.(container, this);
339
339
  shapeDrawer?.particleInit?.(container, this);
340
- for (const [, plugin] of container.plugins) {
340
+ for (const plugin of container.plugins.values()) {
341
341
  plugin.particleCreated?.(this);
342
342
  }
343
343
  }
@@ -125,7 +125,7 @@ class Particles {
125
125
  options.manualParticles.forEach(p => this.addParticle(p.position ? (0, Utils_js_1.getPosition)(p.position, container.canvas.size) : undefined, p.options));
126
126
  }
127
127
  addParticle(position, overrideOptions, group, initializer) {
128
- const limitMode = this._container.actualOptions.particles.number.limit.mode, limit = group === undefined ? this._limit : this._groupLimits.get(group) ?? this._limit, currentCount = this.count, minLimit = 0;
128
+ const limitMode = this._container.actualOptions.particles.number.limit.mode, limit = group === undefined ? this._limit : (this._groupLimits.get(group) ?? this._limit), currentCount = this.count, minLimit = 0;
129
129
  if (limit > minLimit) {
130
130
  switch (limitMode) {
131
131
  case LimitMode_js_1.LimitMode.delete: {
@@ -159,7 +159,7 @@ class Particles {
159
159
  const container = this._container, canvas = container.canvas;
160
160
  canvas.clear();
161
161
  this.update(delta);
162
- for (const [, plugin] of container.plugins) {
162
+ for (const plugin of container.plugins.values()) {
163
163
  canvas.drawPlugin(plugin, delta);
164
164
  }
165
165
  for (const p of this._zArray) {
@@ -184,7 +184,7 @@ class Particles {
184
184
  this._needsSort = false;
185
185
  await this.initPlugins();
186
186
  let handled = false;
187
- for (const [, plugin] of container.plugins) {
187
+ for (const plugin of container.plugins.values()) {
188
188
  handled = plugin.particlesInitialization?.() ?? handled;
189
189
  if (handled) {
190
190
  break;
@@ -212,7 +212,7 @@ class Particles {
212
212
  this.movers = await this._engine.getMovers(container, true);
213
213
  this.updaters = await this._engine.getUpdaters(container, true);
214
214
  await this._interactionManager.init();
215
- for (const [, pathGenerator] of container.pathGenerators) {
215
+ for (const pathGenerator of container.pathGenerators.values()) {
216
216
  pathGenerator.init(container);
217
217
  }
218
218
  }
@@ -236,7 +236,8 @@ class Particles {
236
236
  }
237
237
  let deleted = 0;
238
238
  for (let i = index; deleted < quantity && i < this.count; i++) {
239
- if (this._removeParticle(i--, group, override)) {
239
+ if (this._removeParticle(i, group, override)) {
240
+ i--;
240
241
  deleted++;
241
242
  }
242
243
  }
@@ -262,10 +263,10 @@ class Particles {
262
263
  update(delta) {
263
264
  const container = this._container, particlesToDelete = new Set();
264
265
  this.quadTree = new QuadTree_js_1.QuadTree(qTreeRectangle(container.canvas.size), qTreeCapacity);
265
- for (const [, pathGenerator] of container.pathGenerators) {
266
+ for (const pathGenerator of container.pathGenerators.values()) {
266
267
  pathGenerator.update();
267
268
  }
268
- for (const [, plugin] of container.plugins) {
269
+ for (const plugin of container.plugins.values()) {
269
270
  plugin.update?.(delta);
270
271
  }
271
272
  const resizeFactor = this._resizeFactor;
@@ -278,7 +279,7 @@ class Particles {
278
279
  }
279
280
  particle.ignoresResizeRatio = false;
280
281
  this._interactionManager.reset(particle);
281
- for (const [, plugin] of this._container.plugins) {
282
+ for (const plugin of this._container.plugins.values()) {
282
283
  if (particle.destroyed) {
283
284
  break;
284
285
  }
@@ -190,7 +190,7 @@ class EventListeners {
190
190
  if (!mousePosition || !options.interactivity.events.onClick.enable) {
191
191
  return;
192
192
  }
193
- for (const [, plugin] of container.plugins) {
193
+ for (const plugin of container.plugins.values()) {
194
194
  if (!plugin.clickPositionValid) {
195
195
  continue;
196
196
  }
@@ -46,8 +46,8 @@ function drawParticle(data) {
46
46
  cos: Math.cos(angle),
47
47
  }, rotating = !!angle, identity = 1, transformData = {
48
48
  a: rotateData.cos * (transform.a ?? defaultTransform.a),
49
- b: rotating ? rotateData.sin * (transform.b ?? identity) : transform.b ?? defaultTransform.b,
50
- c: rotating ? -rotateData.sin * (transform.c ?? identity) : transform.c ?? defaultTransform.c,
49
+ b: rotating ? rotateData.sin * (transform.b ?? identity) : (transform.b ?? defaultTransform.b),
50
+ c: rotating ? -rotateData.sin * (transform.c ?? identity) : (transform.c ?? defaultTransform.c),
51
51
  d: rotateData.cos * (transform.d ?? defaultTransform.d),
52
52
  };
53
53
  context.setTransform(transformData.a, transformData.b, transformData.c, transformData.d, pos.x, pos.y);
@@ -37,7 +37,7 @@ function addColorManager(manager) {
37
37
  colorManagers.set(manager.key, manager);
38
38
  }
39
39
  function stringToRgba(input) {
40
- for (const [, manager] of colorManagers) {
40
+ for (const manager of colorManagers.values()) {
41
41
  if (input.startsWith(manager.stringPrefix)) {
42
42
  return manager.parseString(input);
43
43
  }
@@ -69,7 +69,7 @@ function rangeColorToRgb(input, index, useIndex = true) {
69
69
  value: (0, Utils_js_1.itemFromArray)(color.value, index, useIndex),
70
70
  });
71
71
  }
72
- for (const [, manager] of colorManagers) {
72
+ for (const manager of colorManagers.values()) {
73
73
  const res = manager.handleRangeColor(color);
74
74
  if (res) {
75
75
  return res;
@@ -89,7 +89,7 @@ function colorToRgb(input, index, useIndex = true) {
89
89
  value: (0, Utils_js_1.itemFromArray)(color.value, index, useIndex),
90
90
  });
91
91
  }
92
- for (const [, manager] of colorManagers) {
92
+ for (const manager of colorManagers.values()) {
93
93
  const res = manager.handleColor(color);
94
94
  if (res) {
95
95
  return res;
@@ -22,9 +22,6 @@ function setStyle(canvas, style, important = false) {
22
22
  }
23
23
  for (const key in style) {
24
24
  const value = style[key];
25
- if (!value) {
26
- continue;
27
- }
28
25
  elementStyle.setProperty(key, value, important ? "important" : "");
29
26
  }
30
27
  }
@@ -208,10 +205,11 @@ export class Canvas {
208
205
  if (!element) {
209
206
  return;
210
207
  }
211
- const radix = 10;
208
+ const radix = 10, zIndex = this.container.actualOptions.fullScreen.zIndex.toString(radix);
212
209
  setStyle(element, {
213
210
  position: "fixed",
214
- zIndex: this.container.actualOptions.fullScreen.zIndex.toString(radix),
211
+ "z-index": zIndex,
212
+ zIndex: zIndex,
215
213
  top: "0",
216
214
  left: "0",
217
215
  width: "100%",
@@ -378,7 +376,7 @@ export class Canvas {
378
376
  }
379
377
  initPlugins() {
380
378
  this._resizePlugins = [];
381
- for (const [, plugin] of this.container.plugins) {
379
+ for (const plugin of this.container.plugins.values()) {
382
380
  if (plugin.resize) {
383
381
  this._resizePlugins.push(plugin);
384
382
  }