@tsparticles/updater-gradient 3.0.0-alpha.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/LICENSE +21 -0
- package/README.md +70 -0
- package/browser/GradientUpdater.js +227 -0
- package/browser/Options/Classes/AnimatableGradient.js +25 -0
- package/browser/Options/Classes/AnimatableGradientColor.js +26 -0
- package/browser/Options/Classes/GradientAngle.js +20 -0
- package/browser/Options/Classes/GradientAngleAnimation.js +30 -0
- package/browser/Options/Classes/GradientColorOpacity.js +17 -0
- package/browser/Options/Classes/GradientColorOpacityAnimation.js +31 -0
- package/browser/Options/Interfaces/Gradients.js +1 -0
- package/browser/Options/Interfaces/IAnimatableGradient.js +1 -0
- package/browser/Options/Interfaces/IOptionsGradient.js +1 -0
- package/browser/index.js +4 -0
- package/cjs/GradientUpdater.js +231 -0
- package/cjs/Options/Classes/AnimatableGradient.js +29 -0
- package/cjs/Options/Classes/AnimatableGradientColor.js +30 -0
- package/cjs/Options/Classes/GradientAngle.js +24 -0
- package/cjs/Options/Classes/GradientAngleAnimation.js +34 -0
- package/cjs/Options/Classes/GradientColorOpacity.js +21 -0
- package/cjs/Options/Classes/GradientColorOpacityAnimation.js +35 -0
- package/cjs/Options/Interfaces/Gradients.js +2 -0
- package/cjs/Options/Interfaces/IAnimatableGradient.js +2 -0
- package/cjs/Options/Interfaces/IOptionsGradient.js +2 -0
- package/cjs/index.js +8 -0
- package/esm/GradientUpdater.js +227 -0
- package/esm/Options/Classes/AnimatableGradient.js +25 -0
- package/esm/Options/Classes/AnimatableGradientColor.js +26 -0
- package/esm/Options/Classes/GradientAngle.js +20 -0
- package/esm/Options/Classes/GradientAngleAnimation.js +30 -0
- package/esm/Options/Classes/GradientColorOpacity.js +17 -0
- package/esm/Options/Classes/GradientColorOpacityAnimation.js +31 -0
- package/esm/Options/Interfaces/Gradients.js +1 -0
- package/esm/Options/Interfaces/IAnimatableGradient.js +1 -0
- package/esm/Options/Interfaces/IOptionsGradient.js +1 -0
- package/esm/index.js +4 -0
- package/package.json +92 -0
- package/report.html +39 -0
- package/tsparticles.updater.gradient.js +486 -0
- package/tsparticles.updater.gradient.min.js +2 -0
- package/tsparticles.updater.gradient.min.js.LICENSE.txt +8 -0
- package/types/GradientUpdater.d.ts +32 -0
- package/types/Options/Classes/AnimatableGradient.d.ts +12 -0
- package/types/Options/Classes/AnimatableGradientColor.d.ts +11 -0
- package/types/Options/Classes/GradientAngle.d.ts +11 -0
- package/types/Options/Classes/GradientAngleAnimation.d.ts +10 -0
- package/types/Options/Classes/GradientColorOpacity.d.ts +10 -0
- package/types/Options/Classes/GradientColorOpacityAnimation.d.ts +13 -0
- package/types/Options/Interfaces/Gradients.d.ts +18 -0
- package/types/Options/Interfaces/IAnimatableGradient.d.ts +7 -0
- package/types/Options/Interfaces/IOptionsGradient.d.ts +10 -0
- package/types/index.d.ts +2 -0
- package/umd/GradientUpdater.js +241 -0
- package/umd/Options/Classes/AnimatableGradient.js +39 -0
- package/umd/Options/Classes/AnimatableGradientColor.js +40 -0
- package/umd/Options/Classes/GradientAngle.js +34 -0
- package/umd/Options/Classes/GradientAngleAnimation.js +44 -0
- package/umd/Options/Classes/GradientColorOpacity.js +31 -0
- package/umd/Options/Classes/GradientColorOpacityAnimation.js +45 -0
- package/umd/Options/Interfaces/Gradients.js +12 -0
- package/umd/Options/Interfaces/IAnimatableGradient.js +12 -0
- package/umd/Options/Interfaces/IOptionsGradient.js +12 -0
- package/umd/index.js +18 -0
|
@@ -0,0 +1,241 @@
|
|
|
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", "./Options/Classes/AnimatableGradient"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.GradientUpdater = void 0;
|
|
13
|
+
const engine_1 = require("@tsparticles/engine");
|
|
14
|
+
const AnimatableGradient_1 = require("./Options/Classes/AnimatableGradient");
|
|
15
|
+
function updateColorOpacity(delta, value) {
|
|
16
|
+
var _a, _b, _c;
|
|
17
|
+
if (!value.enable) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const decay = (_a = value.decay) !== null && _a !== void 0 ? _a : 1;
|
|
21
|
+
switch (value.status) {
|
|
22
|
+
case "increasing":
|
|
23
|
+
if (value.value >= value.max) {
|
|
24
|
+
value.status = "decreasing";
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
value.value += ((_b = value.velocity) !== null && _b !== void 0 ? _b : 0) * delta.factor;
|
|
28
|
+
}
|
|
29
|
+
break;
|
|
30
|
+
case "decreasing":
|
|
31
|
+
if (value.value <= value.min) {
|
|
32
|
+
value.status = "increasing";
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
value.value -= ((_c = value.velocity) !== null && _c !== void 0 ? _c : 0) * delta.factor;
|
|
36
|
+
}
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
if (value.velocity && decay !== 1) {
|
|
40
|
+
value.velocity *= decay;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function updateColorValue(delta, value, max, decrease) {
|
|
44
|
+
var _a, _b;
|
|
45
|
+
const colorValue = value;
|
|
46
|
+
if (!colorValue || !colorValue.enable) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const velocity = ((_a = value.velocity) !== null && _a !== void 0 ? _a : 0) * delta.factor, decay = (_b = value.decay) !== null && _b !== void 0 ? _b : 1;
|
|
50
|
+
if (!decrease || colorValue.status === "increasing") {
|
|
51
|
+
colorValue.value += velocity;
|
|
52
|
+
if (decrease && colorValue.value > max) {
|
|
53
|
+
colorValue.status = "decreasing";
|
|
54
|
+
colorValue.value -= colorValue.value % max;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
colorValue.value -= velocity;
|
|
59
|
+
if (colorValue.value < 0) {
|
|
60
|
+
colorValue.status = "increasing";
|
|
61
|
+
colorValue.value += colorValue.value;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
if (colorValue.value > max) {
|
|
65
|
+
colorValue.value %= max;
|
|
66
|
+
}
|
|
67
|
+
if (value.velocity && decay !== 1) {
|
|
68
|
+
value.velocity *= decay;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
function updateAngle(delta, angle) {
|
|
72
|
+
var _a, _b;
|
|
73
|
+
const speed = ((_a = angle.velocity) !== null && _a !== void 0 ? _a : 0) * delta.factor, max = 2 * Math.PI, decay = (_b = angle.decay) !== null && _b !== void 0 ? _b : 1;
|
|
74
|
+
if (!angle.enable) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
switch (angle.status) {
|
|
78
|
+
case "increasing":
|
|
79
|
+
angle.value += speed;
|
|
80
|
+
if (angle.value > max) {
|
|
81
|
+
angle.value -= max;
|
|
82
|
+
}
|
|
83
|
+
break;
|
|
84
|
+
case "decreasing":
|
|
85
|
+
default:
|
|
86
|
+
angle.value -= speed;
|
|
87
|
+
if (angle.value < 0) {
|
|
88
|
+
angle.value += max;
|
|
89
|
+
}
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
if (angle.velocity && decay !== 1) {
|
|
93
|
+
angle.velocity *= decay;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
function updateGradient(particle, delta) {
|
|
97
|
+
var _a, _b, _c;
|
|
98
|
+
const gradient = particle.gradient;
|
|
99
|
+
if (!gradient) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
updateAngle(delta, gradient.angle);
|
|
103
|
+
for (const color of gradient.colors) {
|
|
104
|
+
if (((_a = particle.color) === null || _a === void 0 ? void 0 : _a.h) !== undefined) {
|
|
105
|
+
updateColorValue(delta, color.value.h, 360, false);
|
|
106
|
+
}
|
|
107
|
+
if (((_b = particle.color) === null || _b === void 0 ? void 0 : _b.s) !== undefined) {
|
|
108
|
+
updateColorValue(delta, color.value.s, 100, true);
|
|
109
|
+
}
|
|
110
|
+
if (((_c = particle.color) === null || _c === void 0 ? void 0 : _c.l) !== undefined) {
|
|
111
|
+
updateColorValue(delta, color.value.l, 100, true);
|
|
112
|
+
}
|
|
113
|
+
if (color.opacity) {
|
|
114
|
+
updateColorOpacity(delta, color.opacity);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
class GradientUpdater {
|
|
119
|
+
getColorStyles(particle, context, radius, opacity) {
|
|
120
|
+
var _a, _b;
|
|
121
|
+
const gradient = particle.gradient;
|
|
122
|
+
if (!gradient) {
|
|
123
|
+
return {};
|
|
124
|
+
}
|
|
125
|
+
const gradientAngle = gradient.angle.value, fillGradient = gradient.type === "radial"
|
|
126
|
+
? context.createRadialGradient(0, 0, 0, 0, 0, radius)
|
|
127
|
+
: context.createLinearGradient(Math.cos(gradientAngle) * -radius, Math.sin(gradientAngle) * -radius, Math.cos(gradientAngle) * radius, Math.sin(gradientAngle) * radius);
|
|
128
|
+
for (const color of gradient.colors) {
|
|
129
|
+
fillGradient.addColorStop(color.stop, (0, engine_1.getStyleFromHsl)({
|
|
130
|
+
h: color.value.h.value,
|
|
131
|
+
s: color.value.s.value,
|
|
132
|
+
l: color.value.l.value,
|
|
133
|
+
}, (_b = (_a = color.opacity) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : opacity));
|
|
134
|
+
}
|
|
135
|
+
return { fill: fillGradient };
|
|
136
|
+
}
|
|
137
|
+
init(particle) {
|
|
138
|
+
const gradient = (0, engine_1.itemFromSingleOrMultiple)(particle.options.gradient);
|
|
139
|
+
if (!gradient) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
particle.gradient = {
|
|
143
|
+
angle: {
|
|
144
|
+
value: gradient.angle.value,
|
|
145
|
+
enable: gradient.angle.animation.enable,
|
|
146
|
+
velocity: ((0, engine_1.getRangeValue)(gradient.angle.animation.speed) / 360) * particle.container.retina.reduceFactor,
|
|
147
|
+
decay: 1 - (0, engine_1.getRangeValue)(gradient.angle.animation.decay),
|
|
148
|
+
},
|
|
149
|
+
type: gradient.type,
|
|
150
|
+
colors: [],
|
|
151
|
+
};
|
|
152
|
+
let rotateDirection = gradient.angle.direction;
|
|
153
|
+
if (rotateDirection === "random") {
|
|
154
|
+
const index = Math.floor((0, engine_1.getRandom)() * 2);
|
|
155
|
+
rotateDirection = index > 0 ? "counter-clockwise" : "clockwise";
|
|
156
|
+
}
|
|
157
|
+
switch (rotateDirection) {
|
|
158
|
+
case "counter-clockwise":
|
|
159
|
+
case "counterClockwise":
|
|
160
|
+
particle.gradient.angle.status = "decreasing";
|
|
161
|
+
break;
|
|
162
|
+
case "clockwise":
|
|
163
|
+
particle.gradient.angle.status = "increasing";
|
|
164
|
+
break;
|
|
165
|
+
}
|
|
166
|
+
const reduceDuplicates = particle.options.reduceDuplicates;
|
|
167
|
+
for (const grColor of gradient.colors) {
|
|
168
|
+
const grHslColor = (0, engine_1.rangeColorToHsl)(grColor.value, particle.id, reduceDuplicates);
|
|
169
|
+
if (!grHslColor) {
|
|
170
|
+
continue;
|
|
171
|
+
}
|
|
172
|
+
const grHslAnimation = (0, engine_1.getHslAnimationFromHsl)(grHslColor, grColor.value.animation, particle.container.retina.reduceFactor), addColor = {
|
|
173
|
+
stop: grColor.stop,
|
|
174
|
+
value: grHslAnimation,
|
|
175
|
+
opacity: grColor.opacity
|
|
176
|
+
? {
|
|
177
|
+
enable: grColor.opacity.animation.enable,
|
|
178
|
+
max: (0, engine_1.getRangeMax)(grColor.opacity.value),
|
|
179
|
+
min: (0, engine_1.getRangeMin)(grColor.opacity.value),
|
|
180
|
+
status: "increasing",
|
|
181
|
+
value: (0, engine_1.getRangeValue)(grColor.opacity.value),
|
|
182
|
+
velocity: ((0, engine_1.getRangeValue)(grColor.opacity.animation.speed) / 100) *
|
|
183
|
+
particle.container.retina.reduceFactor,
|
|
184
|
+
decay: 1 - (0, engine_1.getRangeValue)(grColor.opacity.animation.decay),
|
|
185
|
+
}
|
|
186
|
+
: undefined,
|
|
187
|
+
};
|
|
188
|
+
if (grColor.opacity && addColor.opacity) {
|
|
189
|
+
const opacityRange = grColor.opacity.value;
|
|
190
|
+
addColor.opacity.min = (0, engine_1.getRangeMin)(opacityRange);
|
|
191
|
+
addColor.opacity.max = (0, engine_1.getRangeMax)(opacityRange);
|
|
192
|
+
const opacityAnimation = grColor.opacity.animation;
|
|
193
|
+
switch (opacityAnimation.startValue) {
|
|
194
|
+
case "min":
|
|
195
|
+
addColor.opacity.value = addColor.opacity.min;
|
|
196
|
+
addColor.opacity.status = "increasing";
|
|
197
|
+
break;
|
|
198
|
+
case "random":
|
|
199
|
+
addColor.opacity.value = (0, engine_1.randomInRange)(addColor.opacity);
|
|
200
|
+
addColor.opacity.status =
|
|
201
|
+
(0, engine_1.getRandom)() >= 0.5 ? "increasing" : "decreasing";
|
|
202
|
+
break;
|
|
203
|
+
case "max":
|
|
204
|
+
default:
|
|
205
|
+
addColor.opacity.value = addColor.opacity.max;
|
|
206
|
+
addColor.opacity.status = "decreasing";
|
|
207
|
+
break;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
particle.gradient.colors.push(addColor);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
isEnabled(particle) {
|
|
214
|
+
var _a, _b, _c;
|
|
215
|
+
return (!particle.destroyed &&
|
|
216
|
+
!particle.spawning &&
|
|
217
|
+
(((_a = particle.gradient) === null || _a === void 0 ? void 0 : _a.angle.enable) ||
|
|
218
|
+
((_c = (_b = particle.gradient) === null || _b === void 0 ? void 0 : _b.colors.some((c) => c.value.h.enable || c.value.s.enable || c.value.l.enable)) !== null && _c !== void 0 ? _c : false)));
|
|
219
|
+
}
|
|
220
|
+
loadOptions(options, ...sources) {
|
|
221
|
+
for (const source of sources) {
|
|
222
|
+
if (!(source === null || source === void 0 ? void 0 : source.gradient)) {
|
|
223
|
+
continue;
|
|
224
|
+
}
|
|
225
|
+
const gradientToLoad = source.gradient;
|
|
226
|
+
if (!gradientToLoad) {
|
|
227
|
+
continue;
|
|
228
|
+
}
|
|
229
|
+
options.gradient = (0, engine_1.executeOnSingleOrMultiple)(gradientToLoad, (gradient) => {
|
|
230
|
+
const tmp = new AnimatableGradient_1.AnimatableGradient();
|
|
231
|
+
tmp.load(gradient);
|
|
232
|
+
return tmp;
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
update(particle, delta) {
|
|
237
|
+
updateGradient(particle, delta);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
exports.GradientUpdater = GradientUpdater;
|
|
241
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
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", "./AnimatableGradientColor", "./GradientAngle"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.AnimatableGradient = void 0;
|
|
13
|
+
const AnimatableGradientColor_1 = require("./AnimatableGradientColor");
|
|
14
|
+
const GradientAngle_1 = require("./GradientAngle");
|
|
15
|
+
class AnimatableGradient {
|
|
16
|
+
constructor() {
|
|
17
|
+
this.angle = new GradientAngle_1.GradientAngle();
|
|
18
|
+
this.colors = [];
|
|
19
|
+
this.type = "random";
|
|
20
|
+
}
|
|
21
|
+
load(data) {
|
|
22
|
+
if (!data) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
this.angle.load(data.angle);
|
|
26
|
+
if (data.colors !== undefined) {
|
|
27
|
+
this.colors = data.colors.map((s) => {
|
|
28
|
+
const tmp = new AnimatableGradientColor_1.AnimatableGradientColor();
|
|
29
|
+
tmp.load(s);
|
|
30
|
+
return tmp;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
if (data.type !== undefined) {
|
|
34
|
+
this.type = data.type;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.AnimatableGradient = AnimatableGradient;
|
|
39
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
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", "./GradientColorOpacity"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.AnimatableGradientColor = void 0;
|
|
13
|
+
const engine_1 = require("@tsparticles/engine");
|
|
14
|
+
const GradientColorOpacity_1 = require("./GradientColorOpacity");
|
|
15
|
+
class AnimatableGradientColor {
|
|
16
|
+
constructor() {
|
|
17
|
+
this.stop = 0;
|
|
18
|
+
this.value = new engine_1.AnimatableColor();
|
|
19
|
+
}
|
|
20
|
+
load(data) {
|
|
21
|
+
if (!data) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
if (data.stop !== undefined) {
|
|
25
|
+
this.stop = data.stop;
|
|
26
|
+
}
|
|
27
|
+
this.value = engine_1.AnimatableColor.create(this.value, data.value);
|
|
28
|
+
if (data.opacity !== undefined) {
|
|
29
|
+
this.opacity = new GradientColorOpacity_1.GradientColorOpacity();
|
|
30
|
+
if (typeof data.opacity === "number") {
|
|
31
|
+
this.opacity.value = data.opacity;
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
this.opacity.load(data.opacity);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.AnimatableGradientColor = AnimatableGradientColor;
|
|
40
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
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", "./GradientAngleAnimation"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.GradientAngle = void 0;
|
|
13
|
+
const GradientAngleAnimation_1 = require("./GradientAngleAnimation");
|
|
14
|
+
class GradientAngle {
|
|
15
|
+
constructor() {
|
|
16
|
+
this.value = 0;
|
|
17
|
+
this.animation = new GradientAngleAnimation_1.GradientAngleAnimation();
|
|
18
|
+
this.direction = "clockwise";
|
|
19
|
+
}
|
|
20
|
+
load(data) {
|
|
21
|
+
if (!data) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
this.animation.load(data.animation);
|
|
25
|
+
if (data.value !== undefined) {
|
|
26
|
+
this.value = data.value;
|
|
27
|
+
}
|
|
28
|
+
if (data.direction !== undefined) {
|
|
29
|
+
this.direction = data.direction;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.GradientAngle = GradientAngle;
|
|
34
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
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.GradientAngleAnimation = void 0;
|
|
13
|
+
const engine_1 = require("@tsparticles/engine");
|
|
14
|
+
class GradientAngleAnimation {
|
|
15
|
+
constructor() {
|
|
16
|
+
this.count = 0;
|
|
17
|
+
this.enable = false;
|
|
18
|
+
this.speed = 0;
|
|
19
|
+
this.decay = 0;
|
|
20
|
+
this.sync = false;
|
|
21
|
+
}
|
|
22
|
+
load(data) {
|
|
23
|
+
if (!data) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (data.count !== undefined) {
|
|
27
|
+
this.count = (0, engine_1.setRangeValue)(data.count);
|
|
28
|
+
}
|
|
29
|
+
if (data.enable !== undefined) {
|
|
30
|
+
this.enable = data.enable;
|
|
31
|
+
}
|
|
32
|
+
if (data.speed !== undefined) {
|
|
33
|
+
this.speed = (0, engine_1.setRangeValue)(data.speed);
|
|
34
|
+
}
|
|
35
|
+
if (data.decay !== undefined) {
|
|
36
|
+
this.decay = (0, engine_1.setRangeValue)(data.decay);
|
|
37
|
+
}
|
|
38
|
+
if (data.sync !== undefined) {
|
|
39
|
+
this.sync = data.sync;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.GradientAngleAnimation = GradientAngleAnimation;
|
|
44
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
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", "./GradientColorOpacityAnimation", "@tsparticles/engine"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.GradientColorOpacity = void 0;
|
|
13
|
+
const GradientColorOpacityAnimation_1 = require("./GradientColorOpacityAnimation");
|
|
14
|
+
const engine_1 = require("@tsparticles/engine");
|
|
15
|
+
class GradientColorOpacity {
|
|
16
|
+
constructor() {
|
|
17
|
+
this.value = 0;
|
|
18
|
+
this.animation = new GradientColorOpacityAnimation_1.GradientColorOpacityAnimation();
|
|
19
|
+
}
|
|
20
|
+
load(data) {
|
|
21
|
+
if (!data) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
this.animation.load(data.animation);
|
|
25
|
+
if (data.value !== undefined) {
|
|
26
|
+
this.value = (0, engine_1.setRangeValue)(data.value);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.GradientColorOpacity = GradientColorOpacity;
|
|
31
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
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.GradientColorOpacityAnimation = void 0;
|
|
13
|
+
const engine_1 = require("@tsparticles/engine");
|
|
14
|
+
class GradientColorOpacityAnimation {
|
|
15
|
+
constructor() {
|
|
16
|
+
this.count = 0;
|
|
17
|
+
this.enable = false;
|
|
18
|
+
this.speed = 0;
|
|
19
|
+
this.decay = 0;
|
|
20
|
+
this.sync = false;
|
|
21
|
+
this.startValue = "random";
|
|
22
|
+
}
|
|
23
|
+
load(data) {
|
|
24
|
+
if (!data) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
if (data.count !== undefined) {
|
|
28
|
+
this.count = (0, engine_1.setRangeValue)(data.count);
|
|
29
|
+
}
|
|
30
|
+
if (data.enable !== undefined) {
|
|
31
|
+
this.enable = data.enable;
|
|
32
|
+
}
|
|
33
|
+
if (data.speed !== undefined) {
|
|
34
|
+
this.speed = (0, engine_1.setRangeValue)(data.speed);
|
|
35
|
+
}
|
|
36
|
+
if (data.sync !== undefined) {
|
|
37
|
+
this.sync = data.sync;
|
|
38
|
+
}
|
|
39
|
+
if (data.startValue !== undefined) {
|
|
40
|
+
this.startValue = data.startValue;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.GradientColorOpacityAnimation = GradientColorOpacityAnimation;
|
|
45
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
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"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
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"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
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"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
});
|
package/umd/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
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", "./GradientUpdater"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.loadGradientUpdater = void 0;
|
|
13
|
+
const GradientUpdater_1 = require("./GradientUpdater");
|
|
14
|
+
function loadGradientUpdater(engine) {
|
|
15
|
+
engine.addParticleUpdater("gradient", () => new GradientUpdater_1.GradientUpdater());
|
|
16
|
+
}
|
|
17
|
+
exports.loadGradientUpdater = loadGradientUpdater;
|
|
18
|
+
});
|