@tsparticles/smooth-value-noise 4.0.0-alpha.2 → 4.0.0-alpha.20

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.
@@ -6,14 +6,12 @@ const lerp = (a, b, t) => {
6
6
  return x - Math.floor(x);
7
7
  };
8
8
  export class SmoothValueNoise {
9
- constructor() {
10
- this._coeffW = 29.537;
11
- this._coeffX = 127.1;
12
- this._coeffY = 311.7;
13
- this._coeffZ = 78.233;
14
- this._coeffZW = 37.719;
15
- this._scaleFactor = 43758.5453;
16
- }
9
+ _coeffW = 29.537;
10
+ _coeffX = 127.1;
11
+ _coeffY = 311.7;
12
+ _coeffZ = 78.233;
13
+ _coeffZW = 37.719;
14
+ _scaleFactor = 43758.5453;
17
15
  noise2d(x, y) {
18
16
  const x0 = Math.floor(x), y0 = Math.floor(y), x1 = x0 + 1, y1 = y0 + 1, sx = smoothstep(x - x0), sy = smoothstep(y - y0), n00 = this._valueNoise2D(x0, y0), n10 = this._valueNoise2D(x1, y0), n01 = this._valueNoise2D(x0, y1), n11 = this._valueNoise2D(x1, y1), ix0 = lerp(n00, n10, sx), ix1 = lerp(n01, n11, sx);
19
17
  return lerp(ix0, ix1, sy);
@@ -6,14 +6,12 @@ const lerp = (a, b, t) => {
6
6
  return x - Math.floor(x);
7
7
  };
8
8
  export class SmoothValueNoise {
9
- constructor() {
10
- this._coeffW = 29.537;
11
- this._coeffX = 127.1;
12
- this._coeffY = 311.7;
13
- this._coeffZ = 78.233;
14
- this._coeffZW = 37.719;
15
- this._scaleFactor = 43758.5453;
16
- }
9
+ _coeffW = 29.537;
10
+ _coeffX = 127.1;
11
+ _coeffY = 311.7;
12
+ _coeffZ = 78.233;
13
+ _coeffZW = 37.719;
14
+ _scaleFactor = 43758.5453;
17
15
  noise2d(x, y) {
18
16
  const x0 = Math.floor(x), y0 = Math.floor(y), x1 = x0 + 1, y1 = y0 + 1, sx = smoothstep(x - x0), sy = smoothstep(y - y0), n00 = this._valueNoise2D(x0, y0), n10 = this._valueNoise2D(x1, y0), n01 = this._valueNoise2D(x0, y1), n11 = this._valueNoise2D(x1, y1), ix0 = lerp(n00, n10, sx), ix1 = lerp(n01, n11, sx);
19
17
  return lerp(ix0, ix1, sy);
@@ -6,14 +6,12 @@ const lerp = (a, b, t) => {
6
6
  return x - Math.floor(x);
7
7
  };
8
8
  export class SmoothValueNoise {
9
- constructor() {
10
- this._coeffW = 29.537;
11
- this._coeffX = 127.1;
12
- this._coeffY = 311.7;
13
- this._coeffZ = 78.233;
14
- this._coeffZW = 37.719;
15
- this._scaleFactor = 43758.5453;
16
- }
9
+ _coeffW = 29.537;
10
+ _coeffX = 127.1;
11
+ _coeffY = 311.7;
12
+ _coeffZ = 78.233;
13
+ _coeffZW = 37.719;
14
+ _scaleFactor = 43758.5453;
17
15
  noise2d(x, y) {
18
16
  const x0 = Math.floor(x), y0 = Math.floor(y), x1 = x0 + 1, y1 = y0 + 1, sx = smoothstep(x - x0), sy = smoothstep(y - y0), n00 = this._valueNoise2D(x0, y0), n10 = this._valueNoise2D(x1, y0), n01 = this._valueNoise2D(x0, y1), n11 = this._valueNoise2D(x1, y1), ix0 = lerp(n00, n10, sx), ix1 = lerp(n01, n11, sx);
19
17
  return lerp(ix0, ix1, sy);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/smooth-value-noise",
3
- "version": "4.0.0-alpha.2",
3
+ "version": "4.0.0-alpha.20",
4
4
  "description": "tsParticles smooth value noise library",
5
5
  "homepage": "https://particles.js.org",
6
6
  "repository": {