@tsparticles/updater-stroke-color 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,5 @@
1
- import { getHslAnimationFromHsl, getRangeValue, itemFromSingleOrMultiple, rangeColorToHsl, } from "@tsparticles/engine";
2
- import { updateStrokeColor } from "./Utils.js";
1
+ import { getHslAnimationFromHsl, getRangeValue, itemFromSingleOrMultiple, rangeColorToHsl, updateColor, } from "@tsparticles/engine";
2
+ const defaultOpacity = 1;
3
3
  export class StrokeColorUpdater {
4
4
  constructor(container) {
5
5
  this.container = container;
@@ -8,7 +8,7 @@ export class StrokeColorUpdater {
8
8
  const container = this.container, options = particle.options;
9
9
  const stroke = itemFromSingleOrMultiple(options.stroke, particle.id, options.reduceDuplicates);
10
10
  particle.strokeWidth = getRangeValue(stroke.width) * container.retina.pixelRatio;
11
- particle.strokeOpacity = getRangeValue(stroke.opacity ?? 1);
11
+ particle.strokeOpacity = getRangeValue(stroke.opacity ?? defaultOpacity);
12
12
  particle.strokeAnimation = stroke.color?.animation;
13
13
  const strokeHslColor = rangeColorToHsl(stroke.color) ?? particle.getFillColor();
14
14
  if (strokeHslColor) {
@@ -28,6 +28,6 @@ export class StrokeColorUpdater {
28
28
  if (!this.isEnabled(particle)) {
29
29
  return;
30
30
  }
31
- updateStrokeColor(particle, delta);
31
+ updateColor(particle.strokeColor, delta);
32
32
  }
33
33
  }
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.StrokeColorUpdater = void 0;
4
4
  const engine_1 = require("@tsparticles/engine");
5
- const Utils_js_1 = require("./Utils.js");
5
+ const defaultOpacity = 1;
6
6
  class StrokeColorUpdater {
7
7
  constructor(container) {
8
8
  this.container = container;
@@ -11,7 +11,7 @@ class StrokeColorUpdater {
11
11
  const container = this.container, options = particle.options;
12
12
  const stroke = (0, engine_1.itemFromSingleOrMultiple)(options.stroke, particle.id, options.reduceDuplicates);
13
13
  particle.strokeWidth = (0, engine_1.getRangeValue)(stroke.width) * container.retina.pixelRatio;
14
- particle.strokeOpacity = (0, engine_1.getRangeValue)(stroke.opacity ?? 1);
14
+ particle.strokeOpacity = (0, engine_1.getRangeValue)(stroke.opacity ?? defaultOpacity);
15
15
  particle.strokeAnimation = stroke.color?.animation;
16
16
  const strokeHslColor = (0, engine_1.rangeColorToHsl)(stroke.color) ?? particle.getFillColor();
17
17
  if (strokeHslColor) {
@@ -31,7 +31,7 @@ class StrokeColorUpdater {
31
31
  if (!this.isEnabled(particle)) {
32
32
  return;
33
33
  }
34
- (0, Utils_js_1.updateStrokeColor)(particle, delta);
34
+ (0, engine_1.updateColor)(particle.strokeColor, delta);
35
35
  }
36
36
  }
37
37
  exports.StrokeColorUpdater = StrokeColorUpdater;
@@ -1,5 +1,5 @@
1
- import { getHslAnimationFromHsl, getRangeValue, itemFromSingleOrMultiple, rangeColorToHsl, } from "@tsparticles/engine";
2
- import { updateStrokeColor } from "./Utils.js";
1
+ import { getHslAnimationFromHsl, getRangeValue, itemFromSingleOrMultiple, rangeColorToHsl, updateColor, } from "@tsparticles/engine";
2
+ const defaultOpacity = 1;
3
3
  export class StrokeColorUpdater {
4
4
  constructor(container) {
5
5
  this.container = container;
@@ -8,7 +8,7 @@ export class StrokeColorUpdater {
8
8
  const container = this.container, options = particle.options;
9
9
  const stroke = itemFromSingleOrMultiple(options.stroke, particle.id, options.reduceDuplicates);
10
10
  particle.strokeWidth = getRangeValue(stroke.width) * container.retina.pixelRatio;
11
- particle.strokeOpacity = getRangeValue(stroke.opacity ?? 1);
11
+ particle.strokeOpacity = getRangeValue(stroke.opacity ?? defaultOpacity);
12
12
  particle.strokeAnimation = stroke.color?.animation;
13
13
  const strokeHslColor = rangeColorToHsl(stroke.color) ?? particle.getFillColor();
14
14
  if (strokeHslColor) {
@@ -28,6 +28,6 @@ export class StrokeColorUpdater {
28
28
  if (!this.isEnabled(particle)) {
29
29
  return;
30
30
  }
31
- updateStrokeColor(particle, delta);
31
+ updateColor(particle.strokeColor, delta);
32
32
  }
33
33
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/updater-stroke-color",
3
- "version": "3.0.3",
3
+ "version": "3.1.0",
4
4
  "description": "tsParticles particles stroke color 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.3"
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-stroke-color [26 Dec 2023 at 19:32]</title>
6
+ <title>@tsparticles/updater-stroke-color [13 Jan 2024 at 23:09]</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.stroke-color.js","isAsset":true,"statSize":3708,"parsedSize":7510,"gzipSize":2237,"groups":[{"label":"dist/browser","path":"./dist/browser","statSize":3666,"groups":[{"id":999,"label":"index.js + 2 modules (concatenated)","path":"./dist/browser/index.js + 2 modules (concatenated)","statSize":3666,"parsedSize":7510,"gzipSize":2237,"concatenated":true,"groups":[{"label":"dist/browser","path":"./dist/browser/index.js + 2 modules (concatenated)/dist/browser","statSize":3666,"groups":[{"id":null,"label":"index.js","path":"./dist/browser/index.js + 2 modules (concatenated)/dist/browser/index.js","statSize":241,"parsedSize":493,"gzipSize":147,"inaccurateSizes":true},{"id":null,"label":"StrokeColorUpdater.js","path":"./dist/browser/index.js + 2 modules (concatenated)/dist/browser/StrokeColorUpdater.js","statSize":1413,"parsedSize":2894,"gzipSize":862,"inaccurateSizes":true},{"id":null,"label":"Utils.js","path":"./dist/browser/index.js + 2 modules (concatenated)/dist/browser/Utils.js","statSize":2012,"parsedSize":4121,"gzipSize":1227,"inaccurateSizes":true}],"parsedSize":7510,"gzipSize":2237,"inaccurateSizes":true}]}],"parsedSize":7510,"gzipSize":2237},{"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.stroke-color":true}}];
34
+ window.chartData = [{"label":"tsparticles.updater.stroke-color.js","isAsset":true,"statSize":1706,"parsedSize":5551,"gzipSize":1807,"groups":[{"label":"dist/browser","path":"./dist/browser","statSize":1664,"groups":[{"id":961,"label":"index.js + 1 modules (concatenated)","path":"./dist/browser/index.js + 1 modules (concatenated)","statSize":1664,"parsedSize":5551,"gzipSize":1807,"concatenated":true,"groups":[{"label":"dist/browser","path":"./dist/browser/index.js + 1 modules (concatenated)/dist/browser","statSize":1664,"groups":[{"id":null,"label":"index.js","path":"./dist/browser/index.js + 1 modules (concatenated)/dist/browser/index.js","statSize":241,"parsedSize":803,"gzipSize":261,"inaccurateSizes":true},{"id":null,"label":"StrokeColorUpdater.js","path":"./dist/browser/index.js + 1 modules (concatenated)/dist/browser/StrokeColorUpdater.js","statSize":1423,"parsedSize":4747,"gzipSize":1545,"inaccurateSizes":true}],"parsedSize":5551,"gzipSize":1807,"inaccurateSizes":true}]}],"parsedSize":5551,"gzipSize":1807},{"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.stroke-color":true}}];
35
35
  window.entrypoints = ["tsparticles.updater.stroke-color","tsparticles.updater.stroke-color.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')
@@ -96,81 +96,9 @@ __webpack_require__.d(__webpack_exports__, {
96
96
 
97
97
  // EXTERNAL MODULE: external {"commonjs":"@tsparticles/engine","commonjs2":"@tsparticles/engine","amd":"@tsparticles/engine","root":"window"}
98
98
  var engine_root_window_ = __webpack_require__(533);
99
- ;// CONCATENATED MODULE: ./dist/browser/Utils.js
100
-
101
- function updateColorValue(delta, colorValue, valueAnimation, max, decrease) {
102
- if (!colorValue || !valueAnimation.enable || (colorValue.maxLoops ?? 0) > 0 && (colorValue.loops ?? 0) > (colorValue.maxLoops ?? 0)) {
103
- return;
104
- }
105
- if (!colorValue.time) {
106
- colorValue.time = 0;
107
- }
108
- if ((colorValue.delayTime ?? 0) > 0 && colorValue.time < (colorValue.delayTime ?? 0)) {
109
- colorValue.time += delta.value;
110
- }
111
- if ((colorValue.delayTime ?? 0) > 0 && colorValue.time < (colorValue.delayTime ?? 0)) {
112
- return;
113
- }
114
- const offset = (0,engine_root_window_.randomInRange)(valueAnimation.offset),
115
- velocity = (colorValue.velocity ?? 0) * delta.factor + offset * 3.6,
116
- decay = colorValue.decay ?? 1;
117
- if (!decrease || colorValue.status === "increasing") {
118
- colorValue.value += velocity;
119
- if (colorValue.value > max) {
120
- if (!colorValue.loops) {
121
- colorValue.loops = 0;
122
- }
123
- colorValue.loops++;
124
- if (decrease) {
125
- colorValue.status = "decreasing";
126
- colorValue.value -= colorValue.value % max;
127
- }
128
- }
129
- } else {
130
- colorValue.value -= velocity;
131
- if (colorValue.value < 0) {
132
- if (!colorValue.loops) {
133
- colorValue.loops = 0;
134
- }
135
- colorValue.loops++;
136
- colorValue.status = "increasing";
137
- colorValue.value += colorValue.value;
138
- }
139
- }
140
- if (colorValue.velocity && decay !== 1) {
141
- colorValue.velocity *= decay;
142
- }
143
- if (colorValue.value > max) {
144
- colorValue.value %= max;
145
- }
146
- }
147
- function updateStrokeColor(particle, delta) {
148
- if (!particle.strokeColor || !particle.strokeAnimation) {
149
- return;
150
- }
151
- const {
152
- h,
153
- s,
154
- l
155
- } = particle.strokeColor,
156
- {
157
- h: hAnimation,
158
- s: sAnimation,
159
- l: lAnimation
160
- } = particle.strokeAnimation;
161
- if (h) {
162
- updateColorValue(delta, h, hAnimation, 360, false);
163
- }
164
- if (s) {
165
- updateColorValue(delta, s, sAnimation, 100, true);
166
- }
167
- if (l) {
168
- updateColorValue(delta, l, lAnimation, 100, true);
169
- }
170
- }
171
99
  ;// CONCATENATED MODULE: ./dist/browser/StrokeColorUpdater.js
172
100
 
173
-
101
+ const defaultOpacity = 1;
174
102
  class StrokeColorUpdater {
175
103
  constructor(container) {
176
104
  this.container = container;
@@ -180,7 +108,7 @@ class StrokeColorUpdater {
180
108
  options = particle.options;
181
109
  const stroke = (0,engine_root_window_.itemFromSingleOrMultiple)(options.stroke, particle.id, options.reduceDuplicates);
182
110
  particle.strokeWidth = (0,engine_root_window_.getRangeValue)(stroke.width) * container.retina.pixelRatio;
183
- particle.strokeOpacity = (0,engine_root_window_.getRangeValue)(stroke.opacity ?? 1);
111
+ particle.strokeOpacity = (0,engine_root_window_.getRangeValue)(stroke.opacity ?? defaultOpacity);
184
112
  particle.strokeAnimation = stroke.color?.animation;
185
113
  const strokeHslColor = (0,engine_root_window_.rangeColorToHsl)(stroke.color) ?? particle.getFillColor();
186
114
  if (strokeHslColor) {
@@ -198,7 +126,7 @@ class StrokeColorUpdater {
198
126
  if (!this.isEnabled(particle)) {
199
127
  return;
200
128
  }
201
- updateStrokeColor(particle, delta);
129
+ (0,engine_root_window_.updateColor)(particle.strokeColor, delta);
202
130
  }
203
131
  }
204
132
  ;// CONCATENATED MODULE: ./dist/browser/index.js
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see tsparticles.updater.stroke-color.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 t="object"==typeof exports?o(require("@tsparticles/engine")):o(e.window);for(var r in t)("object"==typeof exports?exports:e)[r]=t[r]}}(this,(e=>(()=>{"use strict";var o={533:o=>{o.exports=e}},t={};function r(e){var i=t[e];if(void 0!==i)return i.exports;var n=t[e]={exports:{}};return o[e](n,n.exports,r),n.exports}r.d=(e,o)=>{for(var t in o)r.o(o,t)&&!r.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:o[t]})},r.o=(e,o)=>Object.prototype.hasOwnProperty.call(e,o),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return(()=>{r.r(i),r.d(i,{loadStrokeColorUpdater:()=>n});var e=r(533);function o(o,t,r,i,n){if(!t||!r.enable||(t.maxLoops??0)>0&&(t.loops??0)>(t.maxLoops??0))return;if(t.time||(t.time=0),(t.delayTime??0)>0&&t.time<(t.delayTime??0)&&(t.time+=o.value),(t.delayTime??0)>0&&t.time<(t.delayTime??0))return;const a=(0,e.randomInRange)(r.offset),l=(t.velocity??0)*o.factor+3.6*a,s=t.decay??1;n&&"increasing"!==t.status?(t.value-=l,t.value<0&&(t.loops||(t.loops=0),t.loops++,t.status="increasing",t.value+=t.value)):(t.value+=l,t.value>i&&(t.loops||(t.loops=0),t.loops++,n&&(t.status="decreasing",t.value-=t.value%i))),t.velocity&&1!==s&&(t.velocity*=s),t.value>i&&(t.value%=i)}class t{constructor(e){this.container=e}init(o){const t=this.container,r=o.options,i=(0,e.itemFromSingleOrMultiple)(r.stroke,o.id,r.reduceDuplicates);o.strokeWidth=(0,e.getRangeValue)(i.width)*t.retina.pixelRatio,o.strokeOpacity=(0,e.getRangeValue)(i.opacity??1),o.strokeAnimation=i.color?.animation;const n=(0,e.rangeColorToHsl)(i.color)??o.getFillColor();n&&(o.strokeColor=(0,e.getHslAnimationFromHsl)(n,o.strokeAnimation,t.retina.reduceFactor))}isEnabled(e){const o=e.strokeAnimation,{strokeColor:t}=e;return!e.destroyed&&!e.spawning&&!!o&&(void 0!==t?.h.value&&t.h.enable||void 0!==t?.s.value&&t.s.enable||void 0!==t?.l.value&&t.l.enable)}update(e,t){this.isEnabled(e)&&function(e,t){if(!e.strokeColor||!e.strokeAnimation)return;const{h:r,s:i,l:n}=e.strokeColor,{h:a,s:l,l:s}=e.strokeAnimation;r&&o(t,r,a,360,!1),i&&o(t,i,l,100,!0),n&&o(t,n,s,100,!0)}(e,t)}}async function n(e,o=!0){await e.addParticleUpdater("strokeColor",(e=>new t(e)),o)}})(),i})()));
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 t="object"==typeof exports?o(require("@tsparticles/engine")):o(e.window);for(var r in t)("object"==typeof exports?exports:e)[r]=t[r]}}(this,(e=>(()=>{"use strict";var o={533:o=>{o.exports=e}},t={};function r(e){var i=t[e];if(void 0!==i)return i.exports;var n=t[e]={exports:{}};return o[e](n,n.exports,r),n.exports}r.d=(e,o)=>{for(var t in o)r.o(o,t)&&!r.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:o[t]})},r.o=(e,o)=>Object.prototype.hasOwnProperty.call(e,o),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return(()=>{r.r(i),r.d(i,{loadStrokeColorUpdater:()=>t});var e=r(533);class o{constructor(e){this.container=e}init(o){const t=this.container,r=o.options,i=(0,e.itemFromSingleOrMultiple)(r.stroke,o.id,r.reduceDuplicates);o.strokeWidth=(0,e.getRangeValue)(i.width)*t.retina.pixelRatio,o.strokeOpacity=(0,e.getRangeValue)(i.opacity??1),o.strokeAnimation=i.color?.animation;const n=(0,e.rangeColorToHsl)(i.color)??o.getFillColor();n&&(o.strokeColor=(0,e.getHslAnimationFromHsl)(n,o.strokeAnimation,t.retina.reduceFactor))}isEnabled(e){const o=e.strokeAnimation,{strokeColor:t}=e;return!e.destroyed&&!e.spawning&&!!o&&(void 0!==t?.h.value&&t.h.enable||void 0!==t?.s.value&&t.s.enable||void 0!==t?.l.value&&t.l.enable)}update(o,t){this.isEnabled(o)&&(0,e.updateColor)(o.strokeColor,t)}}async function t(e,t=!0){await e.addParticleUpdater("strokeColor",(e=>new o(e)),t)}})(),i})()));
@@ -1 +1 @@
1
- /*! tsParticles Stroke Color Updater v3.0.3 by Matteo Bruni */
1
+ /*! tsParticles Stroke Color Updater v3.1.0 by Matteo Bruni */
@@ -4,14 +4,14 @@
4
4
  if (v !== undefined) module.exports = v;
5
5
  }
6
6
  else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "@tsparticles/engine", "./Utils.js"], factory);
7
+ define(["require", "exports", "@tsparticles/engine"], factory);
8
8
  }
9
9
  })(function (require, exports) {
10
10
  "use strict";
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.StrokeColorUpdater = void 0;
13
13
  const engine_1 = require("@tsparticles/engine");
14
- const Utils_js_1 = require("./Utils.js");
14
+ const defaultOpacity = 1;
15
15
  class StrokeColorUpdater {
16
16
  constructor(container) {
17
17
  this.container = container;
@@ -20,7 +20,7 @@
20
20
  const container = this.container, options = particle.options;
21
21
  const stroke = (0, engine_1.itemFromSingleOrMultiple)(options.stroke, particle.id, options.reduceDuplicates);
22
22
  particle.strokeWidth = (0, engine_1.getRangeValue)(stroke.width) * container.retina.pixelRatio;
23
- particle.strokeOpacity = (0, engine_1.getRangeValue)(stroke.opacity ?? 1);
23
+ particle.strokeOpacity = (0, engine_1.getRangeValue)(stroke.opacity ?? defaultOpacity);
24
24
  particle.strokeAnimation = stroke.color?.animation;
25
25
  const strokeHslColor = (0, engine_1.rangeColorToHsl)(stroke.color) ?? particle.getFillColor();
26
26
  if (strokeHslColor) {
@@ -40,7 +40,7 @@
40
40
  if (!this.isEnabled(particle)) {
41
41
  return;
42
42
  }
43
- (0, Utils_js_1.updateStrokeColor)(particle, delta);
43
+ (0, engine_1.updateColor)(particle.strokeColor, delta);
44
44
  }
45
45
  }
46
46
  exports.StrokeColorUpdater = StrokeColorUpdater;
package/browser/Utils.js DELETED
@@ -1,63 +0,0 @@
1
- import { randomInRange, } from "@tsparticles/engine";
2
- function updateColorValue(delta, colorValue, valueAnimation, max, decrease) {
3
- if (!colorValue ||
4
- !valueAnimation.enable ||
5
- ((colorValue.maxLoops ?? 0) > 0 && (colorValue.loops ?? 0) > (colorValue.maxLoops ?? 0))) {
6
- return;
7
- }
8
- if (!colorValue.time) {
9
- colorValue.time = 0;
10
- }
11
- if ((colorValue.delayTime ?? 0) > 0 && colorValue.time < (colorValue.delayTime ?? 0)) {
12
- colorValue.time += delta.value;
13
- }
14
- if ((colorValue.delayTime ?? 0) > 0 && colorValue.time < (colorValue.delayTime ?? 0)) {
15
- return;
16
- }
17
- const offset = randomInRange(valueAnimation.offset), velocity = (colorValue.velocity ?? 0) * delta.factor + offset * 3.6, decay = colorValue.decay ?? 1;
18
- if (!decrease || colorValue.status === "increasing") {
19
- colorValue.value += velocity;
20
- if (colorValue.value > max) {
21
- if (!colorValue.loops) {
22
- colorValue.loops = 0;
23
- }
24
- colorValue.loops++;
25
- if (decrease) {
26
- colorValue.status = "decreasing";
27
- colorValue.value -= colorValue.value % max;
28
- }
29
- }
30
- }
31
- else {
32
- colorValue.value -= velocity;
33
- if (colorValue.value < 0) {
34
- if (!colorValue.loops) {
35
- colorValue.loops = 0;
36
- }
37
- colorValue.loops++;
38
- colorValue.status = "increasing";
39
- colorValue.value += colorValue.value;
40
- }
41
- }
42
- if (colorValue.velocity && decay !== 1) {
43
- colorValue.velocity *= decay;
44
- }
45
- if (colorValue.value > max) {
46
- colorValue.value %= max;
47
- }
48
- }
49
- export function updateStrokeColor(particle, delta) {
50
- if (!particle.strokeColor || !particle.strokeAnimation) {
51
- return;
52
- }
53
- const { h, s, l } = particle.strokeColor, { h: hAnimation, s: sAnimation, l: lAnimation } = particle.strokeAnimation;
54
- if (h) {
55
- updateColorValue(delta, h, hAnimation, 360, false);
56
- }
57
- if (s) {
58
- updateColorValue(delta, s, sAnimation, 100, true);
59
- }
60
- if (l) {
61
- updateColorValue(delta, l, lAnimation, 100, true);
62
- }
63
- }
package/cjs/Utils.js DELETED
@@ -1,67 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.updateStrokeColor = void 0;
4
- const engine_1 = require("@tsparticles/engine");
5
- function updateColorValue(delta, colorValue, valueAnimation, max, decrease) {
6
- if (!colorValue ||
7
- !valueAnimation.enable ||
8
- ((colorValue.maxLoops ?? 0) > 0 && (colorValue.loops ?? 0) > (colorValue.maxLoops ?? 0))) {
9
- return;
10
- }
11
- if (!colorValue.time) {
12
- colorValue.time = 0;
13
- }
14
- if ((colorValue.delayTime ?? 0) > 0 && colorValue.time < (colorValue.delayTime ?? 0)) {
15
- colorValue.time += delta.value;
16
- }
17
- if ((colorValue.delayTime ?? 0) > 0 && colorValue.time < (colorValue.delayTime ?? 0)) {
18
- return;
19
- }
20
- const offset = (0, engine_1.randomInRange)(valueAnimation.offset), velocity = (colorValue.velocity ?? 0) * delta.factor + offset * 3.6, decay = colorValue.decay ?? 1;
21
- if (!decrease || colorValue.status === "increasing") {
22
- colorValue.value += velocity;
23
- if (colorValue.value > max) {
24
- if (!colorValue.loops) {
25
- colorValue.loops = 0;
26
- }
27
- colorValue.loops++;
28
- if (decrease) {
29
- colorValue.status = "decreasing";
30
- colorValue.value -= colorValue.value % max;
31
- }
32
- }
33
- }
34
- else {
35
- colorValue.value -= velocity;
36
- if (colorValue.value < 0) {
37
- if (!colorValue.loops) {
38
- colorValue.loops = 0;
39
- }
40
- colorValue.loops++;
41
- colorValue.status = "increasing";
42
- colorValue.value += colorValue.value;
43
- }
44
- }
45
- if (colorValue.velocity && decay !== 1) {
46
- colorValue.velocity *= decay;
47
- }
48
- if (colorValue.value > max) {
49
- colorValue.value %= max;
50
- }
51
- }
52
- function updateStrokeColor(particle, delta) {
53
- if (!particle.strokeColor || !particle.strokeAnimation) {
54
- return;
55
- }
56
- const { h, s, l } = particle.strokeColor, { h: hAnimation, s: sAnimation, l: lAnimation } = particle.strokeAnimation;
57
- if (h) {
58
- updateColorValue(delta, h, hAnimation, 360, false);
59
- }
60
- if (s) {
61
- updateColorValue(delta, s, sAnimation, 100, true);
62
- }
63
- if (l) {
64
- updateColorValue(delta, l, lAnimation, 100, true);
65
- }
66
- }
67
- exports.updateStrokeColor = updateStrokeColor;
package/esm/Utils.js DELETED
@@ -1,63 +0,0 @@
1
- import { randomInRange, } from "@tsparticles/engine";
2
- function updateColorValue(delta, colorValue, valueAnimation, max, decrease) {
3
- if (!colorValue ||
4
- !valueAnimation.enable ||
5
- ((colorValue.maxLoops ?? 0) > 0 && (colorValue.loops ?? 0) > (colorValue.maxLoops ?? 0))) {
6
- return;
7
- }
8
- if (!colorValue.time) {
9
- colorValue.time = 0;
10
- }
11
- if ((colorValue.delayTime ?? 0) > 0 && colorValue.time < (colorValue.delayTime ?? 0)) {
12
- colorValue.time += delta.value;
13
- }
14
- if ((colorValue.delayTime ?? 0) > 0 && colorValue.time < (colorValue.delayTime ?? 0)) {
15
- return;
16
- }
17
- const offset = randomInRange(valueAnimation.offset), velocity = (colorValue.velocity ?? 0) * delta.factor + offset * 3.6, decay = colorValue.decay ?? 1;
18
- if (!decrease || colorValue.status === "increasing") {
19
- colorValue.value += velocity;
20
- if (colorValue.value > max) {
21
- if (!colorValue.loops) {
22
- colorValue.loops = 0;
23
- }
24
- colorValue.loops++;
25
- if (decrease) {
26
- colorValue.status = "decreasing";
27
- colorValue.value -= colorValue.value % max;
28
- }
29
- }
30
- }
31
- else {
32
- colorValue.value -= velocity;
33
- if (colorValue.value < 0) {
34
- if (!colorValue.loops) {
35
- colorValue.loops = 0;
36
- }
37
- colorValue.loops++;
38
- colorValue.status = "increasing";
39
- colorValue.value += colorValue.value;
40
- }
41
- }
42
- if (colorValue.velocity && decay !== 1) {
43
- colorValue.velocity *= decay;
44
- }
45
- if (colorValue.value > max) {
46
- colorValue.value %= max;
47
- }
48
- }
49
- export function updateStrokeColor(particle, delta) {
50
- if (!particle.strokeColor || !particle.strokeAnimation) {
51
- return;
52
- }
53
- const { h, s, l } = particle.strokeColor, { h: hAnimation, s: sAnimation, l: lAnimation } = particle.strokeAnimation;
54
- if (h) {
55
- updateColorValue(delta, h, hAnimation, 360, false);
56
- }
57
- if (s) {
58
- updateColorValue(delta, s, sAnimation, 100, true);
59
- }
60
- if (l) {
61
- updateColorValue(delta, l, lAnimation, 100, true);
62
- }
63
- }
package/types/Utils.d.ts DELETED
@@ -1,3 +0,0 @@
1
- import { type IDelta } from "@tsparticles/engine";
2
- import type { StrokeParticle } from "./Types.js";
3
- export declare function updateStrokeColor(particle: StrokeParticle, delta: IDelta): void;
package/umd/Utils.js DELETED
@@ -1,77 +0,0 @@
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.updateStrokeColor = void 0;
13
- const engine_1 = require("@tsparticles/engine");
14
- function updateColorValue(delta, colorValue, valueAnimation, max, decrease) {
15
- if (!colorValue ||
16
- !valueAnimation.enable ||
17
- ((colorValue.maxLoops ?? 0) > 0 && (colorValue.loops ?? 0) > (colorValue.maxLoops ?? 0))) {
18
- return;
19
- }
20
- if (!colorValue.time) {
21
- colorValue.time = 0;
22
- }
23
- if ((colorValue.delayTime ?? 0) > 0 && colorValue.time < (colorValue.delayTime ?? 0)) {
24
- colorValue.time += delta.value;
25
- }
26
- if ((colorValue.delayTime ?? 0) > 0 && colorValue.time < (colorValue.delayTime ?? 0)) {
27
- return;
28
- }
29
- const offset = (0, engine_1.randomInRange)(valueAnimation.offset), velocity = (colorValue.velocity ?? 0) * delta.factor + offset * 3.6, decay = colorValue.decay ?? 1;
30
- if (!decrease || colorValue.status === "increasing") {
31
- colorValue.value += velocity;
32
- if (colorValue.value > max) {
33
- if (!colorValue.loops) {
34
- colorValue.loops = 0;
35
- }
36
- colorValue.loops++;
37
- if (decrease) {
38
- colorValue.status = "decreasing";
39
- colorValue.value -= colorValue.value % max;
40
- }
41
- }
42
- }
43
- else {
44
- colorValue.value -= velocity;
45
- if (colorValue.value < 0) {
46
- if (!colorValue.loops) {
47
- colorValue.loops = 0;
48
- }
49
- colorValue.loops++;
50
- colorValue.status = "increasing";
51
- colorValue.value += colorValue.value;
52
- }
53
- }
54
- if (colorValue.velocity && decay !== 1) {
55
- colorValue.velocity *= decay;
56
- }
57
- if (colorValue.value > max) {
58
- colorValue.value %= max;
59
- }
60
- }
61
- function updateStrokeColor(particle, delta) {
62
- if (!particle.strokeColor || !particle.strokeAnimation) {
63
- return;
64
- }
65
- const { h, s, l } = particle.strokeColor, { h: hAnimation, s: sAnimation, l: lAnimation } = particle.strokeAnimation;
66
- if (h) {
67
- updateColorValue(delta, h, hAnimation, 360, false);
68
- }
69
- if (s) {
70
- updateColorValue(delta, s, sAnimation, 100, true);
71
- }
72
- if (l) {
73
- updateColorValue(delta, l, lAnimation, 100, true);
74
- }
75
- }
76
- exports.updateStrokeColor = updateStrokeColor;
77
- });