@tsparticles/path-curves 3.0.3 → 3.1.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.
@@ -1,5 +1,10 @@
1
1
  import { Vector, getRandom, isFunction, isString } from "@tsparticles/engine";
2
2
  import { CurvesPathGen } from "./Curves.js";
3
+ const double = 2, doublePI = Math.PI * double;
4
+ function randomVelocity() {
5
+ const offset = 0.8, factor = 0.6;
6
+ return getRandom() * factor + offset;
7
+ }
3
8
  export class CurvesPathGenerator {
4
9
  constructor() {
5
10
  this.options = {
@@ -18,12 +23,12 @@ export class CurvesPathGenerator {
18
23
  }
19
24
  if (!p.curveVelocity) {
20
25
  p.curveVelocity = Vector.origin;
21
- p.curveVelocity.length = getRandom() * 0.6 + 0.8;
22
- p.curveVelocity.angle = getRandom() * Math.PI * 2;
26
+ p.curveVelocity.length = randomVelocity();
27
+ p.curveVelocity.angle = getRandom() * doublePI;
23
28
  }
24
29
  else {
25
30
  p.curveVelocity.length += 0.01;
26
- p.curveVelocity.angle = (p.curveVelocity.angle + p.pathGen()) % (Math.PI * 2);
31
+ p.curveVelocity.angle = (p.curveVelocity.angle + p.pathGen()) % doublePI;
27
32
  }
28
33
  p.velocity.x = 0;
29
34
  p.velocity.y = 0;
@@ -36,7 +41,7 @@ export class CurvesPathGenerator {
36
41
  }
37
42
  else if (isString(sourceOptions.rndFunc)) {
38
43
  options.rndFunc =
39
- window[sourceOptions.rndFunc] || this.options.rndFunc;
44
+ window[sourceOptions.rndFunc] ?? this.options.rndFunc;
40
45
  }
41
46
  options.period = sourceOptions.period ?? options.period;
42
47
  options.nbHarmonics = sourceOptions.nbHarmonics ?? options.nbHarmonics;
@@ -3,6 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CurvesPathGenerator = void 0;
4
4
  const engine_1 = require("@tsparticles/engine");
5
5
  const Curves_js_1 = require("./Curves.js");
6
+ const double = 2, doublePI = Math.PI * double;
7
+ function randomVelocity() {
8
+ const offset = 0.8, factor = 0.6;
9
+ return (0, engine_1.getRandom)() * factor + offset;
10
+ }
6
11
  class CurvesPathGenerator {
7
12
  constructor() {
8
13
  this.options = {
@@ -21,12 +26,12 @@ class CurvesPathGenerator {
21
26
  }
22
27
  if (!p.curveVelocity) {
23
28
  p.curveVelocity = engine_1.Vector.origin;
24
- p.curveVelocity.length = (0, engine_1.getRandom)() * 0.6 + 0.8;
25
- p.curveVelocity.angle = (0, engine_1.getRandom)() * Math.PI * 2;
29
+ p.curveVelocity.length = randomVelocity();
30
+ p.curveVelocity.angle = (0, engine_1.getRandom)() * doublePI;
26
31
  }
27
32
  else {
28
33
  p.curveVelocity.length += 0.01;
29
- p.curveVelocity.angle = (p.curveVelocity.angle + p.pathGen()) % (Math.PI * 2);
34
+ p.curveVelocity.angle = (p.curveVelocity.angle + p.pathGen()) % doublePI;
30
35
  }
31
36
  p.velocity.x = 0;
32
37
  p.velocity.y = 0;
@@ -39,7 +44,7 @@ class CurvesPathGenerator {
39
44
  }
40
45
  else if ((0, engine_1.isString)(sourceOptions.rndFunc)) {
41
46
  options.rndFunc =
42
- window[sourceOptions.rndFunc] || this.options.rndFunc;
47
+ window[sourceOptions.rndFunc] ?? this.options.rndFunc;
43
48
  }
44
49
  options.period = sourceOptions.period ?? options.period;
45
50
  options.nbHarmonics = sourceOptions.nbHarmonics ?? options.nbHarmonics;
@@ -1,5 +1,10 @@
1
1
  import { Vector, getRandom, isFunction, isString } from "@tsparticles/engine";
2
2
  import { CurvesPathGen } from "./Curves.js";
3
+ const double = 2, doublePI = Math.PI * double;
4
+ function randomVelocity() {
5
+ const offset = 0.8, factor = 0.6;
6
+ return getRandom() * factor + offset;
7
+ }
3
8
  export class CurvesPathGenerator {
4
9
  constructor() {
5
10
  this.options = {
@@ -18,12 +23,12 @@ export class CurvesPathGenerator {
18
23
  }
19
24
  if (!p.curveVelocity) {
20
25
  p.curveVelocity = Vector.origin;
21
- p.curveVelocity.length = getRandom() * 0.6 + 0.8;
22
- p.curveVelocity.angle = getRandom() * Math.PI * 2;
26
+ p.curveVelocity.length = randomVelocity();
27
+ p.curveVelocity.angle = getRandom() * doublePI;
23
28
  }
24
29
  else {
25
30
  p.curveVelocity.length += 0.01;
26
- p.curveVelocity.angle = (p.curveVelocity.angle + p.pathGen()) % (Math.PI * 2);
31
+ p.curveVelocity.angle = (p.curveVelocity.angle + p.pathGen()) % doublePI;
27
32
  }
28
33
  p.velocity.x = 0;
29
34
  p.velocity.y = 0;
@@ -36,7 +41,7 @@ export class CurvesPathGenerator {
36
41
  }
37
42
  else if (isString(sourceOptions.rndFunc)) {
38
43
  options.rndFunc =
39
- window[sourceOptions.rndFunc] || this.options.rndFunc;
44
+ window[sourceOptions.rndFunc] ?? this.options.rndFunc;
40
45
  }
41
46
  options.period = sourceOptions.period ?? options.period;
42
47
  options.nbHarmonics = sourceOptions.nbHarmonics ?? options.nbHarmonics;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/path-curves",
3
- "version": "3.0.3",
3
+ "version": "3.1.0",
4
4
  "description": "tsParticles curves path",
5
5
  "homepage": "https://particles.js.org",
6
6
  "repository": {
@@ -104,6 +104,6 @@
104
104
  "./package.json": "./package.json"
105
105
  },
106
106
  "dependencies": {
107
- "@tsparticles/engine": "^3.0.3"
107
+ "@tsparticles/engine": "^3.1.0"
108
108
  }
109
109
  }
package/report.html CHANGED
@@ -3,7 +3,7 @@
3
3
  <head>
4
4
  <meta charset="UTF-8"/>
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1"/>
6
- <title>@tsparticles/path-curves [26 Dec 2023 at 19:27]</title>
6
+ <title>@tsparticles/path-curves [13 Jan 2024 at 23:01]</title>
7
7
  <link rel="shortcut icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAABrVBMVEUAAAD///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////+O1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awJhPcAaTEShgrG+iGyvb5a0Ndb1YGHFPEwoqAinoaykaID1o1pdPNu7XsnCKQ3R+hwWIIhGvORcJUBYXe3Xa3vq/mF/N9V13ugufMkfXn+KHsRD0B8AAAAASUVORK5CYII=" type="image/x-icon" />
8
8
 
9
9
  <script>
@@ -31,7 +31,7 @@
31
31
  <body>
32
32
  <div id="app"></div>
33
33
  <script>
34
- window.chartData = [{"label":"tsparticles.path.curves.js","isAsset":true,"statSize":3275,"parsedSize":7150,"gzipSize":2249,"groups":[{"label":"dist/browser","path":"./dist/browser","statSize":3233,"groups":[{"id":953,"label":"index.js + 2 modules (concatenated)","path":"./dist/browser/index.js + 2 modules (concatenated)","statSize":3233,"parsedSize":7150,"gzipSize":2249,"concatenated":true,"groups":[{"label":"dist/browser","path":"./dist/browser/index.js + 2 modules (concatenated)/dist/browser","statSize":3233,"groups":[{"id":null,"label":"index.js","path":"./dist/browser/index.js + 2 modules (concatenated)/dist/browser/index.js","statSize":266,"parsedSize":588,"gzipSize":185,"inaccurateSizes":true},{"id":null,"label":"CurvesPathGenerator.js","path":"./dist/browser/index.js + 2 modules (concatenated)/dist/browser/CurvesPathGenerator.js","statSize":1801,"parsedSize":3983,"gzipSize":1252,"inaccurateSizes":true},{"id":null,"label":"Curves.js","path":"./dist/browser/index.js + 2 modules (concatenated)/dist/browser/Curves.js","statSize":1166,"parsedSize":2578,"gzipSize":811,"inaccurateSizes":true}],"parsedSize":7150,"gzipSize":2249,"inaccurateSizes":true}]}],"parsedSize":7150,"gzipSize":2249},{"label":"engine\",\"commonjs2\":\"@tsparticles/engine\",\"amd\":\"@tsparticles","path":"./engine\",\"commonjs2\":\"@tsparticles/engine\",\"amd\":\"@tsparticles","statSize":42,"groups":[{"id":533,"label":"engine\",\"root\":\"window\"}","path":"./engine\",\"commonjs2\":\"@tsparticles/engine\",\"amd\":\"@tsparticles/engine\",\"root\":\"window\"}","statSize":42}],"parsedSize":0,"gzipSize":0}],"isInitialByEntrypoint":{"tsparticles.path.curves":true}}];
34
+ window.chartData = [{"label":"tsparticles.path.curves.js","isAsset":true,"statSize":3419,"parsedSize":7334,"gzipSize":2292,"groups":[{"label":"dist/browser","path":"./dist/browser","statSize":3377,"groups":[{"id":644,"label":"index.js + 2 modules (concatenated)","path":"./dist/browser/index.js + 2 modules (concatenated)","statSize":3377,"parsedSize":7334,"gzipSize":2292,"concatenated":true,"groups":[{"label":"dist/browser","path":"./dist/browser/index.js + 2 modules (concatenated)/dist/browser","statSize":3377,"groups":[{"id":null,"label":"index.js","path":"./dist/browser/index.js + 2 modules (concatenated)/dist/browser/index.js","statSize":266,"parsedSize":577,"gzipSize":180,"inaccurateSizes":true},{"id":null,"label":"CurvesPathGenerator.js","path":"./dist/browser/index.js + 2 modules (concatenated)/dist/browser/CurvesPathGenerator.js","statSize":1945,"parsedSize":4224,"gzipSize":1320,"inaccurateSizes":true},{"id":null,"label":"Curves.js","path":"./dist/browser/index.js + 2 modules (concatenated)/dist/browser/Curves.js","statSize":1166,"parsedSize":2532,"gzipSize":791,"inaccurateSizes":true}],"parsedSize":7334,"gzipSize":2292,"inaccurateSizes":true}]}],"parsedSize":7334,"gzipSize":2292},{"label":"engine\",\"commonjs2\":\"@tsparticles/engine\",\"amd\":\"@tsparticles","path":"./engine\",\"commonjs2\":\"@tsparticles/engine\",\"amd\":\"@tsparticles","statSize":42,"groups":[{"id":533,"label":"engine\",\"root\":\"window\"}","path":"./engine\",\"commonjs2\":\"@tsparticles/engine\",\"amd\":\"@tsparticles/engine\",\"root\":\"window\"}","statSize":42}],"parsedSize":0,"gzipSize":0}],"isInitialByEntrypoint":{"tsparticles.path.curves":true}}];
35
35
  window.entrypoints = ["tsparticles.path.curves","tsparticles.path.curves.min"];
36
36
  window.defaultSizes = "parsed";
37
37
  </script>
@@ -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
- * v3.0.3
7
+ * v3.1.0
8
8
  */
9
9
  (function webpackUniversalModuleDefinition(root, factory) {
10
10
  if(typeof exports === 'object' && typeof module === 'object')
@@ -137,6 +137,13 @@ function CurvesPathGen(rndFunc, period, nbHarmonics, attenHarmonics, lowValue =
137
137
  ;// CONCATENATED MODULE: ./dist/browser/CurvesPathGenerator.js
138
138
 
139
139
 
140
+ const CurvesPathGenerator_double = 2,
141
+ doublePI = Math.PI * CurvesPathGenerator_double;
142
+ function randomVelocity() {
143
+ const offset = 0.8,
144
+ factor = 0.6;
145
+ return (0,engine_root_window_.getRandom)() * factor + offset;
146
+ }
140
147
  class CurvesPathGenerator {
141
148
  constructor() {
142
149
  this.options = {
@@ -155,11 +162,11 @@ class CurvesPathGenerator {
155
162
  }
156
163
  if (!p.curveVelocity) {
157
164
  p.curveVelocity = engine_root_window_.Vector.origin;
158
- p.curveVelocity.length = (0,engine_root_window_.getRandom)() * 0.6 + 0.8;
159
- p.curveVelocity.angle = (0,engine_root_window_.getRandom)() * Math.PI * 2;
165
+ p.curveVelocity.length = randomVelocity();
166
+ p.curveVelocity.angle = (0,engine_root_window_.getRandom)() * doublePI;
160
167
  } else {
161
168
  p.curveVelocity.length += 0.01;
162
- p.curveVelocity.angle = (p.curveVelocity.angle + p.pathGen()) % (Math.PI * 2);
169
+ p.curveVelocity.angle = (p.curveVelocity.angle + p.pathGen()) % doublePI;
163
170
  }
164
171
  p.velocity.x = 0;
165
172
  p.velocity.y = 0;
@@ -173,7 +180,7 @@ class CurvesPathGenerator {
173
180
  if ((0,engine_root_window_.isFunction)(sourceOptions.rndFunc)) {
174
181
  options.rndFunc = sourceOptions.rndFunc;
175
182
  } else if ((0,engine_root_window_.isString)(sourceOptions.rndFunc)) {
176
- options.rndFunc = window[sourceOptions.rndFunc] || this.options.rndFunc;
183
+ options.rndFunc = window[sourceOptions.rndFunc] ?? this.options.rndFunc;
177
184
  }
178
185
  options.period = sourceOptions.period ?? options.period;
179
186
  options.nbHarmonics = sourceOptions.nbHarmonics ?? options.nbHarmonics;
@@ -1,2 +1,2 @@
1
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 n="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var o in n)("object"==typeof exports?exports:e)[o]=n[o]}}(this,(e=>(()=>{"use strict";var t={533:t=>{t.exports=e}},n={};function o(e){var r=n[e];if(void 0!==r)return r.exports;var i=n[e]={exports:{}};return t[e](i,i.exports,o),i.exports}o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return(()=>{o.r(r),o.d(r,{curvesPathName:()=>n,loadCurvesPath:()=>i});var e=o(533);class t{constructor(){this.options={rndFunc:null,period:100,nbHarmonics:2,attenHarmonics:.8,lowValue:-.03,highValue:.03}}generate(t){if(!t.pathGen){const n=this.options;t.pathGen=function(t,n,o,r,i=0,a=1){const c=[],l=[],s=[],u=[],p=[],d=t??e.getRandom;let h=0;o<1&&(o=1);for(let e=1;e<=o;++e)c[e]=d(),l[e]=d(),s[e]=1===e?1:s[e-1]*r,h+=s[e],u[e]=e/n,p[e]=d();return s.forEach(((e,t)=>s[t]=e/h*(a-i))),()=>{let e,t,n=0;for(let r=o;r>=1;--r)e=p[r]+=u[r],p[r]>=1&&(e=p[r]-=1,c[r]=l[r],l[r]=d()),t=e**2*(3-2*e),n+=(c[r]*(1-t)+l[r]*t)*s[r];return n+i}}(n.rndFunc,n.period,n.nbHarmonics,n.attenHarmonics,n.lowValue,n.highValue)}return t.curveVelocity?(t.curveVelocity.length+=.01,t.curveVelocity.angle=(t.curveVelocity.angle+t.pathGen())%(2*Math.PI)):(t.curveVelocity=e.Vector.origin,t.curveVelocity.length=.6*(0,e.getRandom)()+.8,t.curveVelocity.angle=(0,e.getRandom)()*Math.PI*2),t.velocity.x=0,t.velocity.y=0,t.curveVelocity}init(t){const n=t.actualOptions.particles.move.path.options,{options:o}=this;(0,e.isFunction)(n.rndFunc)?o.rndFunc=n.rndFunc:(0,e.isString)(n.rndFunc)&&(o.rndFunc=window[n.rndFunc]||this.options.rndFunc),o.period=n.period??o.period,o.nbHarmonics=n.nbHarmonics??o.nbHarmonics,o.attenHarmonics=n.attenHarmonics??o.attenHarmonics,o.lowValue=n.lowValue??o.lowValue,o.highValue=n.highValue??o.highValue}reset(e){delete e.pathGen,delete e.curveVelocity}update(){}}const n="curvesPathGenerator";async function i(e,o=!0){await e.addPathGenerator(n,new t,o)}})(),r})()));
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 n="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var o in n)("object"==typeof exports?exports:e)[o]=n[o]}}(this,(e=>(()=>{"use strict";var t={533:t=>{t.exports=e}},n={};function o(e){var r=n[e];if(void 0!==r)return r.exports;var i=n[e]={exports:{}};return t[e](i,i.exports,o),i.exports}o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return(()=>{o.r(r),o.d(r,{curvesPathName:()=>i,loadCurvesPath:()=>a});var e=o(533);const t=2*Math.PI;class n{constructor(){this.options={rndFunc:null,period:100,nbHarmonics:2,attenHarmonics:.8,lowValue:-.03,highValue:.03}}generate(n){if(!n.pathGen){const t=this.options;n.pathGen=function(t,n,o,r,i=0,a=1){const c=[],l=[],s=[],u=[],p=[],d=t??e.getRandom;let h=0;o<1&&(o=1);for(let e=1;e<=o;++e)c[e]=d(),l[e]=d(),s[e]=1===e?1:s[e-1]*r,h+=s[e],u[e]=e/n,p[e]=d();return s.forEach(((e,t)=>s[t]=e/h*(a-i))),()=>{let e,t,n=0;for(let r=o;r>=1;--r)e=p[r]+=u[r],p[r]>=1&&(e=p[r]-=1,c[r]=l[r],l[r]=d()),t=e**2*(3-2*e),n+=(c[r]*(1-t)+l[r]*t)*s[r];return n+i}}(t.rndFunc,t.period,t.nbHarmonics,t.attenHarmonics,t.lowValue,t.highValue)}return n.curveVelocity?(n.curveVelocity.length+=.01,n.curveVelocity.angle=(n.curveVelocity.angle+n.pathGen())%t):(n.curveVelocity=e.Vector.origin,n.curveVelocity.length=.6*(0,e.getRandom)()+.8,n.curveVelocity.angle=(0,e.getRandom)()*t),n.velocity.x=0,n.velocity.y=0,n.curveVelocity}init(t){const n=t.actualOptions.particles.move.path.options,{options:o}=this;(0,e.isFunction)(n.rndFunc)?o.rndFunc=n.rndFunc:(0,e.isString)(n.rndFunc)&&(o.rndFunc=window[n.rndFunc]??this.options.rndFunc),o.period=n.period??o.period,o.nbHarmonics=n.nbHarmonics??o.nbHarmonics,o.attenHarmonics=n.attenHarmonics??o.attenHarmonics,o.lowValue=n.lowValue??o.lowValue,o.highValue=n.highValue??o.highValue}reset(e){delete e.pathGen,delete e.curveVelocity}update(){}}const i="curvesPathGenerator";async function a(e,t=!0){await e.addPathGenerator(i,new n,t)}})(),r})()));
@@ -1 +1 @@
1
- /*! tsParticles Curves Path v3.0.3 by Matteo Bruni */
1
+ /*! tsParticles Curves Path v3.1.0 by Matteo Bruni */
@@ -1,11 +1,6 @@
1
1
  import { type Container, type IMovePathGenerator, Vector } from "@tsparticles/engine";
2
2
  import type { CurvesPathParticle } from "./CurvesPathParticle.js";
3
3
  import type { ICurvesOptions } from "./ICurvesOptions.js";
4
- declare global {
5
- interface Window {
6
- [key: string]: unknown;
7
- }
8
- }
9
4
  export declare class CurvesPathGenerator implements IMovePathGenerator {
10
5
  readonly options: ICurvesOptions;
11
6
  constructor();
@@ -12,6 +12,11 @@
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 double = 2, doublePI = Math.PI * double;
16
+ function randomVelocity() {
17
+ const offset = 0.8, factor = 0.6;
18
+ return (0, engine_1.getRandom)() * factor + offset;
19
+ }
15
20
  class CurvesPathGenerator {
16
21
  constructor() {
17
22
  this.options = {
@@ -30,12 +35,12 @@
30
35
  }
31
36
  if (!p.curveVelocity) {
32
37
  p.curveVelocity = engine_1.Vector.origin;
33
- p.curveVelocity.length = (0, engine_1.getRandom)() * 0.6 + 0.8;
34
- p.curveVelocity.angle = (0, engine_1.getRandom)() * Math.PI * 2;
38
+ p.curveVelocity.length = randomVelocity();
39
+ p.curveVelocity.angle = (0, engine_1.getRandom)() * doublePI;
35
40
  }
36
41
  else {
37
42
  p.curveVelocity.length += 0.01;
38
- p.curveVelocity.angle = (p.curveVelocity.angle + p.pathGen()) % (Math.PI * 2);
43
+ p.curveVelocity.angle = (p.curveVelocity.angle + p.pathGen()) % doublePI;
39
44
  }
40
45
  p.velocity.x = 0;
41
46
  p.velocity.y = 0;
@@ -48,7 +53,7 @@
48
53
  }
49
54
  else if ((0, engine_1.isString)(sourceOptions.rndFunc)) {
50
55
  options.rndFunc =
51
- window[sourceOptions.rndFunc] || this.options.rndFunc;
56
+ window[sourceOptions.rndFunc] ?? this.options.rndFunc;
52
57
  }
53
58
  options.period = sourceOptions.period ?? options.period;
54
59
  options.nbHarmonics = sourceOptions.nbHarmonics ?? options.nbHarmonics;