@tsparticles/path-curl-noise 3.0.0-beta.4
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/LICENSE +21 -0
- package/README.md +74 -0
- package/browser/CurlNoiseGenerator.js +31 -0
- package/browser/ICurlOptions.js +1 -0
- package/browser/index.js +5 -0
- package/browser/package.json +1 -0
- package/cjs/CurlNoiseGenerator.js +35 -0
- package/cjs/ICurlOptions.js +2 -0
- package/cjs/index.js +9 -0
- package/cjs/package.json +1 -0
- package/esm/CurlNoiseGenerator.js +31 -0
- package/esm/ICurlOptions.js +1 -0
- package/esm/index.js +5 -0
- package/esm/package.json +1 -0
- package/package.json +110 -0
- package/report.html +39 -0
- package/tsparticles.path.curl.noise.js +162 -0
- package/tsparticles.path.curl.noise.min.js +2 -0
- package/tsparticles.path.curl.noise.min.js.LICENSE.txt +1 -0
- package/types/CurlNoiseGenerator.d.ts +11 -0
- package/types/ICurlOptions.d.ts +5 -0
- package/types/index.d.ts +3 -0
- package/umd/CurlNoiseGenerator.js +45 -0
- package/umd/ICurlOptions.js +12 -0
- package/umd/index.js +19 -0
|
@@ -0,0 +1,162 @@
|
|
|
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
|
+
* v3.0.0-beta.4
|
|
8
|
+
*/
|
|
9
|
+
(function webpackUniversalModuleDefinition(root, factory) {
|
|
10
|
+
if(typeof exports === 'object' && typeof module === 'object')
|
|
11
|
+
module.exports = factory(require("@tsparticles/engine"), require("@tsparticles/simplex-noise"));
|
|
12
|
+
else if(typeof define === 'function' && define.amd)
|
|
13
|
+
define(["@tsparticles/engine", "@tsparticles/simplex-noise"], factory);
|
|
14
|
+
else {
|
|
15
|
+
var a = typeof exports === 'object' ? factory(require("@tsparticles/engine"), require("@tsparticles/simplex-noise")) : factory(root["window"], root["window"]);
|
|
16
|
+
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
|
|
17
|
+
}
|
|
18
|
+
})(this, (__WEBPACK_EXTERNAL_MODULE__533__, __WEBPACK_EXTERNAL_MODULE__245__) => {
|
|
19
|
+
return /******/ (() => { // webpackBootstrap
|
|
20
|
+
/******/ "use strict";
|
|
21
|
+
/******/ var __webpack_modules__ = ({
|
|
22
|
+
|
|
23
|
+
/***/ 533:
|
|
24
|
+
/***/ ((module) => {
|
|
25
|
+
|
|
26
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__533__;
|
|
27
|
+
|
|
28
|
+
/***/ }),
|
|
29
|
+
|
|
30
|
+
/***/ 245:
|
|
31
|
+
/***/ ((module) => {
|
|
32
|
+
|
|
33
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__245__;
|
|
34
|
+
|
|
35
|
+
/***/ })
|
|
36
|
+
|
|
37
|
+
/******/ });
|
|
38
|
+
/************************************************************************/
|
|
39
|
+
/******/ // The module cache
|
|
40
|
+
/******/ var __webpack_module_cache__ = {};
|
|
41
|
+
/******/
|
|
42
|
+
/******/ // The require function
|
|
43
|
+
/******/ function __webpack_require__(moduleId) {
|
|
44
|
+
/******/ // Check if module is in cache
|
|
45
|
+
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
46
|
+
/******/ if (cachedModule !== undefined) {
|
|
47
|
+
/******/ return cachedModule.exports;
|
|
48
|
+
/******/ }
|
|
49
|
+
/******/ // Create a new module (and put it into the cache)
|
|
50
|
+
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
51
|
+
/******/ // no module.id needed
|
|
52
|
+
/******/ // no module.loaded needed
|
|
53
|
+
/******/ exports: {}
|
|
54
|
+
/******/ };
|
|
55
|
+
/******/
|
|
56
|
+
/******/ // Execute the module function
|
|
57
|
+
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
58
|
+
/******/
|
|
59
|
+
/******/ // Return the exports of the module
|
|
60
|
+
/******/ return module.exports;
|
|
61
|
+
/******/ }
|
|
62
|
+
/******/
|
|
63
|
+
/************************************************************************/
|
|
64
|
+
/******/ /* webpack/runtime/define property getters */
|
|
65
|
+
/******/ (() => {
|
|
66
|
+
/******/ // define getter functions for harmony exports
|
|
67
|
+
/******/ __webpack_require__.d = (exports, definition) => {
|
|
68
|
+
/******/ for(var key in definition) {
|
|
69
|
+
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
70
|
+
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
71
|
+
/******/ }
|
|
72
|
+
/******/ }
|
|
73
|
+
/******/ };
|
|
74
|
+
/******/ })();
|
|
75
|
+
/******/
|
|
76
|
+
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
77
|
+
/******/ (() => {
|
|
78
|
+
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
79
|
+
/******/ })();
|
|
80
|
+
/******/
|
|
81
|
+
/******/ /* webpack/runtime/make namespace object */
|
|
82
|
+
/******/ (() => {
|
|
83
|
+
/******/ // define __esModule on exports
|
|
84
|
+
/******/ __webpack_require__.r = (exports) => {
|
|
85
|
+
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
86
|
+
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
87
|
+
/******/ }
|
|
88
|
+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
89
|
+
/******/ };
|
|
90
|
+
/******/ })();
|
|
91
|
+
/******/
|
|
92
|
+
/************************************************************************/
|
|
93
|
+
var __webpack_exports__ = {};
|
|
94
|
+
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
|
|
95
|
+
(() => {
|
|
96
|
+
// ESM COMPAT FLAG
|
|
97
|
+
__webpack_require__.r(__webpack_exports__);
|
|
98
|
+
|
|
99
|
+
// EXPORTS
|
|
100
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
101
|
+
curlNoisePathName: () => (/* binding */ curlNoisePathName),
|
|
102
|
+
loadCurlNoisePath: () => (/* binding */ loadCurlNoisePath)
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
// EXTERNAL MODULE: external {"commonjs":"@tsparticles/engine","commonjs2":"@tsparticles/engine","amd":"@tsparticles/engine","root":"window"}
|
|
106
|
+
var engine_root_window_ = __webpack_require__(533);
|
|
107
|
+
// EXTERNAL MODULE: external {"commonjs":"@tsparticles/simplex-noise","commonjs2":"@tsparticles/simplex-noise","amd":"@tsparticles/simplex-noise","root":"window"}
|
|
108
|
+
var simplex_noise_root_window_ = __webpack_require__(245);
|
|
109
|
+
;// CONCATENATED MODULE: ./dist/browser/CurlNoiseGenerator.js
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
const defaultOptions = {
|
|
113
|
+
speed: 0.2,
|
|
114
|
+
step: 250
|
|
115
|
+
};
|
|
116
|
+
class CurlNoiseGenerator {
|
|
117
|
+
constructor() {
|
|
118
|
+
const simplex = new simplex_noise_root_window_.SimplexNoise();
|
|
119
|
+
this._simplex = simplex.noise2d;
|
|
120
|
+
this.options = (0,engine_root_window_.deepExtend)({}, defaultOptions);
|
|
121
|
+
}
|
|
122
|
+
generate(particle) {
|
|
123
|
+
const pos = particle.getPosition(),
|
|
124
|
+
{
|
|
125
|
+
speed,
|
|
126
|
+
step
|
|
127
|
+
} = this.options,
|
|
128
|
+
x = pos.x / step,
|
|
129
|
+
y = pos.y / step,
|
|
130
|
+
eps = 0.001,
|
|
131
|
+
n1a = this._simplex.noise(x, y + eps),
|
|
132
|
+
n2a = this._simplex.noise(x, y - eps),
|
|
133
|
+
a = (n1a - n2a) / (2 * eps),
|
|
134
|
+
n1b = this._simplex.noise(x + eps, y),
|
|
135
|
+
n2b = this._simplex.noise(x - eps, y),
|
|
136
|
+
b = (n1b - n2b) / (2 * eps);
|
|
137
|
+
particle.velocity.x = 0;
|
|
138
|
+
particle.velocity.y = 0;
|
|
139
|
+
return engine_root_window_.Vector.create(speed * a, speed * -b);
|
|
140
|
+
}
|
|
141
|
+
init(container) {
|
|
142
|
+
const sourceOptions = container.actualOptions.particles.move.path.options;
|
|
143
|
+
this.options.seed = sourceOptions?.seed;
|
|
144
|
+
this.options.speed = (sourceOptions?.speed ?? defaultOptions.speed) * container.retina.pixelRatio;
|
|
145
|
+
this.options.step = sourceOptions?.step ?? defaultOptions.step;
|
|
146
|
+
this._simplex.seed(this.options.seed ?? (0,engine_root_window_.getRandom)());
|
|
147
|
+
}
|
|
148
|
+
reset() {}
|
|
149
|
+
update() {}
|
|
150
|
+
}
|
|
151
|
+
;// CONCATENATED MODULE: ./dist/browser/index.js
|
|
152
|
+
|
|
153
|
+
const curlNoisePathName = "curlNoise";
|
|
154
|
+
async function loadCurlNoisePath(engine, refresh = true) {
|
|
155
|
+
await engine.addPathGenerator(curlNoisePathName, new CurlNoiseGenerator(), refresh);
|
|
156
|
+
}
|
|
157
|
+
})();
|
|
158
|
+
|
|
159
|
+
/******/ return __webpack_exports__;
|
|
160
|
+
/******/ })()
|
|
161
|
+
;
|
|
162
|
+
});
|
|
@@ -0,0 +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 s="object"==typeof exports?t(require("@tsparticles/engine"),require("@tsparticles/simplex-noise")):t(e.window,e.window);for(var o in s)("object"==typeof exports?exports:e)[o]=s[o]}}(this,((e,t)=>(()=>{"use strict";var s={533:t=>{t.exports=e},245:e=>{e.exports=t}},o={};function i(e){var t=o[e];if(void 0!==t)return t.exports;var r=o[e]={exports:{}};return s[e](r,r.exports,i),r.exports}i.d=(e,t)=>{for(var s in t)i.o(t,s)&&!i.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return(()=>{i.r(r),i.d(r,{curlNoisePathName:()=>n,loadCurlNoisePath:()=>p});var e=i(533),t=i(245);const s={speed:.2,step:250};class o{constructor(){const o=new t.SimplexNoise;this._simplex=o.noise2d,this.options=(0,e.deepExtend)({},s)}generate(t){const s=t.getPosition(),{speed:o,step:i}=this.options,r=s.x/i,n=s.y/i,p=.001,a=(this._simplex.noise(r,n+p)-this._simplex.noise(r,n-p))/.002,l=(this._simplex.noise(r+p,n)-this._simplex.noise(r-p,n))/.002;return t.velocity.x=0,t.velocity.y=0,e.Vector.create(o*a,o*-l)}init(t){const o=t.actualOptions.particles.move.path.options;this.options.seed=o?.seed,this.options.speed=(o?.speed??s.speed)*t.retina.pixelRatio,this.options.step=o?.step??s.step,this._simplex.seed(this.options.seed??(0,e.getRandom)())}reset(){}update(){}}const n="curlNoise";async function p(e,t=!0){await e.addPathGenerator(n,new o,t)}})(),r})()));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! tsParticles Curl Noise Path v3.0.0-beta.4 by Matteo Bruni */
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type Container, type IMovePathGenerator, type Particle, Vector } from "@tsparticles/engine";
|
|
2
|
+
import type { ICurlOptions } from "./ICurlOptions.js";
|
|
3
|
+
export declare class CurlNoiseGenerator implements IMovePathGenerator {
|
|
4
|
+
readonly options: ICurlOptions;
|
|
5
|
+
private readonly _simplex;
|
|
6
|
+
constructor();
|
|
7
|
+
generate(particle: Particle): Vector;
|
|
8
|
+
init(container: Container): void;
|
|
9
|
+
reset(): void;
|
|
10
|
+
update(): void;
|
|
11
|
+
}
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
(function (factory) {
|
|
2
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
+
var v = factory(require, exports);
|
|
4
|
+
if (v !== undefined) module.exports = v;
|
|
5
|
+
}
|
|
6
|
+
else if (typeof define === "function" && define.amd) {
|
|
7
|
+
define(["require", "exports", "@tsparticles/engine", "@tsparticles/simplex-noise"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.CurlNoiseGenerator = void 0;
|
|
13
|
+
const engine_1 = require("@tsparticles/engine");
|
|
14
|
+
const simplex_noise_1 = require("@tsparticles/simplex-noise");
|
|
15
|
+
const defaultOptions = {
|
|
16
|
+
speed: 0.2,
|
|
17
|
+
step: 250,
|
|
18
|
+
};
|
|
19
|
+
class CurlNoiseGenerator {
|
|
20
|
+
constructor() {
|
|
21
|
+
const simplex = new simplex_noise_1.SimplexNoise();
|
|
22
|
+
this._simplex = simplex.noise2d;
|
|
23
|
+
this.options = (0, engine_1.deepExtend)({}, defaultOptions);
|
|
24
|
+
}
|
|
25
|
+
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) / (2 * eps), n1b = this._simplex.noise(x + eps, y), n2b = this._simplex.noise(x - eps, y), b = (n1b - n2b) / (2 * eps);
|
|
27
|
+
particle.velocity.x = 0;
|
|
28
|
+
particle.velocity.y = 0;
|
|
29
|
+
return engine_1.Vector.create(speed * a, speed * -b);
|
|
30
|
+
}
|
|
31
|
+
init(container) {
|
|
32
|
+
const sourceOptions = container.actualOptions.particles.move.path.options;
|
|
33
|
+
this.options.seed = sourceOptions?.seed;
|
|
34
|
+
this.options.speed =
|
|
35
|
+
(sourceOptions?.speed ?? defaultOptions.speed) * container.retina.pixelRatio;
|
|
36
|
+
this.options.step = sourceOptions?.step ?? defaultOptions.step;
|
|
37
|
+
this._simplex.seed(this.options.seed ?? (0, engine_1.getRandom)());
|
|
38
|
+
}
|
|
39
|
+
reset() {
|
|
40
|
+
}
|
|
41
|
+
update() {
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.CurlNoiseGenerator = CurlNoiseGenerator;
|
|
45
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
(function (factory) {
|
|
2
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
+
var v = factory(require, exports);
|
|
4
|
+
if (v !== undefined) module.exports = v;
|
|
5
|
+
}
|
|
6
|
+
else if (typeof define === "function" && define.amd) {
|
|
7
|
+
define(["require", "exports"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
});
|
package/umd/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
(function (factory) {
|
|
2
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
+
var v = factory(require, exports);
|
|
4
|
+
if (v !== undefined) module.exports = v;
|
|
5
|
+
}
|
|
6
|
+
else if (typeof define === "function" && define.amd) {
|
|
7
|
+
define(["require", "exports", "./CurlNoiseGenerator.js"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.loadCurlNoisePath = exports.curlNoisePathName = void 0;
|
|
13
|
+
const CurlNoiseGenerator_js_1 = require("./CurlNoiseGenerator.js");
|
|
14
|
+
exports.curlNoisePathName = "curlNoise";
|
|
15
|
+
async function loadCurlNoisePath(engine, refresh = true) {
|
|
16
|
+
await engine.addPathGenerator(exports.curlNoisePathName, new CurlNoiseGenerator_js_1.CurlNoiseGenerator(), refresh);
|
|
17
|
+
}
|
|
18
|
+
exports.loadCurlNoisePath = loadCurlNoisePath;
|
|
19
|
+
});
|