@tsparticles/engine 3.6.0 → 3.7.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/README.md +6 -1
- package/browser/Core/Canvas.js +32 -21
- package/browser/Core/Container.js +1 -1
- package/browser/Core/Engine.js +17 -1
- package/browser/Core/Particle.js +1 -1
- package/browser/Types/EasingFunction.js +1 -0
- package/browser/Utils/ColorUtils.js +25 -45
- package/browser/Utils/NumberUtils.js +1 -10
- package/browser/Utils/Utils.js +6 -0
- package/browser/exports.js +0 -2
- package/browser/init.js +0 -6
- package/cjs/Core/Canvas.js +32 -21
- package/cjs/Core/Container.js +1 -1
- package/cjs/Core/Engine.js +17 -1
- package/cjs/Core/Particle.js +1 -1
- package/cjs/Types/EasingFunction.js +2 -0
- package/cjs/Utils/ColorUtils.js +25 -46
- package/cjs/Utils/NumberUtils.js +1 -12
- package/cjs/Utils/Utils.js +7 -0
- package/cjs/exports.js +0 -2
- package/cjs/init.js +0 -6
- package/esm/Core/Canvas.js +32 -21
- package/esm/Core/Container.js +1 -1
- package/esm/Core/Engine.js +17 -1
- package/esm/Core/Particle.js +1 -1
- package/esm/Types/EasingFunction.js +1 -0
- package/esm/Utils/ColorUtils.js +25 -45
- package/esm/Utils/NumberUtils.js +1 -10
- package/esm/Utils/Utils.js +6 -0
- package/esm/exports.js +0 -2
- package/esm/init.js +0 -6
- package/package.json +1 -1
- package/report.html +1 -1
- package/tsparticles.engine.js +11 -31
- package/tsparticles.engine.min.js +1 -1
- package/tsparticles.engine.min.js.LICENSE.txt +1 -1
- package/types/Core/Canvas.d.ts +4 -1
- package/types/Core/Engine.d.ts +9 -1
- package/types/Types/EasingFunction.d.ts +1 -0
- package/types/Utils/ColorUtils.d.ts +8 -9
- package/types/Utils/NumberUtils.d.ts +0 -5
- package/types/Utils/Utils.d.ts +2 -0
- package/types/exports.d.ts +0 -2
- package/umd/Core/Canvas.js +32 -21
- package/umd/Core/Container.js +1 -1
- package/umd/Core/Engine.js +17 -1
- package/umd/Core/Particle.js +1 -1
- package/umd/Types/EasingFunction.js +12 -0
- package/umd/Utils/ColorUtils.js +25 -46
- package/umd/Utils/NumberUtils.js +1 -12
- package/umd/Utils/Utils.js +7 -0
- package/umd/exports.js +1 -3
- package/umd/init.js +1 -7
- package/browser/Utils/HslColorManager.js +0 -45
- package/browser/Utils/RgbColorManager.js +0 -44
- package/cjs/Utils/HslColorManager.js +0 -49
- package/cjs/Utils/RgbColorManager.js +0 -48
- package/esm/Utils/HslColorManager.js +0 -45
- package/esm/Utils/RgbColorManager.js +0 -44
- package/types/Utils/HslColorManager.d.ts +0 -10
- package/types/Utils/RgbColorManager.d.ts +0 -10
- package/umd/Utils/HslColorManager.js +0 -59
- package/umd/Utils/RgbColorManager.js +0 -58
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { getRangeValue, parseAlpha } from "./NumberUtils.js";
|
|
2
|
-
import { hslToRgb, hslaToRgba } from "./ColorUtils.js";
|
|
3
|
-
var HslIndexes;
|
|
4
|
-
(function (HslIndexes) {
|
|
5
|
-
HslIndexes[HslIndexes["h"] = 1] = "h";
|
|
6
|
-
HslIndexes[HslIndexes["s"] = 2] = "s";
|
|
7
|
-
HslIndexes[HslIndexes["l"] = 3] = "l";
|
|
8
|
-
HslIndexes[HslIndexes["a"] = 5] = "a";
|
|
9
|
-
})(HslIndexes || (HslIndexes = {}));
|
|
10
|
-
export class HslColorManager {
|
|
11
|
-
constructor() {
|
|
12
|
-
this.key = "hsl";
|
|
13
|
-
this.stringPrefix = "hsl";
|
|
14
|
-
}
|
|
15
|
-
handleColor(color) {
|
|
16
|
-
const colorValue = color.value, hslColor = colorValue.hsl ?? color.value;
|
|
17
|
-
if (hslColor.h !== undefined && hslColor.s !== undefined && hslColor.l !== undefined) {
|
|
18
|
-
return hslToRgb(hslColor);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
handleRangeColor(color) {
|
|
22
|
-
const colorValue = color.value, hslColor = colorValue.hsl ?? color.value;
|
|
23
|
-
if (hslColor.h !== undefined && hslColor.l !== undefined) {
|
|
24
|
-
return hslToRgb({
|
|
25
|
-
h: getRangeValue(hslColor.h),
|
|
26
|
-
l: getRangeValue(hslColor.l),
|
|
27
|
-
s: getRangeValue(hslColor.s),
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
parseString(input) {
|
|
32
|
-
if (!input.startsWith("hsl")) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
const regex = /hsla?\(\s*(\d+)\s*[\s,]\s*(\d+)%\s*[\s,]\s*(\d+)%\s*([\s,]\s*(0|1|0?\.\d+|(\d{1,3})%)\s*)?\)/i, result = regex.exec(input), minLength = 4, defaultAlpha = 1, radix = 10;
|
|
36
|
-
return result
|
|
37
|
-
? hslaToRgba({
|
|
38
|
-
a: result.length > minLength ? parseAlpha(result[HslIndexes.a]) : defaultAlpha,
|
|
39
|
-
h: parseInt(result[HslIndexes.h], radix),
|
|
40
|
-
l: parseInt(result[HslIndexes.l], radix),
|
|
41
|
-
s: parseInt(result[HslIndexes.s], radix),
|
|
42
|
-
})
|
|
43
|
-
: undefined;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { getRangeValue, parseAlpha } from "./NumberUtils.js";
|
|
2
|
-
var RgbIndexes;
|
|
3
|
-
(function (RgbIndexes) {
|
|
4
|
-
RgbIndexes[RgbIndexes["r"] = 1] = "r";
|
|
5
|
-
RgbIndexes[RgbIndexes["g"] = 2] = "g";
|
|
6
|
-
RgbIndexes[RgbIndexes["b"] = 3] = "b";
|
|
7
|
-
RgbIndexes[RgbIndexes["a"] = 5] = "a";
|
|
8
|
-
})(RgbIndexes || (RgbIndexes = {}));
|
|
9
|
-
export class RgbColorManager {
|
|
10
|
-
constructor() {
|
|
11
|
-
this.key = "rgb";
|
|
12
|
-
this.stringPrefix = "rgb";
|
|
13
|
-
}
|
|
14
|
-
handleColor(color) {
|
|
15
|
-
const colorValue = color.value, rgbColor = colorValue.rgb ?? color.value;
|
|
16
|
-
if (rgbColor.r !== undefined) {
|
|
17
|
-
return rgbColor;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
handleRangeColor(color) {
|
|
21
|
-
const colorValue = color.value, rgbColor = colorValue.rgb ?? color.value;
|
|
22
|
-
if (rgbColor.r !== undefined) {
|
|
23
|
-
return {
|
|
24
|
-
r: getRangeValue(rgbColor.r),
|
|
25
|
-
g: getRangeValue(rgbColor.g),
|
|
26
|
-
b: getRangeValue(rgbColor.b),
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
parseString(input) {
|
|
31
|
-
if (!input.startsWith(this.stringPrefix)) {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
const regex = /rgba?\(\s*(\d{1,3})\s*[\s,]\s*(\d{1,3})\s*[\s,]\s*(\d{1,3})\s*([\s,]\s*(0|1|0?\.\d+|(\d{1,3})%)\s*)?\)/i, result = regex.exec(input), radix = 10, minLength = 4, defaultAlpha = 1;
|
|
35
|
-
return result
|
|
36
|
-
? {
|
|
37
|
-
a: result.length > minLength ? parseAlpha(result[RgbIndexes.a]) : defaultAlpha,
|
|
38
|
-
b: parseInt(result[RgbIndexes.b], radix),
|
|
39
|
-
g: parseInt(result[RgbIndexes.g], radix),
|
|
40
|
-
r: parseInt(result[RgbIndexes.r], radix),
|
|
41
|
-
}
|
|
42
|
-
: undefined;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { IColor, IRangeColor, IRgb, IRgba } from "../Core/Interfaces/Colors.js";
|
|
2
|
-
import type { IColorManager } from "../Core/Interfaces/IColorManager.js";
|
|
3
|
-
export declare class HslColorManager implements IColorManager {
|
|
4
|
-
readonly key: string;
|
|
5
|
-
readonly stringPrefix: string;
|
|
6
|
-
constructor();
|
|
7
|
-
handleColor(color: IColor): IRgb | undefined;
|
|
8
|
-
handleRangeColor(color: IRangeColor): IRgb | undefined;
|
|
9
|
-
parseString(input: string): IRgba | undefined;
|
|
10
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { IColor, IRangeColor, IRgb, IRgba } from "../Core/Interfaces/Colors.js";
|
|
2
|
-
import type { IColorManager } from "../Core/Interfaces/IColorManager.js";
|
|
3
|
-
export declare class RgbColorManager implements IColorManager {
|
|
4
|
-
readonly key: string;
|
|
5
|
-
readonly stringPrefix: string;
|
|
6
|
-
constructor();
|
|
7
|
-
handleColor(color: IColor): IRgb | undefined;
|
|
8
|
-
handleRangeColor(color: IRangeColor): IRgb | undefined;
|
|
9
|
-
parseString(input: string): IRgba | undefined;
|
|
10
|
-
}
|
|
@@ -1,59 +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", "./NumberUtils.js", "./ColorUtils.js"], factory);
|
|
8
|
-
}
|
|
9
|
-
})(function (require, exports) {
|
|
10
|
-
"use strict";
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.HslColorManager = void 0;
|
|
13
|
-
const NumberUtils_js_1 = require("./NumberUtils.js");
|
|
14
|
-
const ColorUtils_js_1 = require("./ColorUtils.js");
|
|
15
|
-
var HslIndexes;
|
|
16
|
-
(function (HslIndexes) {
|
|
17
|
-
HslIndexes[HslIndexes["h"] = 1] = "h";
|
|
18
|
-
HslIndexes[HslIndexes["s"] = 2] = "s";
|
|
19
|
-
HslIndexes[HslIndexes["l"] = 3] = "l";
|
|
20
|
-
HslIndexes[HslIndexes["a"] = 5] = "a";
|
|
21
|
-
})(HslIndexes || (HslIndexes = {}));
|
|
22
|
-
class HslColorManager {
|
|
23
|
-
constructor() {
|
|
24
|
-
this.key = "hsl";
|
|
25
|
-
this.stringPrefix = "hsl";
|
|
26
|
-
}
|
|
27
|
-
handleColor(color) {
|
|
28
|
-
const colorValue = color.value, hslColor = colorValue.hsl ?? color.value;
|
|
29
|
-
if (hslColor.h !== undefined && hslColor.s !== undefined && hslColor.l !== undefined) {
|
|
30
|
-
return (0, ColorUtils_js_1.hslToRgb)(hslColor);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
handleRangeColor(color) {
|
|
34
|
-
const colorValue = color.value, hslColor = colorValue.hsl ?? color.value;
|
|
35
|
-
if (hslColor.h !== undefined && hslColor.l !== undefined) {
|
|
36
|
-
return (0, ColorUtils_js_1.hslToRgb)({
|
|
37
|
-
h: (0, NumberUtils_js_1.getRangeValue)(hslColor.h),
|
|
38
|
-
l: (0, NumberUtils_js_1.getRangeValue)(hslColor.l),
|
|
39
|
-
s: (0, NumberUtils_js_1.getRangeValue)(hslColor.s),
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
parseString(input) {
|
|
44
|
-
if (!input.startsWith("hsl")) {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
const regex = /hsla?\(\s*(\d+)\s*[\s,]\s*(\d+)%\s*[\s,]\s*(\d+)%\s*([\s,]\s*(0|1|0?\.\d+|(\d{1,3})%)\s*)?\)/i, result = regex.exec(input), minLength = 4, defaultAlpha = 1, radix = 10;
|
|
48
|
-
return result
|
|
49
|
-
? (0, ColorUtils_js_1.hslaToRgba)({
|
|
50
|
-
a: result.length > minLength ? (0, NumberUtils_js_1.parseAlpha)(result[HslIndexes.a]) : defaultAlpha,
|
|
51
|
-
h: parseInt(result[HslIndexes.h], radix),
|
|
52
|
-
l: parseInt(result[HslIndexes.l], radix),
|
|
53
|
-
s: parseInt(result[HslIndexes.s], radix),
|
|
54
|
-
})
|
|
55
|
-
: undefined;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
exports.HslColorManager = HslColorManager;
|
|
59
|
-
});
|
|
@@ -1,58 +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", "./NumberUtils.js"], factory);
|
|
8
|
-
}
|
|
9
|
-
})(function (require, exports) {
|
|
10
|
-
"use strict";
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.RgbColorManager = void 0;
|
|
13
|
-
const NumberUtils_js_1 = require("./NumberUtils.js");
|
|
14
|
-
var RgbIndexes;
|
|
15
|
-
(function (RgbIndexes) {
|
|
16
|
-
RgbIndexes[RgbIndexes["r"] = 1] = "r";
|
|
17
|
-
RgbIndexes[RgbIndexes["g"] = 2] = "g";
|
|
18
|
-
RgbIndexes[RgbIndexes["b"] = 3] = "b";
|
|
19
|
-
RgbIndexes[RgbIndexes["a"] = 5] = "a";
|
|
20
|
-
})(RgbIndexes || (RgbIndexes = {}));
|
|
21
|
-
class RgbColorManager {
|
|
22
|
-
constructor() {
|
|
23
|
-
this.key = "rgb";
|
|
24
|
-
this.stringPrefix = "rgb";
|
|
25
|
-
}
|
|
26
|
-
handleColor(color) {
|
|
27
|
-
const colorValue = color.value, rgbColor = colorValue.rgb ?? color.value;
|
|
28
|
-
if (rgbColor.r !== undefined) {
|
|
29
|
-
return rgbColor;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
handleRangeColor(color) {
|
|
33
|
-
const colorValue = color.value, rgbColor = colorValue.rgb ?? color.value;
|
|
34
|
-
if (rgbColor.r !== undefined) {
|
|
35
|
-
return {
|
|
36
|
-
r: (0, NumberUtils_js_1.getRangeValue)(rgbColor.r),
|
|
37
|
-
g: (0, NumberUtils_js_1.getRangeValue)(rgbColor.g),
|
|
38
|
-
b: (0, NumberUtils_js_1.getRangeValue)(rgbColor.b),
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
parseString(input) {
|
|
43
|
-
if (!input.startsWith(this.stringPrefix)) {
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
const regex = /rgba?\(\s*(\d{1,3})\s*[\s,]\s*(\d{1,3})\s*[\s,]\s*(\d{1,3})\s*([\s,]\s*(0|1|0?\.\d+|(\d{1,3})%)\s*)?\)/i, result = regex.exec(input), radix = 10, minLength = 4, defaultAlpha = 1;
|
|
47
|
-
return result
|
|
48
|
-
? {
|
|
49
|
-
a: result.length > minLength ? (0, NumberUtils_js_1.parseAlpha)(result[RgbIndexes.a]) : defaultAlpha,
|
|
50
|
-
b: parseInt(result[RgbIndexes.b], radix),
|
|
51
|
-
g: parseInt(result[RgbIndexes.g], radix),
|
|
52
|
-
r: parseInt(result[RgbIndexes.r], radix),
|
|
53
|
-
}
|
|
54
|
-
: undefined;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
exports.RgbColorManager = RgbColorManager;
|
|
58
|
-
});
|