@tsparticles/updater-color 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/ColorUpdater.js +2 -3
- package/cjs/ColorUpdater.js +1 -2
- package/esm/ColorUpdater.js +2 -3
- package/package.json +2 -2
- package/report.html +2 -2
- package/tsparticles.updater.color.js +2 -78
- package/tsparticles.updater.color.min.js +1 -1
- package/tsparticles.updater.color.min.js.LICENSE.txt +1 -1
- package/umd/ColorUpdater.js +2 -3
- package/browser/Utils.js +0 -64
- package/cjs/Utils.js +0 -68
- package/esm/Utils.js +0 -64
- package/types/Utils.d.ts +0 -2
- package/umd/Utils.js +0 -78
package/browser/ColorUpdater.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { getHslAnimationFromHsl, rangeColorToHsl, } from "@tsparticles/engine";
|
|
2
|
-
import { updateColor } from "./Utils.js";
|
|
1
|
+
import { getHslAnimationFromHsl, rangeColorToHsl, updateColor, } from "@tsparticles/engine";
|
|
3
2
|
export class ColorUpdater {
|
|
4
3
|
constructor(container) {
|
|
5
4
|
this.container = container;
|
|
@@ -19,6 +18,6 @@ export class ColorUpdater {
|
|
|
19
18
|
(color?.l.value !== undefined && lAnimation.enable)));
|
|
20
19
|
}
|
|
21
20
|
update(particle, delta) {
|
|
22
|
-
updateColor(particle, delta);
|
|
21
|
+
updateColor(particle.color, delta);
|
|
23
22
|
}
|
|
24
23
|
}
|
package/cjs/ColorUpdater.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ColorUpdater = void 0;
|
|
4
4
|
const engine_1 = require("@tsparticles/engine");
|
|
5
|
-
const Utils_js_1 = require("./Utils.js");
|
|
6
5
|
class ColorUpdater {
|
|
7
6
|
constructor(container) {
|
|
8
7
|
this.container = container;
|
|
@@ -22,7 +21,7 @@ class ColorUpdater {
|
|
|
22
21
|
(color?.l.value !== undefined && lAnimation.enable)));
|
|
23
22
|
}
|
|
24
23
|
update(particle, delta) {
|
|
25
|
-
(0,
|
|
24
|
+
(0, engine_1.updateColor)(particle.color, delta);
|
|
26
25
|
}
|
|
27
26
|
}
|
|
28
27
|
exports.ColorUpdater = ColorUpdater;
|
package/esm/ColorUpdater.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { getHslAnimationFromHsl, rangeColorToHsl, } from "@tsparticles/engine";
|
|
2
|
-
import { updateColor } from "./Utils.js";
|
|
1
|
+
import { getHslAnimationFromHsl, rangeColorToHsl, updateColor, } from "@tsparticles/engine";
|
|
3
2
|
export class ColorUpdater {
|
|
4
3
|
constructor(container) {
|
|
5
4
|
this.container = container;
|
|
@@ -19,6 +18,6 @@ export class ColorUpdater {
|
|
|
19
18
|
(color?.l.value !== undefined && lAnimation.enable)));
|
|
20
19
|
}
|
|
21
20
|
update(particle, delta) {
|
|
22
|
-
updateColor(particle, delta);
|
|
21
|
+
updateColor(particle.color, delta);
|
|
23
22
|
}
|
|
24
23
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/updater-color",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "tsParticles particles 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
|
|
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-color [
|
|
6
|
+
<title>@tsparticles/updater-color [13 Jan 2024 at 23:07]</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.color.js","isAsset":true,"statSize":
|
|
34
|
+
window.chartData = [{"label":"tsparticles.updater.color.js","isAsset":true,"statSize":1204,"parsedSize":5012,"gzipSize":1669,"groups":[{"label":"dist/browser","path":"./dist/browser","statSize":1162,"groups":[{"id":660,"label":"index.js + 1 modules (concatenated)","path":"./dist/browser/index.js + 1 modules (concatenated)","statSize":1162,"parsedSize":5012,"gzipSize":1669,"concatenated":true,"groups":[{"label":"dist/browser","path":"./dist/browser/index.js + 1 modules (concatenated)/dist/browser","statSize":1162,"groups":[{"id":null,"label":"index.js","path":"./dist/browser/index.js + 1 modules (concatenated)/dist/browser/index.js","statSize":211,"parsedSize":910,"gzipSize":303,"inaccurateSizes":true},{"id":null,"label":"ColorUpdater.js","path":"./dist/browser/index.js + 1 modules (concatenated)/dist/browser/ColorUpdater.js","statSize":951,"parsedSize":4101,"gzipSize":1365,"inaccurateSizes":true}],"parsedSize":5012,"gzipSize":1669,"inaccurateSizes":true}]}],"parsedSize":5012,"gzipSize":1669},{"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.color":true}}];
|
|
35
35
|
window.entrypoints = ["tsparticles.updater.color","tsparticles.updater.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
|
|
7
|
+
* v3.1.0
|
|
8
8
|
*/
|
|
9
9
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
10
10
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
@@ -96,84 +96,8 @@ __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 updateColor(particle, delta) {
|
|
148
|
-
const {
|
|
149
|
-
h: hAnimation,
|
|
150
|
-
s: sAnimation,
|
|
151
|
-
l: lAnimation
|
|
152
|
-
} = particle.options.color.animation,
|
|
153
|
-
{
|
|
154
|
-
color
|
|
155
|
-
} = particle;
|
|
156
|
-
if (!color) {
|
|
157
|
-
return;
|
|
158
|
-
}
|
|
159
|
-
const {
|
|
160
|
-
h,
|
|
161
|
-
s,
|
|
162
|
-
l
|
|
163
|
-
} = color;
|
|
164
|
-
if (h) {
|
|
165
|
-
updateColorValue(delta, h, hAnimation, 360, false);
|
|
166
|
-
}
|
|
167
|
-
if (s) {
|
|
168
|
-
updateColorValue(delta, s, sAnimation, 100, true);
|
|
169
|
-
}
|
|
170
|
-
if (l) {
|
|
171
|
-
updateColorValue(delta, l, lAnimation, 100, true);
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
99
|
;// CONCATENATED MODULE: ./dist/browser/ColorUpdater.js
|
|
175
100
|
|
|
176
|
-
|
|
177
101
|
class ColorUpdater {
|
|
178
102
|
constructor(container) {
|
|
179
103
|
this.container = container;
|
|
@@ -196,7 +120,7 @@ class ColorUpdater {
|
|
|
196
120
|
return !particle.destroyed && !particle.spawning && (color?.h.value !== undefined && hAnimation.enable || color?.s.value !== undefined && sAnimation.enable || color?.l.value !== undefined && lAnimation.enable);
|
|
197
121
|
}
|
|
198
122
|
update(particle, delta) {
|
|
199
|
-
updateColor(particle, delta);
|
|
123
|
+
(0,engine_root_window_.updateColor)(particle.color, delta);
|
|
200
124
|
}
|
|
201
125
|
}
|
|
202
126
|
;// CONCATENATED MODULE: ./dist/browser/index.js
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see tsparticles.updater.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 n=t[e];if(void 0!==n)return n.exports;var i=t[e]={exports:{}};return o[e](i,i.exports,r),i.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 n={};return(()=>{r.r(n),r.d(n,{loadColorUpdater:()=>
|
|
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 n=t[e];if(void 0!==n)return n.exports;var i=t[e]={exports:{}};return o[e](i,i.exports,r),i.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 n={};return(()=>{r.r(n),r.d(n,{loadColorUpdater:()=>t});var e=r(533);class o{constructor(e){this.container=e}init(o){const t=(0,e.rangeColorToHsl)(o.options.color,o.id,o.options.reduceDuplicates);t&&(o.color=(0,e.getHslAnimationFromHsl)(t,o.options.color.animation,this.container.retina.reduceFactor))}isEnabled(e){const{h:o,s:t,l:r}=e.options.color.animation,{color:n}=e;return!e.destroyed&&!e.spawning&&(void 0!==n?.h.value&&o.enable||void 0!==n?.s.value&&t.enable||void 0!==n?.l.value&&r.enable)}update(o,t){(0,e.updateColor)(o.color,t)}}async function t(e,t=!0){await e.addParticleUpdater("color",(e=>new o(e)),t)}})(),n})()));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
/*! tsParticles Color Updater v3.0
|
|
1
|
+
/*! tsParticles Color Updater v3.1.0 by Matteo Bruni */
|
package/umd/ColorUpdater.js
CHANGED
|
@@ -4,14 +4,13 @@
|
|
|
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"
|
|
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.ColorUpdater = void 0;
|
|
13
13
|
const engine_1 = require("@tsparticles/engine");
|
|
14
|
-
const Utils_js_1 = require("./Utils.js");
|
|
15
14
|
class ColorUpdater {
|
|
16
15
|
constructor(container) {
|
|
17
16
|
this.container = container;
|
|
@@ -31,7 +30,7 @@
|
|
|
31
30
|
(color?.l.value !== undefined && lAnimation.enable)));
|
|
32
31
|
}
|
|
33
32
|
update(particle, delta) {
|
|
34
|
-
(0,
|
|
33
|
+
(0, engine_1.updateColor)(particle.color, delta);
|
|
35
34
|
}
|
|
36
35
|
}
|
|
37
36
|
exports.ColorUpdater = ColorUpdater;
|
package/browser/Utils.js
DELETED
|
@@ -1,64 +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 updateColor(particle, delta) {
|
|
50
|
-
const { h: hAnimation, s: sAnimation, l: lAnimation } = particle.options.color.animation, { color } = particle;
|
|
51
|
-
if (!color) {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
const { h, s, l } = color;
|
|
55
|
-
if (h) {
|
|
56
|
-
updateColorValue(delta, h, hAnimation, 360, false);
|
|
57
|
-
}
|
|
58
|
-
if (s) {
|
|
59
|
-
updateColorValue(delta, s, sAnimation, 100, true);
|
|
60
|
-
}
|
|
61
|
-
if (l) {
|
|
62
|
-
updateColorValue(delta, l, lAnimation, 100, true);
|
|
63
|
-
}
|
|
64
|
-
}
|
package/cjs/Utils.js
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updateColor = 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 updateColor(particle, delta) {
|
|
53
|
-
const { h: hAnimation, s: sAnimation, l: lAnimation } = particle.options.color.animation, { color } = particle;
|
|
54
|
-
if (!color) {
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
const { h, s, l } = color;
|
|
58
|
-
if (h) {
|
|
59
|
-
updateColorValue(delta, h, hAnimation, 360, false);
|
|
60
|
-
}
|
|
61
|
-
if (s) {
|
|
62
|
-
updateColorValue(delta, s, sAnimation, 100, true);
|
|
63
|
-
}
|
|
64
|
-
if (l) {
|
|
65
|
-
updateColorValue(delta, l, lAnimation, 100, true);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
exports.updateColor = updateColor;
|
package/esm/Utils.js
DELETED
|
@@ -1,64 +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 updateColor(particle, delta) {
|
|
50
|
-
const { h: hAnimation, s: sAnimation, l: lAnimation } = particle.options.color.animation, { color } = particle;
|
|
51
|
-
if (!color) {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
const { h, s, l } = color;
|
|
55
|
-
if (h) {
|
|
56
|
-
updateColorValue(delta, h, hAnimation, 360, false);
|
|
57
|
-
}
|
|
58
|
-
if (s) {
|
|
59
|
-
updateColorValue(delta, s, sAnimation, 100, true);
|
|
60
|
-
}
|
|
61
|
-
if (l) {
|
|
62
|
-
updateColorValue(delta, l, lAnimation, 100, true);
|
|
63
|
-
}
|
|
64
|
-
}
|
package/types/Utils.d.ts
DELETED
package/umd/Utils.js
DELETED
|
@@ -1,78 +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.updateColor = 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 updateColor(particle, delta) {
|
|
62
|
-
const { h: hAnimation, s: sAnimation, l: lAnimation } = particle.options.color.animation, { color } = particle;
|
|
63
|
-
if (!color) {
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
const { h, s, l } = color;
|
|
67
|
-
if (h) {
|
|
68
|
-
updateColorValue(delta, h, hAnimation, 360, false);
|
|
69
|
-
}
|
|
70
|
-
if (s) {
|
|
71
|
-
updateColorValue(delta, s, sAnimation, 100, true);
|
|
72
|
-
}
|
|
73
|
-
if (l) {
|
|
74
|
-
updateColorValue(delta, l, lAnimation, 100, true);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
exports.updateColor = updateColor;
|
|
78
|
-
});
|