@tsparticles/updater-roll 3.0.2 → 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.
package/browser/Utils.js CHANGED
@@ -1,4 +1,5 @@
1
- import { getRandom, getRangeValue, rangeColorToHsl } from "@tsparticles/engine";
1
+ import { getRandom, getRangeValue, halfRandom, rangeColorToHsl } from "@tsparticles/engine";
2
+ const double = 2, doublePI = Math.PI * double, maxAngle = 360;
2
3
  export function initParticle(particle) {
3
4
  const rollOpt = particle.options.roll;
4
5
  if (!rollOpt?.enable) {
@@ -15,14 +16,14 @@ export function initParticle(particle) {
15
16
  enable: rollOpt.enable,
16
17
  horizontal: rollOpt.mode === "horizontal" || rollOpt.mode === "both",
17
18
  vertical: rollOpt.mode === "vertical" || rollOpt.mode === "both",
18
- angle: getRandom() * Math.PI * 2,
19
- speed: getRangeValue(rollOpt.speed) / 360,
19
+ angle: getRandom() * doublePI,
20
+ speed: getRangeValue(rollOpt.speed) / maxAngle,
20
21
  };
21
22
  if (rollOpt.backColor) {
22
23
  particle.backColor = rangeColorToHsl(rollOpt.backColor);
23
24
  }
24
25
  else if (rollOpt.darken.enable && rollOpt.enlighten.enable) {
25
- const alterType = getRandom() >= 0.5 ? "darken" : "enlighten";
26
+ const alterType = getRandom() >= halfRandom ? "darken" : "enlighten";
26
27
  particle.roll.alter = {
27
28
  type: alterType,
28
29
  value: getRangeValue(alterType === "darken" ? rollOpt.darken.value : rollOpt.enlighten.value),
@@ -46,7 +47,7 @@ export function updateRoll(particle, delta) {
46
47
  if (!data || !roll?.enable) {
47
48
  return;
48
49
  }
49
- const speed = data.speed * delta.factor, max = 2 * Math.PI;
50
+ const speed = data.speed * delta.factor, max = doublePI;
50
51
  data.angle += speed;
51
52
  if (data.angle > max) {
52
53
  data.angle -= max;
package/cjs/Utils.js CHANGED
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.updateRoll = exports.initParticle = void 0;
4
4
  const engine_1 = require("@tsparticles/engine");
5
+ const double = 2, doublePI = Math.PI * double, maxAngle = 360;
5
6
  function initParticle(particle) {
6
7
  const rollOpt = particle.options.roll;
7
8
  if (!rollOpt?.enable) {
@@ -18,14 +19,14 @@ function initParticle(particle) {
18
19
  enable: rollOpt.enable,
19
20
  horizontal: rollOpt.mode === "horizontal" || rollOpt.mode === "both",
20
21
  vertical: rollOpt.mode === "vertical" || rollOpt.mode === "both",
21
- angle: (0, engine_1.getRandom)() * Math.PI * 2,
22
- speed: (0, engine_1.getRangeValue)(rollOpt.speed) / 360,
22
+ angle: (0, engine_1.getRandom)() * doublePI,
23
+ speed: (0, engine_1.getRangeValue)(rollOpt.speed) / maxAngle,
23
24
  };
24
25
  if (rollOpt.backColor) {
25
26
  particle.backColor = (0, engine_1.rangeColorToHsl)(rollOpt.backColor);
26
27
  }
27
28
  else if (rollOpt.darken.enable && rollOpt.enlighten.enable) {
28
- const alterType = (0, engine_1.getRandom)() >= 0.5 ? "darken" : "enlighten";
29
+ const alterType = (0, engine_1.getRandom)() >= engine_1.halfRandom ? "darken" : "enlighten";
29
30
  particle.roll.alter = {
30
31
  type: alterType,
31
32
  value: (0, engine_1.getRangeValue)(alterType === "darken" ? rollOpt.darken.value : rollOpt.enlighten.value),
@@ -50,7 +51,7 @@ function updateRoll(particle, delta) {
50
51
  if (!data || !roll?.enable) {
51
52
  return;
52
53
  }
53
- const speed = data.speed * delta.factor, max = 2 * Math.PI;
54
+ const speed = data.speed * delta.factor, max = doublePI;
54
55
  data.angle += speed;
55
56
  if (data.angle > max) {
56
57
  data.angle -= max;
package/esm/Utils.js CHANGED
@@ -1,4 +1,5 @@
1
- import { getRandom, getRangeValue, rangeColorToHsl } from "@tsparticles/engine";
1
+ import { getRandom, getRangeValue, halfRandom, rangeColorToHsl } from "@tsparticles/engine";
2
+ const double = 2, doublePI = Math.PI * double, maxAngle = 360;
2
3
  export function initParticle(particle) {
3
4
  const rollOpt = particle.options.roll;
4
5
  if (!rollOpt?.enable) {
@@ -15,14 +16,14 @@ export function initParticle(particle) {
15
16
  enable: rollOpt.enable,
16
17
  horizontal: rollOpt.mode === "horizontal" || rollOpt.mode === "both",
17
18
  vertical: rollOpt.mode === "vertical" || rollOpt.mode === "both",
18
- angle: getRandom() * Math.PI * 2,
19
- speed: getRangeValue(rollOpt.speed) / 360,
19
+ angle: getRandom() * doublePI,
20
+ speed: getRangeValue(rollOpt.speed) / maxAngle,
20
21
  };
21
22
  if (rollOpt.backColor) {
22
23
  particle.backColor = rangeColorToHsl(rollOpt.backColor);
23
24
  }
24
25
  else if (rollOpt.darken.enable && rollOpt.enlighten.enable) {
25
- const alterType = getRandom() >= 0.5 ? "darken" : "enlighten";
26
+ const alterType = getRandom() >= halfRandom ? "darken" : "enlighten";
26
27
  particle.roll.alter = {
27
28
  type: alterType,
28
29
  value: getRangeValue(alterType === "darken" ? rollOpt.darken.value : rollOpt.enlighten.value),
@@ -46,7 +47,7 @@ export function updateRoll(particle, delta) {
46
47
  if (!data || !roll?.enable) {
47
48
  return;
48
49
  }
49
- const speed = data.speed * delta.factor, max = 2 * Math.PI;
50
+ const speed = data.speed * delta.factor, max = doublePI;
50
51
  data.angle += speed;
51
52
  if (data.angle > max) {
52
53
  data.angle -= max;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/updater-roll",
3
- "version": "3.0.2",
3
+ "version": "3.1.0",
4
4
  "description": "tsParticles particles roll updater",
5
5
  "homepage": "https://particles.js.org",
6
6
  "repository": {
@@ -87,7 +87,7 @@
87
87
  "./package.json": "./package.json"
88
88
  },
89
89
  "dependencies": {
90
- "@tsparticles/engine": "^3.0.2"
90
+ "@tsparticles/engine": "^3.1.0"
91
91
  },
92
92
  "publishConfig": {
93
93
  "access": "public"
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/updater-roll [6 Dec 2023 at 17:46]</title>
6
+ <title>@tsparticles/updater-roll [13 Jan 2024 at 23:08]</title>
7
7
  <link rel="shortcut icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAABrVBMVEUAAAD///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////+O1foceMD///+J0/qK1Pr7/v8Xdr/9///W8P4UdL7L7P0Scr2r4Pyj3vwad8D5/f/2/f+55f3E6f34+/2H0/ojfMKpzOd0rNgQcb3F3O/j9f7c8v6g3Pz0/P/w+v/q+P7n9v6T1/uQ1vuE0vqLut/y+v+Z2fvt+f+15Pzv9fuc2/vR7v2V2Pvd6/bg9P7I6/285/2y4/yp3/zp8vk8i8kqgMT7/P31+fyv4vxGkcz6/P6/6P3j7vfS5PNnpNUxhcbO7f7F6v3O4vHK3/DA2u631Ouy0eqXweKJud5wqthfoNMMbLvY8f73+v2dxeR8sNtTmdDx9/zX6PSjyeaCtd1YnNGX2PuQveCGt95Nls42h8dLlM3F4vBtAAAAM3RSTlMAAyOx0/sKBvik8opWGBMOAe3l1snDm2E9LSb06eHcu5JpHbarfHZCN9CBb08zzkdNS0kYaptYAAAFV0lEQVRYw92X51/aYBDHHS2O2qqttVbrqNq9m+TJIAYIShBkWwqIiCgoWvfeq7Z2/s29hyQNyUcR7LveGwVyXy6XH8/9rqxglLfUPLxVduUor3h0rfp2TYvpivk37929TkG037hffoX0+peVtZQc1589rigVUdXS/ABSAyEmGIO/1XfvldSK8vs3OqB6u3m0nxmIrvgB0dj7rr7Y9IbuF68hnfFaiHA/sxqm0wciIG43P60qKv9WXWc1RXGh/mFESFABTSBi0sNAKzqet17eCtOb3kZIDwxEEU0oAIJGYxNBDhBND29e0rtXXbcpuPmED9IhEAAQ/AXEaF8EPmnrrKsv0LvWR3fg5sWDNAFZOgAgaKvZDogHNU9MFwnnYROkc56RD5CjAbQX9Ow4g7upCsvYu55aSI/Nj0H1akgKQEUM94dwK65hYRmFU9MIcH/fqJYOZYcnuJSU/waKDgTOEVaVKhwrTRP5XzgSpAITYzom7UvkhFX5VutmxeNnWDjjswTKTyfgluNDGbUpWissXhF3s7mlSml+czWkg3D0l1nNjGNjz3myOQOa1KM/jOS6ebdbAVTCi4gljHSFrviza7tOgRWcS0MOUX9zdNgag5w7rRqA44Lzw0hr1WqES36dFliSJFlh2rXIae3FFcDDgKdxrUIDePr8jGcSClV1u7A9xeN0ModY/pHMxmR1EzRh8TJiwqsHmKW0l4FCEZI+jHio+JdPPE9qwQtTRxku2D8sIeRL2LnxWSllANCQGOIiqVHAz2ye2JR0DcH+HoxDkaADLjgxjKQ+AwCX/g0+DNgdG0ukYCONAe+dbc2IAc6fwt1ARoDSezNHxV2Cmzwv3O6lDMV55edBGwGK9n1+x2F8EDfAGCxug8MhpsMEcTEAWf3rx2vZhe/LAmtIn/6apE6PN0ULKgywD9mmdxbmFl3OvD5AS5fW5zLbv/YHmcsBTjf/afDz3MaZTVCfAP9z6/Bw6ycv8EUBWJIn9zYcoAWWlW9+OzO3vkTy8H+RANLmdrpOuYWdZYEXpo+TlCJrW5EARb7fF+bWdqf3hhyZI1nWJQHgznErZhbjoEsWqi8dQNoE294aldzFurwSABL2XXMf9+H1VQGke9exw5P/AnA5Pv5ngMul7LOvO922iwACu8WkCwLCafvM4CeWPxfA8lNHcWZSoi8EwMAIciKX2Z4SWCMAa3snCZ/G4EA8D6CMLNFsGQhkkz/gQNEBbPCbWsxGUpYVu3z8IyNAknwJkfPMEhLyrdi5RTyUVACkw4GSFRNWJNEW+fgPGwHD8/JxnRuLabN4CGNRkAE23na2+VmEAUmrYymSGjMAYqH84YUIyzgzs3XC7gNgH36Vcc4zKY9o9fgPBXUAiHHwVboBHGLiX6Zcjp1f2wu4tvzZKo0ecPnDtQYDQvJXaBeNzce45Fp28ZQLrEZVuFqgBwOalArKXnW1UzlnSusQKJqKYNuz4tOnI6sZG4zanpemv+7ySU2jbA9h6uhcgpfy6G2PahirDZ6zvq6zDduMVFTKvzw8wgyEdelwY9in3XkEPs3osJuwRQ4qTkfzifndg9Gfc4pdsu82+tTnHZTBa2EAMrqr2t43pguc8tNm7JQVQ2S0ukj2d22dhXYP0/veWtwKrCkNoNimAN5+Xr/oLrxswKbVJjteWrX7eR63o4j9q0GxnaBdWgGA5VStpanIjQmEhV0/nVt5VOFUvix6awJhPcAaTEShgrG+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.updater.roll.js","isAsset":true,"statSize":3940,"parsedSize":7815,"gzipSize":2244,"groups":[{"label":"dist/browser","path":"./dist/browser","statSize":3898,"groups":[{"id":881,"label":"index.js + 4 modules (concatenated)","path":"./dist/browser/index.js + 4 modules (concatenated)","statSize":3898,"parsedSize":7815,"gzipSize":2244,"concatenated":true,"groups":[{"label":"dist/browser","path":"./dist/browser/index.js + 4 modules (concatenated)/dist/browser","statSize":3898,"groups":[{"id":null,"label":"index.js","path":"./dist/browser/index.js + 4 modules (concatenated)/dist/browser/index.js","statSize":190,"parsedSize":380,"gzipSize":109,"inaccurateSizes":true},{"id":null,"label":"RollUpdater.js","path":"./dist/browser/index.js + 4 modules (concatenated)/dist/browser/RollUpdater.js","statSize":955,"parsedSize":1914,"gzipSize":549,"inaccurateSizes":true},{"id":null,"label":"Utils.js","path":"./dist/browser/index.js + 4 modules (concatenated)/dist/browser/Utils.js","statSize":1598,"parsedSize":3203,"gzipSize":919,"inaccurateSizes":true},{"label":"Options/Classes","path":"./dist/browser/index.js + 4 modules (concatenated)/dist/browser/Options/Classes","statSize":1155,"groups":[{"id":null,"label":"Roll.js","path":"./dist/browser/index.js + 4 modules (concatenated)/dist/browser/Options/Classes/Roll.js","statSize":789,"parsedSize":1581,"gzipSize":454,"inaccurateSizes":true},{"id":null,"label":"RollLight.js","path":"./dist/browser/index.js + 4 modules (concatenated)/dist/browser/Options/Classes/RollLight.js","statSize":366,"parsedSize":733,"gzipSize":210,"inaccurateSizes":true}],"parsedSize":2315,"gzipSize":664,"inaccurateSizes":true}],"parsedSize":7815,"gzipSize":2244,"inaccurateSizes":true}]}],"parsedSize":7815,"gzipSize":2244},{"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.updater.roll":true}}];
34
+ window.chartData = [{"label":"tsparticles.updater.roll.js","isAsset":true,"statSize":4025,"parsedSize":7920,"gzipSize":2281,"groups":[{"label":"dist/browser","path":"./dist/browser","statSize":3983,"groups":[{"id":988,"label":"index.js + 4 modules (concatenated)","path":"./dist/browser/index.js + 4 modules (concatenated)","statSize":3983,"parsedSize":7920,"gzipSize":2281,"concatenated":true,"groups":[{"label":"dist/browser","path":"./dist/browser/index.js + 4 modules (concatenated)/dist/browser","statSize":3983,"groups":[{"id":null,"label":"index.js","path":"./dist/browser/index.js + 4 modules (concatenated)/dist/browser/index.js","statSize":190,"parsedSize":377,"gzipSize":108,"inaccurateSizes":true},{"id":null,"label":"RollUpdater.js","path":"./dist/browser/index.js + 4 modules (concatenated)/dist/browser/RollUpdater.js","statSize":955,"parsedSize":1898,"gzipSize":546,"inaccurateSizes":true},{"id":null,"label":"Utils.js","path":"./dist/browser/index.js + 4 modules (concatenated)/dist/browser/Utils.js","statSize":1683,"parsedSize":3346,"gzipSize":963,"inaccurateSizes":true},{"label":"Options/Classes","path":"./dist/browser/index.js + 4 modules (concatenated)/dist/browser/Options/Classes","statSize":1155,"groups":[{"id":null,"label":"Roll.js","path":"./dist/browser/index.js + 4 modules (concatenated)/dist/browser/Options/Classes/Roll.js","statSize":789,"parsedSize":1568,"gzipSize":451,"inaccurateSizes":true},{"id":null,"label":"RollLight.js","path":"./dist/browser/index.js + 4 modules (concatenated)/dist/browser/Options/Classes/RollLight.js","statSize":366,"parsedSize":727,"gzipSize":209,"inaccurateSizes":true}],"parsedSize":2296,"gzipSize":661,"inaccurateSizes":true}],"parsedSize":7920,"gzipSize":2281,"inaccurateSizes":true}]}],"parsedSize":7920,"gzipSize":2281},{"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.updater.roll":true}}];
35
35
  window.entrypoints = ["tsparticles.updater.roll","tsparticles.updater.roll.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.2
7
+ * v3.1.0
8
8
  */
9
9
  (function webpackUniversalModuleDefinition(root, factory) {
10
10
  if(typeof exports === 'object' && typeof module === 'object')
@@ -98,6 +98,9 @@ __webpack_require__.d(__webpack_exports__, {
98
98
  var engine_root_window_ = __webpack_require__(533);
99
99
  ;// CONCATENATED MODULE: ./dist/browser/Utils.js
100
100
 
101
+ const Utils_double = 2,
102
+ doublePI = Math.PI * Utils_double,
103
+ maxAngle = 360;
101
104
  function initParticle(particle) {
102
105
  const rollOpt = particle.options.roll;
103
106
  if (!rollOpt?.enable) {
@@ -114,13 +117,13 @@ function initParticle(particle) {
114
117
  enable: rollOpt.enable,
115
118
  horizontal: rollOpt.mode === "horizontal" || rollOpt.mode === "both",
116
119
  vertical: rollOpt.mode === "vertical" || rollOpt.mode === "both",
117
- angle: (0,engine_root_window_.getRandom)() * Math.PI * 2,
118
- speed: (0,engine_root_window_.getRangeValue)(rollOpt.speed) / 360
120
+ angle: (0,engine_root_window_.getRandom)() * doublePI,
121
+ speed: (0,engine_root_window_.getRangeValue)(rollOpt.speed) / maxAngle
119
122
  };
120
123
  if (rollOpt.backColor) {
121
124
  particle.backColor = (0,engine_root_window_.rangeColorToHsl)(rollOpt.backColor);
122
125
  } else if (rollOpt.darken.enable && rollOpt.enlighten.enable) {
123
- const alterType = (0,engine_root_window_.getRandom)() >= 0.5 ? "darken" : "enlighten";
126
+ const alterType = (0,engine_root_window_.getRandom)() >= engine_root_window_.halfRandom ? "darken" : "enlighten";
124
127
  particle.roll.alter = {
125
128
  type: alterType,
126
129
  value: (0,engine_root_window_.getRangeValue)(alterType === "darken" ? rollOpt.darken.value : rollOpt.enlighten.value)
@@ -144,7 +147,7 @@ function updateRoll(particle, delta) {
144
147
  return;
145
148
  }
146
149
  const speed = data.speed * delta.factor,
147
- max = 2 * Math.PI;
150
+ max = doublePI;
148
151
  data.angle += speed;
149
152
  if (data.angle > max) {
150
153
  data.angle -= max;
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see tsparticles.updater.roll.min.js.LICENSE.txt */
2
- !function(e,o){if("object"==typeof exports&&"object"==typeof module)module.exports=o(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],o);else{var l="object"==typeof exports?o(require("@tsparticles/engine")):o(e.window);for(var t in l)("object"==typeof exports?exports:e)[t]=l[t]}}(this,(e=>(()=>{"use strict";var o={533:o=>{o.exports=e}},l={};function t(e){var n=l[e];if(void 0!==n)return n.exports;var a=l[e]={exports:{}};return o[e](a,a.exports,t),a.exports}t.d=(e,o)=>{for(var l in o)t.o(o,l)&&!t.o(e,l)&&Object.defineProperty(e,l,{enumerable:!0,get:o[l]})},t.o=(e,o)=>Object.prototype.hasOwnProperty.call(e,o),t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{t.r(n),t.d(n,{loadRollUpdater:()=>r});var e=t(533);class o{constructor(){this.enable=!1,this.value=0}load(o){o&&(void 0!==o.enable&&(this.enable=o.enable),void 0!==o.value&&(this.value=(0,e.setRangeValue)(o.value)))}}class l{constructor(){this.darken=new o,this.enable=!1,this.enlighten=new o,this.mode="vertical",this.speed=25}load(o){o&&(void 0!==o.backColor&&(this.backColor=e.OptionsColor.create(this.backColor,o.backColor)),this.darken.load(o.darken),void 0!==o.enable&&(this.enable=o.enable),this.enlighten.load(o.enlighten),void 0!==o.mode&&(this.mode=o.mode),void 0!==o.speed&&(this.speed=(0,e.setRangeValue)(o.speed)))}}class a{getTransformValues(e){const o=e.roll?.enable&&e.roll,l=o&&o.horizontal,t=o&&o.vertical;return{a:l?Math.cos(o.angle):void 0,d:t?Math.sin(o.angle):void 0}}init(o){!function(o){const l=o.options.roll;if(l?.enable)if(o.roll={enable:l.enable,horizontal:"horizontal"===l.mode||"both"===l.mode,vertical:"vertical"===l.mode||"both"===l.mode,angle:(0,e.getRandom)()*Math.PI*2,speed:(0,e.getRangeValue)(l.speed)/360},l.backColor)o.backColor=(0,e.rangeColorToHsl)(l.backColor);else if(l.darken.enable&&l.enlighten.enable){const t=(0,e.getRandom)()>=.5?"darken":"enlighten";o.roll.alter={type:t,value:(0,e.getRangeValue)("darken"===t?l.darken.value:l.enlighten.value)}}else l.darken.enable?o.roll.alter={type:"darken",value:(0,e.getRangeValue)(l.darken.value)}:l.enlighten.enable&&(o.roll.alter={type:"enlighten",value:(0,e.getRangeValue)(l.enlighten.value)});else o.roll={enable:!1,horizontal:!1,vertical:!1,angle:0,speed:0}}(o)}isEnabled(e){const o=e.options.roll;return!e.destroyed&&!e.spawning&&!!o?.enable}loadOptions(e,...o){e.roll||(e.roll=new l);for(const l of o)e.roll.load(l?.roll)}update(e,o){this.isEnabled(e)&&function(e,o){const l=e.options.roll,t=e.roll;if(!t||!l?.enable)return;const n=t.speed*o.factor,a=2*Math.PI;t.angle+=n,t.angle>a&&(t.angle-=a)}(e,o)}}async function r(e,o=!0){await e.addParticleUpdater("roll",(()=>new a),o)}})(),n})()));
2
+ !function(e,o){if("object"==typeof exports&&"object"==typeof module)module.exports=o(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],o);else{var l="object"==typeof exports?o(require("@tsparticles/engine")):o(e.window);for(var t in l)("object"==typeof exports?exports:e)[t]=l[t]}}(this,(e=>(()=>{"use strict";var o={533:o=>{o.exports=e}},l={};function t(e){var n=l[e];if(void 0!==n)return n.exports;var a=l[e]={exports:{}};return o[e](a,a.exports,t),a.exports}t.d=(e,o)=>{for(var l in o)t.o(o,l)&&!t.o(e,l)&&Object.defineProperty(e,l,{enumerable:!0,get:o[l]})},t.o=(e,o)=>Object.prototype.hasOwnProperty.call(e,o),t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{t.r(n),t.d(n,{loadRollUpdater:()=>i});var e=t(533);const o=2*Math.PI;class l{constructor(){this.enable=!1,this.value=0}load(o){o&&(void 0!==o.enable&&(this.enable=o.enable),void 0!==o.value&&(this.value=(0,e.setRangeValue)(o.value)))}}class a{constructor(){this.darken=new l,this.enable=!1,this.enlighten=new l,this.mode="vertical",this.speed=25}load(o){o&&(void 0!==o.backColor&&(this.backColor=e.OptionsColor.create(this.backColor,o.backColor)),this.darken.load(o.darken),void 0!==o.enable&&(this.enable=o.enable),this.enlighten.load(o.enlighten),void 0!==o.mode&&(this.mode=o.mode),void 0!==o.speed&&(this.speed=(0,e.setRangeValue)(o.speed)))}}class r{getTransformValues(e){const o=e.roll?.enable&&e.roll,l=o&&o.horizontal,t=o&&o.vertical;return{a:l?Math.cos(o.angle):void 0,d:t?Math.sin(o.angle):void 0}}init(l){!function(l){const t=l.options.roll;if(t?.enable)if(l.roll={enable:t.enable,horizontal:"horizontal"===t.mode||"both"===t.mode,vertical:"vertical"===t.mode||"both"===t.mode,angle:(0,e.getRandom)()*o,speed:(0,e.getRangeValue)(t.speed)/360},t.backColor)l.backColor=(0,e.rangeColorToHsl)(t.backColor);else if(t.darken.enable&&t.enlighten.enable){const o=(0,e.getRandom)()>=e.halfRandom?"darken":"enlighten";l.roll.alter={type:o,value:(0,e.getRangeValue)("darken"===o?t.darken.value:t.enlighten.value)}}else t.darken.enable?l.roll.alter={type:"darken",value:(0,e.getRangeValue)(t.darken.value)}:t.enlighten.enable&&(l.roll.alter={type:"enlighten",value:(0,e.getRangeValue)(t.enlighten.value)});else l.roll={enable:!1,horizontal:!1,vertical:!1,angle:0,speed:0}}(l)}isEnabled(e){const o=e.options.roll;return!e.destroyed&&!e.spawning&&!!o?.enable}loadOptions(e,...o){e.roll||(e.roll=new a);for(const l of o)e.roll.load(l?.roll)}update(e,l){this.isEnabled(e)&&function(e,l){const t=e.options.roll,n=e.roll;if(!n||!t?.enable)return;const a=n.speed*l.factor,r=o;n.angle+=a,n.angle>r&&(n.angle-=r)}(e,l)}}async function i(e,o=!0){await e.addParticleUpdater("roll",(()=>new r),o)}})(),n})()));
@@ -1 +1 @@
1
- /*! tsParticles Roll Updater v3.0.2 by Matteo Bruni */
1
+ /*! tsParticles Roll Updater v3.1.0 by Matteo Bruni */
package/umd/Utils.js CHANGED
@@ -11,6 +11,7 @@
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.updateRoll = exports.initParticle = void 0;
13
13
  const engine_1 = require("@tsparticles/engine");
14
+ const double = 2, doublePI = Math.PI * double, maxAngle = 360;
14
15
  function initParticle(particle) {
15
16
  const rollOpt = particle.options.roll;
16
17
  if (!rollOpt?.enable) {
@@ -27,14 +28,14 @@
27
28
  enable: rollOpt.enable,
28
29
  horizontal: rollOpt.mode === "horizontal" || rollOpt.mode === "both",
29
30
  vertical: rollOpt.mode === "vertical" || rollOpt.mode === "both",
30
- angle: (0, engine_1.getRandom)() * Math.PI * 2,
31
- speed: (0, engine_1.getRangeValue)(rollOpt.speed) / 360,
31
+ angle: (0, engine_1.getRandom)() * doublePI,
32
+ speed: (0, engine_1.getRangeValue)(rollOpt.speed) / maxAngle,
32
33
  };
33
34
  if (rollOpt.backColor) {
34
35
  particle.backColor = (0, engine_1.rangeColorToHsl)(rollOpt.backColor);
35
36
  }
36
37
  else if (rollOpt.darken.enable && rollOpt.enlighten.enable) {
37
- const alterType = (0, engine_1.getRandom)() >= 0.5 ? "darken" : "enlighten";
38
+ const alterType = (0, engine_1.getRandom)() >= engine_1.halfRandom ? "darken" : "enlighten";
38
39
  particle.roll.alter = {
39
40
  type: alterType,
40
41
  value: (0, engine_1.getRangeValue)(alterType === "darken" ? rollOpt.darken.value : rollOpt.enlighten.value),
@@ -59,7 +60,7 @@
59
60
  if (!data || !roll?.enable) {
60
61
  return;
61
62
  }
62
- const speed = data.speed * delta.factor, max = 2 * Math.PI;
63
+ const speed = data.speed * delta.factor, max = doublePI;
63
64
  data.angle += speed;
64
65
  if (data.angle > max) {
65
66
  data.angle -= max;