@tsparticles/updater-opacity 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/OpacityUpdater.js +10 -10
- package/cjs/OpacityUpdater.js +9 -9
- package/esm/OpacityUpdater.js +10 -10
- package/package.json +2 -2
- package/report.html +2 -2
- package/tsparticles.updater.opacity.js +9 -73
- package/tsparticles.updater.opacity.min.js +1 -1
- package/tsparticles.updater.opacity.min.js.LICENSE.txt +1 -1
- package/umd/OpacityUpdater.js +10 -10
- 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
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { getRandom, getRangeValue, initParticleNumericAnimationValue, } from "@tsparticles/engine";
|
|
2
|
-
import { updateOpacity } from "./Utils.js";
|
|
1
|
+
import { getRandom, getRangeValue, initParticleNumericAnimationValue, percentDenominator, updateAnimation, } from "@tsparticles/engine";
|
|
3
2
|
export class OpacityUpdater {
|
|
4
3
|
constructor(container) {
|
|
5
4
|
this.container = container;
|
|
6
5
|
}
|
|
7
6
|
init(particle) {
|
|
8
|
-
const opacityOptions = particle.options.opacity;
|
|
9
|
-
particle.opacity = initParticleNumericAnimationValue(opacityOptions,
|
|
7
|
+
const opacityOptions = particle.options.opacity, pxRatio = 1;
|
|
8
|
+
particle.opacity = initParticleNumericAnimationValue(opacityOptions, pxRatio);
|
|
10
9
|
const opacityAnimation = opacityOptions.animation;
|
|
11
10
|
if (opacityAnimation.enable) {
|
|
12
11
|
particle.opacity.velocity =
|
|
13
|
-
(getRangeValue(opacityAnimation.speed) /
|
|
12
|
+
(getRangeValue(opacityAnimation.speed) / percentDenominator) * this.container.retina.reduceFactor;
|
|
14
13
|
if (!opacityAnimation.sync) {
|
|
15
14
|
particle.opacity.velocity *= getRandom();
|
|
16
15
|
}
|
|
17
16
|
}
|
|
18
17
|
}
|
|
19
18
|
isEnabled(particle) {
|
|
19
|
+
const none = 0;
|
|
20
20
|
return (!particle.destroyed &&
|
|
21
21
|
!particle.spawning &&
|
|
22
22
|
!!particle.opacity &&
|
|
23
23
|
particle.opacity.enable &&
|
|
24
|
-
((particle.opacity.maxLoops ??
|
|
25
|
-
((particle.opacity.maxLoops ??
|
|
26
|
-
(particle.opacity.loops ??
|
|
24
|
+
((particle.opacity.maxLoops ?? none) <= none ||
|
|
25
|
+
((particle.opacity.maxLoops ?? none) > none &&
|
|
26
|
+
(particle.opacity.loops ?? none) < (particle.opacity.maxLoops ?? none))));
|
|
27
27
|
}
|
|
28
28
|
reset(particle) {
|
|
29
29
|
if (particle.opacity) {
|
|
@@ -32,9 +32,9 @@ export class OpacityUpdater {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
update(particle, delta) {
|
|
35
|
-
if (!this.isEnabled(particle)) {
|
|
35
|
+
if (!this.isEnabled(particle) || !particle.opacity) {
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
38
|
-
|
|
38
|
+
updateAnimation(particle, particle.opacity, true, particle.options.opacity.animation.destroy, delta);
|
|
39
39
|
}
|
|
40
40
|
}
|
package/cjs/OpacityUpdater.js
CHANGED
|
@@ -2,31 +2,31 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.OpacityUpdater = void 0;
|
|
4
4
|
const engine_1 = require("@tsparticles/engine");
|
|
5
|
-
const Utils_js_1 = require("./Utils.js");
|
|
6
5
|
class OpacityUpdater {
|
|
7
6
|
constructor(container) {
|
|
8
7
|
this.container = container;
|
|
9
8
|
}
|
|
10
9
|
init(particle) {
|
|
11
|
-
const opacityOptions = particle.options.opacity;
|
|
12
|
-
particle.opacity = (0, engine_1.initParticleNumericAnimationValue)(opacityOptions,
|
|
10
|
+
const opacityOptions = particle.options.opacity, pxRatio = 1;
|
|
11
|
+
particle.opacity = (0, engine_1.initParticleNumericAnimationValue)(opacityOptions, pxRatio);
|
|
13
12
|
const opacityAnimation = opacityOptions.animation;
|
|
14
13
|
if (opacityAnimation.enable) {
|
|
15
14
|
particle.opacity.velocity =
|
|
16
|
-
((0, engine_1.getRangeValue)(opacityAnimation.speed) /
|
|
15
|
+
((0, engine_1.getRangeValue)(opacityAnimation.speed) / engine_1.percentDenominator) * this.container.retina.reduceFactor;
|
|
17
16
|
if (!opacityAnimation.sync) {
|
|
18
17
|
particle.opacity.velocity *= (0, engine_1.getRandom)();
|
|
19
18
|
}
|
|
20
19
|
}
|
|
21
20
|
}
|
|
22
21
|
isEnabled(particle) {
|
|
22
|
+
const none = 0;
|
|
23
23
|
return (!particle.destroyed &&
|
|
24
24
|
!particle.spawning &&
|
|
25
25
|
!!particle.opacity &&
|
|
26
26
|
particle.opacity.enable &&
|
|
27
|
-
((particle.opacity.maxLoops ??
|
|
28
|
-
((particle.opacity.maxLoops ??
|
|
29
|
-
(particle.opacity.loops ??
|
|
27
|
+
((particle.opacity.maxLoops ?? none) <= none ||
|
|
28
|
+
((particle.opacity.maxLoops ?? none) > none &&
|
|
29
|
+
(particle.opacity.loops ?? none) < (particle.opacity.maxLoops ?? none))));
|
|
30
30
|
}
|
|
31
31
|
reset(particle) {
|
|
32
32
|
if (particle.opacity) {
|
|
@@ -35,10 +35,10 @@ class OpacityUpdater {
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
update(particle, delta) {
|
|
38
|
-
if (!this.isEnabled(particle)) {
|
|
38
|
+
if (!this.isEnabled(particle) || !particle.opacity) {
|
|
39
39
|
return;
|
|
40
40
|
}
|
|
41
|
-
(0,
|
|
41
|
+
(0, engine_1.updateAnimation)(particle, particle.opacity, true, particle.options.opacity.animation.destroy, delta);
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
exports.OpacityUpdater = OpacityUpdater;
|
package/esm/OpacityUpdater.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { getRandom, getRangeValue, initParticleNumericAnimationValue, } from "@tsparticles/engine";
|
|
2
|
-
import { updateOpacity } from "./Utils.js";
|
|
1
|
+
import { getRandom, getRangeValue, initParticleNumericAnimationValue, percentDenominator, updateAnimation, } from "@tsparticles/engine";
|
|
3
2
|
export class OpacityUpdater {
|
|
4
3
|
constructor(container) {
|
|
5
4
|
this.container = container;
|
|
6
5
|
}
|
|
7
6
|
init(particle) {
|
|
8
|
-
const opacityOptions = particle.options.opacity;
|
|
9
|
-
particle.opacity = initParticleNumericAnimationValue(opacityOptions,
|
|
7
|
+
const opacityOptions = particle.options.opacity, pxRatio = 1;
|
|
8
|
+
particle.opacity = initParticleNumericAnimationValue(opacityOptions, pxRatio);
|
|
10
9
|
const opacityAnimation = opacityOptions.animation;
|
|
11
10
|
if (opacityAnimation.enable) {
|
|
12
11
|
particle.opacity.velocity =
|
|
13
|
-
(getRangeValue(opacityAnimation.speed) /
|
|
12
|
+
(getRangeValue(opacityAnimation.speed) / percentDenominator) * this.container.retina.reduceFactor;
|
|
14
13
|
if (!opacityAnimation.sync) {
|
|
15
14
|
particle.opacity.velocity *= getRandom();
|
|
16
15
|
}
|
|
17
16
|
}
|
|
18
17
|
}
|
|
19
18
|
isEnabled(particle) {
|
|
19
|
+
const none = 0;
|
|
20
20
|
return (!particle.destroyed &&
|
|
21
21
|
!particle.spawning &&
|
|
22
22
|
!!particle.opacity &&
|
|
23
23
|
particle.opacity.enable &&
|
|
24
|
-
((particle.opacity.maxLoops ??
|
|
25
|
-
((particle.opacity.maxLoops ??
|
|
26
|
-
(particle.opacity.loops ??
|
|
24
|
+
((particle.opacity.maxLoops ?? none) <= none ||
|
|
25
|
+
((particle.opacity.maxLoops ?? none) > none &&
|
|
26
|
+
(particle.opacity.loops ?? none) < (particle.opacity.maxLoops ?? none))));
|
|
27
27
|
}
|
|
28
28
|
reset(particle) {
|
|
29
29
|
if (particle.opacity) {
|
|
@@ -32,9 +32,9 @@ export class OpacityUpdater {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
update(particle, delta) {
|
|
35
|
-
if (!this.isEnabled(particle)) {
|
|
35
|
+
if (!this.isEnabled(particle) || !particle.opacity) {
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
38
|
-
|
|
38
|
+
updateAnimation(particle, particle.opacity, true, particle.options.opacity.animation.destroy, delta);
|
|
39
39
|
}
|
|
40
40
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/updater-opacity",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "tsParticles particles opacity 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-opacity [
|
|
6
|
+
<title>@tsparticles/updater-opacity [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+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|
|
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.opacity.js","isAsset":true,"statSize":
|
|
34
|
+
window.chartData = [{"label":"tsparticles.updater.opacity.js","isAsset":true,"statSize":1653,"parsedSize":5463,"gzipSize":1770,"groups":[{"label":"dist/browser","path":"./dist/browser","statSize":1611,"groups":[{"id":730,"label":"index.js + 1 modules (concatenated)","path":"./dist/browser/index.js + 1 modules (concatenated)","statSize":1611,"parsedSize":5463,"gzipSize":1770,"concatenated":true,"groups":[{"label":"dist/browser","path":"./dist/browser/index.js + 1 modules (concatenated)/dist/browser","statSize":1611,"groups":[{"id":null,"label":"index.js","path":"./dist/browser/index.js + 1 modules (concatenated)/dist/browser/index.js","statSize":221,"parsedSize":749,"gzipSize":242,"inaccurateSizes":true},{"id":null,"label":"OpacityUpdater.js","path":"./dist/browser/index.js + 1 modules (concatenated)/dist/browser/OpacityUpdater.js","statSize":1390,"parsedSize":4713,"gzipSize":1527,"inaccurateSizes":true}],"parsedSize":5463,"gzipSize":1770,"inaccurateSizes":true}]}],"parsedSize":5463,"gzipSize":1770},{"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.opacity":true}}];
|
|
35
35
|
window.entrypoints = ["tsparticles.updater.opacity","tsparticles.updater.opacity.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,91 +96,27 @@ __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 checkDestroy(particle, value, minValue, maxValue) {
|
|
102
|
-
switch (particle.options.opacity.animation.destroy) {
|
|
103
|
-
case "max":
|
|
104
|
-
if (value >= maxValue) {
|
|
105
|
-
particle.destroy();
|
|
106
|
-
}
|
|
107
|
-
break;
|
|
108
|
-
case "min":
|
|
109
|
-
if (value <= minValue) {
|
|
110
|
-
particle.destroy();
|
|
111
|
-
}
|
|
112
|
-
break;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
function updateOpacity(particle, delta) {
|
|
116
|
-
const data = particle.opacity;
|
|
117
|
-
if (particle.destroyed || !data?.enable || (data.maxLoops ?? 0) > 0 && (data.loops ?? 0) > (data.maxLoops ?? 0)) {
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
const minValue = data.min,
|
|
121
|
-
maxValue = data.max,
|
|
122
|
-
decay = data.decay ?? 1;
|
|
123
|
-
if (!data.time) {
|
|
124
|
-
data.time = 0;
|
|
125
|
-
}
|
|
126
|
-
if ((data.delayTime ?? 0) > 0 && data.time < (data.delayTime ?? 0)) {
|
|
127
|
-
data.time += delta.value;
|
|
128
|
-
}
|
|
129
|
-
if ((data.delayTime ?? 0) > 0 && data.time < (data.delayTime ?? 0)) {
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
switch (data.status) {
|
|
133
|
-
case "increasing":
|
|
134
|
-
if (data.value >= maxValue) {
|
|
135
|
-
data.status = "decreasing";
|
|
136
|
-
if (!data.loops) {
|
|
137
|
-
data.loops = 0;
|
|
138
|
-
}
|
|
139
|
-
data.loops++;
|
|
140
|
-
} else {
|
|
141
|
-
data.value += (data.velocity ?? 0) * delta.factor;
|
|
142
|
-
}
|
|
143
|
-
break;
|
|
144
|
-
case "decreasing":
|
|
145
|
-
if (data.value <= minValue) {
|
|
146
|
-
data.status = "increasing";
|
|
147
|
-
if (!data.loops) {
|
|
148
|
-
data.loops = 0;
|
|
149
|
-
}
|
|
150
|
-
data.loops++;
|
|
151
|
-
} else {
|
|
152
|
-
data.value -= (data.velocity ?? 0) * delta.factor;
|
|
153
|
-
}
|
|
154
|
-
break;
|
|
155
|
-
}
|
|
156
|
-
if (data.velocity && data.decay !== 1) {
|
|
157
|
-
data.velocity *= decay;
|
|
158
|
-
}
|
|
159
|
-
checkDestroy(particle, data.value, minValue, maxValue);
|
|
160
|
-
if (!particle.destroyed) {
|
|
161
|
-
data.value = (0,engine_root_window_.clamp)(data.value, minValue, maxValue);
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
99
|
;// CONCATENATED MODULE: ./dist/browser/OpacityUpdater.js
|
|
165
100
|
|
|
166
|
-
|
|
167
101
|
class OpacityUpdater {
|
|
168
102
|
constructor(container) {
|
|
169
103
|
this.container = container;
|
|
170
104
|
}
|
|
171
105
|
init(particle) {
|
|
172
|
-
const opacityOptions = particle.options.opacity
|
|
173
|
-
|
|
106
|
+
const opacityOptions = particle.options.opacity,
|
|
107
|
+
pxRatio = 1;
|
|
108
|
+
particle.opacity = (0,engine_root_window_.initParticleNumericAnimationValue)(opacityOptions, pxRatio);
|
|
174
109
|
const opacityAnimation = opacityOptions.animation;
|
|
175
110
|
if (opacityAnimation.enable) {
|
|
176
|
-
particle.opacity.velocity = (0,engine_root_window_.getRangeValue)(opacityAnimation.speed) /
|
|
111
|
+
particle.opacity.velocity = (0,engine_root_window_.getRangeValue)(opacityAnimation.speed) / engine_root_window_.percentDenominator * this.container.retina.reduceFactor;
|
|
177
112
|
if (!opacityAnimation.sync) {
|
|
178
113
|
particle.opacity.velocity *= (0,engine_root_window_.getRandom)();
|
|
179
114
|
}
|
|
180
115
|
}
|
|
181
116
|
}
|
|
182
117
|
isEnabled(particle) {
|
|
183
|
-
|
|
118
|
+
const none = 0;
|
|
119
|
+
return !particle.destroyed && !particle.spawning && !!particle.opacity && particle.opacity.enable && ((particle.opacity.maxLoops ?? none) <= none || (particle.opacity.maxLoops ?? none) > none && (particle.opacity.loops ?? none) < (particle.opacity.maxLoops ?? none));
|
|
184
120
|
}
|
|
185
121
|
reset(particle) {
|
|
186
122
|
if (particle.opacity) {
|
|
@@ -189,10 +125,10 @@ class OpacityUpdater {
|
|
|
189
125
|
}
|
|
190
126
|
}
|
|
191
127
|
update(particle, delta) {
|
|
192
|
-
if (!this.isEnabled(particle)) {
|
|
128
|
+
if (!this.isEnabled(particle) || !particle.opacity) {
|
|
193
129
|
return;
|
|
194
130
|
}
|
|
195
|
-
|
|
131
|
+
(0,engine_root_window_.updateAnimation)(particle, particle.opacity, true, particle.options.opacity.animation.destroy, delta);
|
|
196
132
|
}
|
|
197
133
|
}
|
|
198
134
|
;// CONCATENATED MODULE: ./dist/browser/index.js
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see tsparticles.updater.opacity.min.js.LICENSE.txt */
|
|
2
|
-
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],t);else{var o="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var
|
|
2
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],t);else{var o="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var i in o)("object"==typeof exports?exports:e)[i]=o[i]}}(this,(e=>(()=>{"use strict";var t={533:t=>{t.exports=e}},o={};function i(e){var a=o[e];if(void 0!==a)return a.exports;var n=o[e]={exports:{}};return t[e](n,n.exports,i),n.exports}i.d=(e,t)=>{for(var o in t)i.o(t,o)&&!i.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};return(()=>{i.r(a),i.d(a,{loadOpacityUpdater:()=>o});var e=i(533);class t{constructor(e){this.container=e}init(t){const o=t.options.opacity;t.opacity=(0,e.initParticleNumericAnimationValue)(o,1);const i=o.animation;i.enable&&(t.opacity.velocity=(0,e.getRangeValue)(i.speed)/e.percentDenominator*this.container.retina.reduceFactor,i.sync||(t.opacity.velocity*=(0,e.getRandom)()))}isEnabled(e){return!e.destroyed&&!e.spawning&&!!e.opacity&&e.opacity.enable&&((e.opacity.maxLoops??0)<=0||(e.opacity.maxLoops??0)>0&&(e.opacity.loops??0)<(e.opacity.maxLoops??0))}reset(e){e.opacity&&(e.opacity.time=0,e.opacity.loops=0)}update(t,o){this.isEnabled(t)&&t.opacity&&(0,e.updateAnimation)(t,t.opacity,!0,t.options.opacity.animation.destroy,o)}}async function o(e,o=!0){await e.addParticleUpdater("opacity",(e=>new t(e)),o)}})(),a})()));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
/*! tsParticles Opacity Updater v3.0
|
|
1
|
+
/*! tsParticles Opacity Updater v3.1.0 by Matteo Bruni */
|
package/umd/OpacityUpdater.js
CHANGED
|
@@ -4,38 +4,38 @@
|
|
|
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.OpacityUpdater = void 0;
|
|
13
13
|
const engine_1 = require("@tsparticles/engine");
|
|
14
|
-
const Utils_js_1 = require("./Utils.js");
|
|
15
14
|
class OpacityUpdater {
|
|
16
15
|
constructor(container) {
|
|
17
16
|
this.container = container;
|
|
18
17
|
}
|
|
19
18
|
init(particle) {
|
|
20
|
-
const opacityOptions = particle.options.opacity;
|
|
21
|
-
particle.opacity = (0, engine_1.initParticleNumericAnimationValue)(opacityOptions,
|
|
19
|
+
const opacityOptions = particle.options.opacity, pxRatio = 1;
|
|
20
|
+
particle.opacity = (0, engine_1.initParticleNumericAnimationValue)(opacityOptions, pxRatio);
|
|
22
21
|
const opacityAnimation = opacityOptions.animation;
|
|
23
22
|
if (opacityAnimation.enable) {
|
|
24
23
|
particle.opacity.velocity =
|
|
25
|
-
((0, engine_1.getRangeValue)(opacityAnimation.speed) /
|
|
24
|
+
((0, engine_1.getRangeValue)(opacityAnimation.speed) / engine_1.percentDenominator) * this.container.retina.reduceFactor;
|
|
26
25
|
if (!opacityAnimation.sync) {
|
|
27
26
|
particle.opacity.velocity *= (0, engine_1.getRandom)();
|
|
28
27
|
}
|
|
29
28
|
}
|
|
30
29
|
}
|
|
31
30
|
isEnabled(particle) {
|
|
31
|
+
const none = 0;
|
|
32
32
|
return (!particle.destroyed &&
|
|
33
33
|
!particle.spawning &&
|
|
34
34
|
!!particle.opacity &&
|
|
35
35
|
particle.opacity.enable &&
|
|
36
|
-
((particle.opacity.maxLoops ??
|
|
37
|
-
((particle.opacity.maxLoops ??
|
|
38
|
-
(particle.opacity.loops ??
|
|
36
|
+
((particle.opacity.maxLoops ?? none) <= none ||
|
|
37
|
+
((particle.opacity.maxLoops ?? none) > none &&
|
|
38
|
+
(particle.opacity.loops ?? none) < (particle.opacity.maxLoops ?? none))));
|
|
39
39
|
}
|
|
40
40
|
reset(particle) {
|
|
41
41
|
if (particle.opacity) {
|
|
@@ -44,10 +44,10 @@
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
update(particle, delta) {
|
|
47
|
-
if (!this.isEnabled(particle)) {
|
|
47
|
+
if (!this.isEnabled(particle) || !particle.opacity) {
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
50
|
-
(0,
|
|
50
|
+
(0, engine_1.updateAnimation)(particle, particle.opacity, true, particle.options.opacity.animation.destroy, delta);
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
exports.OpacityUpdater = OpacityUpdater;
|
package/browser/Utils.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { clamp } from "@tsparticles/engine";
|
|
2
|
-
function checkDestroy(particle, value, minValue, maxValue) {
|
|
3
|
-
switch (particle.options.opacity.animation.destroy) {
|
|
4
|
-
case "max":
|
|
5
|
-
if (value >= maxValue) {
|
|
6
|
-
particle.destroy();
|
|
7
|
-
}
|
|
8
|
-
break;
|
|
9
|
-
case "min":
|
|
10
|
-
if (value <= minValue) {
|
|
11
|
-
particle.destroy();
|
|
12
|
-
}
|
|
13
|
-
break;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
export function updateOpacity(particle, delta) {
|
|
17
|
-
const data = particle.opacity;
|
|
18
|
-
if (particle.destroyed || !data?.enable || ((data.maxLoops ?? 0) > 0 && (data.loops ?? 0) > (data.maxLoops ?? 0))) {
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
const minValue = data.min, maxValue = data.max, decay = data.decay ?? 1;
|
|
22
|
-
if (!data.time) {
|
|
23
|
-
data.time = 0;
|
|
24
|
-
}
|
|
25
|
-
if ((data.delayTime ?? 0) > 0 && data.time < (data.delayTime ?? 0)) {
|
|
26
|
-
data.time += delta.value;
|
|
27
|
-
}
|
|
28
|
-
if ((data.delayTime ?? 0) > 0 && data.time < (data.delayTime ?? 0)) {
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
switch (data.status) {
|
|
32
|
-
case "increasing":
|
|
33
|
-
if (data.value >= maxValue) {
|
|
34
|
-
data.status = "decreasing";
|
|
35
|
-
if (!data.loops) {
|
|
36
|
-
data.loops = 0;
|
|
37
|
-
}
|
|
38
|
-
data.loops++;
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
data.value += (data.velocity ?? 0) * delta.factor;
|
|
42
|
-
}
|
|
43
|
-
break;
|
|
44
|
-
case "decreasing":
|
|
45
|
-
if (data.value <= minValue) {
|
|
46
|
-
data.status = "increasing";
|
|
47
|
-
if (!data.loops) {
|
|
48
|
-
data.loops = 0;
|
|
49
|
-
}
|
|
50
|
-
data.loops++;
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
data.value -= (data.velocity ?? 0) * delta.factor;
|
|
54
|
-
}
|
|
55
|
-
break;
|
|
56
|
-
}
|
|
57
|
-
if (data.velocity && data.decay !== 1) {
|
|
58
|
-
data.velocity *= decay;
|
|
59
|
-
}
|
|
60
|
-
checkDestroy(particle, data.value, minValue, maxValue);
|
|
61
|
-
if (!particle.destroyed) {
|
|
62
|
-
data.value = clamp(data.value, minValue, maxValue);
|
|
63
|
-
}
|
|
64
|
-
}
|
package/cjs/Utils.js
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updateOpacity = void 0;
|
|
4
|
-
const engine_1 = require("@tsparticles/engine");
|
|
5
|
-
function checkDestroy(particle, value, minValue, maxValue) {
|
|
6
|
-
switch (particle.options.opacity.animation.destroy) {
|
|
7
|
-
case "max":
|
|
8
|
-
if (value >= maxValue) {
|
|
9
|
-
particle.destroy();
|
|
10
|
-
}
|
|
11
|
-
break;
|
|
12
|
-
case "min":
|
|
13
|
-
if (value <= minValue) {
|
|
14
|
-
particle.destroy();
|
|
15
|
-
}
|
|
16
|
-
break;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
function updateOpacity(particle, delta) {
|
|
20
|
-
const data = particle.opacity;
|
|
21
|
-
if (particle.destroyed || !data?.enable || ((data.maxLoops ?? 0) > 0 && (data.loops ?? 0) > (data.maxLoops ?? 0))) {
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
const minValue = data.min, maxValue = data.max, decay = data.decay ?? 1;
|
|
25
|
-
if (!data.time) {
|
|
26
|
-
data.time = 0;
|
|
27
|
-
}
|
|
28
|
-
if ((data.delayTime ?? 0) > 0 && data.time < (data.delayTime ?? 0)) {
|
|
29
|
-
data.time += delta.value;
|
|
30
|
-
}
|
|
31
|
-
if ((data.delayTime ?? 0) > 0 && data.time < (data.delayTime ?? 0)) {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
switch (data.status) {
|
|
35
|
-
case "increasing":
|
|
36
|
-
if (data.value >= maxValue) {
|
|
37
|
-
data.status = "decreasing";
|
|
38
|
-
if (!data.loops) {
|
|
39
|
-
data.loops = 0;
|
|
40
|
-
}
|
|
41
|
-
data.loops++;
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
data.value += (data.velocity ?? 0) * delta.factor;
|
|
45
|
-
}
|
|
46
|
-
break;
|
|
47
|
-
case "decreasing":
|
|
48
|
-
if (data.value <= minValue) {
|
|
49
|
-
data.status = "increasing";
|
|
50
|
-
if (!data.loops) {
|
|
51
|
-
data.loops = 0;
|
|
52
|
-
}
|
|
53
|
-
data.loops++;
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
data.value -= (data.velocity ?? 0) * delta.factor;
|
|
57
|
-
}
|
|
58
|
-
break;
|
|
59
|
-
}
|
|
60
|
-
if (data.velocity && data.decay !== 1) {
|
|
61
|
-
data.velocity *= decay;
|
|
62
|
-
}
|
|
63
|
-
checkDestroy(particle, data.value, minValue, maxValue);
|
|
64
|
-
if (!particle.destroyed) {
|
|
65
|
-
data.value = (0, engine_1.clamp)(data.value, minValue, maxValue);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
exports.updateOpacity = updateOpacity;
|
package/esm/Utils.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { clamp } from "@tsparticles/engine";
|
|
2
|
-
function checkDestroy(particle, value, minValue, maxValue) {
|
|
3
|
-
switch (particle.options.opacity.animation.destroy) {
|
|
4
|
-
case "max":
|
|
5
|
-
if (value >= maxValue) {
|
|
6
|
-
particle.destroy();
|
|
7
|
-
}
|
|
8
|
-
break;
|
|
9
|
-
case "min":
|
|
10
|
-
if (value <= minValue) {
|
|
11
|
-
particle.destroy();
|
|
12
|
-
}
|
|
13
|
-
break;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
export function updateOpacity(particle, delta) {
|
|
17
|
-
const data = particle.opacity;
|
|
18
|
-
if (particle.destroyed || !data?.enable || ((data.maxLoops ?? 0) > 0 && (data.loops ?? 0) > (data.maxLoops ?? 0))) {
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
const minValue = data.min, maxValue = data.max, decay = data.decay ?? 1;
|
|
22
|
-
if (!data.time) {
|
|
23
|
-
data.time = 0;
|
|
24
|
-
}
|
|
25
|
-
if ((data.delayTime ?? 0) > 0 && data.time < (data.delayTime ?? 0)) {
|
|
26
|
-
data.time += delta.value;
|
|
27
|
-
}
|
|
28
|
-
if ((data.delayTime ?? 0) > 0 && data.time < (data.delayTime ?? 0)) {
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
switch (data.status) {
|
|
32
|
-
case "increasing":
|
|
33
|
-
if (data.value >= maxValue) {
|
|
34
|
-
data.status = "decreasing";
|
|
35
|
-
if (!data.loops) {
|
|
36
|
-
data.loops = 0;
|
|
37
|
-
}
|
|
38
|
-
data.loops++;
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
data.value += (data.velocity ?? 0) * delta.factor;
|
|
42
|
-
}
|
|
43
|
-
break;
|
|
44
|
-
case "decreasing":
|
|
45
|
-
if (data.value <= minValue) {
|
|
46
|
-
data.status = "increasing";
|
|
47
|
-
if (!data.loops) {
|
|
48
|
-
data.loops = 0;
|
|
49
|
-
}
|
|
50
|
-
data.loops++;
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
data.value -= (data.velocity ?? 0) * delta.factor;
|
|
54
|
-
}
|
|
55
|
-
break;
|
|
56
|
-
}
|
|
57
|
-
if (data.velocity && data.decay !== 1) {
|
|
58
|
-
data.velocity *= decay;
|
|
59
|
-
}
|
|
60
|
-
checkDestroy(particle, data.value, minValue, maxValue);
|
|
61
|
-
if (!particle.destroyed) {
|
|
62
|
-
data.value = clamp(data.value, minValue, maxValue);
|
|
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.updateOpacity = void 0;
|
|
13
|
-
const engine_1 = require("@tsparticles/engine");
|
|
14
|
-
function checkDestroy(particle, value, minValue, maxValue) {
|
|
15
|
-
switch (particle.options.opacity.animation.destroy) {
|
|
16
|
-
case "max":
|
|
17
|
-
if (value >= maxValue) {
|
|
18
|
-
particle.destroy();
|
|
19
|
-
}
|
|
20
|
-
break;
|
|
21
|
-
case "min":
|
|
22
|
-
if (value <= minValue) {
|
|
23
|
-
particle.destroy();
|
|
24
|
-
}
|
|
25
|
-
break;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
function updateOpacity(particle, delta) {
|
|
29
|
-
const data = particle.opacity;
|
|
30
|
-
if (particle.destroyed || !data?.enable || ((data.maxLoops ?? 0) > 0 && (data.loops ?? 0) > (data.maxLoops ?? 0))) {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
const minValue = data.min, maxValue = data.max, decay = data.decay ?? 1;
|
|
34
|
-
if (!data.time) {
|
|
35
|
-
data.time = 0;
|
|
36
|
-
}
|
|
37
|
-
if ((data.delayTime ?? 0) > 0 && data.time < (data.delayTime ?? 0)) {
|
|
38
|
-
data.time += delta.value;
|
|
39
|
-
}
|
|
40
|
-
if ((data.delayTime ?? 0) > 0 && data.time < (data.delayTime ?? 0)) {
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
switch (data.status) {
|
|
44
|
-
case "increasing":
|
|
45
|
-
if (data.value >= maxValue) {
|
|
46
|
-
data.status = "decreasing";
|
|
47
|
-
if (!data.loops) {
|
|
48
|
-
data.loops = 0;
|
|
49
|
-
}
|
|
50
|
-
data.loops++;
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
data.value += (data.velocity ?? 0) * delta.factor;
|
|
54
|
-
}
|
|
55
|
-
break;
|
|
56
|
-
case "decreasing":
|
|
57
|
-
if (data.value <= minValue) {
|
|
58
|
-
data.status = "increasing";
|
|
59
|
-
if (!data.loops) {
|
|
60
|
-
data.loops = 0;
|
|
61
|
-
}
|
|
62
|
-
data.loops++;
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
data.value -= (data.velocity ?? 0) * delta.factor;
|
|
66
|
-
}
|
|
67
|
-
break;
|
|
68
|
-
}
|
|
69
|
-
if (data.velocity && data.decay !== 1) {
|
|
70
|
-
data.velocity *= decay;
|
|
71
|
-
}
|
|
72
|
-
checkDestroy(particle, data.value, minValue, maxValue);
|
|
73
|
-
if (!particle.destroyed) {
|
|
74
|
-
data.value = (0, engine_1.clamp)(data.value, minValue, maxValue);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
exports.updateOpacity = updateOpacity;
|
|
78
|
-
});
|