@tsparticles/noise-field 4.0.5 → 4.1.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.
@@ -31,13 +31,13 @@ export class NoiseFieldGenerator {
31
31
  noiseGen;
32
32
  noiseW;
33
33
  options;
34
- _res;
34
+ #res;
35
35
  constructor(container, noiseGen) {
36
36
  this.container = container;
37
37
  this.noiseGen = noiseGen;
38
38
  this.field = [];
39
39
  this.noiseW = 0;
40
- this._res = Vector.origin;
40
+ this.#res = Vector.origin;
41
41
  this.options = deepExtend({}, defaultOptions);
42
42
  }
43
43
  generate(particle) {
@@ -47,32 +47,32 @@ export class NoiseFieldGenerator {
47
47
  z: Math.max(Math.floor(pos.z * sizeFactor), originCoordinate),
48
48
  }, { field } = this, fieldPoint = field[point.x]?.[point.y]?.[point.z];
49
49
  if (fieldPoint) {
50
- this._res.x = fieldPoint.x;
51
- this._res.y = fieldPoint.y;
50
+ this.#res.x = fieldPoint.x;
51
+ this.#res.y = fieldPoint.y;
52
52
  }
53
53
  else {
54
- this._res.x = 0;
55
- this._res.y = 0;
54
+ this.#res.x = 0;
55
+ this.#res.y = 0;
56
56
  }
57
- return this._res;
57
+ return this.#res;
58
58
  }
59
59
  init() {
60
- this._setup();
60
+ this.#setup();
61
61
  }
62
62
  reset() {
63
63
  }
64
64
  update() {
65
- this._calculateField();
65
+ this.#calculateField();
66
66
  this.noiseW += this.options.increment;
67
67
  if (!this.options.draw) {
68
68
  return;
69
69
  }
70
70
  this.container.canvas.render.draw(ctx => {
71
- this._drawField(ctx);
71
+ this.#drawField(ctx);
72
72
  });
73
73
  }
74
- _calculateField() {
75
- const { field, noiseGen, options, noiseW } = this, lengthFactor = options.factor.length, angleFactor = options.factor.angle;
74
+ #calculateField() {
75
+ const field = this.field, noiseGen = this.noiseGen, options = this.options, noiseW = this.noiseW, lengthFactor = options.factor.length, angleFactor = options.factor.angle;
76
76
  for (let x = 0; x < options.columns; x++) {
77
77
  const xColumn = field[x];
78
78
  if (!xColumn) {
@@ -94,7 +94,7 @@ export class NoiseFieldGenerator {
94
94
  }
95
95
  }
96
96
  }
97
- _drawField(ctx) {
97
+ #drawField(ctx) {
98
98
  const { field, options } = this;
99
99
  for (let x = 0; x < options.columns; x++) {
100
100
  const xColumn = field[x];
@@ -122,7 +122,7 @@ export class NoiseFieldGenerator {
122
122
  }
123
123
  }
124
124
  }
125
- _initField() {
125
+ #initField() {
126
126
  const { columns, rows, layers } = this.options;
127
127
  this.field = new Array(columns);
128
128
  for (let x = 0; x < columns; x++) {
@@ -137,7 +137,7 @@ export class NoiseFieldGenerator {
137
137
  this.field[x] = newX;
138
138
  }
139
139
  }
140
- _resetField() {
140
+ #resetField() {
141
141
  const container = this.container, sourceOptions = container.actualOptions.particles.move.path.options, { options } = this;
142
142
  options.width = container.canvas.size.width;
143
143
  options.height = container.canvas.size.height;
@@ -159,13 +159,13 @@ export class NoiseFieldGenerator {
159
159
  options.columns = Math.floor(options.width / options.size) + optionsSizeOffset;
160
160
  options.rows = Math.floor(options.height / options.size) + optionsSizeOffset;
161
161
  options.layers = Math.floor(container.zLayers / options.size) + optionsSizeOffset;
162
- this._initField();
162
+ this.#initField();
163
163
  }
164
- _setup() {
164
+ #setup() {
165
165
  this.noiseW = 0;
166
- this._resetField();
166
+ this.#resetField();
167
167
  addEventListener("resize", () => {
168
- this._resetField();
168
+ this.#resetField();
169
169
  });
170
170
  }
171
171
  }
@@ -31,13 +31,13 @@ export class NoiseFieldGenerator {
31
31
  noiseGen;
32
32
  noiseW;
33
33
  options;
34
- _res;
34
+ #res;
35
35
  constructor(container, noiseGen) {
36
36
  this.container = container;
37
37
  this.noiseGen = noiseGen;
38
38
  this.field = [];
39
39
  this.noiseW = 0;
40
- this._res = Vector.origin;
40
+ this.#res = Vector.origin;
41
41
  this.options = deepExtend({}, defaultOptions);
42
42
  }
43
43
  generate(particle) {
@@ -47,32 +47,32 @@ export class NoiseFieldGenerator {
47
47
  z: Math.max(Math.floor(pos.z * sizeFactor), originCoordinate),
48
48
  }, { field } = this, fieldPoint = field[point.x]?.[point.y]?.[point.z];
49
49
  if (fieldPoint) {
50
- this._res.x = fieldPoint.x;
51
- this._res.y = fieldPoint.y;
50
+ this.#res.x = fieldPoint.x;
51
+ this.#res.y = fieldPoint.y;
52
52
  }
53
53
  else {
54
- this._res.x = 0;
55
- this._res.y = 0;
54
+ this.#res.x = 0;
55
+ this.#res.y = 0;
56
56
  }
57
- return this._res;
57
+ return this.#res;
58
58
  }
59
59
  init() {
60
- this._setup();
60
+ this.#setup();
61
61
  }
62
62
  reset() {
63
63
  }
64
64
  update() {
65
- this._calculateField();
65
+ this.#calculateField();
66
66
  this.noiseW += this.options.increment;
67
67
  if (!this.options.draw) {
68
68
  return;
69
69
  }
70
70
  this.container.canvas.render.draw(ctx => {
71
- this._drawField(ctx);
71
+ this.#drawField(ctx);
72
72
  });
73
73
  }
74
- _calculateField() {
75
- const { field, noiseGen, options, noiseW } = this, lengthFactor = options.factor.length, angleFactor = options.factor.angle;
74
+ #calculateField() {
75
+ const field = this.field, noiseGen = this.noiseGen, options = this.options, noiseW = this.noiseW, lengthFactor = options.factor.length, angleFactor = options.factor.angle;
76
76
  for (let x = 0; x < options.columns; x++) {
77
77
  const xColumn = field[x];
78
78
  if (!xColumn) {
@@ -94,7 +94,7 @@ export class NoiseFieldGenerator {
94
94
  }
95
95
  }
96
96
  }
97
- _drawField(ctx) {
97
+ #drawField(ctx) {
98
98
  const { field, options } = this;
99
99
  for (let x = 0; x < options.columns; x++) {
100
100
  const xColumn = field[x];
@@ -122,7 +122,7 @@ export class NoiseFieldGenerator {
122
122
  }
123
123
  }
124
124
  }
125
- _initField() {
125
+ #initField() {
126
126
  const { columns, rows, layers } = this.options;
127
127
  this.field = new Array(columns);
128
128
  for (let x = 0; x < columns; x++) {
@@ -137,7 +137,7 @@ export class NoiseFieldGenerator {
137
137
  this.field[x] = newX;
138
138
  }
139
139
  }
140
- _resetField() {
140
+ #resetField() {
141
141
  const container = this.container, sourceOptions = container.actualOptions.particles.move.path.options, { options } = this;
142
142
  options.width = container.canvas.size.width;
143
143
  options.height = container.canvas.size.height;
@@ -159,13 +159,13 @@ export class NoiseFieldGenerator {
159
159
  options.columns = Math.floor(options.width / options.size) + optionsSizeOffset;
160
160
  options.rows = Math.floor(options.height / options.size) + optionsSizeOffset;
161
161
  options.layers = Math.floor(container.zLayers / options.size) + optionsSizeOffset;
162
- this._initField();
162
+ this.#initField();
163
163
  }
164
- _setup() {
164
+ #setup() {
165
165
  this.noiseW = 0;
166
- this._resetField();
166
+ this.#resetField();
167
167
  addEventListener("resize", () => {
168
- this._resetField();
168
+ this.#resetField();
169
169
  });
170
170
  }
171
171
  }
@@ -31,13 +31,13 @@ export class NoiseFieldGenerator {
31
31
  noiseGen;
32
32
  noiseW;
33
33
  options;
34
- _res;
34
+ #res;
35
35
  constructor(container, noiseGen) {
36
36
  this.container = container;
37
37
  this.noiseGen = noiseGen;
38
38
  this.field = [];
39
39
  this.noiseW = 0;
40
- this._res = Vector.origin;
40
+ this.#res = Vector.origin;
41
41
  this.options = deepExtend({}, defaultOptions);
42
42
  }
43
43
  generate(particle) {
@@ -47,32 +47,32 @@ export class NoiseFieldGenerator {
47
47
  z: Math.max(Math.floor(pos.z * sizeFactor), originCoordinate),
48
48
  }, { field } = this, fieldPoint = field[point.x]?.[point.y]?.[point.z];
49
49
  if (fieldPoint) {
50
- this._res.x = fieldPoint.x;
51
- this._res.y = fieldPoint.y;
50
+ this.#res.x = fieldPoint.x;
51
+ this.#res.y = fieldPoint.y;
52
52
  }
53
53
  else {
54
- this._res.x = 0;
55
- this._res.y = 0;
54
+ this.#res.x = 0;
55
+ this.#res.y = 0;
56
56
  }
57
- return this._res;
57
+ return this.#res;
58
58
  }
59
59
  init() {
60
- this._setup();
60
+ this.#setup();
61
61
  }
62
62
  reset() {
63
63
  }
64
64
  update() {
65
- this._calculateField();
65
+ this.#calculateField();
66
66
  this.noiseW += this.options.increment;
67
67
  if (!this.options.draw) {
68
68
  return;
69
69
  }
70
70
  this.container.canvas.render.draw(ctx => {
71
- this._drawField(ctx);
71
+ this.#drawField(ctx);
72
72
  });
73
73
  }
74
- _calculateField() {
75
- const { field, noiseGen, options, noiseW } = this, lengthFactor = options.factor.length, angleFactor = options.factor.angle;
74
+ #calculateField() {
75
+ const field = this.field, noiseGen = this.noiseGen, options = this.options, noiseW = this.noiseW, lengthFactor = options.factor.length, angleFactor = options.factor.angle;
76
76
  for (let x = 0; x < options.columns; x++) {
77
77
  const xColumn = field[x];
78
78
  if (!xColumn) {
@@ -94,7 +94,7 @@ export class NoiseFieldGenerator {
94
94
  }
95
95
  }
96
96
  }
97
- _drawField(ctx) {
97
+ #drawField(ctx) {
98
98
  const { field, options } = this;
99
99
  for (let x = 0; x < options.columns; x++) {
100
100
  const xColumn = field[x];
@@ -122,7 +122,7 @@ export class NoiseFieldGenerator {
122
122
  }
123
123
  }
124
124
  }
125
- _initField() {
125
+ #initField() {
126
126
  const { columns, rows, layers } = this.options;
127
127
  this.field = new Array(columns);
128
128
  for (let x = 0; x < columns; x++) {
@@ -137,7 +137,7 @@ export class NoiseFieldGenerator {
137
137
  this.field[x] = newX;
138
138
  }
139
139
  }
140
- _resetField() {
140
+ #resetField() {
141
141
  const container = this.container, sourceOptions = container.actualOptions.particles.move.path.options, { options } = this;
142
142
  options.width = container.canvas.size.width;
143
143
  options.height = container.canvas.size.height;
@@ -159,13 +159,13 @@ export class NoiseFieldGenerator {
159
159
  options.columns = Math.floor(options.width / options.size) + optionsSizeOffset;
160
160
  options.rows = Math.floor(options.height / options.size) + optionsSizeOffset;
161
161
  options.layers = Math.floor(container.zLayers / options.size) + optionsSizeOffset;
162
- this._initField();
162
+ this.#initField();
163
163
  }
164
- _setup() {
164
+ #setup() {
165
165
  this.noiseW = 0;
166
- this._resetField();
166
+ this.#resetField();
167
167
  addEventListener("resize", () => {
168
- this._resetField();
168
+ this.#resetField();
169
169
  });
170
170
  }
171
171
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/noise-field",
3
- "version": "4.0.5",
3
+ "version": "4.1.0",
4
4
  "description": "tsParticles noise field library",
5
5
  "homepage": "https://particles.js.org",
6
6
  "repository": {
@@ -92,8 +92,8 @@
92
92
  "module": "esm/index.js",
93
93
  "types": "types/index.d.ts",
94
94
  "peerDependencies": {
95
- "@tsparticles/engine": "4.0.5",
96
- "@tsparticles/plugin-move": "4.0.5"
95
+ "@tsparticles/engine": "4.1.0",
96
+ "@tsparticles/plugin-move": "4.1.0"
97
97
  },
98
98
  "exports": {
99
99
  ".": {
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.noise.field.js","children":[{"name":"dist/browser","children":[{"uid":"4acb8429-1","name":"NoiseFieldGenerator.js"},{"uid":"4acb8429-3","name":"browser.js"}]}]}],"isRoot":true},"nodeParts":{"4acb8429-1":{"renderedLength":6896,"gzipLength":0,"brotliLength":0,"metaUid":"4acb8429-0"},"4acb8429-3":{"renderedLength":121,"gzipLength":0,"brotliLength":0,"metaUid":"4acb8429-2"}},"nodeMetas":{"4acb8429-0":{"id":"/dist/browser/NoiseFieldGenerator.js","moduleParts":{"tsparticles.noise.field.js":"4acb8429-1"},"imported":[{"uid":"4acb8429-5"}],"importedBy":[{"uid":"4acb8429-4"}]},"4acb8429-2":{"id":"/dist/browser/browser.js","moduleParts":{"tsparticles.noise.field.js":"4acb8429-3"},"imported":[{"uid":"4acb8429-4"}],"importedBy":[],"isEntry":true},"4acb8429-4":{"id":"/dist/browser/index.js","moduleParts":{},"imported":[{"uid":"4acb8429-0"}],"importedBy":[{"uid":"4acb8429-2"}]},"4acb8429-5":{"id":"@tsparticles/engine","moduleParts":{},"imported":[],"importedBy":[{"uid":"4acb8429-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.noise.field.js","children":[{"name":"dist/browser","children":[{"uid":"97265d3f-1","name":"NoiseFieldGenerator.js"},{"uid":"97265d3f-3","name":"browser.js"}]}]}],"isRoot":true},"nodeParts":{"97265d3f-1":{"renderedLength":6943,"gzipLength":0,"brotliLength":0,"metaUid":"97265d3f-0"},"97265d3f-3":{"renderedLength":121,"gzipLength":0,"brotliLength":0,"metaUid":"97265d3f-2"}},"nodeMetas":{"97265d3f-0":{"id":"/dist/browser/NoiseFieldGenerator.js","moduleParts":{"tsparticles.noise.field.js":"97265d3f-1"},"imported":[{"uid":"97265d3f-5"}],"importedBy":[{"uid":"97265d3f-4"}]},"97265d3f-2":{"id":"/dist/browser/browser.js","moduleParts":{"tsparticles.noise.field.js":"97265d3f-3"},"imported":[{"uid":"97265d3f-4"}],"importedBy":[],"isEntry":true},"97265d3f-4":{"id":"/dist/browser/index.js","moduleParts":{},"imported":[{"uid":"97265d3f-0"}],"importedBy":[{"uid":"97265d3f-2"}]},"97265d3f-5":{"id":"@tsparticles/engine","moduleParts":{},"imported":[],"importedBy":[{"uid":"97265d3f-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,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
- /* Utility v4.0.5 */
2
+ /* Utility v4.1.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) :
@@ -38,13 +38,13 @@
38
38
  noiseGen;
39
39
  noiseW;
40
40
  options;
41
- _res;
41
+ #res;
42
42
  constructor(container, noiseGen) {
43
43
  this.container = container;
44
44
  this.noiseGen = noiseGen;
45
45
  this.field = [];
46
46
  this.noiseW = 0;
47
- this._res = engine.Vector.origin;
47
+ this.#res = engine.Vector.origin;
48
48
  this.options = engine.deepExtend({}, defaultOptions);
49
49
  }
50
50
  generate(particle) {
@@ -54,32 +54,32 @@
54
54
  z: Math.max(Math.floor(pos.z * sizeFactor), originCoordinate),
55
55
  }, { field } = this, fieldPoint = field[point.x]?.[point.y]?.[point.z];
56
56
  if (fieldPoint) {
57
- this._res.x = fieldPoint.x;
58
- this._res.y = fieldPoint.y;
57
+ this.#res.x = fieldPoint.x;
58
+ this.#res.y = fieldPoint.y;
59
59
  }
60
60
  else {
61
- this._res.x = 0;
62
- this._res.y = 0;
61
+ this.#res.x = 0;
62
+ this.#res.y = 0;
63
63
  }
64
- return this._res;
64
+ return this.#res;
65
65
  }
66
66
  init() {
67
- this._setup();
67
+ this.#setup();
68
68
  }
69
69
  reset() {
70
70
  }
71
71
  update() {
72
- this._calculateField();
72
+ this.#calculateField();
73
73
  this.noiseW += this.options.increment;
74
74
  if (!this.options.draw) {
75
75
  return;
76
76
  }
77
77
  this.container.canvas.render.draw(ctx => {
78
- this._drawField(ctx);
78
+ this.#drawField(ctx);
79
79
  });
80
80
  }
81
- _calculateField() {
82
- const { field, noiseGen, options, noiseW } = this, lengthFactor = options.factor.length, angleFactor = options.factor.angle;
81
+ #calculateField() {
82
+ const field = this.field, noiseGen = this.noiseGen, options = this.options, noiseW = this.noiseW, lengthFactor = options.factor.length, angleFactor = options.factor.angle;
83
83
  for (let x = 0; x < options.columns; x++) {
84
84
  const xColumn = field[x];
85
85
  if (!xColumn) {
@@ -101,7 +101,7 @@
101
101
  }
102
102
  }
103
103
  }
104
- _drawField(ctx) {
104
+ #drawField(ctx) {
105
105
  const { field, options } = this;
106
106
  for (let x = 0; x < options.columns; x++) {
107
107
  const xColumn = field[x];
@@ -129,7 +129,7 @@
129
129
  }
130
130
  }
131
131
  }
132
- _initField() {
132
+ #initField() {
133
133
  const { columns, rows, layers } = this.options;
134
134
  this.field = new Array(columns);
135
135
  for (let x = 0; x < columns; x++) {
@@ -144,7 +144,7 @@
144
144
  this.field[x] = newX;
145
145
  }
146
146
  }
147
- _resetField() {
147
+ #resetField() {
148
148
  const container = this.container, sourceOptions = container.actualOptions.particles.move.path.options, { options } = this;
149
149
  options.width = container.canvas.size.width;
150
150
  options.height = container.canvas.size.height;
@@ -166,13 +166,13 @@
166
166
  options.columns = Math.floor(options.width / options.size) + optionsSizeOffset;
167
167
  options.rows = Math.floor(options.height / options.size) + optionsSizeOffset;
168
168
  options.layers = Math.floor(container.zLayers / options.size) + optionsSizeOffset;
169
- this._initField();
169
+ this.#initField();
170
170
  }
171
- _setup() {
171
+ #setup() {
172
172
  this.noiseW = 0;
173
- this._resetField();
173
+ this.#resetField();
174
174
  addEventListener("resize", () => {
175
- this._resetField();
175
+ this.#resetField();
176
176
  });
177
177
  }
178
178
  }
@@ -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.noise=t.__tsParticlesInternals.noise||{},t.__tsParticlesInternals.noise.field=t.__tsParticlesInternals.noise.field||{}),t.__tsParticlesInternals.engine)}(this,function(t,s){"use strict";const e=1,n=0,i=0,a=1,r=0,l=0,o={draw:!1,size:20,increment:.004,columns:0,rows:0,layers:0,width:0,height:0,factor:{angle:.02,length:.01},offset:{x:4e4,y:4e4,z:4e4}};const _=globalThis;_.__tsParticlesInternals=_.__tsParticlesInternals??{},t.NoiseFieldGenerator=class{container;field;noiseGen;noiseW;options;_res;constructor(t,e){this.container=t,this.noiseGen=e,this.field=[],this.noiseW=0,this._res=s.Vector.origin,this.options=s.deepExtend({},o)}generate(t){const e=t.getPosition(),{size:n}=this.options,i=s.identity/n,a=Math.max(Math.floor(e.x*i),0),r=Math.max(Math.floor(e.y*i),0),l=Math.max(Math.floor(e.z*i),0),{field:o}=this,_=o[a]?.[r]?.[l];return _?(this._res.x=_.x,this._res.y=_.y):(this._res.x=0,this._res.y=0),this._res}init(){this._setup()}reset(){}update(){this._calculateField(),this.noiseW+=this.options.increment,this.options.draw&&this.container.canvas.render.draw(t=>{this._drawField(t)})}_calculateField(){const{field:t,noiseGen:e,options:n,noiseW:i}=this,a=n.factor.length,r=n.factor.angle;for(let l=0;l<n.columns;l++){const o=t[l];if(o)for(let t=0;t<n.rows;t++){const _=o[t];if(_)for(let o=0;o<n.layers;o++){const c=_[o];c&&(c.length=e.noise4d(l*a+n.offset.x,t*a+n.offset.y,o*a+n.offset.z,i),c.angle=e.noise4d(l*r,t*r,o*r,i)*s.doublePI)}}}}_drawField(t){const{field:s,options:o}=this;for(let _=0;_<o.columns;_++){const c=s[_];if(c)for(let s=0;s<o.rows;s++){const o=c[s];if(!o)continue;const h=o[0];if(!h)continue;const{angle:f,length:p}=h;t.setTransform(e,n,i,a,_*this.options.size,s*this.options.size),t.rotate(f),t.strokeStyle="white",t.beginPath(),t.moveTo(0,0),t.lineTo(0,this.options.size*p),t.stroke(),t.setTransform(e,n,i,a,r,l)}}}_initField(){const{columns:t,rows:e,layers:n}=this.options;this.field=new Array(t);for(let i=0;i<t;i++){const t=new Array(e);for(let i=0;i<e;i++){const e=new Array(n);for(let t=0;t<n;t++)e[t]=s.Vector.origin;t[i]=e}this.field[i]=t}}_resetField(){const t=this.container,e=t.actualOptions.particles.move.path.options,{options:n}=this;n.width=t.canvas.size.width,n.height=t.canvas.size.height,n.size=e.size>0?e.size:o.size,n.increment=e.increment>0?e.increment:o.increment,n.draw=!!e.draw;const i=e.offset;n.offset.x=i?.x??o.offset.x,n.offset.y=i?.y??o.offset.y,n.offset.z=i?.z??o.offset.z;const a=e.factor;n.factor.angle=a?.angle??o.factor.angle,n.factor.length=a?.length??o.factor.length,n.seed=e.seed,this.noiseGen.seed(n.seed??s.getRandom()),n.columns=Math.floor(n.width/n.size)+1,n.rows=Math.floor(n.height/n.size)+1,n.layers=Math.floor(t.zLayers/n.size)+1,this._initField()}_setup(){this.noiseW=0,this._resetField(),addEventListener("resize",()=>{this._resetField()})}}}),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")):"function"==typeof define&&define.amd?define(["exports","@tsparticles/engine"],s):s(((t="undefined"!=typeof globalThis?globalThis:t||self).__tsParticlesInternals=t.__tsParticlesInternals||{},t.__tsParticlesInternals.noise=t.__tsParticlesInternals.noise||{},t.__tsParticlesInternals.noise.field=t.__tsParticlesInternals.noise.field||{}),t.__tsParticlesInternals.engine)}(this,function(t,s){"use strict";const e=1,n=0,i=0,a=1,r=0,l=0,o={draw:!1,size:20,increment:.004,columns:0,rows:0,layers:0,width:0,height:0,factor:{angle:.02,length:.01},offset:{x:4e4,y:4e4,z:4e4}};const c=globalThis;c.__tsParticlesInternals=c.__tsParticlesInternals??{},t.NoiseFieldGenerator=class{container;field;noiseGen;noiseW;options;#t;constructor(t,e){this.container=t,this.noiseGen=e,this.field=[],this.noiseW=0,this.#t=s.Vector.origin,this.options=s.deepExtend({},o)}generate(t){const e=t.getPosition(),{size:n}=this.options,i=s.identity/n,a=Math.max(Math.floor(e.x*i),0),r=Math.max(Math.floor(e.y*i),0),l=Math.max(Math.floor(e.z*i),0),{field:o}=this,c=o[a]?.[r]?.[l];return c?(this.#t.x=c.x,this.#t.y=c.y):(this.#t.x=0,this.#t.y=0),this.#t}init(){this.#s()}reset(){}update(){this.#e(),this.noiseW+=this.options.increment,this.options.draw&&this.container.canvas.render.draw(t=>{this.#n(t)})}#e(){const t=this.field,e=this.noiseGen,n=this.options,i=this.noiseW,a=n.factor.length,r=n.factor.angle;for(let l=0;l<n.columns;l++){const o=t[l];if(o)for(let t=0;t<n.rows;t++){const c=o[t];if(c)for(let o=0;o<n.layers;o++){const _=c[o];_&&(_.length=e.noise4d(l*a+n.offset.x,t*a+n.offset.y,o*a+n.offset.z,i),_.angle=e.noise4d(l*r,t*r,o*r,i)*s.doublePI)}}}}#n(t){const{field:s,options:o}=this;for(let c=0;c<o.columns;c++){const _=s[c];if(_)for(let s=0;s<o.rows;s++){const o=_[s];if(!o)continue;const h=o[0];if(!h)continue;const{angle:f,length:p}=h;t.setTransform(e,n,i,a,c*this.options.size,s*this.options.size),t.rotate(f),t.strokeStyle="white",t.beginPath(),t.moveTo(0,0),t.lineTo(0,this.options.size*p),t.stroke(),t.setTransform(e,n,i,a,r,l)}}}#i(){const{columns:t,rows:e,layers:n}=this.options;this.field=new Array(t);for(let i=0;i<t;i++){const t=new Array(e);for(let i=0;i<e;i++){const e=new Array(n);for(let t=0;t<n;t++)e[t]=s.Vector.origin;t[i]=e}this.field[i]=t}}#a(){const t=this.container,e=t.actualOptions.particles.move.path.options,{options:n}=this;n.width=t.canvas.size.width,n.height=t.canvas.size.height,n.size=e.size>0?e.size:o.size,n.increment=e.increment>0?e.increment:o.increment,n.draw=!!e.draw;const i=e.offset;n.offset.x=i?.x??o.offset.x,n.offset.y=i?.y??o.offset.y,n.offset.z=i?.z??o.offset.z;const a=e.factor;n.factor.angle=a?.angle??o.factor.angle,n.factor.length=a?.length??o.factor.length,n.seed=e.seed,this.noiseGen.seed(n.seed??s.getRandom()),n.columns=Math.floor(n.width/n.size)+1,n.rows=Math.floor(n.height/n.size)+1,n.layers=Math.floor(t.zLayers/n.size)+1,this.#i()}#s(){this.noiseW=0,this.#a(),addEventListener("resize",()=>{this.#a()})}}}),delete(globalThis.window||globalThis).tsparticlesInternalExports;
@@ -3,20 +3,15 @@ import { type IMovePathGenerator } from "@tsparticles/plugin-move";
3
3
  import type { INoiseFieldOptions } from "./INoiseFieldOptions.js";
4
4
  import type { INoiseGenerator } from "./INoiseGenerator.js";
5
5
  export declare abstract class NoiseFieldGenerator implements IMovePathGenerator {
6
+ #private;
6
7
  readonly container: Container;
7
8
  field: Vector[][][];
8
9
  readonly noiseGen: INoiseGenerator;
9
10
  noiseW: number;
10
11
  readonly options: INoiseFieldOptions;
11
- private readonly _res;
12
12
  protected constructor(container: Container, noiseGen: INoiseGenerator);
13
13
  generate(particle: Particle): Vector;
14
14
  init(): void;
15
15
  reset(): void;
16
16
  update(): void;
17
- private _calculateField;
18
- private _drawField;
19
- private _initField;
20
- private _resetField;
21
- private _setup;
22
17
  }