@tsparticles/path-curl-noise 3.9.0 → 4.0.0-alpha.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.
package/720.min.js ADDED
@@ -0,0 +1,2 @@
1
+ /*! For license information please see 720.min.js.LICENSE.txt */
2
+ (this.webpackChunk_tsparticles_path_curl_noise=this.webpackChunk_tsparticles_path_curl_noise||[]).push([[720],{720(e,s,t){t.d(s,{CurlNoiseGenerator:()=>n});var i=t(303),o=t(226);const p={speed:.2,step:250};class n{constructor(){const e=new o.SimplexNoise;this._simplex=e.noise2d,this.options=(0,i.deepExtend)({},p)}generate(e){const s=e.getPosition(),{speed:t,step:o}=this.options,p=s.x/o,n=s.y/o,h=.001,a=(this._simplex.noise(p,n+h)-this._simplex.noise(p,n-h))/.002,c=(this._simplex.noise(p+h,n)-this._simplex.noise(p-h,n))/.002;return e.velocity.x=0,e.velocity.y=0,i.Vector.create(t*a,t*-c)}init(e){const s=e.actualOptions.particles.move.path.options;this.options.seed=s.seed,this.options.speed=(s.speed??p.speed)*e.retina.pixelRatio,this.options.step=s.step??p.step,this._simplex.seed(this.options.seed??(0,i.getRandom)())}reset(){}update(){}}}}]);
@@ -0,0 +1 @@
1
+ /*! tsParticles Curl Noise Path v4.0.0-alpha.0 by Matteo Bruni */
@@ -18,10 +18,10 @@ export class CurlNoiseGenerator {
18
18
  }
19
19
  init(container) {
20
20
  const sourceOptions = container.actualOptions.particles.move.path.options;
21
- this.options.seed = sourceOptions?.seed;
21
+ this.options.seed = sourceOptions["seed"];
22
22
  this.options.speed =
23
- (sourceOptions?.speed ?? defaultOptions.speed) * container.retina.pixelRatio;
24
- this.options.step = sourceOptions?.step ?? defaultOptions.step;
23
+ (sourceOptions["speed"] ?? defaultOptions.speed) * container.retina.pixelRatio;
24
+ this.options.step = sourceOptions["step"] ?? defaultOptions.step;
25
25
  this._simplex.seed(this.options.seed ?? getRandom());
26
26
  }
27
27
  reset() {
package/browser/index.js CHANGED
@@ -1,6 +1,8 @@
1
- import { CurlNoiseGenerator } from "./CurlNoiseGenerator.js";
2
1
  export const curlNoisePathName = "curlNoise";
3
- export async function loadCurlNoisePath(engine, refresh = true) {
4
- engine.checkVersion("3.9.0");
5
- await engine.addPathGenerator(curlNoisePathName, new CurlNoiseGenerator(), refresh);
2
+ export function loadCurlNoisePath(engine) {
3
+ engine.checkVersion("4.0.0-alpha.0");
4
+ engine.register(async (e) => {
5
+ const { CurlNoiseGenerator } = await import("./CurlNoiseGenerator.js");
6
+ e.addPathGenerator(curlNoisePathName, new CurlNoiseGenerator());
7
+ });
6
8
  }
@@ -1,35 +1,31 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CurlNoiseGenerator = void 0;
4
- const engine_1 = require("@tsparticles/engine");
5
- const simplex_noise_1 = require("@tsparticles/simplex-noise");
1
+ import { Vector, deepExtend, getRandom, } from "@tsparticles/engine";
2
+ import { SimplexNoise } from "@tsparticles/simplex-noise";
6
3
  const defaultOptions = {
7
4
  speed: 0.2,
8
5
  step: 250,
9
6
  }, double = 2;
10
- class CurlNoiseGenerator {
7
+ export class CurlNoiseGenerator {
11
8
  constructor() {
12
- const simplex = new simplex_noise_1.SimplexNoise();
9
+ const simplex = new SimplexNoise();
13
10
  this._simplex = simplex.noise2d;
14
- this.options = (0, engine_1.deepExtend)({}, defaultOptions);
11
+ this.options = deepExtend({}, defaultOptions);
15
12
  }
16
13
  generate(particle) {
17
14
  const pos = particle.getPosition(), { speed, step } = this.options, x = pos.x / step, y = pos.y / step, eps = 0.001, n1a = this._simplex.noise(x, y + eps), n2a = this._simplex.noise(x, y - eps), a = (n1a - n2a) / (double * eps), n1b = this._simplex.noise(x + eps, y), n2b = this._simplex.noise(x - eps, y), b = (n1b - n2b) / (double * eps);
18
15
  particle.velocity.x = 0;
19
16
  particle.velocity.y = 0;
20
- return engine_1.Vector.create(speed * a, speed * -b);
17
+ return Vector.create(speed * a, speed * -b);
21
18
  }
22
19
  init(container) {
23
20
  const sourceOptions = container.actualOptions.particles.move.path.options;
24
- this.options.seed = sourceOptions?.seed;
21
+ this.options.seed = sourceOptions["seed"];
25
22
  this.options.speed =
26
- (sourceOptions?.speed ?? defaultOptions.speed) * container.retina.pixelRatio;
27
- this.options.step = sourceOptions?.step ?? defaultOptions.step;
28
- this._simplex.seed(this.options.seed ?? (0, engine_1.getRandom)());
23
+ (sourceOptions["speed"] ?? defaultOptions.speed) * container.retina.pixelRatio;
24
+ this.options.step = sourceOptions["step"] ?? defaultOptions.step;
25
+ this._simplex.seed(this.options.seed ?? getRandom());
29
26
  }
30
27
  reset() {
31
28
  }
32
29
  update() {
33
30
  }
34
31
  }
35
- exports.CurlNoiseGenerator = CurlNoiseGenerator;
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
package/cjs/index.js CHANGED
@@ -1,10 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.curlNoisePathName = void 0;
4
- exports.loadCurlNoisePath = loadCurlNoisePath;
5
- const CurlNoiseGenerator_js_1 = require("./CurlNoiseGenerator.js");
6
- exports.curlNoisePathName = "curlNoise";
7
- async function loadCurlNoisePath(engine, refresh = true) {
8
- engine.checkVersion("3.9.0");
9
- await engine.addPathGenerator(exports.curlNoisePathName, new CurlNoiseGenerator_js_1.CurlNoiseGenerator(), refresh);
1
+ export const curlNoisePathName = "curlNoise";
2
+ export function loadCurlNoisePath(engine) {
3
+ engine.checkVersion("4.0.0-alpha.0");
4
+ engine.register(async (e) => {
5
+ const { CurlNoiseGenerator } = await import("./CurlNoiseGenerator.js");
6
+ e.addPathGenerator(curlNoisePathName, new CurlNoiseGenerator());
7
+ });
10
8
  }
@@ -0,0 +1,30 @@
1
+ /*!
2
+ * Author : Matteo Bruni
3
+ * MIT license: https://opensource.org/licenses/MIT
4
+ * Demo / Generator : https://particles.js.org/
5
+ * GitHub : https://www.github.com/matteobruni/tsparticles
6
+ * How to use? : Check the GitHub README
7
+ * v4.0.0-alpha.0
8
+ */
9
+ "use strict";
10
+ /*
11
+ * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
12
+ * This devtool is neither made for production nor for readable output files.
13
+ * It uses "eval()" calls to create a separate source file in the browser devtools.
14
+ * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
15
+ * or disable the default devtool with "devtool: false".
16
+ * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
17
+ */
18
+ (this["webpackChunk_tsparticles_path_curl_noise"] = this["webpackChunk_tsparticles_path_curl_noise"] || []).push([["dist_browser_CurlNoiseGenerator_js"],{
19
+
20
+ /***/ "./dist/browser/CurlNoiseGenerator.js"
21
+ /*!********************************************!*\
22
+ !*** ./dist/browser/CurlNoiseGenerator.js ***!
23
+ \********************************************/
24
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
25
+
26
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CurlNoiseGenerator: () => (/* binding */ CurlNoiseGenerator)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_simplex_noise__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @tsparticles/simplex-noise */ \"@tsparticles/simplex-noise\");\n\n\nconst defaultOptions = {\n speed: 0.2,\n step: 250\n },\n double = 2;\nclass CurlNoiseGenerator {\n constructor() {\n const simplex = new _tsparticles_simplex_noise__WEBPACK_IMPORTED_MODULE_1__.SimplexNoise();\n this._simplex = simplex.noise2d;\n this.options = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.deepExtend)({}, defaultOptions);\n }\n generate(particle) {\n const pos = particle.getPosition(),\n {\n speed,\n step\n } = this.options,\n x = pos.x / step,\n y = pos.y / step,\n eps = 0.001,\n n1a = this._simplex.noise(x, y + eps),\n n2a = this._simplex.noise(x, y - eps),\n a = (n1a - n2a) / (double * eps),\n n1b = this._simplex.noise(x + eps, y),\n n2b = this._simplex.noise(x - eps, y),\n b = (n1b - n2b) / (double * eps);\n particle.velocity.x = 0;\n particle.velocity.y = 0;\n return _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.Vector.create(speed * a, speed * -b);\n }\n init(container) {\n const sourceOptions = container.actualOptions.particles.move.path.options;\n this.options.seed = sourceOptions[\"seed\"];\n this.options.speed = (sourceOptions[\"speed\"] ?? defaultOptions.speed) * container.retina.pixelRatio;\n this.options.step = sourceOptions[\"step\"] ?? defaultOptions.step;\n this._simplex.seed(this.options.seed ?? (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRandom)());\n }\n reset() {}\n update() {}\n}\n\n//# sourceURL=webpack://@tsparticles/path-curl-noise/./dist/browser/CurlNoiseGenerator.js?\n}");
27
+
28
+ /***/ }
29
+
30
+ }]);
@@ -18,10 +18,10 @@ export class CurlNoiseGenerator {
18
18
  }
19
19
  init(container) {
20
20
  const sourceOptions = container.actualOptions.particles.move.path.options;
21
- this.options.seed = sourceOptions?.seed;
21
+ this.options.seed = sourceOptions["seed"];
22
22
  this.options.speed =
23
- (sourceOptions?.speed ?? defaultOptions.speed) * container.retina.pixelRatio;
24
- this.options.step = sourceOptions?.step ?? defaultOptions.step;
23
+ (sourceOptions["speed"] ?? defaultOptions.speed) * container.retina.pixelRatio;
24
+ this.options.step = sourceOptions["step"] ?? defaultOptions.step;
25
25
  this._simplex.seed(this.options.seed ?? getRandom());
26
26
  }
27
27
  reset() {
package/esm/index.js CHANGED
@@ -1,6 +1,8 @@
1
- import { CurlNoiseGenerator } from "./CurlNoiseGenerator.js";
2
1
  export const curlNoisePathName = "curlNoise";
3
- export async function loadCurlNoisePath(engine, refresh = true) {
4
- engine.checkVersion("3.9.0");
5
- await engine.addPathGenerator(curlNoisePathName, new CurlNoiseGenerator(), refresh);
2
+ export function loadCurlNoisePath(engine) {
3
+ engine.checkVersion("4.0.0-alpha.0");
4
+ engine.register(async (e) => {
5
+ const { CurlNoiseGenerator } = await import("./CurlNoiseGenerator.js");
6
+ e.addPathGenerator(curlNoisePathName, new CurlNoiseGenerator());
7
+ });
6
8
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/path-curl-noise",
3
- "version": "3.9.0",
3
+ "version": "4.0.0-alpha.0",
4
4
  "description": "tsParticles curl noise path",
5
5
  "homepage": "https://particles.js.org",
6
6
  "repository": {
@@ -104,7 +104,8 @@
104
104
  "./package.json": "./package.json"
105
105
  },
106
106
  "dependencies": {
107
- "@tsparticles/engine": "3.9.0",
108
- "@tsparticles/simplex-noise": "3.9.0"
109
- }
107
+ "@tsparticles/engine": "4.0.0-alpha.0",
108
+ "@tsparticles/simplex-noise": "4.0.0-alpha.0"
109
+ },
110
+ "type": "module"
110
111
  }