@tsparticles/noise-field 4.0.0-beta.0 → 4.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,5 @@
1
- import { Vector, deepExtend, doublePI, getRandom } from "@tsparticles/engine";
1
+ import { Vector, deepExtend, doublePI, getRandom, identity, } from "@tsparticles/engine";
2
+ import {} from "@tsparticles/plugin-move";
2
3
  const originCoordinate = 0, firstIndex = 0, empty = 0, optionsSizeOffset = 1, transformDefaultValues = {
3
4
  a: 1,
4
5
  b: 0,
@@ -41,10 +42,10 @@ export class NoiseFieldGenerator {
41
42
  this.options = deepExtend({}, defaultOptions);
42
43
  }
43
44
  generate(particle) {
44
- const pos = particle.getPosition(), { size } = this.options, point = {
45
- x: Math.max(Math.floor(pos.x / size), originCoordinate),
46
- y: Math.max(Math.floor(pos.y / size), originCoordinate),
47
- z: Math.max(Math.floor(pos.z / size), originCoordinate),
45
+ const pos = particle.getPosition(), { size } = this.options, sizeFactor = identity / size, point = {
46
+ x: Math.max(Math.floor(pos.x * sizeFactor), originCoordinate),
47
+ y: Math.max(Math.floor(pos.y * sizeFactor), originCoordinate),
48
+ z: Math.max(Math.floor(pos.z * sizeFactor), originCoordinate),
48
49
  }, { field } = this, fieldPoint = field[point.x]?.[point.y]?.[point.z];
49
50
  if (fieldPoint) {
50
51
  this._res.x = fieldPoint.x;
@@ -67,7 +68,7 @@ export class NoiseFieldGenerator {
67
68
  if (!this.options.draw) {
68
69
  return;
69
70
  }
70
- this.container.canvas.draw(ctx => {
71
+ this.container.canvas.render.draw(ctx => {
71
72
  this._drawField(ctx);
72
73
  });
73
74
  }
@@ -1,4 +1,5 @@
1
- import { Vector, deepExtend, doublePI, getRandom } from "@tsparticles/engine";
1
+ import { Vector, deepExtend, doublePI, getRandom, identity, } from "@tsparticles/engine";
2
+ import {} from "@tsparticles/plugin-move";
2
3
  const originCoordinate = 0, firstIndex = 0, empty = 0, optionsSizeOffset = 1, transformDefaultValues = {
3
4
  a: 1,
4
5
  b: 0,
@@ -41,10 +42,10 @@ export class NoiseFieldGenerator {
41
42
  this.options = deepExtend({}, defaultOptions);
42
43
  }
43
44
  generate(particle) {
44
- const pos = particle.getPosition(), { size } = this.options, point = {
45
- x: Math.max(Math.floor(pos.x / size), originCoordinate),
46
- y: Math.max(Math.floor(pos.y / size), originCoordinate),
47
- z: Math.max(Math.floor(pos.z / size), originCoordinate),
45
+ const pos = particle.getPosition(), { size } = this.options, sizeFactor = identity / size, point = {
46
+ x: Math.max(Math.floor(pos.x * sizeFactor), originCoordinate),
47
+ y: Math.max(Math.floor(pos.y * sizeFactor), originCoordinate),
48
+ z: Math.max(Math.floor(pos.z * sizeFactor), originCoordinate),
48
49
  }, { field } = this, fieldPoint = field[point.x]?.[point.y]?.[point.z];
49
50
  if (fieldPoint) {
50
51
  this._res.x = fieldPoint.x;
@@ -67,7 +68,7 @@ export class NoiseFieldGenerator {
67
68
  if (!this.options.draw) {
68
69
  return;
69
70
  }
70
- this.container.canvas.draw(ctx => {
71
+ this.container.canvas.render.draw(ctx => {
71
72
  this._drawField(ctx);
72
73
  });
73
74
  }
@@ -1,4 +1,5 @@
1
- import { Vector, deepExtend, doublePI, getRandom } from "@tsparticles/engine";
1
+ import { Vector, deepExtend, doublePI, getRandom, identity, } from "@tsparticles/engine";
2
+ import {} from "@tsparticles/plugin-move";
2
3
  const originCoordinate = 0, firstIndex = 0, empty = 0, optionsSizeOffset = 1, transformDefaultValues = {
3
4
  a: 1,
4
5
  b: 0,
@@ -41,10 +42,10 @@ export class NoiseFieldGenerator {
41
42
  this.options = deepExtend({}, defaultOptions);
42
43
  }
43
44
  generate(particle) {
44
- const pos = particle.getPosition(), { size } = this.options, point = {
45
- x: Math.max(Math.floor(pos.x / size), originCoordinate),
46
- y: Math.max(Math.floor(pos.y / size), originCoordinate),
47
- z: Math.max(Math.floor(pos.z / size), originCoordinate),
45
+ const pos = particle.getPosition(), { size } = this.options, sizeFactor = identity / size, point = {
46
+ x: Math.max(Math.floor(pos.x * sizeFactor), originCoordinate),
47
+ y: Math.max(Math.floor(pos.y * sizeFactor), originCoordinate),
48
+ z: Math.max(Math.floor(pos.z * sizeFactor), originCoordinate),
48
49
  }, { field } = this, fieldPoint = field[point.x]?.[point.y]?.[point.z];
49
50
  if (fieldPoint) {
50
51
  this._res.x = fieldPoint.x;
@@ -67,7 +68,7 @@ export class NoiseFieldGenerator {
67
68
  if (!this.options.draw) {
68
69
  return;
69
70
  }
70
- this.container.canvas.draw(ctx => {
71
+ this.container.canvas.render.draw(ctx => {
71
72
  this._drawField(ctx);
72
73
  });
73
74
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/noise-field",
3
- "version": "4.0.0-beta.0",
3
+ "version": "4.0.0-beta.2",
4
4
  "description": "tsParticles noise field library",
5
5
  "homepage": "https://particles.js.org",
6
6
  "repository": {
@@ -91,9 +91,9 @@
91
91
  "main": "cjs/index.js",
92
92
  "module": "esm/index.js",
93
93
  "types": "types/index.d.ts",
94
- "dependencies": {
95
- "@tsparticles/engine": "4.0.0-beta.0",
96
- "@tsparticles/plugin-move": "4.0.0-beta.0"
94
+ "peerDependencies": {
95
+ "@tsparticles/engine": "4.0.0-beta.1",
96
+ "@tsparticles/plugin-move": "4.0.0-beta.1"
97
97
  },
98
98
  "exports": {
99
99
  ".": {
@@ -101,8 +101,7 @@
101
101
  "browser": "./browser/index.js",
102
102
  "import": "./esm/index.js",
103
103
  "require": "./cjs/index.js",
104
- "umd": "./umd/index.js",
105
- "default": "./cjs/index.js"
104
+ "default": "./esm/index.js"
106
105
  },
107
106
  "./package.json": "./package.json"
108
107
  },