@tsparticles/noise-field 4.0.0-beta.0 → 4.0.0-beta.10
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.
- package/README.md +17 -0
- package/browser/NoiseFieldGenerator.js +6 -6
- package/cjs/NoiseFieldGenerator.js +6 -6
- package/esm/NoiseFieldGenerator.js +6 -6
- package/package.json +5 -6
- package/report.html +84 -29
- package/tsparticles.noise.field.js +2 -2
- package/tsparticles.noise.field.min.js +1 -1
- package/umd/IFactorOffsetValues.js +0 -12
- package/umd/INoiseFieldOptions.js +0 -12
- package/umd/INoiseGenerator.js +0 -12
- package/umd/NoiseFieldGenerator.js +0 -185
- package/umd/index.js +0 -15
package/README.md
CHANGED
|
@@ -8,6 +8,12 @@
|
|
|
8
8
|
|
|
9
9
|
[tsParticles](https://github.com/tsparticles/tsparticles) path plugin for fractal noise movement.
|
|
10
10
|
|
|
11
|
+
## Quick checklist
|
|
12
|
+
|
|
13
|
+
1. Install `@tsparticles/engine` (or use the CDN bundle below)
|
|
14
|
+
2. Call the package loader function(s) before `tsParticles.load(...)`
|
|
15
|
+
3. Apply the package options in your `tsParticles.load(...)` config
|
|
16
|
+
|
|
11
17
|
## How to use it
|
|
12
18
|
|
|
13
19
|
### CDN / Vanilla JS / jQuery
|
|
@@ -72,3 +78,14 @@ import { loadFractalNoisePath } from "@tsparticles/fractal-noise";
|
|
|
72
78
|
await loadFractalNoisePath(tsParticles);
|
|
73
79
|
})();
|
|
74
80
|
```
|
|
81
|
+
|
|
82
|
+
## Common pitfalls
|
|
83
|
+
|
|
84
|
+
- Calling `tsParticles.load(...)` before `loadFractalNoisePath(...)`
|
|
85
|
+
- Verify required peer packages before enabling advanced options
|
|
86
|
+
- Change one option group at a time to isolate regressions quickly
|
|
87
|
+
|
|
88
|
+
## Related docs
|
|
89
|
+
|
|
90
|
+
- All packages catalog: <https://github.com/tsparticles/tsparticles>
|
|
91
|
+
- Main docs: <https://particles.js.org/docs/>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Vector, deepExtend, doublePI, getRandom } from "@tsparticles/engine";
|
|
1
|
+
import { Vector, deepExtend, doublePI, getRandom, identity, } from "@tsparticles/engine";
|
|
2
2
|
const originCoordinate = 0, firstIndex = 0, empty = 0, optionsSizeOffset = 1, transformDefaultValues = {
|
|
3
3
|
a: 1,
|
|
4
4
|
b: 0,
|
|
@@ -41,10 +41,10 @@ export class NoiseFieldGenerator {
|
|
|
41
41
|
this.options = deepExtend({}, defaultOptions);
|
|
42
42
|
}
|
|
43
43
|
generate(particle) {
|
|
44
|
-
const pos = particle.getPosition(), { size } = this.options, point = {
|
|
45
|
-
x: Math.max(Math.floor(pos.x
|
|
46
|
-
y: Math.max(Math.floor(pos.y
|
|
47
|
-
z: Math.max(Math.floor(pos.z
|
|
44
|
+
const pos = particle.getPosition(), { size } = this.options, sizeFactor = identity / size, point = {
|
|
45
|
+
x: Math.max(Math.floor(pos.x * sizeFactor), originCoordinate),
|
|
46
|
+
y: Math.max(Math.floor(pos.y * sizeFactor), originCoordinate),
|
|
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
50
|
this._res.x = fieldPoint.x;
|
|
@@ -67,7 +67,7 @@ export class NoiseFieldGenerator {
|
|
|
67
67
|
if (!this.options.draw) {
|
|
68
68
|
return;
|
|
69
69
|
}
|
|
70
|
-
this.container.canvas.draw(ctx => {
|
|
70
|
+
this.container.canvas.render.draw(ctx => {
|
|
71
71
|
this._drawField(ctx);
|
|
72
72
|
});
|
|
73
73
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Vector, deepExtend, doublePI, getRandom } from "@tsparticles/engine";
|
|
1
|
+
import { Vector, deepExtend, doublePI, getRandom, identity, } from "@tsparticles/engine";
|
|
2
2
|
const originCoordinate = 0, firstIndex = 0, empty = 0, optionsSizeOffset = 1, transformDefaultValues = {
|
|
3
3
|
a: 1,
|
|
4
4
|
b: 0,
|
|
@@ -41,10 +41,10 @@ export class NoiseFieldGenerator {
|
|
|
41
41
|
this.options = deepExtend({}, defaultOptions);
|
|
42
42
|
}
|
|
43
43
|
generate(particle) {
|
|
44
|
-
const pos = particle.getPosition(), { size } = this.options, point = {
|
|
45
|
-
x: Math.max(Math.floor(pos.x
|
|
46
|
-
y: Math.max(Math.floor(pos.y
|
|
47
|
-
z: Math.max(Math.floor(pos.z
|
|
44
|
+
const pos = particle.getPosition(), { size } = this.options, sizeFactor = identity / size, point = {
|
|
45
|
+
x: Math.max(Math.floor(pos.x * sizeFactor), originCoordinate),
|
|
46
|
+
y: Math.max(Math.floor(pos.y * sizeFactor), originCoordinate),
|
|
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
50
|
this._res.x = fieldPoint.x;
|
|
@@ -67,7 +67,7 @@ export class NoiseFieldGenerator {
|
|
|
67
67
|
if (!this.options.draw) {
|
|
68
68
|
return;
|
|
69
69
|
}
|
|
70
|
-
this.container.canvas.draw(ctx => {
|
|
70
|
+
this.container.canvas.render.draw(ctx => {
|
|
71
71
|
this._drawField(ctx);
|
|
72
72
|
});
|
|
73
73
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Vector, deepExtend, doublePI, getRandom } from "@tsparticles/engine";
|
|
1
|
+
import { Vector, deepExtend, doublePI, getRandom, identity, } from "@tsparticles/engine";
|
|
2
2
|
const originCoordinate = 0, firstIndex = 0, empty = 0, optionsSizeOffset = 1, transformDefaultValues = {
|
|
3
3
|
a: 1,
|
|
4
4
|
b: 0,
|
|
@@ -41,10 +41,10 @@ export class NoiseFieldGenerator {
|
|
|
41
41
|
this.options = deepExtend({}, defaultOptions);
|
|
42
42
|
}
|
|
43
43
|
generate(particle) {
|
|
44
|
-
const pos = particle.getPosition(), { size } = this.options, point = {
|
|
45
|
-
x: Math.max(Math.floor(pos.x
|
|
46
|
-
y: Math.max(Math.floor(pos.y
|
|
47
|
-
z: Math.max(Math.floor(pos.z
|
|
44
|
+
const pos = particle.getPosition(), { size } = this.options, sizeFactor = identity / size, point = {
|
|
45
|
+
x: Math.max(Math.floor(pos.x * sizeFactor), originCoordinate),
|
|
46
|
+
y: Math.max(Math.floor(pos.y * sizeFactor), originCoordinate),
|
|
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
50
|
this._res.x = fieldPoint.x;
|
|
@@ -67,7 +67,7 @@ export class NoiseFieldGenerator {
|
|
|
67
67
|
if (!this.options.draw) {
|
|
68
68
|
return;
|
|
69
69
|
}
|
|
70
|
-
this.container.canvas.draw(ctx => {
|
|
70
|
+
this.container.canvas.render.draw(ctx => {
|
|
71
71
|
this._drawField(ctx);
|
|
72
72
|
});
|
|
73
73
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/noise-field",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.10",
|
|
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
|
-
"
|
|
95
|
-
"@tsparticles/engine": "4.0.0-beta.
|
|
96
|
-
"@tsparticles/plugin-move": "4.0.0-beta.
|
|
94
|
+
"peerDependencies": {
|
|
95
|
+
"@tsparticles/engine": "4.0.0-beta.10",
|
|
96
|
+
"@tsparticles/plugin-move": "4.0.0-beta.10"
|
|
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
|
-
"
|
|
105
|
-
"default": "./cjs/index.js"
|
|
104
|
+
"default": "./esm/index.js"
|
|
106
105
|
},
|
|
107
106
|
"./package.json": "./package.json"
|
|
108
107
|
},
|