@tsparticles/updater-life 4.1.2 → 4.2.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,4 +1,4 @@
1
- import { getRandom, getRangeValue, millisecondsToSeconds, } from "@tsparticles/engine";
1
+ import { getRandom, getRangeValue, loadOptionProperty, millisecondsToSeconds, } from "@tsparticles/engine";
2
2
  import { Life } from "./Options/Classes/Life.js";
3
3
  import { updateLife } from "./Utils.js";
4
4
  const noTime = 0, identity = 1, infiniteValue = -1;
@@ -38,10 +38,7 @@ export class LifeUpdater {
38
38
  return !particle.destroyed;
39
39
  }
40
40
  loadOptions(options, ...sources) {
41
- options.life ??= new Life();
42
- for (const source of sources) {
43
- options.life.load(source?.life);
44
- }
41
+ loadOptionProperty(options, "life", Life, ...sources);
45
42
  }
46
43
  update(particle, delta) {
47
44
  if (!this.isEnabled(particle) || !particle.life) {
@@ -1,22 +1,15 @@
1
- import { isNull } from "@tsparticles/engine";
1
+ import { isNull, loadProperty } from "@tsparticles/engine";
2
2
  import { LifeDelay } from "./LifeDelay.js";
3
3
  import { LifeDuration } from "./LifeDuration.js";
4
4
  export class Life {
5
- count;
6
- delay;
7
- duration;
8
- constructor() {
9
- this.count = 0;
10
- this.delay = new LifeDelay();
11
- this.duration = new LifeDuration();
12
- }
5
+ count = 0;
6
+ delay = new LifeDelay();
7
+ duration = new LifeDuration();
13
8
  load(data) {
14
9
  if (isNull(data)) {
15
10
  return;
16
11
  }
17
- if (data.count !== undefined) {
18
- this.count = data.count;
19
- }
12
+ loadProperty(this, "count", data.count);
20
13
  this.delay.load(data.delay);
21
14
  this.duration.load(data.duration);
22
15
  }
@@ -1,17 +1,11 @@
1
- import { ValueWithRandom, isNull } from "@tsparticles/engine";
1
+ import { ValueWithRandom, isNull, loadProperty } from "@tsparticles/engine";
2
2
  export class LifeDelay extends ValueWithRandom {
3
- sync;
4
- constructor() {
5
- super();
6
- this.sync = false;
7
- }
3
+ sync = false;
8
4
  load(data) {
9
5
  if (isNull(data)) {
10
6
  return;
11
7
  }
12
8
  super.load(data);
13
- if (data.sync !== undefined) {
14
- this.sync = data.sync;
15
- }
9
+ loadProperty(this, "sync", data.sync);
16
10
  }
17
11
  }
@@ -1,17 +1,11 @@
1
- import { ValueWithRandom, isNull } from "@tsparticles/engine";
1
+ import { ValueWithRandom, isNull, loadProperty } from "@tsparticles/engine";
2
2
  export class LifeDuration extends ValueWithRandom {
3
- sync;
4
- constructor() {
5
- super();
6
- this.sync = false;
7
- }
3
+ sync = false;
8
4
  load(data) {
9
5
  if (isNull(data)) {
10
6
  return;
11
7
  }
12
8
  super.load(data);
13
- if (data.sync !== undefined) {
14
- this.sync = data.sync;
15
- }
9
+ loadProperty(this, "sync", data.sync);
16
10
  }
17
11
  }
package/browser/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { LifeUpdater } from "./LifeUpdater.js";
2
2
  export async function loadLifeUpdater(engine) {
3
- engine.checkVersion("4.1.2");
3
+ engine.checkVersion("4.2.0");
4
4
  await engine.pluginManager.register(e => {
5
5
  e.pluginManager.addParticleUpdater("life", container => {
6
6
  return Promise.resolve(new LifeUpdater(container));
@@ -1,5 +1,5 @@
1
1
  export async function loadLifeUpdater(engine) {
2
- engine.checkVersion("4.1.2");
2
+ engine.checkVersion("4.2.0");
3
3
  await engine.pluginManager.register(e => {
4
4
  e.pluginManager.addParticleUpdater("life", async (container) => {
5
5
  const { LifeUpdater } = await import("./LifeUpdater.js");
@@ -1,4 +1,4 @@
1
- import { getRandom, getRangeValue, millisecondsToSeconds, } from "@tsparticles/engine";
1
+ import { getRandom, getRangeValue, loadOptionProperty, millisecondsToSeconds, } from "@tsparticles/engine";
2
2
  import { Life } from "./Options/Classes/Life.js";
3
3
  import { updateLife } from "./Utils.js";
4
4
  const noTime = 0, identity = 1, infiniteValue = -1;
@@ -38,10 +38,7 @@ export class LifeUpdater {
38
38
  return !particle.destroyed;
39
39
  }
40
40
  loadOptions(options, ...sources) {
41
- options.life ??= new Life();
42
- for (const source of sources) {
43
- options.life.load(source?.life);
44
- }
41
+ loadOptionProperty(options, "life", Life, ...sources);
45
42
  }
46
43
  update(particle, delta) {
47
44
  if (!this.isEnabled(particle) || !particle.life) {
@@ -1,22 +1,15 @@
1
- import { isNull } from "@tsparticles/engine";
1
+ import { isNull, loadProperty } from "@tsparticles/engine";
2
2
  import { LifeDelay } from "./LifeDelay.js";
3
3
  import { LifeDuration } from "./LifeDuration.js";
4
4
  export class Life {
5
- count;
6
- delay;
7
- duration;
8
- constructor() {
9
- this.count = 0;
10
- this.delay = new LifeDelay();
11
- this.duration = new LifeDuration();
12
- }
5
+ count = 0;
6
+ delay = new LifeDelay();
7
+ duration = new LifeDuration();
13
8
  load(data) {
14
9
  if (isNull(data)) {
15
10
  return;
16
11
  }
17
- if (data.count !== undefined) {
18
- this.count = data.count;
19
- }
12
+ loadProperty(this, "count", data.count);
20
13
  this.delay.load(data.delay);
21
14
  this.duration.load(data.duration);
22
15
  }
@@ -1,17 +1,11 @@
1
- import { ValueWithRandom, isNull } from "@tsparticles/engine";
1
+ import { ValueWithRandom, isNull, loadProperty } from "@tsparticles/engine";
2
2
  export class LifeDelay extends ValueWithRandom {
3
- sync;
4
- constructor() {
5
- super();
6
- this.sync = false;
7
- }
3
+ sync = false;
8
4
  load(data) {
9
5
  if (isNull(data)) {
10
6
  return;
11
7
  }
12
8
  super.load(data);
13
- if (data.sync !== undefined) {
14
- this.sync = data.sync;
15
- }
9
+ loadProperty(this, "sync", data.sync);
16
10
  }
17
11
  }
@@ -1,17 +1,11 @@
1
- import { ValueWithRandom, isNull } from "@tsparticles/engine";
1
+ import { ValueWithRandom, isNull, loadProperty } from "@tsparticles/engine";
2
2
  export class LifeDuration extends ValueWithRandom {
3
- sync;
4
- constructor() {
5
- super();
6
- this.sync = false;
7
- }
3
+ sync = false;
8
4
  load(data) {
9
5
  if (isNull(data)) {
10
6
  return;
11
7
  }
12
8
  super.load(data);
13
- if (data.sync !== undefined) {
14
- this.sync = data.sync;
15
- }
9
+ loadProperty(this, "sync", data.sync);
16
10
  }
17
11
  }
package/cjs/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { LifeUpdater } from "./LifeUpdater.js";
2
2
  export async function loadLifeUpdater(engine) {
3
- engine.checkVersion("4.1.2");
3
+ engine.checkVersion("4.2.0");
4
4
  await engine.pluginManager.register(e => {
5
5
  e.pluginManager.addParticleUpdater("life", container => {
6
6
  return Promise.resolve(new LifeUpdater(container));
package/cjs/index.lazy.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export async function loadLifeUpdater(engine) {
2
- engine.checkVersion("4.1.2");
2
+ engine.checkVersion("4.2.0");
3
3
  await engine.pluginManager.register(e => {
4
4
  e.pluginManager.addParticleUpdater("life", async (container) => {
5
5
  const { LifeUpdater } = await import("./LifeUpdater.js");
@@ -1,4 +1,4 @@
1
- import { getRandom, getRangeValue, millisecondsToSeconds, } from "@tsparticles/engine";
1
+ import { getRandom, getRangeValue, loadOptionProperty, millisecondsToSeconds, } from "@tsparticles/engine";
2
2
  import { Life } from "./Options/Classes/Life.js";
3
3
  import { updateLife } from "./Utils.js";
4
4
  const noTime = 0, identity = 1, infiniteValue = -1;
@@ -38,10 +38,7 @@ export class LifeUpdater {
38
38
  return !particle.destroyed;
39
39
  }
40
40
  loadOptions(options, ...sources) {
41
- options.life ??= new Life();
42
- for (const source of sources) {
43
- options.life.load(source?.life);
44
- }
41
+ loadOptionProperty(options, "life", Life, ...sources);
45
42
  }
46
43
  update(particle, delta) {
47
44
  if (!this.isEnabled(particle) || !particle.life) {
@@ -1,22 +1,15 @@
1
- import { isNull } from "@tsparticles/engine";
1
+ import { isNull, loadProperty } from "@tsparticles/engine";
2
2
  import { LifeDelay } from "./LifeDelay.js";
3
3
  import { LifeDuration } from "./LifeDuration.js";
4
4
  export class Life {
5
- count;
6
- delay;
7
- duration;
8
- constructor() {
9
- this.count = 0;
10
- this.delay = new LifeDelay();
11
- this.duration = new LifeDuration();
12
- }
5
+ count = 0;
6
+ delay = new LifeDelay();
7
+ duration = new LifeDuration();
13
8
  load(data) {
14
9
  if (isNull(data)) {
15
10
  return;
16
11
  }
17
- if (data.count !== undefined) {
18
- this.count = data.count;
19
- }
12
+ loadProperty(this, "count", data.count);
20
13
  this.delay.load(data.delay);
21
14
  this.duration.load(data.duration);
22
15
  }
@@ -1,17 +1,11 @@
1
- import { ValueWithRandom, isNull } from "@tsparticles/engine";
1
+ import { ValueWithRandom, isNull, loadProperty } from "@tsparticles/engine";
2
2
  export class LifeDelay extends ValueWithRandom {
3
- sync;
4
- constructor() {
5
- super();
6
- this.sync = false;
7
- }
3
+ sync = false;
8
4
  load(data) {
9
5
  if (isNull(data)) {
10
6
  return;
11
7
  }
12
8
  super.load(data);
13
- if (data.sync !== undefined) {
14
- this.sync = data.sync;
15
- }
9
+ loadProperty(this, "sync", data.sync);
16
10
  }
17
11
  }
@@ -1,17 +1,11 @@
1
- import { ValueWithRandom, isNull } from "@tsparticles/engine";
1
+ import { ValueWithRandom, isNull, loadProperty } from "@tsparticles/engine";
2
2
  export class LifeDuration extends ValueWithRandom {
3
- sync;
4
- constructor() {
5
- super();
6
- this.sync = false;
7
- }
3
+ sync = false;
8
4
  load(data) {
9
5
  if (isNull(data)) {
10
6
  return;
11
7
  }
12
8
  super.load(data);
13
- if (data.sync !== undefined) {
14
- this.sync = data.sync;
15
- }
9
+ loadProperty(this, "sync", data.sync);
16
10
  }
17
11
  }
package/esm/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { LifeUpdater } from "./LifeUpdater.js";
2
2
  export async function loadLifeUpdater(engine) {
3
- engine.checkVersion("4.1.2");
3
+ engine.checkVersion("4.2.0");
4
4
  await engine.pluginManager.register(e => {
5
5
  e.pluginManager.addParticleUpdater("life", container => {
6
6
  return Promise.resolve(new LifeUpdater(container));
package/esm/index.lazy.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export async function loadLifeUpdater(engine) {
2
- engine.checkVersion("4.1.2");
2
+ engine.checkVersion("4.2.0");
3
3
  await engine.pluginManager.register(e => {
4
4
  e.pluginManager.addParticleUpdater("life", async (container) => {
5
5
  const { LifeUpdater } = await import("./LifeUpdater.js");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/updater-life",
3
- "version": "4.1.2",
3
+ "version": "4.2.0",
4
4
  "description": "tsParticles particles life updater",
5
5
  "homepage": "https://particles.js.org",
6
6
  "repository": {
@@ -93,7 +93,7 @@
93
93
  "./package.json": "./package.json"
94
94
  },
95
95
  "peerDependencies": {
96
- "@tsparticles/engine": "4.1.2"
96
+ "@tsparticles/engine": "4.2.0"
97
97
  },
98
98
  "publishConfig": {
99
99
  "access": "public"
package/report.html CHANGED
@@ -4930,7 +4930,7 @@ var drawChart = (function (exports) {
4930
4930
  </script>
4931
4931
  <script>
4932
4932
  /*<!--*/
4933
- const data = {"version":2,"tree":{"name":"root","children":[{"name":"tsparticles.updater.life.js","children":[{"name":"dist/browser","children":[{"name":"Options/Classes","children":[{"uid":"ea825175-1","name":"LifeDelay.js"},{"uid":"ea825175-3","name":"LifeDuration.js"},{"uid":"ea825175-5","name":"Life.js"}]},{"uid":"ea825175-7","name":"Utils.js"},{"uid":"ea825175-9","name":"LifeUpdater.js"},{"uid":"ea825175-11","name":"index.js"},{"uid":"ea825175-13","name":"browser.js"}]}]}],"isRoot":true},"nodeParts":{"ea825175-1":{"renderedLength":392,"gzipLength":0,"brotliLength":0,"metaUid":"ea825175-0"},"ea825175-3":{"renderedLength":395,"gzipLength":0,"brotliLength":0,"metaUid":"ea825175-2"},"ea825175-5":{"renderedLength":517,"gzipLength":0,"brotliLength":0,"metaUid":"ea825175-4"},"ea825175-7":{"renderedLength":1866,"gzipLength":0,"brotliLength":0,"metaUid":"ea825175-6"},"ea825175-9":{"renderedLength":2048,"gzipLength":0,"brotliLength":0,"metaUid":"ea825175-8"},"ea825175-11":{"renderedLength":305,"gzipLength":0,"brotliLength":0,"metaUid":"ea825175-10"},"ea825175-13":{"renderedLength":173,"gzipLength":0,"brotliLength":0,"metaUid":"ea825175-12"}},"nodeMetas":{"ea825175-0":{"id":"/dist/browser/Options/Classes/LifeDelay.js","moduleParts":{"tsparticles.updater.life.js":"ea825175-1"},"imported":[{"uid":"ea825175-14"}],"importedBy":[{"uid":"ea825175-4"}]},"ea825175-2":{"id":"/dist/browser/Options/Classes/LifeDuration.js","moduleParts":{"tsparticles.updater.life.js":"ea825175-3"},"imported":[{"uid":"ea825175-14"}],"importedBy":[{"uid":"ea825175-4"}]},"ea825175-4":{"id":"/dist/browser/Options/Classes/Life.js","moduleParts":{"tsparticles.updater.life.js":"ea825175-5"},"imported":[{"uid":"ea825175-14"},{"uid":"ea825175-0"},{"uid":"ea825175-2"}],"importedBy":[{"uid":"ea825175-8"}]},"ea825175-6":{"id":"/dist/browser/Utils.js","moduleParts":{"tsparticles.updater.life.js":"ea825175-7"},"imported":[{"uid":"ea825175-14"}],"importedBy":[{"uid":"ea825175-8"}]},"ea825175-8":{"id":"/dist/browser/LifeUpdater.js","moduleParts":{"tsparticles.updater.life.js":"ea825175-9"},"imported":[{"uid":"ea825175-14"},{"uid":"ea825175-4"},{"uid":"ea825175-6"}],"importedBy":[{"uid":"ea825175-10"}]},"ea825175-10":{"id":"/dist/browser/index.js","moduleParts":{"tsparticles.updater.life.js":"ea825175-11"},"imported":[{"uid":"ea825175-8"}],"importedBy":[{"uid":"ea825175-12"}]},"ea825175-12":{"id":"/dist/browser/browser.js","moduleParts":{"tsparticles.updater.life.js":"ea825175-13"},"imported":[{"uid":"ea825175-10"}],"importedBy":[],"isEntry":true},"ea825175-14":{"id":"@tsparticles/engine","moduleParts":{},"imported":[],"importedBy":[{"uid":"ea825175-8"},{"uid":"ea825175-4"},{"uid":"ea825175-6"},{"uid":"ea825175-0"},{"uid":"ea825175-2"}],"isExternal":true}},"env":{"rollup":"4.60.4"},"options":{"gzip":false,"brotli":false,"sourcemap":false}};
4933
+ const data = {"version":2,"tree":{"name":"root","children":[{"name":"tsparticles.updater.life.js","children":[{"name":"dist/browser","children":[{"name":"Options/Classes","children":[{"uid":"a714bd7c-1","name":"LifeDelay.js"},{"uid":"a714bd7c-3","name":"LifeDuration.js"},{"uid":"a714bd7c-5","name":"Life.js"}]},{"uid":"a714bd7c-7","name":"Utils.js"},{"uid":"a714bd7c-9","name":"LifeUpdater.js"},{"uid":"a714bd7c-11","name":"index.js"},{"uid":"a714bd7c-13","name":"browser.js"}]}]}],"isRoot":true},"nodeParts":{"a714bd7c-1":{"renderedLength":276,"gzipLength":0,"brotliLength":0,"metaUid":"a714bd7c-0"},"a714bd7c-3":{"renderedLength":279,"gzipLength":0,"brotliLength":0,"metaUid":"a714bd7c-2"},"a714bd7c-5":{"renderedLength":369,"gzipLength":0,"brotliLength":0,"metaUid":"a714bd7c-4"},"a714bd7c-7":{"renderedLength":1866,"gzipLength":0,"brotliLength":0,"metaUid":"a714bd7c-6"},"a714bd7c-9":{"renderedLength":1974,"gzipLength":0,"brotliLength":0,"metaUid":"a714bd7c-8"},"a714bd7c-11":{"renderedLength":305,"gzipLength":0,"brotliLength":0,"metaUid":"a714bd7c-10"},"a714bd7c-13":{"renderedLength":173,"gzipLength":0,"brotliLength":0,"metaUid":"a714bd7c-12"}},"nodeMetas":{"a714bd7c-0":{"id":"/dist/browser/Options/Classes/LifeDelay.js","moduleParts":{"tsparticles.updater.life.js":"a714bd7c-1"},"imported":[{"uid":"a714bd7c-14"}],"importedBy":[{"uid":"a714bd7c-4"}]},"a714bd7c-2":{"id":"/dist/browser/Options/Classes/LifeDuration.js","moduleParts":{"tsparticles.updater.life.js":"a714bd7c-3"},"imported":[{"uid":"a714bd7c-14"}],"importedBy":[{"uid":"a714bd7c-4"}]},"a714bd7c-4":{"id":"/dist/browser/Options/Classes/Life.js","moduleParts":{"tsparticles.updater.life.js":"a714bd7c-5"},"imported":[{"uid":"a714bd7c-14"},{"uid":"a714bd7c-0"},{"uid":"a714bd7c-2"}],"importedBy":[{"uid":"a714bd7c-8"}]},"a714bd7c-6":{"id":"/dist/browser/Utils.js","moduleParts":{"tsparticles.updater.life.js":"a714bd7c-7"},"imported":[{"uid":"a714bd7c-14"}],"importedBy":[{"uid":"a714bd7c-8"}]},"a714bd7c-8":{"id":"/dist/browser/LifeUpdater.js","moduleParts":{"tsparticles.updater.life.js":"a714bd7c-9"},"imported":[{"uid":"a714bd7c-14"},{"uid":"a714bd7c-4"},{"uid":"a714bd7c-6"}],"importedBy":[{"uid":"a714bd7c-10"}]},"a714bd7c-10":{"id":"/dist/browser/index.js","moduleParts":{"tsparticles.updater.life.js":"a714bd7c-11"},"imported":[{"uid":"a714bd7c-8"}],"importedBy":[{"uid":"a714bd7c-12"}]},"a714bd7c-12":{"id":"/dist/browser/browser.js","moduleParts":{"tsparticles.updater.life.js":"a714bd7c-13"},"imported":[{"uid":"a714bd7c-10"}],"importedBy":[],"isEntry":true},"a714bd7c-14":{"id":"@tsparticles/engine","moduleParts":{},"imported":[],"importedBy":[{"uid":"a714bd7c-8"},{"uid":"a714bd7c-4"},{"uid":"a714bd7c-6"},{"uid":"a714bd7c-0"},{"uid":"a714bd7c-2"}],"isExternal":true}},"env":{"rollup":"4.62.0"},"options":{"gzip":false,"brotli":false,"sourcemap":false}};
4934
4934
 
4935
4935
  const run = () => {
4936
4936
  const width = window.innerWidth;
@@ -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
- /* Updater v4.1.2 */
2
+ /* Updater v4.2.0 */
3
3
  (function (global, factory) {
4
4
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@tsparticles/engine')) :
5
5
  typeof define === 'function' && define.amd ? define(['exports', '@tsparticles/engine'], factory) :
@@ -7,55 +7,36 @@
7
7
  })(this, (function (exports, engine) { 'use strict';
8
8
 
9
9
  class LifeDelay extends engine.ValueWithRandom {
10
- sync;
11
- constructor() {
12
- super();
13
- this.sync = false;
14
- }
10
+ sync = false;
15
11
  load(data) {
16
12
  if (engine.isNull(data)) {
17
13
  return;
18
14
  }
19
15
  super.load(data);
20
- if (data.sync !== undefined) {
21
- this.sync = data.sync;
22
- }
16
+ engine.loadProperty(this, "sync", data.sync);
23
17
  }
24
18
  }
25
19
 
26
20
  class LifeDuration extends engine.ValueWithRandom {
27
- sync;
28
- constructor() {
29
- super();
30
- this.sync = false;
31
- }
21
+ sync = false;
32
22
  load(data) {
33
23
  if (engine.isNull(data)) {
34
24
  return;
35
25
  }
36
26
  super.load(data);
37
- if (data.sync !== undefined) {
38
- this.sync = data.sync;
39
- }
27
+ engine.loadProperty(this, "sync", data.sync);
40
28
  }
41
29
  }
42
30
 
43
31
  class Life {
44
- count;
45
- delay;
46
- duration;
47
- constructor() {
48
- this.count = 0;
49
- this.delay = new LifeDelay();
50
- this.duration = new LifeDuration();
51
- }
32
+ count = 0;
33
+ delay = new LifeDelay();
34
+ duration = new LifeDuration();
52
35
  load(data) {
53
36
  if (engine.isNull(data)) {
54
37
  return;
55
38
  }
56
- if (data.count !== undefined) {
57
- this.count = data.count;
58
- }
39
+ engine.loadProperty(this, "count", data.count);
59
40
  this.delay.load(data.delay);
60
41
  this.duration.load(data.duration);
61
42
  }
@@ -151,10 +132,7 @@
151
132
  return !particle.destroyed;
152
133
  }
153
134
  loadOptions(options, ...sources) {
154
- options.life ??= new Life();
155
- for (const source of sources) {
156
- options.life.load(source?.life);
157
- }
135
+ engine.loadOptionProperty(options, "life", Life, ...sources);
158
136
  }
159
137
  update(particle, delta) {
160
138
  if (!this.isEnabled(particle) || !particle.life) {
@@ -165,7 +143,7 @@
165
143
  }
166
144
 
167
145
  async function loadLifeUpdater(engine) {
168
- engine.checkVersion("4.1.2");
146
+ engine.checkVersion("4.2.0");
169
147
  await engine.pluginManager.register(e => {
170
148
  e.pluginManager.addParticleUpdater("life", container => {
171
149
  return Promise.resolve(new LifeUpdater(container));
@@ -1 +1 @@
1
- !function(t){t.__tsParticlesInternals=t.__tsParticlesInternals||{},t.__tsParticlesInternals.bundles=t.__tsParticlesInternals.bundles||{},t.__tsParticlesInternals.effects=t.__tsParticlesInternals.effects||{},t.__tsParticlesInternals.engine=t.__tsParticlesInternals.engine||{},t.__tsParticlesInternals.interactions=t.__tsParticlesInternals.interactions||{},t.__tsParticlesInternals.palettes=t.__tsParticlesInternals.palettes||{},t.__tsParticlesInternals.paths=t.__tsParticlesInternals.paths||{},t.__tsParticlesInternals.plugins=t.__tsParticlesInternals.plugins||{},t.__tsParticlesInternals.plugins=t.__tsParticlesInternals.plugins||{},t.__tsParticlesInternals.plugins.emittersShapes=t.__tsParticlesInternals.plugins.emittersShapes||{},t.__tsParticlesInternals.presets=t.__tsParticlesInternals.presets||{},t.__tsParticlesInternals.shapes=t.__tsParticlesInternals.shapes||{},t.__tsParticlesInternals.updaters=t.__tsParticlesInternals.updaters||{},t.__tsParticlesInternals.utils=t.__tsParticlesInternals.utils||{},t.__tsParticlesInternals.canvas=t.__tsParticlesInternals.canvas||{},t.__tsParticlesInternals.canvas=t.__tsParticlesInternals.canvas||{},t.__tsParticlesInternals.canvas.utils=t.__tsParticlesInternals.canvas.utils||{},t.__tsParticlesInternals.path=t.__tsParticlesInternals.path||{},t.__tsParticlesInternals.path=t.__tsParticlesInternals.path||{},t.__tsParticlesInternals.path.utils=t.__tsParticlesInternals.path.utils||{};var s="undefined"!=typeof Proxy?function(t){return new Proxy(t,{get:function(t,s){return s in t||(t[s]={}),t[s]}})}:function(t){return t};t.__tsParticlesInternals.bundles=s(t.__tsParticlesInternals.bundles),t.__tsParticlesInternals.effects=s(t.__tsParticlesInternals.effects),t.__tsParticlesInternals.interactions=s(t.__tsParticlesInternals.interactions),t.__tsParticlesInternals.palettes=s(t.__tsParticlesInternals.palettes),t.__tsParticlesInternals.paths=s(t.__tsParticlesInternals.paths),t.__tsParticlesInternals.plugins=s(t.__tsParticlesInternals.plugins),t.__tsParticlesInternals.plugins.emittersShapes=s(t.__tsParticlesInternals.plugins.emittersShapes),t.__tsParticlesInternals.presets=s(t.__tsParticlesInternals.presets),t.__tsParticlesInternals.shapes=s(t.__tsParticlesInternals.shapes),t.__tsParticlesInternals.updaters=s(t.__tsParticlesInternals.updaters),t.__tsParticlesInternals.utils=s(t.__tsParticlesInternals.utils),t.__tsParticlesInternals.canvas=s(t.__tsParticlesInternals.canvas),t.__tsParticlesInternals.path=s(t.__tsParticlesInternals.path),t.tsparticlesInternalExports=t.tsparticlesInternalExports||{}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:this),function(t,s){"object"==typeof exports&&"undefined"!=typeof module?s(exports,require("@tsparticles/engine")):"function"==typeof define&&define.amd?define(["exports","@tsparticles/engine"],s):s(((t="undefined"!=typeof globalThis?globalThis:t||self).__tsParticlesInternals=t.__tsParticlesInternals||{},t.__tsParticlesInternals.updaters=t.__tsParticlesInternals.updaters||{},t.__tsParticlesInternals.updaters.life=t.__tsParticlesInternals.updaters.life||{}),t.__tsParticlesInternals.engine)}(this,function(t,s){"use strict";class e extends s.ValueWithRandom{sync;constructor(){super(),this.sync=!1}load(t){s.isNull(t)||(super.load(t),void 0!==t.sync&&(this.sync=t.sync))}}class n extends s.ValueWithRandom{sync;constructor(){super(),this.sync=!1}load(t){s.isNull(t)||(super.load(t),void 0!==t.sync&&(this.sync=t.sync))}}class a{count;delay;duration;constructor(){this.count=0,this.delay=new e,this.duration=new n}load(t){s.isNull(t)||(void 0!==t.count&&(this.count=t.count),this.delay.load(t.delay),this.duration.load(t.duration))}}class l{#t;constructor(t){this.#t=t}init(t){const e=this.#t,n=t.options.life;if(!n)return;const a=n.delay.sync?1:s.getRandom(),l=n.duration.sync?1:s.getRandom();t.life={delay:e.retina.reduceFactor?s.getRangeValue(n.delay.value)*a/e.retina.reduceFactor*s.millisecondsToSeconds:0,delayTime:0,duration:e.retina.reduceFactor?s.getRangeValue(n.duration.value)*l/e.retina.reduceFactor*s.millisecondsToSeconds:0,time:0,count:n.count},t.life.duration<=0&&(t.life.duration=-1),t.life.count<=0&&(t.life.count=-1),t.spawning=t.life.delay>0}isEnabled(t){return!t.destroyed}loadOptions(t,...s){t.life??=new a;for(const e of s)t.life.load(e?.life)}update(t,e){this.isEnabled(t)&&t.life&&function(t,e,n){if(!t.life)return;const a=t.life;let l=!1;if(t.spawning){if(a.delayTime+=e.value,!(a.delayTime>=t.life.delay))return;l=!0,t.spawning=!1,a.delayTime=0,a.time=0}if(-1===a.duration)return;if(l?a.time=0:a.time+=e.value,a.time<a.duration)return;if(a.time=0,t.life.count>0&&t.life.count--,0===t.life.count)return void t.destroy();const i=s.setRangeValue(0,n.width),r=s.setRangeValue(0,n.width);t.position.x=s.randomInRangeValue(i),t.position.y=s.randomInRangeValue(r),t.spawning=!0,a.delayTime=0,a.time=0,t.reset();const c=t.options.life;c&&(a.delay=s.getRangeValue(c.delay.value)*s.millisecondsToSeconds,a.duration=s.getRangeValue(c.duration.value)*s.millisecondsToSeconds)}(t,e,this.#t.canvas.size)}}async function i(t){t.checkVersion("4.1.2"),await t.pluginManager.register(t=>{t.pluginManager.addParticleUpdater("life",t=>Promise.resolve(new l(t)))})}const r=globalThis;r.__tsParticlesInternals=r.__tsParticlesInternals??{},r.loadLifeUpdater=i,t.loadLifeUpdater=i}),Object.assign(globalThis.window||globalThis,{loadLifeUpdater:(globalThis.__tsParticlesInternals.updaters.life||{}).loadLifeUpdater}),delete(globalThis.window||globalThis).tsparticlesInternalExports;
1
+ !function(t){t.__tsParticlesInternals=t.__tsParticlesInternals||{},t.__tsParticlesInternals.bundles=t.__tsParticlesInternals.bundles||{},t.__tsParticlesInternals.effects=t.__tsParticlesInternals.effects||{},t.__tsParticlesInternals.engine=t.__tsParticlesInternals.engine||{},t.__tsParticlesInternals.interactions=t.__tsParticlesInternals.interactions||{},t.__tsParticlesInternals.palettes=t.__tsParticlesInternals.palettes||{},t.__tsParticlesInternals.paths=t.__tsParticlesInternals.paths||{},t.__tsParticlesInternals.plugins=t.__tsParticlesInternals.plugins||{},t.__tsParticlesInternals.plugins=t.__tsParticlesInternals.plugins||{},t.__tsParticlesInternals.plugins.emittersShapes=t.__tsParticlesInternals.plugins.emittersShapes||{},t.__tsParticlesInternals.presets=t.__tsParticlesInternals.presets||{},t.__tsParticlesInternals.shapes=t.__tsParticlesInternals.shapes||{},t.__tsParticlesInternals.updaters=t.__tsParticlesInternals.updaters||{},t.__tsParticlesInternals.utils=t.__tsParticlesInternals.utils||{},t.__tsParticlesInternals.canvas=t.__tsParticlesInternals.canvas||{},t.__tsParticlesInternals.canvas=t.__tsParticlesInternals.canvas||{},t.__tsParticlesInternals.canvas.utils=t.__tsParticlesInternals.canvas.utils||{},t.__tsParticlesInternals.path=t.__tsParticlesInternals.path||{},t.__tsParticlesInternals.path=t.__tsParticlesInternals.path||{},t.__tsParticlesInternals.path.utils=t.__tsParticlesInternals.path.utils||{};var e="undefined"!=typeof Proxy?function(t){return new Proxy(t,{get:function(t,e){return e in t||(t[e]={}),t[e]}})}:function(t){return t};t.__tsParticlesInternals.bundles=e(t.__tsParticlesInternals.bundles),t.__tsParticlesInternals.effects=e(t.__tsParticlesInternals.effects),t.__tsParticlesInternals.interactions=e(t.__tsParticlesInternals.interactions),t.__tsParticlesInternals.palettes=e(t.__tsParticlesInternals.palettes),t.__tsParticlesInternals.paths=e(t.__tsParticlesInternals.paths),t.__tsParticlesInternals.plugins=e(t.__tsParticlesInternals.plugins),t.__tsParticlesInternals.plugins.emittersShapes=e(t.__tsParticlesInternals.plugins.emittersShapes),t.__tsParticlesInternals.presets=e(t.__tsParticlesInternals.presets),t.__tsParticlesInternals.shapes=e(t.__tsParticlesInternals.shapes),t.__tsParticlesInternals.updaters=e(t.__tsParticlesInternals.updaters),t.__tsParticlesInternals.utils=e(t.__tsParticlesInternals.utils),t.__tsParticlesInternals.canvas=e(t.__tsParticlesInternals.canvas),t.__tsParticlesInternals.path=e(t.__tsParticlesInternals.path),t.tsparticlesInternalExports=t.tsparticlesInternalExports||{}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:this),function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@tsparticles/engine")):"function"==typeof define&&define.amd?define(["exports","@tsparticles/engine"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).__tsParticlesInternals=t.__tsParticlesInternals||{},t.__tsParticlesInternals.updaters=t.__tsParticlesInternals.updaters||{},t.__tsParticlesInternals.updaters.life=t.__tsParticlesInternals.updaters.life||{}),t.__tsParticlesInternals.engine)}(this,function(t,e){"use strict";class s extends e.ValueWithRandom{sync=!1;load(t){e.isNull(t)||(super.load(t),e.loadProperty(this,"sync",t.sync))}}class n extends e.ValueWithRandom{sync=!1;load(t){e.isNull(t)||(super.load(t),e.loadProperty(this,"sync",t.sync))}}class a{count=0;delay=new s;duration=new n;load(t){e.isNull(t)||(e.loadProperty(this,"count",t.count),this.delay.load(t.delay),this.duration.load(t.duration))}}class l{#t;constructor(t){this.#t=t}init(t){const s=this.#t,n=t.options.life;if(!n)return;const a=n.delay.sync?1:e.getRandom(),l=n.duration.sync?1:e.getRandom();t.life={delay:s.retina.reduceFactor?e.getRangeValue(n.delay.value)*a/s.retina.reduceFactor*e.millisecondsToSeconds:0,delayTime:0,duration:s.retina.reduceFactor?e.getRangeValue(n.duration.value)*l/s.retina.reduceFactor*e.millisecondsToSeconds:0,time:0,count:n.count},t.life.duration<=0&&(t.life.duration=-1),t.life.count<=0&&(t.life.count=-1),t.spawning=t.life.delay>0}isEnabled(t){return!t.destroyed}loadOptions(t,...s){e.loadOptionProperty(t,"life",a,...s)}update(t,s){this.isEnabled(t)&&t.life&&function(t,s,n){if(!t.life)return;const a=t.life;let l=!1;if(t.spawning){if(a.delayTime+=s.value,!(a.delayTime>=t.life.delay))return;l=!0,t.spawning=!1,a.delayTime=0,a.time=0}if(-1===a.duration)return;if(l?a.time=0:a.time+=s.value,a.time<a.duration)return;if(a.time=0,t.life.count>0&&t.life.count--,0===t.life.count)return void t.destroy();const r=e.setRangeValue(0,n.width),i=e.setRangeValue(0,n.width);t.position.x=e.randomInRangeValue(r),t.position.y=e.randomInRangeValue(i),t.spawning=!0,a.delayTime=0,a.time=0,t.reset();const c=t.options.life;c&&(a.delay=e.getRangeValue(c.delay.value)*e.millisecondsToSeconds,a.duration=e.getRangeValue(c.duration.value)*e.millisecondsToSeconds)}(t,s,this.#t.canvas.size)}}async function r(t){t.checkVersion("4.2.0"),await t.pluginManager.register(t=>{t.pluginManager.addParticleUpdater("life",t=>Promise.resolve(new l(t)))})}const i=globalThis;i.__tsParticlesInternals=i.__tsParticlesInternals??{},i.loadLifeUpdater=r,t.loadLifeUpdater=r}),Object.assign(globalThis.window||globalThis,{loadLifeUpdater:(globalThis.__tsParticlesInternals.updaters.life||{}).loadLifeUpdater}),delete(globalThis.window||globalThis).tsparticlesInternalExports;
@@ -4,8 +4,7 @@ import { LifeDelay } from "./LifeDelay.js";
4
4
  import { LifeDuration } from "./LifeDuration.js";
5
5
  export declare class Life implements ILife, IOptionLoader<ILife> {
6
6
  count: number;
7
- delay: LifeDelay;
8
- duration: LifeDuration;
9
- constructor();
7
+ readonly delay: LifeDelay;
8
+ readonly duration: LifeDuration;
10
9
  load(data?: RecursivePartial<ILife>): void;
11
10
  }
@@ -2,6 +2,5 @@ import { type IOptionLoader, type RecursivePartial, ValueWithRandom } from "@tsp
2
2
  import type { ILifeDelay } from "../Interfaces/ILifeDelay.js";
3
3
  export declare class LifeDelay extends ValueWithRandom implements ILifeDelay, IOptionLoader<ILifeDelay> {
4
4
  sync: boolean;
5
- constructor();
6
5
  load(data?: RecursivePartial<ILifeDelay>): void;
7
6
  }
@@ -2,6 +2,5 @@ import { type IOptionLoader, type RecursivePartial, ValueWithRandom } from "@tsp
2
2
  import type { ILifeDuration } from "../Interfaces/ILifeDuration.js";
3
3
  export declare class LifeDuration extends ValueWithRandom implements ILifeDuration, IOptionLoader<ILifeDuration> {
4
4
  sync: boolean;
5
- constructor();
6
5
  load(data?: RecursivePartial<ILifeDuration>): void;
7
6
  }