@tsparticles/updater-life 4.0.0-beta.12 → 4.0.0-beta.16

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.
@@ -12,16 +12,15 @@ export class LifeUpdater {
12
12
  if (!lifeOptions) {
13
13
  return;
14
14
  }
15
+ const delayFactor = lifeOptions.delay.sync ? identity : getRandom(), durationFactor = lifeOptions.duration.sync ? identity : getRandom();
15
16
  particle.life = {
16
17
  delay: container.retina.reduceFactor
17
- ? ((getRangeValue(lifeOptions.delay.value) * (lifeOptions.delay.sync ? identity : getRandom())) /
18
- container.retina.reduceFactor) *
18
+ ? ((getRangeValue(lifeOptions.delay.value) * delayFactor) / container.retina.reduceFactor) *
19
19
  millisecondsToSeconds
20
20
  : noTime,
21
21
  delayTime: noTime,
22
22
  duration: container.retina.reduceFactor
23
- ? ((getRangeValue(lifeOptions.duration.value) * (lifeOptions.duration.sync ? identity : getRandom())) /
24
- container.retina.reduceFactor) *
23
+ ? ((getRangeValue(lifeOptions.duration.value) * durationFactor) / container.retina.reduceFactor) *
25
24
  millisecondsToSeconds
26
25
  : noTime,
27
26
  time: noTime,
@@ -0,0 +1,5 @@
1
+ import { loadLifeUpdater } from "./index.js";
2
+ const globalObject = globalThis;
3
+ globalObject.__tsParticlesInternals = globalObject.__tsParticlesInternals ?? {};
4
+ globalObject.loadLifeUpdater = loadLifeUpdater;
5
+ export * from "./index.js";
package/browser/index.js CHANGED
@@ -1,9 +1,9 @@
1
+ import { LifeUpdater } from "./LifeUpdater.js";
1
2
  export async function loadLifeUpdater(engine) {
2
- engine.checkVersion("4.0.0-beta.12");
3
+ engine.checkVersion("4.0.0-beta.16");
3
4
  await engine.pluginManager.register(e => {
4
- e.pluginManager.addParticleUpdater("life", async (container) => {
5
- const { LifeUpdater } = await import("./LifeUpdater.js");
6
- return new LifeUpdater(container);
5
+ e.pluginManager.addParticleUpdater("life", container => {
6
+ return Promise.resolve(new LifeUpdater(container));
7
7
  });
8
8
  });
9
9
  }
@@ -0,0 +1,9 @@
1
+ export async function loadLifeUpdater(engine) {
2
+ engine.checkVersion("4.0.0-beta.16");
3
+ await engine.pluginManager.register(e => {
4
+ e.pluginManager.addParticleUpdater("life", async (container) => {
5
+ const { LifeUpdater } = await import("./LifeUpdater.js");
6
+ return new LifeUpdater(container);
7
+ });
8
+ });
9
+ }
@@ -12,16 +12,15 @@ export class LifeUpdater {
12
12
  if (!lifeOptions) {
13
13
  return;
14
14
  }
15
+ const delayFactor = lifeOptions.delay.sync ? identity : getRandom(), durationFactor = lifeOptions.duration.sync ? identity : getRandom();
15
16
  particle.life = {
16
17
  delay: container.retina.reduceFactor
17
- ? ((getRangeValue(lifeOptions.delay.value) * (lifeOptions.delay.sync ? identity : getRandom())) /
18
- container.retina.reduceFactor) *
18
+ ? ((getRangeValue(lifeOptions.delay.value) * delayFactor) / container.retina.reduceFactor) *
19
19
  millisecondsToSeconds
20
20
  : noTime,
21
21
  delayTime: noTime,
22
22
  duration: container.retina.reduceFactor
23
- ? ((getRangeValue(lifeOptions.duration.value) * (lifeOptions.duration.sync ? identity : getRandom())) /
24
- container.retina.reduceFactor) *
23
+ ? ((getRangeValue(lifeOptions.duration.value) * durationFactor) / container.retina.reduceFactor) *
25
24
  millisecondsToSeconds
26
25
  : noTime,
27
26
  time: noTime,
package/cjs/browser.js ADDED
@@ -0,0 +1,5 @@
1
+ import { loadLifeUpdater } from "./index.js";
2
+ const globalObject = globalThis;
3
+ globalObject.__tsParticlesInternals = globalObject.__tsParticlesInternals ?? {};
4
+ globalObject.loadLifeUpdater = loadLifeUpdater;
5
+ export * from "./index.js";
package/cjs/index.js CHANGED
@@ -1,9 +1,9 @@
1
+ import { LifeUpdater } from "./LifeUpdater.js";
1
2
  export async function loadLifeUpdater(engine) {
2
- engine.checkVersion("4.0.0-beta.12");
3
+ engine.checkVersion("4.0.0-beta.16");
3
4
  await engine.pluginManager.register(e => {
4
- e.pluginManager.addParticleUpdater("life", async (container) => {
5
- const { LifeUpdater } = await import("./LifeUpdater.js");
6
- return new LifeUpdater(container);
5
+ e.pluginManager.addParticleUpdater("life", container => {
6
+ return Promise.resolve(new LifeUpdater(container));
7
7
  });
8
8
  });
9
9
  }
@@ -0,0 +1,9 @@
1
+ export async function loadLifeUpdater(engine) {
2
+ engine.checkVersion("4.0.0-beta.16");
3
+ await engine.pluginManager.register(e => {
4
+ e.pluginManager.addParticleUpdater("life", async (container) => {
5
+ const { LifeUpdater } = await import("./LifeUpdater.js");
6
+ return new LifeUpdater(container);
7
+ });
8
+ });
9
+ }
@@ -12,16 +12,15 @@ export class LifeUpdater {
12
12
  if (!lifeOptions) {
13
13
  return;
14
14
  }
15
+ const delayFactor = lifeOptions.delay.sync ? identity : getRandom(), durationFactor = lifeOptions.duration.sync ? identity : getRandom();
15
16
  particle.life = {
16
17
  delay: container.retina.reduceFactor
17
- ? ((getRangeValue(lifeOptions.delay.value) * (lifeOptions.delay.sync ? identity : getRandom())) /
18
- container.retina.reduceFactor) *
18
+ ? ((getRangeValue(lifeOptions.delay.value) * delayFactor) / container.retina.reduceFactor) *
19
19
  millisecondsToSeconds
20
20
  : noTime,
21
21
  delayTime: noTime,
22
22
  duration: container.retina.reduceFactor
23
- ? ((getRangeValue(lifeOptions.duration.value) * (lifeOptions.duration.sync ? identity : getRandom())) /
24
- container.retina.reduceFactor) *
23
+ ? ((getRangeValue(lifeOptions.duration.value) * durationFactor) / container.retina.reduceFactor) *
25
24
  millisecondsToSeconds
26
25
  : noTime,
27
26
  time: noTime,
package/esm/browser.js ADDED
@@ -0,0 +1,5 @@
1
+ import { loadLifeUpdater } from "./index.js";
2
+ const globalObject = globalThis;
3
+ globalObject.__tsParticlesInternals = globalObject.__tsParticlesInternals ?? {};
4
+ globalObject.loadLifeUpdater = loadLifeUpdater;
5
+ export * from "./index.js";
package/esm/index.js CHANGED
@@ -1,9 +1,9 @@
1
+ import { LifeUpdater } from "./LifeUpdater.js";
1
2
  export async function loadLifeUpdater(engine) {
2
- engine.checkVersion("4.0.0-beta.12");
3
+ engine.checkVersion("4.0.0-beta.16");
3
4
  await engine.pluginManager.register(e => {
4
- e.pluginManager.addParticleUpdater("life", async (container) => {
5
- const { LifeUpdater } = await import("./LifeUpdater.js");
6
- return new LifeUpdater(container);
5
+ e.pluginManager.addParticleUpdater("life", container => {
6
+ return Promise.resolve(new LifeUpdater(container));
7
7
  });
8
8
  });
9
9
  }
@@ -0,0 +1,9 @@
1
+ export async function loadLifeUpdater(engine) {
2
+ engine.checkVersion("4.0.0-beta.16");
3
+ await engine.pluginManager.register(e => {
4
+ e.pluginManager.addParticleUpdater("life", async (container) => {
5
+ const { LifeUpdater } = await import("./LifeUpdater.js");
6
+ return new LifeUpdater(container);
7
+ });
8
+ });
9
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/updater-life",
3
- "version": "4.0.0-beta.12",
3
+ "version": "4.0.0-beta.16",
4
4
  "description": "tsParticles particles life updater",
5
5
  "homepage": "https://particles.js.org",
6
6
  "repository": {
@@ -83,10 +83,17 @@
83
83
  "require": "./cjs/index.js",
84
84
  "default": "./esm/index.js"
85
85
  },
86
+ "./lazy": {
87
+ "types": "./types/index.lazy.d.ts",
88
+ "browser": "./browser/index.lazy.js",
89
+ "import": "./esm/index.lazy.js",
90
+ "require": "./cjs/index.lazy.js",
91
+ "default": "./esm/index.lazy.js"
92
+ },
86
93
  "./package.json": "./package.json"
87
94
  },
88
95
  "peerDependencies": {
89
- "@tsparticles/engine": "4.0.0-beta.12"
96
+ "@tsparticles/engine": "4.0.0-beta.16"
90
97
  },
91
98
  "publishConfig": {
92
99
  "access": "public"