@tsparticles/updater-size 4.0.5 → 4.1.1

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.
@@ -0,0 +1,20 @@
1
+ import { RangedAnimationValueWithRandom, isNull } from "@tsparticles/engine";
2
+ import { SizeAnimation } from "./SizeAnimation.js";
3
+ export class Size extends RangedAnimationValueWithRandom {
4
+ animation;
5
+ constructor() {
6
+ super();
7
+ this.animation = new SizeAnimation();
8
+ this.value = 3;
9
+ }
10
+ load(data) {
11
+ super.load(data);
12
+ if (isNull(data)) {
13
+ return;
14
+ }
15
+ const animation = data.animation;
16
+ if (animation !== undefined) {
17
+ this.animation.load(animation);
18
+ }
19
+ }
20
+ }
@@ -0,0 +1,18 @@
1
+ import { DestroyType, RangedAnimationOptions, isNull, } from "@tsparticles/engine";
2
+ export class SizeAnimation extends RangedAnimationOptions {
3
+ destroy;
4
+ constructor() {
5
+ super();
6
+ this.destroy = DestroyType.none;
7
+ this.speed = 5;
8
+ }
9
+ load(data) {
10
+ super.load(data);
11
+ if (isNull(data)) {
12
+ return;
13
+ }
14
+ if (data.destroy !== undefined) {
15
+ this.destroy = data.destroy;
16
+ }
17
+ }
18
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -1,19 +1,25 @@
1
- import { getRandom, percentDenominator, updateAnimation, } from "@tsparticles/engine";
1
+ import { getRandom, getRangeValue, initParticleNumericAnimationValue, percentDenominator, updateAnimation, } from "@tsparticles/engine";
2
+ import { Size } from "./Options/Classes/Size.js";
2
3
  const minLoops = 0;
3
4
  export class SizeUpdater {
4
- _container;
5
+ #container;
5
6
  constructor(container) {
6
- this._container = container;
7
+ this.#container = container;
7
8
  }
8
9
  init(particle) {
9
- const container = this._container, sizeOptions = particle.options.size, sizeAnimation = sizeOptions.animation;
10
- if (sizeAnimation.enable) {
11
- particle.size.velocity =
12
- (particle.retina.sizeAnimationSpeed / percentDenominator) * container.retina.reduceFactor;
13
- if (!sizeAnimation.sync) {
14
- particle.size.velocity *= getRandom();
15
- }
10
+ const container = this.#container, sizeOptions = particle.options.size;
11
+ if (!sizeOptions) {
12
+ return;
13
+ }
14
+ const sizeAnimation = sizeOptions.animation;
15
+ if (!sizeAnimation.enable) {
16
+ return;
17
+ }
18
+ particle.size.velocity = (particle.retina.sizeAnimationSpeed / percentDenominator) * container.retina.reduceFactor;
19
+ if (sizeAnimation.sync) {
20
+ return;
16
21
  }
22
+ particle.size.velocity *= getRandom();
17
23
  }
18
24
  isEnabled(particle) {
19
25
  return (!particle.destroyed &&
@@ -23,12 +29,26 @@ export class SizeUpdater {
23
29
  ((particle.size.maxLoops ?? minLoops) > minLoops &&
24
30
  (particle.size.loops ?? minLoops) < (particle.size.maxLoops ?? minLoops))));
25
31
  }
32
+ loadOptions(options, ...sources) {
33
+ options.size ??= new Size();
34
+ for (const source of sources) {
35
+ options.size.load(source?.size);
36
+ }
37
+ }
38
+ preInit(particle) {
39
+ const pxRatio = this.#container.retina.pixelRatio, options = particle.options, sizeOptions = options.size;
40
+ if (!sizeOptions) {
41
+ return;
42
+ }
43
+ particle.size = initParticleNumericAnimationValue(sizeOptions, pxRatio);
44
+ particle.retina.sizeAnimationSpeed = getRangeValue(sizeOptions.animation.speed) * pxRatio;
45
+ }
26
46
  reset(particle) {
27
47
  particle.size.time = 0;
28
48
  particle.size.loops = 0;
29
49
  }
30
50
  update(particle, delta) {
31
- if (!this.isEnabled(particle)) {
51
+ if (!this.isEnabled(particle) || !particle.options.size) {
32
52
  return;
33
53
  }
34
54
  updateAnimation(particle, particle.size, true, particle.options.size.animation.destroy, delta);
@@ -0,0 +1 @@
1
+ export {};
package/browser/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { SizeUpdater } from "./SizeUpdater.js";
2
2
  export async function loadSizeUpdater(engine) {
3
- engine.checkVersion("4.0.5");
3
+ engine.checkVersion("4.1.1");
4
4
  await engine.pluginManager.register(e => {
5
5
  e.pluginManager.addParticleUpdater("size", container => {
6
6
  return Promise.resolve(new SizeUpdater(container));
@@ -1,5 +1,5 @@
1
1
  export async function loadSizeUpdater(engine) {
2
- engine.checkVersion("4.0.5");
2
+ engine.checkVersion("4.1.1");
3
3
  await engine.pluginManager.register(e => {
4
4
  e.pluginManager.addParticleUpdater("size", async (container) => {
5
5
  const { SizeUpdater } = await import("./SizeUpdater.js");
@@ -0,0 +1,20 @@
1
+ import { RangedAnimationValueWithRandom, isNull } from "@tsparticles/engine";
2
+ import { SizeAnimation } from "./SizeAnimation.js";
3
+ export class Size extends RangedAnimationValueWithRandom {
4
+ animation;
5
+ constructor() {
6
+ super();
7
+ this.animation = new SizeAnimation();
8
+ this.value = 3;
9
+ }
10
+ load(data) {
11
+ super.load(data);
12
+ if (isNull(data)) {
13
+ return;
14
+ }
15
+ const animation = data.animation;
16
+ if (animation !== undefined) {
17
+ this.animation.load(animation);
18
+ }
19
+ }
20
+ }
@@ -0,0 +1,18 @@
1
+ import { DestroyType, RangedAnimationOptions, isNull, } from "@tsparticles/engine";
2
+ export class SizeAnimation extends RangedAnimationOptions {
3
+ destroy;
4
+ constructor() {
5
+ super();
6
+ this.destroy = DestroyType.none;
7
+ this.speed = 5;
8
+ }
9
+ load(data) {
10
+ super.load(data);
11
+ if (isNull(data)) {
12
+ return;
13
+ }
14
+ if (data.destroy !== undefined) {
15
+ this.destroy = data.destroy;
16
+ }
17
+ }
18
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -1,19 +1,25 @@
1
- import { getRandom, percentDenominator, updateAnimation, } from "@tsparticles/engine";
1
+ import { getRandom, getRangeValue, initParticleNumericAnimationValue, percentDenominator, updateAnimation, } from "@tsparticles/engine";
2
+ import { Size } from "./Options/Classes/Size.js";
2
3
  const minLoops = 0;
3
4
  export class SizeUpdater {
4
- _container;
5
+ #container;
5
6
  constructor(container) {
6
- this._container = container;
7
+ this.#container = container;
7
8
  }
8
9
  init(particle) {
9
- const container = this._container, sizeOptions = particle.options.size, sizeAnimation = sizeOptions.animation;
10
- if (sizeAnimation.enable) {
11
- particle.size.velocity =
12
- (particle.retina.sizeAnimationSpeed / percentDenominator) * container.retina.reduceFactor;
13
- if (!sizeAnimation.sync) {
14
- particle.size.velocity *= getRandom();
15
- }
10
+ const container = this.#container, sizeOptions = particle.options.size;
11
+ if (!sizeOptions) {
12
+ return;
13
+ }
14
+ const sizeAnimation = sizeOptions.animation;
15
+ if (!sizeAnimation.enable) {
16
+ return;
17
+ }
18
+ particle.size.velocity = (particle.retina.sizeAnimationSpeed / percentDenominator) * container.retina.reduceFactor;
19
+ if (sizeAnimation.sync) {
20
+ return;
16
21
  }
22
+ particle.size.velocity *= getRandom();
17
23
  }
18
24
  isEnabled(particle) {
19
25
  return (!particle.destroyed &&
@@ -23,12 +29,26 @@ export class SizeUpdater {
23
29
  ((particle.size.maxLoops ?? minLoops) > minLoops &&
24
30
  (particle.size.loops ?? minLoops) < (particle.size.maxLoops ?? minLoops))));
25
31
  }
32
+ loadOptions(options, ...sources) {
33
+ options.size ??= new Size();
34
+ for (const source of sources) {
35
+ options.size.load(source?.size);
36
+ }
37
+ }
38
+ preInit(particle) {
39
+ const pxRatio = this.#container.retina.pixelRatio, options = particle.options, sizeOptions = options.size;
40
+ if (!sizeOptions) {
41
+ return;
42
+ }
43
+ particle.size = initParticleNumericAnimationValue(sizeOptions, pxRatio);
44
+ particle.retina.sizeAnimationSpeed = getRangeValue(sizeOptions.animation.speed) * pxRatio;
45
+ }
26
46
  reset(particle) {
27
47
  particle.size.time = 0;
28
48
  particle.size.loops = 0;
29
49
  }
30
50
  update(particle, delta) {
31
- if (!this.isEnabled(particle)) {
51
+ if (!this.isEnabled(particle) || !particle.options.size) {
32
52
  return;
33
53
  }
34
54
  updateAnimation(particle, particle.size, true, particle.options.size.animation.destroy, delta);
package/cjs/Types.js ADDED
@@ -0,0 +1 @@
1
+ export {};
package/cjs/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { SizeUpdater } from "./SizeUpdater.js";
2
2
  export async function loadSizeUpdater(engine) {
3
- engine.checkVersion("4.0.5");
3
+ engine.checkVersion("4.1.1");
4
4
  await engine.pluginManager.register(e => {
5
5
  e.pluginManager.addParticleUpdater("size", container => {
6
6
  return Promise.resolve(new SizeUpdater(container));
package/cjs/index.lazy.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export async function loadSizeUpdater(engine) {
2
- engine.checkVersion("4.0.5");
2
+ engine.checkVersion("4.1.1");
3
3
  await engine.pluginManager.register(e => {
4
4
  e.pluginManager.addParticleUpdater("size", async (container) => {
5
5
  const { SizeUpdater } = await import("./SizeUpdater.js");
@@ -0,0 +1,20 @@
1
+ import { RangedAnimationValueWithRandom, isNull } from "@tsparticles/engine";
2
+ import { SizeAnimation } from "./SizeAnimation.js";
3
+ export class Size extends RangedAnimationValueWithRandom {
4
+ animation;
5
+ constructor() {
6
+ super();
7
+ this.animation = new SizeAnimation();
8
+ this.value = 3;
9
+ }
10
+ load(data) {
11
+ super.load(data);
12
+ if (isNull(data)) {
13
+ return;
14
+ }
15
+ const animation = data.animation;
16
+ if (animation !== undefined) {
17
+ this.animation.load(animation);
18
+ }
19
+ }
20
+ }
@@ -0,0 +1,18 @@
1
+ import { DestroyType, RangedAnimationOptions, isNull, } from "@tsparticles/engine";
2
+ export class SizeAnimation extends RangedAnimationOptions {
3
+ destroy;
4
+ constructor() {
5
+ super();
6
+ this.destroy = DestroyType.none;
7
+ this.speed = 5;
8
+ }
9
+ load(data) {
10
+ super.load(data);
11
+ if (isNull(data)) {
12
+ return;
13
+ }
14
+ if (data.destroy !== undefined) {
15
+ this.destroy = data.destroy;
16
+ }
17
+ }
18
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -1,19 +1,25 @@
1
- import { getRandom, percentDenominator, updateAnimation, } from "@tsparticles/engine";
1
+ import { getRandom, getRangeValue, initParticleNumericAnimationValue, percentDenominator, updateAnimation, } from "@tsparticles/engine";
2
+ import { Size } from "./Options/Classes/Size.js";
2
3
  const minLoops = 0;
3
4
  export class SizeUpdater {
4
- _container;
5
+ #container;
5
6
  constructor(container) {
6
- this._container = container;
7
+ this.#container = container;
7
8
  }
8
9
  init(particle) {
9
- const container = this._container, sizeOptions = particle.options.size, sizeAnimation = sizeOptions.animation;
10
- if (sizeAnimation.enable) {
11
- particle.size.velocity =
12
- (particle.retina.sizeAnimationSpeed / percentDenominator) * container.retina.reduceFactor;
13
- if (!sizeAnimation.sync) {
14
- particle.size.velocity *= getRandom();
15
- }
10
+ const container = this.#container, sizeOptions = particle.options.size;
11
+ if (!sizeOptions) {
12
+ return;
13
+ }
14
+ const sizeAnimation = sizeOptions.animation;
15
+ if (!sizeAnimation.enable) {
16
+ return;
17
+ }
18
+ particle.size.velocity = (particle.retina.sizeAnimationSpeed / percentDenominator) * container.retina.reduceFactor;
19
+ if (sizeAnimation.sync) {
20
+ return;
16
21
  }
22
+ particle.size.velocity *= getRandom();
17
23
  }
18
24
  isEnabled(particle) {
19
25
  return (!particle.destroyed &&
@@ -23,12 +29,26 @@ export class SizeUpdater {
23
29
  ((particle.size.maxLoops ?? minLoops) > minLoops &&
24
30
  (particle.size.loops ?? minLoops) < (particle.size.maxLoops ?? minLoops))));
25
31
  }
32
+ loadOptions(options, ...sources) {
33
+ options.size ??= new Size();
34
+ for (const source of sources) {
35
+ options.size.load(source?.size);
36
+ }
37
+ }
38
+ preInit(particle) {
39
+ const pxRatio = this.#container.retina.pixelRatio, options = particle.options, sizeOptions = options.size;
40
+ if (!sizeOptions) {
41
+ return;
42
+ }
43
+ particle.size = initParticleNumericAnimationValue(sizeOptions, pxRatio);
44
+ particle.retina.sizeAnimationSpeed = getRangeValue(sizeOptions.animation.speed) * pxRatio;
45
+ }
26
46
  reset(particle) {
27
47
  particle.size.time = 0;
28
48
  particle.size.loops = 0;
29
49
  }
30
50
  update(particle, delta) {
31
- if (!this.isEnabled(particle)) {
51
+ if (!this.isEnabled(particle) || !particle.options.size) {
32
52
  return;
33
53
  }
34
54
  updateAnimation(particle, particle.size, true, particle.options.size.animation.destroy, delta);
package/esm/Types.js ADDED
@@ -0,0 +1 @@
1
+ export {};
package/esm/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { SizeUpdater } from "./SizeUpdater.js";
2
2
  export async function loadSizeUpdater(engine) {
3
- engine.checkVersion("4.0.5");
3
+ engine.checkVersion("4.1.1");
4
4
  await engine.pluginManager.register(e => {
5
5
  e.pluginManager.addParticleUpdater("size", container => {
6
6
  return Promise.resolve(new SizeUpdater(container));
package/esm/index.lazy.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export async function loadSizeUpdater(engine) {
2
- engine.checkVersion("4.0.5");
2
+ engine.checkVersion("4.1.1");
3
3
  await engine.pluginManager.register(e => {
4
4
  e.pluginManager.addParticleUpdater("size", async (container) => {
5
5
  const { SizeUpdater } = await import("./SizeUpdater.js");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/updater-size",
3
- "version": "4.0.5",
3
+ "version": "4.1.1",
4
4
  "description": "tsParticles particles size 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.0.5"
96
+ "@tsparticles/engine": "4.1.1"
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.size.js","children":[{"name":"dist/browser","children":[{"uid":"bcbdfb06-1","name":"SizeUpdater.js"},{"uid":"bcbdfb06-3","name":"index.js"},{"uid":"bcbdfb06-5","name":"browser.js"}]}]}],"isRoot":true},"nodeParts":{"bcbdfb06-1":{"renderedLength":1409,"gzipLength":0,"brotliLength":0,"metaUid":"bcbdfb06-0"},"bcbdfb06-3":{"renderedLength":305,"gzipLength":0,"brotliLength":0,"metaUid":"bcbdfb06-2"},"bcbdfb06-5":{"renderedLength":173,"gzipLength":0,"brotliLength":0,"metaUid":"bcbdfb06-4"}},"nodeMetas":{"bcbdfb06-0":{"id":"/dist/browser/SizeUpdater.js","moduleParts":{"tsparticles.updater.size.js":"bcbdfb06-1"},"imported":[{"uid":"bcbdfb06-6"}],"importedBy":[{"uid":"bcbdfb06-2"}]},"bcbdfb06-2":{"id":"/dist/browser/index.js","moduleParts":{"tsparticles.updater.size.js":"bcbdfb06-3"},"imported":[{"uid":"bcbdfb06-0"}],"importedBy":[{"uid":"bcbdfb06-4"}]},"bcbdfb06-4":{"id":"/dist/browser/browser.js","moduleParts":{"tsparticles.updater.size.js":"bcbdfb06-5"},"imported":[{"uid":"bcbdfb06-2"}],"importedBy":[],"isEntry":true},"bcbdfb06-6":{"id":"@tsparticles/engine","moduleParts":{},"imported":[],"importedBy":[{"uid":"bcbdfb06-0"}],"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.size.js","children":[{"name":"dist/browser","children":[{"name":"Options/Classes","children":[{"uid":"b4ba9a13-1","name":"SizeAnimation.js"},{"uid":"b4ba9a13-3","name":"Size.js"}]},{"uid":"b4ba9a13-5","name":"SizeUpdater.js"},{"uid":"b4ba9a13-7","name":"index.js"},{"uid":"b4ba9a13-9","name":"browser.js"}]}]}],"isRoot":true},"nodeParts":{"b4ba9a13-1":{"renderedLength":464,"gzipLength":0,"brotliLength":0,"metaUid":"b4ba9a13-0"},"b4ba9a13-3":{"renderedLength":509,"gzipLength":0,"brotliLength":0,"metaUid":"b4ba9a13-2"},"b4ba9a13-5":{"renderedLength":2161,"gzipLength":0,"brotliLength":0,"metaUid":"b4ba9a13-4"},"b4ba9a13-7":{"renderedLength":305,"gzipLength":0,"brotliLength":0,"metaUid":"b4ba9a13-6"},"b4ba9a13-9":{"renderedLength":173,"gzipLength":0,"brotliLength":0,"metaUid":"b4ba9a13-8"}},"nodeMetas":{"b4ba9a13-0":{"id":"/dist/browser/Options/Classes/SizeAnimation.js","moduleParts":{"tsparticles.updater.size.js":"b4ba9a13-1"},"imported":[{"uid":"b4ba9a13-10"}],"importedBy":[{"uid":"b4ba9a13-2"}]},"b4ba9a13-2":{"id":"/dist/browser/Options/Classes/Size.js","moduleParts":{"tsparticles.updater.size.js":"b4ba9a13-3"},"imported":[{"uid":"b4ba9a13-10"},{"uid":"b4ba9a13-0"}],"importedBy":[{"uid":"b4ba9a13-4"}]},"b4ba9a13-4":{"id":"/dist/browser/SizeUpdater.js","moduleParts":{"tsparticles.updater.size.js":"b4ba9a13-5"},"imported":[{"uid":"b4ba9a13-10"},{"uid":"b4ba9a13-2"}],"importedBy":[{"uid":"b4ba9a13-6"}]},"b4ba9a13-6":{"id":"/dist/browser/index.js","moduleParts":{"tsparticles.updater.size.js":"b4ba9a13-7"},"imported":[{"uid":"b4ba9a13-4"}],"importedBy":[{"uid":"b4ba9a13-8"}]},"b4ba9a13-8":{"id":"/dist/browser/browser.js","moduleParts":{"tsparticles.updater.size.js":"b4ba9a13-9"},"imported":[{"uid":"b4ba9a13-6"}],"importedBy":[],"isEntry":true},"b4ba9a13-10":{"id":"@tsparticles/engine","moduleParts":{},"imported":[],"importedBy":[{"uid":"b4ba9a13-4"},{"uid":"b4ba9a13-2"},{"uid":"b4ba9a13-0"}],"isExternal":true}},"env":{"rollup":"4.60.4"},"options":{"gzip":false,"brotli":false,"sourcemap":false}};
4934
4934
 
4935
4935
  const run = () => {
4936
4936
  const width = window.innerWidth;
@@ -1,26 +1,68 @@
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.0.5 */
2
+ /* Updater v4.1.1 */
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) :
6
6
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.__tsParticlesInternals = global.__tsParticlesInternals || {}, global.__tsParticlesInternals.updaters = global.__tsParticlesInternals.updaters || {}, global.__tsParticlesInternals.updaters.size = global.__tsParticlesInternals.updaters.size || {}), global.__tsParticlesInternals.engine));
7
7
  })(this, (function (exports, engine) { 'use strict';
8
8
 
9
+ class SizeAnimation extends engine.RangedAnimationOptions {
10
+ destroy;
11
+ constructor() {
12
+ super();
13
+ this.destroy = engine.DestroyType.none;
14
+ this.speed = 5;
15
+ }
16
+ load(data) {
17
+ super.load(data);
18
+ if (engine.isNull(data)) {
19
+ return;
20
+ }
21
+ if (data.destroy !== undefined) {
22
+ this.destroy = data.destroy;
23
+ }
24
+ }
25
+ }
26
+
27
+ class Size extends engine.RangedAnimationValueWithRandom {
28
+ animation;
29
+ constructor() {
30
+ super();
31
+ this.animation = new SizeAnimation();
32
+ this.value = 3;
33
+ }
34
+ load(data) {
35
+ super.load(data);
36
+ if (engine.isNull(data)) {
37
+ return;
38
+ }
39
+ const animation = data.animation;
40
+ if (animation !== undefined) {
41
+ this.animation.load(animation);
42
+ }
43
+ }
44
+ }
45
+
9
46
  const minLoops = 0;
10
47
  class SizeUpdater {
11
- _container;
48
+ #container;
12
49
  constructor(container) {
13
- this._container = container;
50
+ this.#container = container;
14
51
  }
15
52
  init(particle) {
16
- const container = this._container, sizeOptions = particle.options.size, sizeAnimation = sizeOptions.animation;
17
- if (sizeAnimation.enable) {
18
- particle.size.velocity =
19
- (particle.retina.sizeAnimationSpeed / engine.percentDenominator) * container.retina.reduceFactor;
20
- if (!sizeAnimation.sync) {
21
- particle.size.velocity *= engine.getRandom();
22
- }
53
+ const container = this.#container, sizeOptions = particle.options.size;
54
+ if (!sizeOptions) {
55
+ return;
56
+ }
57
+ const sizeAnimation = sizeOptions.animation;
58
+ if (!sizeAnimation.enable) {
59
+ return;
60
+ }
61
+ particle.size.velocity = (particle.retina.sizeAnimationSpeed / engine.percentDenominator) * container.retina.reduceFactor;
62
+ if (sizeAnimation.sync) {
63
+ return;
23
64
  }
65
+ particle.size.velocity *= engine.getRandom();
24
66
  }
25
67
  isEnabled(particle) {
26
68
  return (!particle.destroyed &&
@@ -30,12 +72,26 @@
30
72
  ((particle.size.maxLoops ?? minLoops) > minLoops &&
31
73
  (particle.size.loops ?? minLoops) < (particle.size.maxLoops ?? minLoops))));
32
74
  }
75
+ loadOptions(options, ...sources) {
76
+ options.size ??= new Size();
77
+ for (const source of sources) {
78
+ options.size.load(source?.size);
79
+ }
80
+ }
81
+ preInit(particle) {
82
+ const pxRatio = this.#container.retina.pixelRatio, options = particle.options, sizeOptions = options.size;
83
+ if (!sizeOptions) {
84
+ return;
85
+ }
86
+ particle.size = engine.initParticleNumericAnimationValue(sizeOptions, pxRatio);
87
+ particle.retina.sizeAnimationSpeed = engine.getRangeValue(sizeOptions.animation.speed) * pxRatio;
88
+ }
33
89
  reset(particle) {
34
90
  particle.size.time = 0;
35
91
  particle.size.loops = 0;
36
92
  }
37
93
  update(particle, delta) {
38
- if (!this.isEnabled(particle)) {
94
+ if (!this.isEnabled(particle) || !particle.options.size) {
39
95
  return;
40
96
  }
41
97
  engine.updateAnimation(particle, particle.size, true, particle.options.size.animation.destroy, delta);
@@ -43,7 +99,7 @@
43
99
  }
44
100
 
45
101
  async function loadSizeUpdater(engine) {
46
- engine.checkVersion("4.0.5");
102
+ engine.checkVersion("4.1.1");
47
103
  await engine.pluginManager.register(e => {
48
104
  e.pluginManager.addParticleUpdater("size", container => {
49
105
  return Promise.resolve(new SizeUpdater(container));
@@ -1 +1 @@
1
- !function(s){s.__tsParticlesInternals=s.__tsParticlesInternals||{},s.__tsParticlesInternals.bundles=s.__tsParticlesInternals.bundles||{},s.__tsParticlesInternals.effects=s.__tsParticlesInternals.effects||{},s.__tsParticlesInternals.engine=s.__tsParticlesInternals.engine||{},s.__tsParticlesInternals.interactions=s.__tsParticlesInternals.interactions||{},s.__tsParticlesInternals.palettes=s.__tsParticlesInternals.palettes||{},s.__tsParticlesInternals.paths=s.__tsParticlesInternals.paths||{},s.__tsParticlesInternals.plugins=s.__tsParticlesInternals.plugins||{},s.__tsParticlesInternals.plugins=s.__tsParticlesInternals.plugins||{},s.__tsParticlesInternals.plugins.emittersShapes=s.__tsParticlesInternals.plugins.emittersShapes||{},s.__tsParticlesInternals.presets=s.__tsParticlesInternals.presets||{},s.__tsParticlesInternals.shapes=s.__tsParticlesInternals.shapes||{},s.__tsParticlesInternals.updaters=s.__tsParticlesInternals.updaters||{},s.__tsParticlesInternals.utils=s.__tsParticlesInternals.utils||{},s.__tsParticlesInternals.canvas=s.__tsParticlesInternals.canvas||{},s.__tsParticlesInternals.canvas=s.__tsParticlesInternals.canvas||{},s.__tsParticlesInternals.canvas.utils=s.__tsParticlesInternals.canvas.utils||{},s.__tsParticlesInternals.path=s.__tsParticlesInternals.path||{},s.__tsParticlesInternals.path=s.__tsParticlesInternals.path||{},s.__tsParticlesInternals.path.utils=s.__tsParticlesInternals.path.utils||{};var t="undefined"!=typeof Proxy?function(s){return new Proxy(s,{get:function(s,t){return t in s||(s[t]={}),s[t]}})}:function(s){return s};s.__tsParticlesInternals.bundles=t(s.__tsParticlesInternals.bundles),s.__tsParticlesInternals.effects=t(s.__tsParticlesInternals.effects),s.__tsParticlesInternals.interactions=t(s.__tsParticlesInternals.interactions),s.__tsParticlesInternals.palettes=t(s.__tsParticlesInternals.palettes),s.__tsParticlesInternals.paths=t(s.__tsParticlesInternals.paths),s.__tsParticlesInternals.plugins=t(s.__tsParticlesInternals.plugins),s.__tsParticlesInternals.plugins.emittersShapes=t(s.__tsParticlesInternals.plugins.emittersShapes),s.__tsParticlesInternals.presets=t(s.__tsParticlesInternals.presets),s.__tsParticlesInternals.shapes=t(s.__tsParticlesInternals.shapes),s.__tsParticlesInternals.updaters=t(s.__tsParticlesInternals.updaters),s.__tsParticlesInternals.utils=t(s.__tsParticlesInternals.utils),s.__tsParticlesInternals.canvas=t(s.__tsParticlesInternals.canvas),s.__tsParticlesInternals.path=t(s.__tsParticlesInternals.path),s.tsparticlesInternalExports=s.tsparticlesInternalExports||{}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:this),function(s,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@tsparticles/engine")):"function"==typeof define&&define.amd?define(["exports","@tsparticles/engine"],t):t(((s="undefined"!=typeof globalThis?globalThis:s||self).__tsParticlesInternals=s.__tsParticlesInternals||{},s.__tsParticlesInternals.updaters=s.__tsParticlesInternals.updaters||{},s.__tsParticlesInternals.updaters.size=s.__tsParticlesInternals.updaters.size||{}),s.__tsParticlesInternals.engine)}(this,function(s,t){"use strict";class e{_container;constructor(s){this._container=s}init(s){const e=this._container,n=s.options.size.animation;n.enable&&(s.size.velocity=s.retina.sizeAnimationSpeed/t.percentDenominator*e.retina.reduceFactor,n.sync||(s.size.velocity*=t.getRandom()))}isEnabled(s){return!s.destroyed&&!s.spawning&&s.size.enable&&((s.size.maxLoops??0)<=0||(s.size.maxLoops??0)>0&&(s.size.loops??0)<(s.size.maxLoops??0))}reset(s){s.size.time=0,s.size.loops=0}update(s,e){this.isEnabled(s)&&t.updateAnimation(s,s.size,!0,s.options.size.animation.destroy,e)}}async function n(s){s.checkVersion("4.0.5"),await s.pluginManager.register(s=>{s.pluginManager.addParticleUpdater("size",s=>Promise.resolve(new e(s)))})}const a=globalThis;a.__tsParticlesInternals=a.__tsParticlesInternals??{},a.loadSizeUpdater=n,s.loadSizeUpdater=n}),Object.assign(globalThis.window||globalThis,{loadSizeUpdater:(globalThis.__tsParticlesInternals.updaters.size||{}).loadSizeUpdater}),delete(globalThis.window||globalThis).tsparticlesInternalExports;
1
+ !function(s){s.__tsParticlesInternals=s.__tsParticlesInternals||{},s.__tsParticlesInternals.bundles=s.__tsParticlesInternals.bundles||{},s.__tsParticlesInternals.effects=s.__tsParticlesInternals.effects||{},s.__tsParticlesInternals.engine=s.__tsParticlesInternals.engine||{},s.__tsParticlesInternals.interactions=s.__tsParticlesInternals.interactions||{},s.__tsParticlesInternals.palettes=s.__tsParticlesInternals.palettes||{},s.__tsParticlesInternals.paths=s.__tsParticlesInternals.paths||{},s.__tsParticlesInternals.plugins=s.__tsParticlesInternals.plugins||{},s.__tsParticlesInternals.plugins=s.__tsParticlesInternals.plugins||{},s.__tsParticlesInternals.plugins.emittersShapes=s.__tsParticlesInternals.plugins.emittersShapes||{},s.__tsParticlesInternals.presets=s.__tsParticlesInternals.presets||{},s.__tsParticlesInternals.shapes=s.__tsParticlesInternals.shapes||{},s.__tsParticlesInternals.updaters=s.__tsParticlesInternals.updaters||{},s.__tsParticlesInternals.utils=s.__tsParticlesInternals.utils||{},s.__tsParticlesInternals.canvas=s.__tsParticlesInternals.canvas||{},s.__tsParticlesInternals.canvas=s.__tsParticlesInternals.canvas||{},s.__tsParticlesInternals.canvas.utils=s.__tsParticlesInternals.canvas.utils||{},s.__tsParticlesInternals.path=s.__tsParticlesInternals.path||{},s.__tsParticlesInternals.path=s.__tsParticlesInternals.path||{},s.__tsParticlesInternals.path.utils=s.__tsParticlesInternals.path.utils||{};var t="undefined"!=typeof Proxy?function(s){return new Proxy(s,{get:function(s,t){return t in s||(s[t]={}),s[t]}})}:function(s){return s};s.__tsParticlesInternals.bundles=t(s.__tsParticlesInternals.bundles),s.__tsParticlesInternals.effects=t(s.__tsParticlesInternals.effects),s.__tsParticlesInternals.interactions=t(s.__tsParticlesInternals.interactions),s.__tsParticlesInternals.palettes=t(s.__tsParticlesInternals.palettes),s.__tsParticlesInternals.paths=t(s.__tsParticlesInternals.paths),s.__tsParticlesInternals.plugins=t(s.__tsParticlesInternals.plugins),s.__tsParticlesInternals.plugins.emittersShapes=t(s.__tsParticlesInternals.plugins.emittersShapes),s.__tsParticlesInternals.presets=t(s.__tsParticlesInternals.presets),s.__tsParticlesInternals.shapes=t(s.__tsParticlesInternals.shapes),s.__tsParticlesInternals.updaters=t(s.__tsParticlesInternals.updaters),s.__tsParticlesInternals.utils=t(s.__tsParticlesInternals.utils),s.__tsParticlesInternals.canvas=t(s.__tsParticlesInternals.canvas),s.__tsParticlesInternals.path=t(s.__tsParticlesInternals.path),s.tsparticlesInternalExports=s.tsparticlesInternalExports||{}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:this),function(s,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@tsparticles/engine")):"function"==typeof define&&define.amd?define(["exports","@tsparticles/engine"],t):t(((s="undefined"!=typeof globalThis?globalThis:s||self).__tsParticlesInternals=s.__tsParticlesInternals||{},s.__tsParticlesInternals.updaters=s.__tsParticlesInternals.updaters||{},s.__tsParticlesInternals.updaters.size=s.__tsParticlesInternals.updaters.size||{}),s.__tsParticlesInternals.engine)}(this,function(s,t){"use strict";class e extends t.RangedAnimationOptions{destroy;constructor(){super(),this.destroy=t.DestroyType.none,this.speed=5}load(s){super.load(s),t.isNull(s)||void 0!==s.destroy&&(this.destroy=s.destroy)}}class n extends t.RangedAnimationValueWithRandom{animation;constructor(){super(),this.animation=new e,this.value=3}load(s){if(super.load(s),t.isNull(s))return;const e=s.animation;void 0!==e&&this.animation.load(e)}}class a{#s;constructor(s){this.#s=s}init(s){const e=this.#s,n=s.options.size;if(!n)return;const a=n.animation;a.enable&&(s.size.velocity=s.retina.sizeAnimationSpeed/t.percentDenominator*e.retina.reduceFactor,a.sync||(s.size.velocity*=t.getRandom()))}isEnabled(s){return!s.destroyed&&!s.spawning&&s.size.enable&&((s.size.maxLoops??0)<=0||(s.size.maxLoops??0)>0&&(s.size.loops??0)<(s.size.maxLoops??0))}loadOptions(s,...t){s.size??=new n;for(const e of t)s.size.load(e?.size)}preInit(s){const e=this.#s.retina.pixelRatio,n=s.options.size;n&&(s.size=t.initParticleNumericAnimationValue(n,e),s.retina.sizeAnimationSpeed=t.getRangeValue(n.animation.speed)*e)}reset(s){s.size.time=0,s.size.loops=0}update(s,e){this.isEnabled(s)&&s.options.size&&t.updateAnimation(s,s.size,!0,s.options.size.animation.destroy,e)}}async function i(s){s.checkVersion("4.1.1"),await s.pluginManager.register(s=>{s.pluginManager.addParticleUpdater("size",s=>Promise.resolve(new a(s)))})}const r=globalThis;r.__tsParticlesInternals=r.__tsParticlesInternals??{},r.loadSizeUpdater=i,s.loadSizeUpdater=i}),Object.assign(globalThis.window||globalThis,{loadSizeUpdater:(globalThis.__tsParticlesInternals.updaters.size||{}).loadSizeUpdater}),delete(globalThis.window||globalThis).tsparticlesInternalExports;
@@ -0,0 +1,8 @@
1
+ import { type IOptionLoader, RangedAnimationValueWithRandom, type RecursivePartial } from "@tsparticles/engine";
2
+ import type { ISize } from "../Interfaces/ISize.js";
3
+ import { SizeAnimation } from "./SizeAnimation.js";
4
+ export declare class Size extends RangedAnimationValueWithRandom implements ISize, IOptionLoader<ISize> {
5
+ readonly animation: SizeAnimation;
6
+ constructor();
7
+ load(data?: RecursivePartial<ISize>): void;
8
+ }
@@ -0,0 +1,7 @@
1
+ import { DestroyType, type IOptionLoader, RangedAnimationOptions, type RecursivePartial } from "@tsparticles/engine";
2
+ import type { ISizeAnimation } from "../Interfaces/ISizeAnimation.js";
3
+ export declare class SizeAnimation extends RangedAnimationOptions implements ISizeAnimation, IOptionLoader<ISizeAnimation> {
4
+ destroy: DestroyType | keyof typeof DestroyType;
5
+ constructor();
6
+ load(data?: RecursivePartial<ISizeAnimation>): void;
7
+ }
@@ -0,0 +1,5 @@
1
+ import type { ISizeAnimation } from "./ISizeAnimation.js";
2
+ import type { IValueWithRandom } from "@tsparticles/engine";
3
+ export interface ISize extends IValueWithRandom {
4
+ animation: ISizeAnimation;
5
+ }
@@ -0,0 +1,4 @@
1
+ import type { DestroyType, IRangedAnimation } from "@tsparticles/engine";
2
+ export interface ISizeAnimation extends IRangedAnimation {
3
+ destroy: DestroyType | keyof typeof DestroyType;
4
+ }
@@ -1,9 +1,12 @@
1
- import { type Container, type IDelta, type IParticleUpdater, type Particle } from "@tsparticles/engine";
1
+ import { type Container, type IDelta, type IParticleUpdater, type RecursivePartial } from "@tsparticles/engine";
2
+ import type { ISizeParticlesOptions, SizeParticle, SizeParticlesOptions } from "./Types.js";
2
3
  export declare class SizeUpdater implements IParticleUpdater {
3
- private readonly _container;
4
+ #private;
4
5
  constructor(container: Container);
5
- init(particle: Particle): void;
6
- isEnabled(particle: Particle): boolean;
7
- reset(particle: Particle): void;
8
- update(particle: Particle, delta: IDelta): void;
6
+ init(particle: SizeParticle): void;
7
+ isEnabled(particle: SizeParticle): boolean;
8
+ loadOptions(options: SizeParticlesOptions, ...sources: (RecursivePartial<ISizeParticlesOptions> | undefined)[]): void;
9
+ preInit(particle: SizeParticle): void;
10
+ reset(particle: SizeParticle): void;
11
+ update(particle: SizeParticle, delta: IDelta): void;
9
12
  }
@@ -0,0 +1,12 @@
1
+ import { type IParticlesOptions, type Particle, type ParticlesOptions } from "@tsparticles/engine";
2
+ import type { ISize } from "./Options/Interfaces/ISize.js";
3
+ import type { Size } from "./Options/Classes/Size.js";
4
+ export type SizeParticlesOptions = ParticlesOptions & {
5
+ size?: Size;
6
+ };
7
+ export type ISizeParticlesOptions = IParticlesOptions & {
8
+ size?: ISize;
9
+ };
10
+ export type SizeParticle = Particle & {
11
+ options: SizeParticlesOptions;
12
+ };