@tsparticles/path-curves 3.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/LICENSE +21 -0
- package/README.md +70 -0
- package/browser/Curves.js +30 -0
- package/browser/CurvesPathGenerator.js +55 -0
- package/browser/CurvesPathParticle.js +1 -0
- package/browser/ICurvesOptions.js +1 -0
- package/browser/index.js +5 -0
- package/cjs/Curves.js +34 -0
- package/cjs/CurvesPathGenerator.js +59 -0
- package/cjs/CurvesPathParticle.js +2 -0
- package/cjs/ICurvesOptions.js +2 -0
- package/cjs/index.js +9 -0
- package/esm/Curves.js +30 -0
- package/esm/CurvesPathGenerator.js +55 -0
- package/esm/CurvesPathParticle.js +1 -0
- package/esm/ICurvesOptions.js +1 -0
- package/esm/index.js +5 -0
- package/package.json +92 -0
- package/report.html +39 -0
- package/tsparticles.path.curves.js +200 -0
- package/tsparticles.path.curves.min.js +2 -0
- package/tsparticles.path.curves.min.js.LICENSE.txt +8 -0
- package/types/Curves.d.ts +1 -0
- package/types/CurvesPathGenerator.d.ts +17 -0
- package/types/CurvesPathParticle.d.ts +5 -0
- package/types/ICurvesOptions.d.ts +8 -0
- package/types/index.d.ts +3 -0
- package/umd/Curves.js +44 -0
- package/umd/CurvesPathGenerator.js +69 -0
- package/umd/CurvesPathParticle.js +12 -0
- package/umd/ICurvesOptions.js +12 -0
- package/umd/index.js +19 -0
|
@@ -0,0 +1,200 @@
|
|
|
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-alpha.0
|
|
8
|
+
*/
|
|
9
|
+
(function webpackUniversalModuleDefinition(root, factory) {
|
|
10
|
+
if(typeof exports === 'object' && typeof module === 'object')
|
|
11
|
+
module.exports = factory(require("@tsparticles/engine"));
|
|
12
|
+
else if(typeof define === 'function' && define.amd)
|
|
13
|
+
define(["@tsparticles/engine"], factory);
|
|
14
|
+
else {
|
|
15
|
+
var a = typeof exports === 'object' ? factory(require("@tsparticles/engine")) : factory(root["window"]);
|
|
16
|
+
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
|
|
17
|
+
}
|
|
18
|
+
})(this, (__WEBPACK_EXTERNAL_MODULE__533__) => {
|
|
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
|
+
/******/ });
|
|
31
|
+
/************************************************************************/
|
|
32
|
+
/******/ // The module cache
|
|
33
|
+
/******/ var __webpack_module_cache__ = {};
|
|
34
|
+
/******/
|
|
35
|
+
/******/ // The require function
|
|
36
|
+
/******/ function __webpack_require__(moduleId) {
|
|
37
|
+
/******/ // Check if module is in cache
|
|
38
|
+
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
39
|
+
/******/ if (cachedModule !== undefined) {
|
|
40
|
+
/******/ return cachedModule.exports;
|
|
41
|
+
/******/ }
|
|
42
|
+
/******/ // Create a new module (and put it into the cache)
|
|
43
|
+
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
44
|
+
/******/ // no module.id needed
|
|
45
|
+
/******/ // no module.loaded needed
|
|
46
|
+
/******/ exports: {}
|
|
47
|
+
/******/ };
|
|
48
|
+
/******/
|
|
49
|
+
/******/ // Execute the module function
|
|
50
|
+
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
51
|
+
/******/
|
|
52
|
+
/******/ // Return the exports of the module
|
|
53
|
+
/******/ return module.exports;
|
|
54
|
+
/******/ }
|
|
55
|
+
/******/
|
|
56
|
+
/************************************************************************/
|
|
57
|
+
/******/ /* webpack/runtime/define property getters */
|
|
58
|
+
/******/ (() => {
|
|
59
|
+
/******/ // define getter functions for harmony exports
|
|
60
|
+
/******/ __webpack_require__.d = (exports, definition) => {
|
|
61
|
+
/******/ for(var key in definition) {
|
|
62
|
+
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
63
|
+
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
64
|
+
/******/ }
|
|
65
|
+
/******/ }
|
|
66
|
+
/******/ };
|
|
67
|
+
/******/ })();
|
|
68
|
+
/******/
|
|
69
|
+
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
70
|
+
/******/ (() => {
|
|
71
|
+
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
72
|
+
/******/ })();
|
|
73
|
+
/******/
|
|
74
|
+
/******/ /* webpack/runtime/make namespace object */
|
|
75
|
+
/******/ (() => {
|
|
76
|
+
/******/ // define __esModule on exports
|
|
77
|
+
/******/ __webpack_require__.r = (exports) => {
|
|
78
|
+
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
79
|
+
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
80
|
+
/******/ }
|
|
81
|
+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
82
|
+
/******/ };
|
|
83
|
+
/******/ })();
|
|
84
|
+
/******/
|
|
85
|
+
/************************************************************************/
|
|
86
|
+
var __webpack_exports__ = {};
|
|
87
|
+
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
|
|
88
|
+
(() => {
|
|
89
|
+
// ESM COMPAT FLAG
|
|
90
|
+
__webpack_require__.r(__webpack_exports__);
|
|
91
|
+
|
|
92
|
+
// EXPORTS
|
|
93
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
94
|
+
"curvesPathName": () => (/* binding */ curvesPathName),
|
|
95
|
+
"loadCurvesPath": () => (/* binding */ loadCurvesPath)
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
// EXTERNAL MODULE: external {"commonjs":"@tsparticles/engine","commonjs2":"@tsparticles/engine","amd":"@tsparticles/engine","root":"window"}
|
|
99
|
+
var engine_root_window_ = __webpack_require__(533);
|
|
100
|
+
;// CONCATENATED MODULE: ./dist/browser/Curves.js
|
|
101
|
+
|
|
102
|
+
function CurvesPathGen(rndFunc, period, nbHarmonics, attenHarmonics, lowValue = 0, highValue = 1) {
|
|
103
|
+
const arP0 = [],
|
|
104
|
+
arP1 = [],
|
|
105
|
+
amplitudes = [],
|
|
106
|
+
increments = [],
|
|
107
|
+
phases = [],
|
|
108
|
+
randomFunc = rndFunc !== null && rndFunc !== void 0 ? rndFunc : engine_root_window_.getRandom;
|
|
109
|
+
let globAmplitude = 0;
|
|
110
|
+
if (nbHarmonics < 1) nbHarmonics = 1;
|
|
111
|
+
for (let kh = 1; kh <= nbHarmonics; ++kh) {
|
|
112
|
+
arP0[kh] = randomFunc();
|
|
113
|
+
arP1[kh] = randomFunc();
|
|
114
|
+
amplitudes[kh] = kh === 1 ? 1 : amplitudes[kh - 1] * attenHarmonics;
|
|
115
|
+
globAmplitude += amplitudes[kh];
|
|
116
|
+
increments[kh] = kh / period;
|
|
117
|
+
phases[kh] = randomFunc();
|
|
118
|
+
}
|
|
119
|
+
amplitudes.forEach((value, kh) => amplitudes[kh] = value / globAmplitude * (highValue - lowValue));
|
|
120
|
+
return () => {
|
|
121
|
+
let pf,
|
|
122
|
+
pfl,
|
|
123
|
+
signal = 0;
|
|
124
|
+
for (let kh = nbHarmonics; kh >= 1; --kh) {
|
|
125
|
+
pf = phases[kh] += increments[kh];
|
|
126
|
+
if (phases[kh] >= 1) {
|
|
127
|
+
pf = phases[kh] -= 1;
|
|
128
|
+
arP0[kh] = arP1[kh];
|
|
129
|
+
arP1[kh] = randomFunc();
|
|
130
|
+
}
|
|
131
|
+
pfl = pf ** 2 * (3 - 2 * pf);
|
|
132
|
+
signal += (arP0[kh] * (1 - pfl) + arP1[kh] * pfl) * amplitudes[kh];
|
|
133
|
+
}
|
|
134
|
+
return signal + lowValue;
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
;// CONCATENATED MODULE: ./dist/browser/CurvesPathGenerator.js
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
class CurvesPathGenerator {
|
|
142
|
+
constructor() {
|
|
143
|
+
this.options = {
|
|
144
|
+
rndFunc: null,
|
|
145
|
+
period: 100,
|
|
146
|
+
nbHarmonics: 2,
|
|
147
|
+
attenHarmonics: 0.8,
|
|
148
|
+
lowValue: -0.03,
|
|
149
|
+
highValue: 0.03
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
generate(p) {
|
|
153
|
+
if (p.pathGen === undefined) {
|
|
154
|
+
const options = this.options;
|
|
155
|
+
p.pathGen = CurvesPathGen(options.rndFunc, options.period, options.nbHarmonics, options.attenHarmonics, options.lowValue, options.highValue);
|
|
156
|
+
}
|
|
157
|
+
if (p.curveVelocity === undefined) {
|
|
158
|
+
p.curveVelocity = engine_root_window_.Vector.origin;
|
|
159
|
+
p.curveVelocity.length = (0,engine_root_window_.getRandom)() * 0.6 + 0.8;
|
|
160
|
+
p.curveVelocity.angle = (0,engine_root_window_.getRandom)() * Math.PI * 2;
|
|
161
|
+
} else {
|
|
162
|
+
p.curveVelocity.length += 0.01;
|
|
163
|
+
p.curveVelocity.angle = (p.curveVelocity.angle + p.pathGen()) % (Math.PI * 2);
|
|
164
|
+
}
|
|
165
|
+
p.velocity.x = 0;
|
|
166
|
+
p.velocity.y = 0;
|
|
167
|
+
return p.curveVelocity;
|
|
168
|
+
}
|
|
169
|
+
init(container) {
|
|
170
|
+
var _a, _b, _c, _d, _e;
|
|
171
|
+
const sourceOptions = container.actualOptions.particles.move.path.options;
|
|
172
|
+
if (typeof sourceOptions.rndFunc === "function") {
|
|
173
|
+
this.options.rndFunc = sourceOptions.rndFunc;
|
|
174
|
+
} else if (typeof sourceOptions.rndFunc === "string") {
|
|
175
|
+
this.options.rndFunc = window[sourceOptions.rndFunc] || this.options.rndFunc;
|
|
176
|
+
}
|
|
177
|
+
this.options.period = (_a = sourceOptions.period) !== null && _a !== void 0 ? _a : this.options.period;
|
|
178
|
+
this.options.nbHarmonics = (_b = sourceOptions.nbHarmonics) !== null && _b !== void 0 ? _b : this.options.nbHarmonics;
|
|
179
|
+
this.options.attenHarmonics = (_c = sourceOptions.attenHarmonics) !== null && _c !== void 0 ? _c : this.options.attenHarmonics;
|
|
180
|
+
this.options.lowValue = (_d = sourceOptions.lowValue) !== null && _d !== void 0 ? _d : this.options.lowValue;
|
|
181
|
+
this.options.highValue = (_e = sourceOptions.highValue) !== null && _e !== void 0 ? _e : this.options.highValue;
|
|
182
|
+
}
|
|
183
|
+
reset(particle) {
|
|
184
|
+
delete particle.pathGen;
|
|
185
|
+
delete particle.curveVelocity;
|
|
186
|
+
}
|
|
187
|
+
update() {}
|
|
188
|
+
}
|
|
189
|
+
;// CONCATENATED MODULE: ./dist/browser/index.js
|
|
190
|
+
|
|
191
|
+
const curvesPathName = "curvesPathGenerator";
|
|
192
|
+
function loadCurvesPath(engine) {
|
|
193
|
+
engine.addPathGenerator(curvesPathName, new CurvesPathGenerator());
|
|
194
|
+
}
|
|
195
|
+
})();
|
|
196
|
+
|
|
197
|
+
/******/ return __webpack_exports__;
|
|
198
|
+
/******/ })()
|
|
199
|
+
;
|
|
200
|
+
});
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! For license information please see tsparticles.path.curves.min.js.LICENSE.txt */
|
|
2
|
+
!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 o="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var n in o)("object"==typeof exports?exports:e)[n]=o[n]}}(this,(e=>(()=>{"use strict";var t={533:t=>{t.exports=e}},o={};function n(e){var i=o[e];if(void 0!==i)return i.exports;var r=o[e]={exports:{}};return t[e](r,r.exports,n),r.exports}n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return(()=>{n.r(i),n.d(i,{curvesPathName:()=>o,loadCurvesPath:()=>r});var e=n(533);class t{constructor(){this.options={rndFunc:null,period:100,nbHarmonics:2,attenHarmonics:.8,lowValue:-.03,highValue:.03}}generate(t){if(void 0===t.pathGen){const o=this.options;t.pathGen=function(t,o,n,i,r=0,s=1){const a=[],l=[],c=[],u=[],p=[],d=null!=t?t:e.getRandom;let h=0;n<1&&(n=1);for(let e=1;e<=n;++e)a[e]=d(),l[e]=d(),c[e]=1===e?1:c[e-1]*i,h+=c[e],u[e]=e/o,p[e]=d();return c.forEach(((e,t)=>c[t]=e/h*(s-r))),()=>{let e,t,o=0;for(let i=n;i>=1;--i)e=p[i]+=u[i],p[i]>=1&&(e=p[i]-=1,a[i]=l[i],l[i]=d()),t=e**2*(3-2*e),o+=(a[i]*(1-t)+l[i]*t)*c[i];return o+r}}(o.rndFunc,o.period,o.nbHarmonics,o.attenHarmonics,o.lowValue,o.highValue)}return void 0===t.curveVelocity?(t.curveVelocity=e.Vector.origin,t.curveVelocity.length=.6*(0,e.getRandom)()+.8,t.curveVelocity.angle=(0,e.getRandom)()*Math.PI*2):(t.curveVelocity.length+=.01,t.curveVelocity.angle=(t.curveVelocity.angle+t.pathGen())%(2*Math.PI)),t.velocity.x=0,t.velocity.y=0,t.curveVelocity}init(e){var t,o,n,i,r;const s=e.actualOptions.particles.move.path.options;"function"==typeof s.rndFunc?this.options.rndFunc=s.rndFunc:"string"==typeof s.rndFunc&&(this.options.rndFunc=window[s.rndFunc]||this.options.rndFunc),this.options.period=null!==(t=s.period)&&void 0!==t?t:this.options.period,this.options.nbHarmonics=null!==(o=s.nbHarmonics)&&void 0!==o?o:this.options.nbHarmonics,this.options.attenHarmonics=null!==(n=s.attenHarmonics)&&void 0!==n?n:this.options.attenHarmonics,this.options.lowValue=null!==(i=s.lowValue)&&void 0!==i?i:this.options.lowValue,this.options.highValue=null!==(r=s.highValue)&&void 0!==r?r:this.options.highValue}reset(e){delete e.pathGen,delete e.curveVelocity}update(){}}const o="curvesPathGenerator";function r(e){e.addPathGenerator(o,new t)}})(),i})()));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function CurvesPathGen(rndFunc: (() => number) | null | undefined, period: number, nbHarmonics: number, attenHarmonics: number, lowValue?: number, highValue?: number): () => number;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Container, IMovePathGenerator } from "@tsparticles/engine";
|
|
2
|
+
import type { CurvesPathParticle } from "./CurvesPathParticle";
|
|
3
|
+
import type { ICurvesOptions } from "./ICurvesOptions";
|
|
4
|
+
import { Vector } from "@tsparticles/engine";
|
|
5
|
+
declare global {
|
|
6
|
+
interface Window {
|
|
7
|
+
[key: string]: unknown;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export declare class CurvesPathGenerator implements IMovePathGenerator {
|
|
11
|
+
readonly options: ICurvesOptions;
|
|
12
|
+
constructor();
|
|
13
|
+
generate(p: CurvesPathParticle): Vector;
|
|
14
|
+
init(container: Container): void;
|
|
15
|
+
reset(particle: CurvesPathParticle): void;
|
|
16
|
+
update(): void;
|
|
17
|
+
}
|
package/types/index.d.ts
ADDED
package/umd/Curves.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
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"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.CurvesPathGen = void 0;
|
|
13
|
+
const engine_1 = require("@tsparticles/engine");
|
|
14
|
+
function CurvesPathGen(rndFunc, period, nbHarmonics, attenHarmonics, lowValue = 0, highValue = 1) {
|
|
15
|
+
const arP0 = [], arP1 = [], amplitudes = [], increments = [], phases = [], randomFunc = rndFunc !== null && rndFunc !== void 0 ? rndFunc : engine_1.getRandom;
|
|
16
|
+
let globAmplitude = 0;
|
|
17
|
+
if (nbHarmonics < 1)
|
|
18
|
+
nbHarmonics = 1;
|
|
19
|
+
for (let kh = 1; kh <= nbHarmonics; ++kh) {
|
|
20
|
+
arP0[kh] = randomFunc();
|
|
21
|
+
arP1[kh] = randomFunc();
|
|
22
|
+
amplitudes[kh] = kh === 1 ? 1 : amplitudes[kh - 1] * attenHarmonics;
|
|
23
|
+
globAmplitude += amplitudes[kh];
|
|
24
|
+
increments[kh] = kh / period;
|
|
25
|
+
phases[kh] = randomFunc();
|
|
26
|
+
}
|
|
27
|
+
amplitudes.forEach((value, kh) => (amplitudes[kh] = (value / globAmplitude) * (highValue - lowValue)));
|
|
28
|
+
return () => {
|
|
29
|
+
let pf, pfl, signal = 0;
|
|
30
|
+
for (let kh = nbHarmonics; kh >= 1; --kh) {
|
|
31
|
+
pf = phases[kh] += increments[kh];
|
|
32
|
+
if (phases[kh] >= 1) {
|
|
33
|
+
pf = phases[kh] -= 1;
|
|
34
|
+
arP0[kh] = arP1[kh];
|
|
35
|
+
arP1[kh] = randomFunc();
|
|
36
|
+
}
|
|
37
|
+
pfl = pf ** 2 * (3 - 2 * pf);
|
|
38
|
+
signal += (arP0[kh] * (1 - pfl) + arP1[kh] * pfl) * amplitudes[kh];
|
|
39
|
+
}
|
|
40
|
+
return signal + lowValue;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
exports.CurvesPathGen = CurvesPathGen;
|
|
44
|
+
});
|
|
@@ -0,0 +1,69 @@
|
|
|
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", "./Curves", "@tsparticles/engine", "@tsparticles/engine"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.CurvesPathGenerator = void 0;
|
|
13
|
+
const Curves_1 = require("./Curves");
|
|
14
|
+
const engine_1 = require("@tsparticles/engine");
|
|
15
|
+
const engine_2 = require("@tsparticles/engine");
|
|
16
|
+
class CurvesPathGenerator {
|
|
17
|
+
constructor() {
|
|
18
|
+
this.options = {
|
|
19
|
+
rndFunc: null,
|
|
20
|
+
period: 100,
|
|
21
|
+
nbHarmonics: 2,
|
|
22
|
+
attenHarmonics: 0.8,
|
|
23
|
+
lowValue: -0.03,
|
|
24
|
+
highValue: 0.03,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
generate(p) {
|
|
28
|
+
if (p.pathGen === undefined) {
|
|
29
|
+
const options = this.options;
|
|
30
|
+
p.pathGen = (0, Curves_1.CurvesPathGen)(options.rndFunc, options.period, options.nbHarmonics, options.attenHarmonics, options.lowValue, options.highValue);
|
|
31
|
+
}
|
|
32
|
+
if (p.curveVelocity === undefined) {
|
|
33
|
+
p.curveVelocity = engine_1.Vector.origin;
|
|
34
|
+
p.curveVelocity.length = (0, engine_2.getRandom)() * 0.6 + 0.8;
|
|
35
|
+
p.curveVelocity.angle = (0, engine_2.getRandom)() * Math.PI * 2;
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
p.curveVelocity.length += 0.01;
|
|
39
|
+
p.curveVelocity.angle = (p.curveVelocity.angle + p.pathGen()) % (Math.PI * 2);
|
|
40
|
+
}
|
|
41
|
+
p.velocity.x = 0;
|
|
42
|
+
p.velocity.y = 0;
|
|
43
|
+
return p.curveVelocity;
|
|
44
|
+
}
|
|
45
|
+
init(container) {
|
|
46
|
+
var _a, _b, _c, _d, _e;
|
|
47
|
+
const sourceOptions = container.actualOptions.particles.move.path.options;
|
|
48
|
+
if (typeof sourceOptions.rndFunc === "function") {
|
|
49
|
+
this.options.rndFunc = sourceOptions.rndFunc;
|
|
50
|
+
}
|
|
51
|
+
else if (typeof sourceOptions.rndFunc === "string") {
|
|
52
|
+
this.options.rndFunc =
|
|
53
|
+
window[sourceOptions.rndFunc] || this.options.rndFunc;
|
|
54
|
+
}
|
|
55
|
+
this.options.period = (_a = sourceOptions.period) !== null && _a !== void 0 ? _a : this.options.period;
|
|
56
|
+
this.options.nbHarmonics = (_b = sourceOptions.nbHarmonics) !== null && _b !== void 0 ? _b : this.options.nbHarmonics;
|
|
57
|
+
this.options.attenHarmonics = (_c = sourceOptions.attenHarmonics) !== null && _c !== void 0 ? _c : this.options.attenHarmonics;
|
|
58
|
+
this.options.lowValue = (_d = sourceOptions.lowValue) !== null && _d !== void 0 ? _d : this.options.lowValue;
|
|
59
|
+
this.options.highValue = (_e = sourceOptions.highValue) !== null && _e !== void 0 ? _e : this.options.highValue;
|
|
60
|
+
}
|
|
61
|
+
reset(particle) {
|
|
62
|
+
delete particle.pathGen;
|
|
63
|
+
delete particle.curveVelocity;
|
|
64
|
+
}
|
|
65
|
+
update() {
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports.CurvesPathGenerator = CurvesPathGenerator;
|
|
69
|
+
});
|
|
@@ -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
|
+
});
|
|
@@ -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", "./CurvesPathGenerator"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.loadCurvesPath = exports.curvesPathName = void 0;
|
|
13
|
+
const CurvesPathGenerator_1 = require("./CurvesPathGenerator");
|
|
14
|
+
exports.curvesPathName = "curvesPathGenerator";
|
|
15
|
+
function loadCurvesPath(engine) {
|
|
16
|
+
engine.addPathGenerator(exports.curvesPathName, new CurvesPathGenerator_1.CurvesPathGenerator());
|
|
17
|
+
}
|
|
18
|
+
exports.loadCurvesPath = loadCurvesPath;
|
|
19
|
+
});
|