@tsparticles/path-curves 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.
- package/265.min.js +1 -0
- package/browser/CurvesPathGenerator.js +39 -33
- package/browser/index.js +7 -5
- package/cjs/CurvesPathGenerator.js +39 -33
- package/cjs/index.js +7 -5
- package/dist_browser_CurvesPathGenerator_js.js +3 -3
- package/esm/CurvesPathGenerator.js +39 -33
- package/esm/index.js +7 -5
- package/package.json +2 -2
- package/report.html +3 -3
- package/tsparticles.path.curves.js +11 -11
- package/tsparticles.path.curves.min.js +2 -2
- package/types/CurvesPathGenerator.d.ts +4 -3
- package/types/index.d.ts +1 -1
- package/umd/CurvesPathGenerator.js +38 -32
- package/umd/index.js +7 -5
- package/298.min.js +0 -2
- package/298.min.js.LICENSE.txt +0 -1
- package/tsparticles.path.curves.min.js.LICENSE.txt +0 -1
|
@@ -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.
|
|
7
|
+
* v4.0.0-alpha.20
|
|
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 */ curvesPathName: () => (/* binding */ curvesPathName),\n/* harmony export */ loadCurvesPath: () => (/* binding */ loadCurvesPath)\n/* harmony export */ });\nconst curvesPathName = \"curvesPathGenerator\";\nfunction loadCurvesPath(engine) {\n engine.checkVersion(\"4.0.0-alpha.2\");\n engine.register(async e => {\n const {\n CurvesPathGenerator\n } = await __webpack_require__.e(/*! import() */ \"dist_browser_CurvesPathGenerator_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./CurvesPathGenerator.js */ \"./dist/browser/CurvesPathGenerator.js\"));\n e.addPathGenerator(curvesPathName, new CurvesPathGenerator());\n });\n}\n\n//# sourceURL=webpack://@tsparticles/path-curves/./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"} ***!
|
|
@@ -46,6 +36,16 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
46
36
|
|
|
47
37
|
module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
|
|
48
38
|
|
|
39
|
+
/***/ },
|
|
40
|
+
|
|
41
|
+
/***/ "./dist/browser/index.js"
|
|
42
|
+
/*!*******************************!*\
|
|
43
|
+
!*** ./dist/browser/index.js ***!
|
|
44
|
+
\*******************************/
|
|
45
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
46
|
+
|
|
47
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ curvesPathName: () => (/* binding */ curvesPathName),\n/* harmony export */ loadCurvesPath: () => (/* binding */ loadCurvesPath)\n/* harmony export */ });\nconst curvesPathName = \"curvesPathGenerator\";\nasync function loadCurvesPath(engine) {\n engine.checkVersion(\"4.0.0-alpha.20\");\n await engine.register((e)=>{\n e.addPathGenerator(curvesPathName, async (container)=>{\n const { CurvesPathGenerator } = await __webpack_require__.e(/*! import() */ \"dist_browser_CurvesPathGenerator_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./CurvesPathGenerator.js */ \"./dist/browser/CurvesPathGenerator.js\"));\n return new CurvesPathGenerator(container);\n });\n });\n}\n\n\n//# sourceURL=webpack://@tsparticles/path-curves/./dist/browser/index.js?\n}");
|
|
48
|
+
|
|
49
49
|
/***/ }
|
|
50
50
|
|
|
51
51
|
/******/ });
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],t);else{var r="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var o in r)("object"==typeof exports?exports:e)[o]=r[o]}}(this,e=>(()=>{"use strict";var t,r,o,n={303(t){t.exports=e}},a={};function i(e){var t=a[e];if(void 0!==t)return t.exports;var r=a[e]={exports:{}};return n[e](r,r.exports,i),r.exports}i.m=n,i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.f={},i.e=e=>Promise.all(Object.keys(i.f).reduce((t,r)=>(i.f[r](e,t),t),[])),i.u=e=>""+e+".min.js",i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s={},i.l=(e,t,r,o)=>{if(s[e])return void s[e].push(t);if(void 0!==r)for(var n,a,c=document.getElementsByTagName("script"),p=0;p<c.length;p++){var u=c[p];if(u.getAttribute("src")==e||u.getAttribute("data-webpack")=="@tsparticles/path-curves:"+r){n=u;break}}n||(a=!0,(n=document.createElement("script")).charset="utf-8",i.nc&&n.setAttribute("nonce",i.nc),n.setAttribute("data-webpack","@tsparticles/path-curves:"+r),n.src=e),s[e]=[t];var l=(t,r)=>{n.onerror=n.onload=null,clearTimeout(d);var o=s[e];if(delete s[e],n.parentNode&&n.parentNode.removeChild(n),o&&o.forEach(e=>e(r)),t)return t(r)},d=setTimeout(l.bind(null,void 0,{type:"timeout",target:n}),12e4);n.onerror=l.bind(null,n.onerror),n.onload=l.bind(null,n.onload),a&&document.head.appendChild(n)},i.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.g.importScripts&&(c=i.g.location+"");var s,c,p=i.g.document;if(!c&&p&&(p.currentScript&&"SCRIPT"===p.currentScript.tagName.toUpperCase()&&(c=p.currentScript.src),!c)){var u=p.getElementsByTagName("script");if(u.length)for(var l=u.length-1;l>-1&&(!c||!/^http(s?):/.test(c));)c=u[l--].src}if(!c)throw Error("Automatic publicPath is not supported in this browser");i.p=c=c.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),t={944:0},i.f.j=(e,r)=>{var o=i.o(t,e)?t[e]:void 0;if(0!==o)if(o)r.push(o[2]);else{var n=new Promise((r,n)=>o=t[e]=[r,n]);r.push(o[2]=n);var a=i.p+i.u(e),s=Error();i.l(a,r=>{if(i.o(t,e)&&(0!==(o=t[e])&&(t[e]=void 0),o)){var n=r&&("load"===r.type?"missing":r.type),a=r&&r.target&&r.target.src;s.message="Loading chunk "+e+` failed.
|
|
2
|
+
(`+n+": "+a+")",s.name="ChunkLoadError",s.type=n,s.request=a,o[1](s)}},"chunk-"+e,e)}},r=(e,r)=>{var o,n,[a,s,c]=r,p=0;if(a.some(e=>0!==t[e])){for(o in s)i.o(s,o)&&(i.m[o]=s[o]);c&&c(i)}for(e&&e(r);p<a.length;p++)n=a[p],i.o(t,n)&&t[n]&&t[n][0](),t[n]=0},(o=this.webpackChunk_tsparticles_path_curves=this.webpackChunk_tsparticles_path_curves||[]).forEach(r.bind(null,0)),o.push=r.bind(null,o.push.bind(o));var d={};i.r(d),i.d(d,{curvesPathName:()=>f,loadCurvesPath:()=>h});let f="curvesPathGenerator";async function h(e){e.checkVersion("4.0.0-alpha.20"),await e.register(e=>{e.addPathGenerator(f,async e=>{let{CurvesPathGenerator:t}=await i.e(265).then(i.bind(i,265));return new t(e)})})}return d})());
|
|
@@ -3,9 +3,10 @@ import type { CurvesPathParticle } from "./CurvesPathParticle.js";
|
|
|
3
3
|
import type { ICurvesOptions } from "./ICurvesOptions.js";
|
|
4
4
|
export declare class CurvesPathGenerator implements IMovePathGenerator {
|
|
5
5
|
readonly options: ICurvesOptions;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
private readonly _container;
|
|
7
|
+
constructor(container: Container);
|
|
8
|
+
generate(particle: CurvesPathParticle): Vector;
|
|
9
|
+
init(): void;
|
|
9
10
|
reset(particle: CurvesPathParticle): void;
|
|
10
11
|
update(): void;
|
|
11
12
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -12,53 +12,59 @@
|
|
|
12
12
|
exports.CurvesPathGenerator = void 0;
|
|
13
13
|
const engine_1 = require("@tsparticles/engine");
|
|
14
14
|
const Curves_js_1 = require("./Curves.js");
|
|
15
|
+
const defaultOptions = {
|
|
16
|
+
rndFunc: null,
|
|
17
|
+
period: 100,
|
|
18
|
+
nbHarmonics: 2,
|
|
19
|
+
attenHarmonics: 0.8,
|
|
20
|
+
lowValue: -0.03,
|
|
21
|
+
highValue: 0.03,
|
|
22
|
+
};
|
|
15
23
|
function randomVelocity() {
|
|
16
24
|
const offset = 0.8, factor = 0.6;
|
|
17
25
|
return (0, engine_1.getRandom)() * factor + offset;
|
|
18
26
|
}
|
|
19
27
|
class CurvesPathGenerator {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
attenHarmonics: 0.8,
|
|
26
|
-
lowValue: -0.03,
|
|
27
|
-
highValue: 0.03,
|
|
28
|
-
};
|
|
28
|
+
options;
|
|
29
|
+
_container;
|
|
30
|
+
constructor(container) {
|
|
31
|
+
this._container = container;
|
|
32
|
+
this.options = (0, engine_1.deepExtend)({}, defaultOptions);
|
|
29
33
|
}
|
|
30
|
-
generate(
|
|
31
|
-
if (!
|
|
32
|
-
const options = this
|
|
33
|
-
|
|
34
|
+
generate(particle) {
|
|
35
|
+
if (!particle.pathGen) {
|
|
36
|
+
const { options } = this;
|
|
37
|
+
particle.pathGen = (0, Curves_js_1.CurvesPathGen)(options.rndFunc, options.period, options.nbHarmonics, options.attenHarmonics, options.lowValue, options.highValue);
|
|
34
38
|
}
|
|
35
|
-
if (
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
p.curveVelocity.angle = (0, engine_1.getRandom)() * engine_1.doublePI;
|
|
39
|
+
if (particle.curveVelocity) {
|
|
40
|
+
particle.curveVelocity.length += 0.01;
|
|
41
|
+
particle.curveVelocity.angle = (particle.curveVelocity.angle + particle.pathGen()) % engine_1.doublePI;
|
|
39
42
|
}
|
|
40
43
|
else {
|
|
41
|
-
|
|
42
|
-
|
|
44
|
+
particle.curveVelocity = engine_1.Vector.origin;
|
|
45
|
+
particle.curveVelocity.length = randomVelocity();
|
|
46
|
+
particle.curveVelocity.angle = (0, engine_1.getRandom)() * engine_1.doublePI;
|
|
43
47
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
return
|
|
48
|
+
particle.velocity.x = 0;
|
|
49
|
+
particle.velocity.y = 0;
|
|
50
|
+
return particle.curveVelocity;
|
|
47
51
|
}
|
|
48
|
-
init(
|
|
49
|
-
const sourceOptions =
|
|
52
|
+
init() {
|
|
53
|
+
const sourceOptions = this._container.actualOptions.particles.move.path.options;
|
|
50
54
|
if ((0, engine_1.isFunction)(sourceOptions["rndFunc"])) {
|
|
51
|
-
options.rndFunc = sourceOptions["rndFunc"];
|
|
55
|
+
this.options.rndFunc = sourceOptions["rndFunc"];
|
|
52
56
|
}
|
|
53
57
|
else if ((0, engine_1.isString)(sourceOptions["rndFunc"])) {
|
|
54
|
-
options.rndFunc =
|
|
55
|
-
globalThis[sourceOptions["rndFunc"]] ??
|
|
58
|
+
this.options.rndFunc =
|
|
59
|
+
globalThis[sourceOptions["rndFunc"]] ??
|
|
60
|
+
this.options.rndFunc;
|
|
56
61
|
}
|
|
57
|
-
options.period = sourceOptions["period"] ?? options.period;
|
|
58
|
-
options.nbHarmonics = sourceOptions["nbHarmonics"] ?? options.nbHarmonics;
|
|
59
|
-
options.attenHarmonics =
|
|
60
|
-
|
|
61
|
-
options.
|
|
62
|
+
this.options.period = sourceOptions["period"] ?? this.options.period;
|
|
63
|
+
this.options.nbHarmonics = sourceOptions["nbHarmonics"] ?? this.options.nbHarmonics;
|
|
64
|
+
this.options.attenHarmonics =
|
|
65
|
+
sourceOptions["attenHarmonics"] ?? this.options.attenHarmonics;
|
|
66
|
+
this.options.lowValue = sourceOptions["lowValue"] ?? this.options.lowValue;
|
|
67
|
+
this.options.highValue = sourceOptions["highValue"] ?? this.options.highValue;
|
|
62
68
|
}
|
|
63
69
|
reset(particle) {
|
|
64
70
|
delete particle.pathGen;
|
package/umd/index.js
CHANGED
|
@@ -46,11 +46,13 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
46
46
|
exports.curvesPathName = void 0;
|
|
47
47
|
exports.loadCurvesPath = loadCurvesPath;
|
|
48
48
|
exports.curvesPathName = "curvesPathGenerator";
|
|
49
|
-
function loadCurvesPath(engine) {
|
|
50
|
-
engine.checkVersion("4.0.0-alpha.
|
|
51
|
-
engine.register(
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
async function loadCurvesPath(engine) {
|
|
50
|
+
engine.checkVersion("4.0.0-alpha.20");
|
|
51
|
+
await engine.register(e => {
|
|
52
|
+
e.addPathGenerator(exports.curvesPathName, async (container) => {
|
|
53
|
+
const { CurvesPathGenerator } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./CurvesPathGenerator.js"))) : new Promise((resolve_1, reject_1) => { require(["./CurvesPathGenerator.js"], resolve_1, reject_1); }).then(__importStar));
|
|
54
|
+
return new CurvesPathGenerator(container);
|
|
55
|
+
});
|
|
54
56
|
});
|
|
55
57
|
}
|
|
56
58
|
});
|
package/298.min.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/*! For license information please see 298.min.js.LICENSE.txt */
|
|
2
|
-
(this.webpackChunk_tsparticles_path_curves=this.webpackChunk_tsparticles_path_curves||[]).push([[298],{298(e,n,t){t.d(n,{CurvesPathGenerator:()=>r});var o=t(303);class r{constructor(){this.options={rndFunc:null,period:100,nbHarmonics:2,attenHarmonics:.8,lowValue:-.03,highValue:.03}}generate(e){if(!e.pathGen){const n=this.options;e.pathGen=function(e,n,t,r,c=0,i=1){const a=[],l=[],u=[],s=[],h=[],p=e??o.getRandom;let d=0;t<1&&(t=1);for(let e=1;e<=t;++e)a[e]=p(),l[e]=p(),u[e]=1===e?1:u[e-1]*r,d+=u[e],s[e]=e/n,h[e]=p();return u.forEach(((e,n)=>u[n]=e/d*(i-c))),()=>{let e,n,o=0;for(let r=t;r>=1;--r)e=h[r]+=s[r],h[r]>=1&&(e=h[r]-=1,a[r]=l[r],l[r]=p()),n=e**2*(3-2*e),o+=(a[r]*(1-n)+l[r]*n)*u[r];return o+c}}(n.rndFunc,n.period,n.nbHarmonics,n.attenHarmonics,n.lowValue,n.highValue)}return e.curveVelocity?(e.curveVelocity.length+=.01,e.curveVelocity.angle=(e.curveVelocity.angle+e.pathGen())%o.doublePI):(e.curveVelocity=o.Vector.origin,e.curveVelocity.length=.6*(0,o.getRandom)()+.8,e.curveVelocity.angle=(0,o.getRandom)()*o.doublePI),e.velocity.x=0,e.velocity.y=0,e.curveVelocity}init(e){const n=e.actualOptions.particles.move.path.options,{options:t}=this;(0,o.isFunction)(n.rndFunc)?t.rndFunc=n.rndFunc:(0,o.isString)(n.rndFunc)&&(t.rndFunc=globalThis[n.rndFunc]??this.options.rndFunc),t.period=n.period??t.period,t.nbHarmonics=n.nbHarmonics??t.nbHarmonics,t.attenHarmonics=n.attenHarmonics??t.attenHarmonics,t.lowValue=n.lowValue??t.lowValue,t.highValue=n.highValue??t.highValue}reset(e){delete e.pathGen,delete e.curveVelocity}update(){}}}}]);
|
package/298.min.js.LICENSE.txt
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/*! tsParticles Curves Path v4.0.0-alpha.2 by Matteo Bruni */
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/*! tsParticles Curves Path v4.0.0-alpha.2 by Matteo Bruni */
|