@tsparticles/updater-tilt 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,28 +1,17 @@
1
- import { ValueWithRandom, isNull } from "@tsparticles/engine";
1
+ import { ValueWithRandom, isNull, loadProperty } from "@tsparticles/engine";
2
2
  import { TiltDirection } from "../../TiltDirection.js";
3
3
  import { TiltAnimation } from "./TiltAnimation.js";
4
4
  export class Tilt extends ValueWithRandom {
5
- animation;
6
- direction;
7
- enable;
8
- constructor() {
9
- super();
10
- this.animation = new TiltAnimation();
11
- this.direction = TiltDirection.clockwise;
12
- this.enable = false;
13
- this.value = 0;
14
- }
5
+ animation = new TiltAnimation();
6
+ direction = TiltDirection.clockwise;
7
+ enable = false;
15
8
  load(data) {
16
9
  super.load(data);
17
10
  if (isNull(data)) {
18
11
  return;
19
12
  }
20
13
  this.animation.load(data.animation);
21
- if (data.direction !== undefined) {
22
- this.direction = data.direction;
23
- }
24
- if (data.enable !== undefined) {
25
- this.enable = data.enable;
26
- }
14
+ loadProperty(this, "direction", data.direction);
15
+ loadProperty(this, "enable", data.enable);
27
16
  }
28
17
  }
@@ -1,30 +1,16 @@
1
- import { isNull, setRangeValue } from "@tsparticles/engine";
1
+ import { isNull, loadProperty, loadRangeProperty, } from "@tsparticles/engine";
2
2
  export class TiltAnimation {
3
- decay;
4
- enable;
5
- speed;
6
- sync;
7
- constructor() {
8
- this.enable = false;
9
- this.speed = 0;
10
- this.decay = 0;
11
- this.sync = false;
12
- }
3
+ decay = 0;
4
+ enable = false;
5
+ speed = 0;
6
+ sync = false;
13
7
  load(data) {
14
8
  if (isNull(data)) {
15
9
  return;
16
10
  }
17
- if (data.enable !== undefined) {
18
- this.enable = data.enable;
19
- }
20
- if (data.speed !== undefined) {
21
- this.speed = setRangeValue(data.speed);
22
- }
23
- if (data.decay !== undefined) {
24
- this.decay = setRangeValue(data.decay);
25
- }
26
- if (data.sync !== undefined) {
27
- this.sync = data.sync;
28
- }
11
+ loadProperty(this, "enable", data.enable);
12
+ loadRangeProperty(this, "speed", data.speed);
13
+ loadRangeProperty(this, "decay", data.decay);
14
+ loadProperty(this, "sync", data.sync);
29
15
  }
30
16
  }
@@ -1,6 +1,7 @@
1
- import { AnimationStatus, DestroyType, degToRad, double, doublePI, getRandom, getRangeValue, half, identity, updateAnimation, } from "@tsparticles/engine";
1
+ import { AnimationStatus, DestroyType, degToRad, double, doublePI, getRandom, getRangeValue, half, identity, loadOptionProperty, } from "@tsparticles/engine";
2
2
  import { Tilt } from "./Options/Classes/Tilt.js";
3
3
  import { TiltDirection } from "./TiltDirection.js";
4
+ import { updateAnimation } from "@tsparticles/animation-utils";
4
5
  const maxAngle = 360;
5
6
  export class TiltUpdater {
6
7
  #container;
@@ -57,10 +58,7 @@ export class TiltUpdater {
57
58
  return !particle.destroyed && !particle.spawning && !!tiltAnimation?.enable;
58
59
  }
59
60
  loadOptions(options, ...sources) {
60
- options.tilt ??= new Tilt();
61
- for (const source of sources) {
62
- options.tilt.load(source?.tilt);
63
- }
61
+ loadOptionProperty(options, "tilt", Tilt, ...sources);
64
62
  }
65
63
  update(particle, delta) {
66
64
  if (!this.isEnabled(particle) || !particle.tilt) {
package/browser/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { TiltUpdater } from "./TiltUpdater.js";
2
2
  export async function loadTiltUpdater(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("tilt", container => {
6
6
  return Promise.resolve(new TiltUpdater(container));
@@ -1,5 +1,5 @@
1
1
  export async function loadTiltUpdater(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("tilt", async (container) => {
5
5
  const { TiltUpdater } = await import("./TiltUpdater.js");
@@ -1,28 +1,17 @@
1
- import { ValueWithRandom, isNull } from "@tsparticles/engine";
1
+ import { ValueWithRandom, isNull, loadProperty } from "@tsparticles/engine";
2
2
  import { TiltDirection } from "../../TiltDirection.js";
3
3
  import { TiltAnimation } from "./TiltAnimation.js";
4
4
  export class Tilt extends ValueWithRandom {
5
- animation;
6
- direction;
7
- enable;
8
- constructor() {
9
- super();
10
- this.animation = new TiltAnimation();
11
- this.direction = TiltDirection.clockwise;
12
- this.enable = false;
13
- this.value = 0;
14
- }
5
+ animation = new TiltAnimation();
6
+ direction = TiltDirection.clockwise;
7
+ enable = false;
15
8
  load(data) {
16
9
  super.load(data);
17
10
  if (isNull(data)) {
18
11
  return;
19
12
  }
20
13
  this.animation.load(data.animation);
21
- if (data.direction !== undefined) {
22
- this.direction = data.direction;
23
- }
24
- if (data.enable !== undefined) {
25
- this.enable = data.enable;
26
- }
14
+ loadProperty(this, "direction", data.direction);
15
+ loadProperty(this, "enable", data.enable);
27
16
  }
28
17
  }
@@ -1,30 +1,16 @@
1
- import { isNull, setRangeValue } from "@tsparticles/engine";
1
+ import { isNull, loadProperty, loadRangeProperty, } from "@tsparticles/engine";
2
2
  export class TiltAnimation {
3
- decay;
4
- enable;
5
- speed;
6
- sync;
7
- constructor() {
8
- this.enable = false;
9
- this.speed = 0;
10
- this.decay = 0;
11
- this.sync = false;
12
- }
3
+ decay = 0;
4
+ enable = false;
5
+ speed = 0;
6
+ sync = false;
13
7
  load(data) {
14
8
  if (isNull(data)) {
15
9
  return;
16
10
  }
17
- if (data.enable !== undefined) {
18
- this.enable = data.enable;
19
- }
20
- if (data.speed !== undefined) {
21
- this.speed = setRangeValue(data.speed);
22
- }
23
- if (data.decay !== undefined) {
24
- this.decay = setRangeValue(data.decay);
25
- }
26
- if (data.sync !== undefined) {
27
- this.sync = data.sync;
28
- }
11
+ loadProperty(this, "enable", data.enable);
12
+ loadRangeProperty(this, "speed", data.speed);
13
+ loadRangeProperty(this, "decay", data.decay);
14
+ loadProperty(this, "sync", data.sync);
29
15
  }
30
16
  }
@@ -1,6 +1,7 @@
1
- import { AnimationStatus, DestroyType, degToRad, double, doublePI, getRandom, getRangeValue, half, identity, updateAnimation, } from "@tsparticles/engine";
1
+ import { AnimationStatus, DestroyType, degToRad, double, doublePI, getRandom, getRangeValue, half, identity, loadOptionProperty, } from "@tsparticles/engine";
2
2
  import { Tilt } from "./Options/Classes/Tilt.js";
3
3
  import { TiltDirection } from "./TiltDirection.js";
4
+ import { updateAnimation } from "@tsparticles/animation-utils";
4
5
  const maxAngle = 360;
5
6
  export class TiltUpdater {
6
7
  #container;
@@ -57,10 +58,7 @@ export class TiltUpdater {
57
58
  return !particle.destroyed && !particle.spawning && !!tiltAnimation?.enable;
58
59
  }
59
60
  loadOptions(options, ...sources) {
60
- options.tilt ??= new Tilt();
61
- for (const source of sources) {
62
- options.tilt.load(source?.tilt);
63
- }
61
+ loadOptionProperty(options, "tilt", Tilt, ...sources);
64
62
  }
65
63
  update(particle, delta) {
66
64
  if (!this.isEnabled(particle) || !particle.tilt) {
package/cjs/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { TiltUpdater } from "./TiltUpdater.js";
2
2
  export async function loadTiltUpdater(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("tilt", container => {
6
6
  return Promise.resolve(new TiltUpdater(container));
package/cjs/index.lazy.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export async function loadTiltUpdater(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("tilt", async (container) => {
5
5
  const { TiltUpdater } = await import("./TiltUpdater.js");
@@ -1,28 +1,17 @@
1
- import { ValueWithRandom, isNull } from "@tsparticles/engine";
1
+ import { ValueWithRandom, isNull, loadProperty } from "@tsparticles/engine";
2
2
  import { TiltDirection } from "../../TiltDirection.js";
3
3
  import { TiltAnimation } from "./TiltAnimation.js";
4
4
  export class Tilt extends ValueWithRandom {
5
- animation;
6
- direction;
7
- enable;
8
- constructor() {
9
- super();
10
- this.animation = new TiltAnimation();
11
- this.direction = TiltDirection.clockwise;
12
- this.enable = false;
13
- this.value = 0;
14
- }
5
+ animation = new TiltAnimation();
6
+ direction = TiltDirection.clockwise;
7
+ enable = false;
15
8
  load(data) {
16
9
  super.load(data);
17
10
  if (isNull(data)) {
18
11
  return;
19
12
  }
20
13
  this.animation.load(data.animation);
21
- if (data.direction !== undefined) {
22
- this.direction = data.direction;
23
- }
24
- if (data.enable !== undefined) {
25
- this.enable = data.enable;
26
- }
14
+ loadProperty(this, "direction", data.direction);
15
+ loadProperty(this, "enable", data.enable);
27
16
  }
28
17
  }
@@ -1,30 +1,16 @@
1
- import { isNull, setRangeValue } from "@tsparticles/engine";
1
+ import { isNull, loadProperty, loadRangeProperty, } from "@tsparticles/engine";
2
2
  export class TiltAnimation {
3
- decay;
4
- enable;
5
- speed;
6
- sync;
7
- constructor() {
8
- this.enable = false;
9
- this.speed = 0;
10
- this.decay = 0;
11
- this.sync = false;
12
- }
3
+ decay = 0;
4
+ enable = false;
5
+ speed = 0;
6
+ sync = false;
13
7
  load(data) {
14
8
  if (isNull(data)) {
15
9
  return;
16
10
  }
17
- if (data.enable !== undefined) {
18
- this.enable = data.enable;
19
- }
20
- if (data.speed !== undefined) {
21
- this.speed = setRangeValue(data.speed);
22
- }
23
- if (data.decay !== undefined) {
24
- this.decay = setRangeValue(data.decay);
25
- }
26
- if (data.sync !== undefined) {
27
- this.sync = data.sync;
28
- }
11
+ loadProperty(this, "enable", data.enable);
12
+ loadRangeProperty(this, "speed", data.speed);
13
+ loadRangeProperty(this, "decay", data.decay);
14
+ loadProperty(this, "sync", data.sync);
29
15
  }
30
16
  }
@@ -1,6 +1,7 @@
1
- import { AnimationStatus, DestroyType, degToRad, double, doublePI, getRandom, getRangeValue, half, identity, updateAnimation, } from "@tsparticles/engine";
1
+ import { AnimationStatus, DestroyType, degToRad, double, doublePI, getRandom, getRangeValue, half, identity, loadOptionProperty, } from "@tsparticles/engine";
2
2
  import { Tilt } from "./Options/Classes/Tilt.js";
3
3
  import { TiltDirection } from "./TiltDirection.js";
4
+ import { updateAnimation } from "@tsparticles/animation-utils";
4
5
  const maxAngle = 360;
5
6
  export class TiltUpdater {
6
7
  #container;
@@ -57,10 +58,7 @@ export class TiltUpdater {
57
58
  return !particle.destroyed && !particle.spawning && !!tiltAnimation?.enable;
58
59
  }
59
60
  loadOptions(options, ...sources) {
60
- options.tilt ??= new Tilt();
61
- for (const source of sources) {
62
- options.tilt.load(source?.tilt);
63
- }
61
+ loadOptionProperty(options, "tilt", Tilt, ...sources);
64
62
  }
65
63
  update(particle, delta) {
66
64
  if (!this.isEnabled(particle) || !particle.tilt) {
package/esm/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { TiltUpdater } from "./TiltUpdater.js";
2
2
  export async function loadTiltUpdater(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("tilt", container => {
6
6
  return Promise.resolve(new TiltUpdater(container));
package/esm/index.lazy.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export async function loadTiltUpdater(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("tilt", async (container) => {
5
5
  const { TiltUpdater } = await import("./TiltUpdater.js");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/updater-tilt",
3
- "version": "4.1.2",
3
+ "version": "4.2.0",
4
4
  "description": "tsParticles particles tilt updater",
5
5
  "homepage": "https://particles.js.org",
6
6
  "repository": {
@@ -92,8 +92,11 @@
92
92
  },
93
93
  "./package.json": "./package.json"
94
94
  },
95
+ "dependencies": {
96
+ "@tsparticles/animation-utils": "4.2.0"
97
+ },
95
98
  "peerDependencies": {
96
- "@tsparticles/engine": "4.1.2"
99
+ "@tsparticles/engine": "4.2.0"
97
100
  },
98
101
  "publishConfig": {
99
102
  "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.tilt.js","children":[{"name":"dist/browser","children":[{"uid":"92a08bce-1","name":"TiltDirection.js"},{"name":"Options/Classes","children":[{"uid":"92a08bce-3","name":"TiltAnimation.js"},{"uid":"92a08bce-5","name":"Tilt.js"}]},{"uid":"92a08bce-7","name":"TiltUpdater.js"},{"uid":"92a08bce-9","name":"index.js"},{"uid":"92a08bce-11","name":"browser.js"}]}]}],"isRoot":true},"nodeParts":{"92a08bce-1":{"renderedLength":260,"gzipLength":0,"brotliLength":0,"metaUid":"92a08bce-0"},"92a08bce-3":{"renderedLength":793,"gzipLength":0,"brotliLength":0,"metaUid":"92a08bce-2"},"92a08bce-5":{"renderedLength":727,"gzipLength":0,"brotliLength":0,"metaUid":"92a08bce-4"},"92a08bce-7":{"renderedLength":2921,"gzipLength":0,"brotliLength":0,"metaUid":"92a08bce-6"},"92a08bce-9":{"renderedLength":305,"gzipLength":0,"brotliLength":0,"metaUid":"92a08bce-8"},"92a08bce-11":{"renderedLength":173,"gzipLength":0,"brotliLength":0,"metaUid":"92a08bce-10"}},"nodeMetas":{"92a08bce-0":{"id":"/dist/browser/TiltDirection.js","moduleParts":{"tsparticles.updater.tilt.js":"92a08bce-1"},"imported":[],"importedBy":[{"uid":"92a08bce-6"},{"uid":"92a08bce-4"}]},"92a08bce-2":{"id":"/dist/browser/Options/Classes/TiltAnimation.js","moduleParts":{"tsparticles.updater.tilt.js":"92a08bce-3"},"imported":[{"uid":"92a08bce-12"}],"importedBy":[{"uid":"92a08bce-4"}]},"92a08bce-4":{"id":"/dist/browser/Options/Classes/Tilt.js","moduleParts":{"tsparticles.updater.tilt.js":"92a08bce-5"},"imported":[{"uid":"92a08bce-12"},{"uid":"92a08bce-0"},{"uid":"92a08bce-2"}],"importedBy":[{"uid":"92a08bce-6"}]},"92a08bce-6":{"id":"/dist/browser/TiltUpdater.js","moduleParts":{"tsparticles.updater.tilt.js":"92a08bce-7"},"imported":[{"uid":"92a08bce-12"},{"uid":"92a08bce-4"},{"uid":"92a08bce-0"}],"importedBy":[{"uid":"92a08bce-8"}]},"92a08bce-8":{"id":"/dist/browser/index.js","moduleParts":{"tsparticles.updater.tilt.js":"92a08bce-9"},"imported":[{"uid":"92a08bce-6"}],"importedBy":[{"uid":"92a08bce-10"}]},"92a08bce-10":{"id":"/dist/browser/browser.js","moduleParts":{"tsparticles.updater.tilt.js":"92a08bce-11"},"imported":[{"uid":"92a08bce-8"}],"importedBy":[],"isEntry":true},"92a08bce-12":{"id":"@tsparticles/engine","moduleParts":{},"imported":[],"importedBy":[{"uid":"92a08bce-6"},{"uid":"92a08bce-4"},{"uid":"92a08bce-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.tilt.js","children":[{"name":"dist/browser","children":[{"uid":"d07be56c-1","name":"TiltDirection.js"},{"name":"Options/Classes","children":[{"uid":"d07be56c-3","name":"TiltAnimation.js"},{"uid":"d07be56c-5","name":"Tilt.js"}]},{"uid":"d07be56c-7","name":"TiltUpdater.js"},{"uid":"d07be56c-9","name":"index.js"},{"uid":"d07be56c-11","name":"browser.js"}]}]}],"isRoot":true},"nodeParts":{"d07be56c-1":{"renderedLength":260,"gzipLength":0,"brotliLength":0,"metaUid":"d07be56c-0"},"d07be56c-3":{"renderedLength":473,"gzipLength":0,"brotliLength":0,"metaUid":"d07be56c-2"},"d07be56c-5":{"renderedLength":480,"gzipLength":0,"brotliLength":0,"metaUid":"d07be56c-4"},"d07be56c-7":{"renderedLength":2855,"gzipLength":0,"brotliLength":0,"metaUid":"d07be56c-6"},"d07be56c-9":{"renderedLength":305,"gzipLength":0,"brotliLength":0,"metaUid":"d07be56c-8"},"d07be56c-11":{"renderedLength":173,"gzipLength":0,"brotliLength":0,"metaUid":"d07be56c-10"}},"nodeMetas":{"d07be56c-0":{"id":"/dist/browser/TiltDirection.js","moduleParts":{"tsparticles.updater.tilt.js":"d07be56c-1"},"imported":[],"importedBy":[{"uid":"d07be56c-6"},{"uid":"d07be56c-4"}]},"d07be56c-2":{"id":"/dist/browser/Options/Classes/TiltAnimation.js","moduleParts":{"tsparticles.updater.tilt.js":"d07be56c-3"},"imported":[{"uid":"d07be56c-12"}],"importedBy":[{"uid":"d07be56c-4"}]},"d07be56c-4":{"id":"/dist/browser/Options/Classes/Tilt.js","moduleParts":{"tsparticles.updater.tilt.js":"d07be56c-5"},"imported":[{"uid":"d07be56c-12"},{"uid":"d07be56c-0"},{"uid":"d07be56c-2"}],"importedBy":[{"uid":"d07be56c-6"}]},"d07be56c-6":{"id":"/dist/browser/TiltUpdater.js","moduleParts":{"tsparticles.updater.tilt.js":"d07be56c-7"},"imported":[{"uid":"d07be56c-12"},{"uid":"d07be56c-4"},{"uid":"d07be56c-0"},{"uid":"d07be56c-13"}],"importedBy":[{"uid":"d07be56c-8"}]},"d07be56c-8":{"id":"/dist/browser/index.js","moduleParts":{"tsparticles.updater.tilt.js":"d07be56c-9"},"imported":[{"uid":"d07be56c-6"}],"importedBy":[{"uid":"d07be56c-10"}]},"d07be56c-10":{"id":"/dist/browser/browser.js","moduleParts":{"tsparticles.updater.tilt.js":"d07be56c-11"},"imported":[{"uid":"d07be56c-8"}],"importedBy":[],"isEntry":true},"d07be56c-12":{"id":"@tsparticles/engine","moduleParts":{},"imported":[],"importedBy":[{"uid":"d07be56c-6"},{"uid":"d07be56c-4"},{"uid":"d07be56c-2"}],"isExternal":true},"d07be56c-13":{"id":"@tsparticles/animation-utils","moduleParts":{},"imported":[],"importedBy":[{"uid":"d07be56c-6"}],"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,10 +1,10 @@
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
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@tsparticles/engine')) :
5
- typeof define === 'function' && define.amd ? define(['exports', '@tsparticles/engine'], factory) :
6
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.__tsParticlesInternals = global.__tsParticlesInternals || {}, global.__tsParticlesInternals.updaters = global.__tsParticlesInternals.updaters || {}, global.__tsParticlesInternals.updaters.tilt = global.__tsParticlesInternals.updaters.tilt || {}), global.__tsParticlesInternals.engine));
7
- })(this, (function (exports, engine) { 'use strict';
4
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@tsparticles/engine'), require('@tsparticles/animation-utils')) :
5
+ typeof define === 'function' && define.amd ? define(['exports', '@tsparticles/engine', '@tsparticles/animation-utils'], factory) :
6
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.__tsParticlesInternals = global.__tsParticlesInternals || {}, global.__tsParticlesInternals.updaters = global.__tsParticlesInternals.updaters || {}, global.__tsParticlesInternals.updaters.tilt = global.__tsParticlesInternals.updaters.tilt || {}), global.__tsParticlesInternals.engine, global.__tsParticlesInternals.animation.utils));
7
+ })(this, (function (exports, engine, animationUtils) { 'use strict';
8
8
 
9
9
  var TiltDirection;
10
10
  (function (TiltDirection) {
@@ -14,58 +14,33 @@
14
14
  })(TiltDirection || (TiltDirection = {}));
15
15
 
16
16
  class TiltAnimation {
17
- decay;
18
- enable;
19
- speed;
20
- sync;
21
- constructor() {
22
- this.enable = false;
23
- this.speed = 0;
24
- this.decay = 0;
25
- this.sync = false;
26
- }
17
+ decay = 0;
18
+ enable = false;
19
+ speed = 0;
20
+ sync = false;
27
21
  load(data) {
28
22
  if (engine.isNull(data)) {
29
23
  return;
30
24
  }
31
- if (data.enable !== undefined) {
32
- this.enable = data.enable;
33
- }
34
- if (data.speed !== undefined) {
35
- this.speed = engine.setRangeValue(data.speed);
36
- }
37
- if (data.decay !== undefined) {
38
- this.decay = engine.setRangeValue(data.decay);
39
- }
40
- if (data.sync !== undefined) {
41
- this.sync = data.sync;
42
- }
25
+ engine.loadProperty(this, "enable", data.enable);
26
+ engine.loadRangeProperty(this, "speed", data.speed);
27
+ engine.loadRangeProperty(this, "decay", data.decay);
28
+ engine.loadProperty(this, "sync", data.sync);
43
29
  }
44
30
  }
45
31
 
46
32
  class Tilt extends engine.ValueWithRandom {
47
- animation;
48
- direction;
49
- enable;
50
- constructor() {
51
- super();
52
- this.animation = new TiltAnimation();
53
- this.direction = TiltDirection.clockwise;
54
- this.enable = false;
55
- this.value = 0;
56
- }
33
+ animation = new TiltAnimation();
34
+ direction = TiltDirection.clockwise;
35
+ enable = false;
57
36
  load(data) {
58
37
  super.load(data);
59
38
  if (engine.isNull(data)) {
60
39
  return;
61
40
  }
62
41
  this.animation.load(data.animation);
63
- if (data.direction !== undefined) {
64
- this.direction = data.direction;
65
- }
66
- if (data.enable !== undefined) {
67
- this.enable = data.enable;
68
- }
42
+ engine.loadProperty(this, "direction", data.direction);
43
+ engine.loadProperty(this, "enable", data.enable);
69
44
  }
70
45
  }
71
46
 
@@ -123,21 +98,18 @@
123
98
  return !particle.destroyed && !particle.spawning && !!tiltAnimation?.enable;
124
99
  }
125
100
  loadOptions(options, ...sources) {
126
- options.tilt ??= new Tilt();
127
- for (const source of sources) {
128
- options.tilt.load(source?.tilt);
129
- }
101
+ engine.loadOptionProperty(options, "tilt", Tilt, ...sources);
130
102
  }
131
103
  update(particle, delta) {
132
104
  if (!this.isEnabled(particle) || !particle.tilt) {
133
105
  return;
134
106
  }
135
- engine.updateAnimation(particle, particle.tilt, false, engine.DestroyType.none, delta);
107
+ animationUtils.updateAnimation(particle, particle.tilt, false, engine.DestroyType.none, delta);
136
108
  }
137
109
  }
138
110
 
139
111
  async function loadTiltUpdater(engine) {
140
- engine.checkVersion("4.1.2");
112
+ engine.checkVersion("4.2.0");
141
113
  await engine.pluginManager.register(e => {
142
114
  e.pluginManager.addParticleUpdater("tilt", container => {
143
115
  return Promise.resolve(new TiltUpdater(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.tilt=t.__tsParticlesInternals.updaters.tilt||{}),t.__tsParticlesInternals.engine)}(this,function(t,s){"use strict";var e;!function(t){t.clockwise="clockwise",t.counterClockwise="counter-clockwise",t.random="random"}(e||(e={}));class n{decay;enable;speed;sync;constructor(){this.enable=!1,this.speed=0,this.decay=0,this.sync=!1}load(t){s.isNull(t)||(void 0!==t.enable&&(this.enable=t.enable),void 0!==t.speed&&(this.speed=s.setRangeValue(t.speed)),void 0!==t.decay&&(this.decay=s.setRangeValue(t.decay)),void 0!==t.sync&&(this.sync=t.sync))}}class a extends s.ValueWithRandom{animation;direction;enable;constructor(){super(),this.animation=new n,this.direction=e.clockwise,this.enable=!1,this.value=0}load(t){super.load(t),s.isNull(t)||(this.animation.load(t.animation),void 0!==t.direction&&(this.direction=t.direction),void 0!==t.enable&&(this.enable=t.enable))}}class l{#t;constructor(t){this.#t=t}getTransformValues(t){const s=t.tilt?.enable&&t.tilt;return{b:s?Math.cos(s.value)*s.cosDirection:void 0,c:s?Math.sin(s.value)*s.sinDirection:void 0}}init(t){const n=t.options.tilt;if(!n)return;t.tilt={enable:n.enable,value:s.degToRad(s.getRangeValue(n.value)),sinDirection:s.getRandom()>=s.half?s.identity:-s.identity,cosDirection:s.getRandom()>=s.half?s.identity:-s.identity,min:0,max:s.doublePI};let a=n.direction;if(a===e.random){a=Math.floor(s.getRandom()*s.double)>0?e.counterClockwise:e.clockwise}switch(a){case e.counterClockwise:case"counterClockwise":t.tilt.status=s.AnimationStatus.decreasing;break;case e.clockwise:t.tilt.status=s.AnimationStatus.increasing}const l=t.options.tilt?.animation;l?.enable&&(t.tilt.decay=s.identity-s.getRangeValue(l.decay),t.tilt.velocity=s.getRangeValue(l.speed)/360*this.#t.retina.reduceFactor,l.sync||(t.tilt.velocity*=s.getRandom()))}isEnabled(t){const s=t.options.tilt?.animation;return!t.destroyed&&!t.spawning&&!!s?.enable}loadOptions(t,...s){t.tilt??=new a;for(const e of s)t.tilt.load(e?.tilt)}update(t,e){this.isEnabled(t)&&t.tilt&&s.updateAnimation(t,t.tilt,!1,s.DestroyType.none,e)}}async function i(t){t.checkVersion("4.1.2"),await t.pluginManager.register(t=>{t.pluginManager.addParticleUpdater("tilt",t=>Promise.resolve(new l(t)))})}const r=globalThis;r.__tsParticlesInternals=r.__tsParticlesInternals??{},r.loadTiltUpdater=i,t.loadTiltUpdater=i}),Object.assign(globalThis.window||globalThis,{loadTiltUpdater:(globalThis.__tsParticlesInternals.updaters.tilt||{}).loadTiltUpdater}),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 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"),require("@tsparticles/animation-utils")):"function"==typeof define&&define.amd?define(["exports","@tsparticles/engine","@tsparticles/animation-utils"],s):s(((t="undefined"!=typeof globalThis?globalThis:t||self).__tsParticlesInternals=t.__tsParticlesInternals||{},t.__tsParticlesInternals.updaters=t.__tsParticlesInternals.updaters||{},t.__tsParticlesInternals.updaters.tilt=t.__tsParticlesInternals.updaters.tilt||{}),t.__tsParticlesInternals.engine,t.__tsParticlesInternals.animation.utils)}(this,function(t,s,e){"use strict";var n;!function(t){t.clockwise="clockwise",t.counterClockwise="counter-clockwise",t.random="random"}(n||(n={}));class a{decay=0;enable=!1;speed=0;sync=!1;load(t){s.isNull(t)||(s.loadProperty(this,"enable",t.enable),s.loadRangeProperty(this,"speed",t.speed),s.loadRangeProperty(this,"decay",t.decay),s.loadProperty(this,"sync",t.sync))}}class l extends s.ValueWithRandom{animation=new a;direction=n.clockwise;enable=!1;load(t){super.load(t),s.isNull(t)||(this.animation.load(t.animation),s.loadProperty(this,"direction",t.direction),s.loadProperty(this,"enable",t.enable))}}class i{#t;constructor(t){this.#t=t}getTransformValues(t){const s=t.tilt?.enable&&t.tilt;return{b:s?Math.cos(s.value)*s.cosDirection:void 0,c:s?Math.sin(s.value)*s.sinDirection:void 0}}init(t){const e=t.options.tilt;if(!e)return;t.tilt={enable:e.enable,value:s.degToRad(s.getRangeValue(e.value)),sinDirection:s.getRandom()>=s.half?s.identity:-s.identity,cosDirection:s.getRandom()>=s.half?s.identity:-s.identity,min:0,max:s.doublePI};let a=e.direction;if(a===n.random){a=Math.floor(s.getRandom()*s.double)>0?n.counterClockwise:n.clockwise}switch(a){case n.counterClockwise:case"counterClockwise":t.tilt.status=s.AnimationStatus.decreasing;break;case n.clockwise:t.tilt.status=s.AnimationStatus.increasing}const l=t.options.tilt?.animation;l?.enable&&(t.tilt.decay=s.identity-s.getRangeValue(l.decay),t.tilt.velocity=s.getRangeValue(l.speed)/360*this.#t.retina.reduceFactor,l.sync||(t.tilt.velocity*=s.getRandom()))}isEnabled(t){const s=t.options.tilt?.animation;return!t.destroyed&&!t.spawning&&!!s?.enable}loadOptions(t,...e){s.loadOptionProperty(t,"tilt",l,...e)}update(t,n){this.isEnabled(t)&&t.tilt&&e.updateAnimation(t,t.tilt,!1,s.DestroyType.none,n)}}async function r(t){t.checkVersion("4.2.0"),await t.pluginManager.register(t=>{t.pluginManager.addParticleUpdater("tilt",t=>Promise.resolve(new i(t)))})}const c=globalThis;c.__tsParticlesInternals=c.__tsParticlesInternals??{},c.loadTiltUpdater=r,t.loadTiltUpdater=r}),Object.assign(globalThis.window||globalThis,{loadTiltUpdater:(globalThis.__tsParticlesInternals.updaters.tilt||{}).loadTiltUpdater}),delete(globalThis.window||globalThis).tsparticlesInternalExports;
@@ -3,9 +3,8 @@ import { TiltDirection, type TiltDirectionAlt } from "../../TiltDirection.js";
3
3
  import type { ITilt } from "../Interfaces/ITilt.js";
4
4
  import { TiltAnimation } from "./TiltAnimation.js";
5
5
  export declare class Tilt extends ValueWithRandom implements ITilt, IOptionLoader<ITilt> {
6
- animation: TiltAnimation;
6
+ readonly animation: TiltAnimation;
7
7
  direction: TiltDirection | keyof typeof TiltDirection | TiltDirectionAlt;
8
8
  enable: boolean;
9
- constructor();
10
9
  load(data?: RecursivePartial<ITilt>): void;
11
10
  }
@@ -5,6 +5,5 @@ export declare class TiltAnimation implements ITiltAnimation, IOptionLoader<ITil
5
5
  enable: boolean;
6
6
  speed: RangeValue;
7
7
  sync: boolean;
8
- constructor();
9
8
  load(data?: RecursivePartial<ITiltAnimation>): void;
10
9
  }