@tsparticles/path-curl-noise 4.0.0-alpha.2 → 4.0.0-alpha.21

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.
@@ -4,7 +4,7 @@
4
4
  * Demo / Generator : https://particles.js.org/
5
5
  * GitHub : https://www.github.com/matteobruni/tsparticles
6
6
  * How to use? : Check the GitHub README
7
- * v4.0.0-alpha.2
7
+ * v4.0.0-alpha.21
8
8
  */
9
9
  /*
10
10
  * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
@@ -28,16 +28,6 @@ return /******/ (() => { // webpackBootstrap
28
28
  /******/ "use strict";
29
29
  /******/ var __webpack_modules__ = ({
30
30
 
31
- /***/ "./dist/browser/index.js"
32
- /*!*******************************!*\
33
- !*** ./dist/browser/index.js ***!
34
- \*******************************/
35
- (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
36
-
37
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ curlNoisePathName: () => (/* binding */ curlNoisePathName),\n/* harmony export */ loadCurlNoisePath: () => (/* binding */ loadCurlNoisePath)\n/* harmony export */ });\nconst curlNoisePathName = \"curlNoise\";\nfunction loadCurlNoisePath(engine) {\n engine.checkVersion(\"4.0.0-alpha.2\");\n engine.register(async e => {\n const {\n CurlNoiseGenerator\n } = await __webpack_require__.e(/*! import() */ \"dist_browser_CurlNoiseGenerator_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./CurlNoiseGenerator.js */ \"./dist/browser/CurlNoiseGenerator.js\"));\n e.addPathGenerator(curlNoisePathName, new CurlNoiseGenerator());\n });\n}\n\n//# sourceURL=webpack://@tsparticles/path-curl-noise/./dist/browser/index.js?\n}");
38
-
39
- /***/ },
40
-
41
31
  /***/ "@tsparticles/engine"
42
32
  /*!*********************************************************************************************************************************!*\
43
33
  !*** external {"commonjs":"@tsparticles/engine","commonjs2":"@tsparticles/engine","amd":"@tsparticles/engine","root":"window"} ***!
@@ -56,6 +46,16 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
56
46
 
57
47
  module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_simplex_noise__;
58
48
 
49
+ /***/ },
50
+
51
+ /***/ "./dist/browser/index.js"
52
+ /*!*******************************!*\
53
+ !*** ./dist/browser/index.js ***!
54
+ \*******************************/
55
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
56
+
57
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ curlNoisePathName: () => (/* binding */ curlNoisePathName),\n/* harmony export */ loadCurlNoisePath: () => (/* binding */ loadCurlNoisePath)\n/* harmony export */ });\nconst curlNoisePathName = \"curlNoise\";\nasync function loadCurlNoisePath(engine) {\n engine.checkVersion(\"4.0.0-alpha.21\");\n await engine.register((e)=>{\n e.addPathGenerator(curlNoisePathName, async (container)=>{\n const { CurlNoiseGenerator } = await __webpack_require__.e(/*! import() */ \"dist_browser_CurlNoiseGenerator_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./CurlNoiseGenerator.js */ \"./dist/browser/CurlNoiseGenerator.js\"));\n return new CurlNoiseGenerator(container);\n });\n });\n}\n\n\n//# sourceURL=webpack://@tsparticles/path-curl-noise/./dist/browser/index.js?\n}");
58
+
59
59
  /***/ }
60
60
 
61
61
  /******/ });
@@ -1,2 +1,2 @@
1
- /*! For license information please see tsparticles.path.curl.noise.min.js.LICENSE.txt */
2
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"),require("@tsparticles/simplex-noise"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine","@tsparticles/simplex-noise"],t);else{var r="object"==typeof exports?t(require("@tsparticles/engine"),require("@tsparticles/simplex-noise")):t(e.window,e.window);for(var o in r)("object"==typeof exports?exports:e)[o]=r[o]}}(this,((e,t)=>(()=>{var r,o,i={226(e){e.exports=t},303(t){t.exports=e}},n={};function a(e){var t=n[e];if(void 0!==t)return t.exports;var r=n[e]={exports:{}};return i[e](r,r.exports,a),r.exports}a.m=i,a.d=(e,t)=>{for(var r in t)a.o(t,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},a.f={},a.e=e=>Promise.all(Object.keys(a.f).reduce(((t,r)=>(a.f[r](e,t),t)),[])),a.u=e=>e+".min.js",a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r={},o="@tsparticles/path-curl-noise:",a.l=(e,t,i,n)=>{if(r[e])r[e].push(t);else{var s,c;if(void 0!==i)for(var l=document.getElementsByTagName("script"),p=0;p<l.length;p++){var u=l[p];if(u.getAttribute("src")==e||u.getAttribute("data-webpack")==o+i){s=u;break}}s||(c=!0,(s=document.createElement("script")).charset="utf-8",a.nc&&s.setAttribute("nonce",a.nc),s.setAttribute("data-webpack",o+i),s.src=e),r[e]=[t];var d=(t,o)=>{s.onerror=s.onload=null,clearTimeout(f);var i=r[e];if(delete r[e],s.parentNode&&s.parentNode.removeChild(s),i&&i.forEach((e=>e(o))),t)return t(o)},f=setTimeout(d.bind(null,void 0,{type:"timeout",target:s}),12e4);s.onerror=d.bind(null,s.onerror),s.onload=d.bind(null,s.onload),c&&document.head.appendChild(s)}},a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;a.g.importScripts&&(e=a.g.location+"");var t=a.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var o=r.length-1;o>-1&&(!e||!/^http(s?):/.test(e));)e=r[o--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),a.p=e})(),(()=>{var e={562:0};a.f.j=(t,r)=>{var o=a.o(e,t)?e[t]:void 0;if(0!==o)if(o)r.push(o[2]);else{var i=new Promise(((r,i)=>o=e[t]=[r,i]));r.push(o[2]=i);var n=a.p+a.u(t),s=new Error;a.l(n,(r=>{if(a.o(e,t)&&(0!==(o=e[t])&&(e[t]=void 0),o)){var i=r&&("load"===r.type?"missing":r.type),n=r&&r.target&&r.target.src;s.message="Loading chunk "+t+" failed.\n("+i+": "+n+")",s.name="ChunkLoadError",s.type=i,s.request=n,o[1](s)}}),"chunk-"+t,t)}};var t=(t,r)=>{var o,i,[n,s,c]=r,l=0;if(n.some((t=>0!==e[t]))){for(o in s)a.o(s,o)&&(a.m[o]=s[o]);if(c)c(a)}for(t&&t(r);l<n.length;l++)i=n[l],a.o(e,i)&&e[i]&&e[i][0](),e[i]=0},r=this.webpackChunk_tsparticles_path_curl_noise=this.webpackChunk_tsparticles_path_curl_noise||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var s={};a.r(s),a.d(s,{curlNoisePathName:()=>c,loadCurlNoisePath:()=>l});const c="curlNoise";function l(e){e.checkVersion("4.0.0-alpha.2"),e.register((async e=>{const{CurlNoiseGenerator:t}=await a.e(720).then(a.bind(a,720));e.addPathGenerator(c,new t)}))}return s})()));
1
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"),require("@tsparticles/simplex-noise"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine","@tsparticles/simplex-noise"],t);else{var r="object"==typeof exports?t(require("@tsparticles/engine"),require("@tsparticles/simplex-noise")):t(e.window,e.window);for(var o in r)("object"==typeof exports?exports:e)[o]=r[o]}}(this,(e,t)=>(()=>{"use strict";var r,o,i,n={303(t){t.exports=e},226(e){e.exports=t}},a={};function s(e){var t=a[e];if(void 0!==t)return t.exports;var r=a[e]={exports:{}};return n[e](r,r.exports,s),r.exports}s.m=n,s.d=(e,t)=>{for(var r in t)s.o(t,r)&&!s.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},s.f={},s.e=e=>Promise.all(Object.keys(s.f).reduce((t,r)=>(s.f[r](e,t),t),[])),s.u=e=>""+e+".min.js",s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),c={},s.l=(e,t,r,o)=>{if(c[e])return void c[e].push(t);if(void 0!==r)for(var i,n,a=document.getElementsByTagName("script"),l=0;l<a.length;l++){var p=a[l];if(p.getAttribute("src")==e||p.getAttribute("data-webpack")=="@tsparticles/path-curl-noise:"+r){i=p;break}}i||(n=!0,(i=document.createElement("script")).charset="utf-8",s.nc&&i.setAttribute("nonce",s.nc),i.setAttribute("data-webpack","@tsparticles/path-curl-noise:"+r),i.src=e),c[e]=[t];var u=(t,r)=>{i.onerror=i.onload=null,clearTimeout(d);var o=c[e];if(delete c[e],i.parentNode&&i.parentNode.removeChild(i),o&&o.forEach(e=>e(r)),t)return t(r)},d=setTimeout(u.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=u.bind(null,i.onerror),i.onload=u.bind(null,i.onload),n&&document.head.appendChild(i)},s.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.g.importScripts&&(l=s.g.location+"");var c,l,p=s.g.document;if(!l&&p&&(p.currentScript&&"SCRIPT"===p.currentScript.tagName.toUpperCase()&&(l=p.currentScript.src),!l)){var u=p.getElementsByTagName("script");if(u.length)for(var d=u.length-1;d>-1&&(!l||!/^http(s?):/.test(l));)l=u[d--].src}if(!l)throw Error("Automatic publicPath is not supported in this browser");s.p=l=l.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),r={562:0},s.f.j=(e,t)=>{var o=s.o(r,e)?r[e]:void 0;if(0!==o)if(o)t.push(o[2]);else{var i=new Promise((t,i)=>o=r[e]=[t,i]);t.push(o[2]=i);var n=s.p+s.u(e),a=Error();s.l(n,t=>{if(s.o(r,e)&&(0!==(o=r[e])&&(r[e]=void 0),o)){var i=t&&("load"===t.type?"missing":t.type),n=t&&t.target&&t.target.src;a.message="Loading chunk "+e+` failed.
2
+ (`+i+": "+n+")",a.name="ChunkLoadError",a.type=i,a.request=n,o[1](a)}},"chunk-"+e,e)}},o=(e,t)=>{var o,i,[n,a,c]=t,l=0;if(n.some(e=>0!==r[e])){for(o in a)s.o(a,o)&&(s.m[o]=a[o]);c&&c(s)}for(e&&e(t);l<n.length;l++)i=n[l],s.o(r,i)&&r[i]&&r[i][0](),r[i]=0},(i=this.webpackChunk_tsparticles_path_curl_noise=this.webpackChunk_tsparticles_path_curl_noise||[]).forEach(o.bind(null,0)),i.push=o.bind(null,i.push.bind(i));var f={};s.r(f),s.d(f,{curlNoisePathName:()=>h,loadCurlNoisePath:()=>b});let h="curlNoise";async function b(e){e.checkVersion("4.0.0-alpha.21"),await e.register(e=>{e.addPathGenerator(h,async e=>{let{CurlNoiseGenerator:t}=await s.e(934).then(s.bind(s,934));return new t(e)})})}return f})());
@@ -2,10 +2,11 @@ import { type Container, type IMovePathGenerator, type Particle, Vector } from "
2
2
  import type { ICurlOptions } from "./ICurlOptions.js";
3
3
  export declare class CurlNoiseGenerator implements IMovePathGenerator {
4
4
  readonly options: ICurlOptions;
5
+ private readonly _container;
5
6
  private readonly _simplex;
6
- constructor();
7
+ constructor(container: Container);
7
8
  generate(particle: Particle): Vector;
8
- init(container: Container): void;
9
+ init(): void;
9
10
  reset(): void;
10
11
  update(): void;
11
12
  }
package/types/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  import { type Engine } from "@tsparticles/engine";
2
2
  export declare const curlNoisePathName = "curlNoise";
3
- export declare function loadCurlNoisePath(engine: Engine): void;
3
+ export declare function loadCurlNoisePath(engine: Engine): Promise<void>;
@@ -15,21 +15,25 @@
15
15
  const defaultOptions = {
16
16
  speed: 0.2,
17
17
  step: 250,
18
- }, double = 2;
18
+ };
19
19
  class CurlNoiseGenerator {
20
- constructor() {
20
+ options;
21
+ _container;
22
+ _simplex;
23
+ constructor(container) {
24
+ this._container = container;
21
25
  const simplex = new simplex_noise_1.SimplexNoise();
22
26
  this._simplex = simplex.noise2d;
23
27
  this.options = (0, engine_1.deepExtend)({}, defaultOptions);
24
28
  }
25
29
  generate(particle) {
26
- 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);
30
+ 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) / (engine_1.double * eps), n1b = this._simplex.noise(x + eps, y), n2b = this._simplex.noise(x - eps, y), b = (n1b - n2b) / (engine_1.double * eps);
27
31
  particle.velocity.x = 0;
28
32
  particle.velocity.y = 0;
29
33
  return engine_1.Vector.create(speed * a, speed * -b);
30
34
  }
31
- init(container) {
32
- const sourceOptions = container.actualOptions.particles.move.path.options;
35
+ init() {
36
+ const container = this._container, sourceOptions = container.actualOptions.particles.move.path.options;
33
37
  this.options.seed = sourceOptions["seed"];
34
38
  this.options.speed =
35
39
  (sourceOptions["speed"] ?? defaultOptions.speed) * container.retina.pixelRatio;
package/umd/index.js CHANGED
@@ -46,11 +46,13 @@ var __importStar = (this && this.__importStar) || (function () {
46
46
  exports.curlNoisePathName = void 0;
47
47
  exports.loadCurlNoisePath = loadCurlNoisePath;
48
48
  exports.curlNoisePathName = "curlNoise";
49
- function loadCurlNoisePath(engine) {
50
- engine.checkVersion("4.0.0-alpha.2");
51
- engine.register(async (e) => {
52
- const { CurlNoiseGenerator } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./CurlNoiseGenerator.js"))) : new Promise((resolve_1, reject_1) => { require(["./CurlNoiseGenerator.js"], resolve_1, reject_1); }).then(__importStar));
53
- e.addPathGenerator(exports.curlNoisePathName, new CurlNoiseGenerator());
49
+ async function loadCurlNoisePath(engine) {
50
+ engine.checkVersion("4.0.0-alpha.21");
51
+ await engine.register(e => {
52
+ e.addPathGenerator(exports.curlNoisePathName, async (container) => {
53
+ const { CurlNoiseGenerator } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./CurlNoiseGenerator.js"))) : new Promise((resolve_1, reject_1) => { require(["./CurlNoiseGenerator.js"], resolve_1, reject_1); }).then(__importStar));
54
+ return new CurlNoiseGenerator(container);
55
+ });
54
56
  });
55
57
  }
56
58
  });
package/720.min.js DELETED
@@ -1,2 +0,0 @@
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(){}}}}]);
@@ -1 +0,0 @@
1
- /*! tsParticles Curl Noise Path v4.0.0-alpha.2 by Matteo Bruni */
@@ -1 +0,0 @@
1
- /*! tsParticles Curl Noise Path v4.0.0-alpha.2 by Matteo Bruni */