@tsparticles/plugin-canvas-mask 4.1.3 → 4.2.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/Options/Classes/CanvasMask.js +8 -18
- package/browser/Options/Classes/CanvasMaskOverride.js +5 -13
- package/browser/Options/Classes/CanvasMaskPixels.js +4 -10
- package/browser/Options/Classes/FontTextMask.js +11 -28
- package/browser/Options/Classes/ImageMask.js +3 -8
- package/browser/Options/Classes/TextMask.js +9 -22
- package/browser/Options/Classes/TextMaskLine.js +5 -13
- package/browser/index.js +1 -1
- package/browser/index.lazy.js +1 -1
- package/cjs/Options/Classes/CanvasMask.js +8 -18
- package/cjs/Options/Classes/CanvasMaskOverride.js +5 -13
- package/cjs/Options/Classes/CanvasMaskPixels.js +4 -10
- package/cjs/Options/Classes/FontTextMask.js +11 -28
- package/cjs/Options/Classes/ImageMask.js +3 -8
- package/cjs/Options/Classes/TextMask.js +9 -22
- package/cjs/Options/Classes/TextMaskLine.js +5 -13
- package/cjs/index.js +1 -1
- package/cjs/index.lazy.js +1 -1
- package/esm/Options/Classes/CanvasMask.js +8 -18
- package/esm/Options/Classes/CanvasMaskOverride.js +5 -13
- package/esm/Options/Classes/CanvasMaskPixels.js +4 -10
- package/esm/Options/Classes/FontTextMask.js +11 -28
- package/esm/Options/Classes/ImageMask.js +3 -8
- package/esm/Options/Classes/TextMask.js +9 -22
- package/esm/Options/Classes/TextMaskLine.js +5 -13
- package/esm/index.js +1 -1
- package/esm/index.lazy.js +1 -1
- package/package.json +3 -3
- package/report.html +1 -1
- package/tsparticles.plugin.canvas-mask.js +40 -107
- package/tsparticles.plugin.canvas-mask.min.js +1 -1
- package/types/Options/Classes/CanvasMaskOverride.d.ts +0 -1
- package/types/Options/Classes/CanvasMaskPixels.d.ts +1 -2
- package/types/Options/Classes/FontTextMask.d.ts +0 -1
- package/types/Options/Classes/ImageMask.d.ts +0 -1
- package/types/Options/Classes/TextMask.d.ts +2 -3
- package/types/Options/Classes/TextMaskLine.d.ts +0 -1
|
@@ -1,27 +1,23 @@
|
|
|
1
|
-
import { isNull } from "@tsparticles/engine";
|
|
1
|
+
import { isNull, loadProperty, } from "@tsparticles/engine";
|
|
2
2
|
import { CanvasMaskOverride } from "./CanvasMaskOverride.js";
|
|
3
3
|
import { CanvasMaskPixels } from "./CanvasMaskPixels.js";
|
|
4
4
|
import { ImageMask } from "./ImageMask.js";
|
|
5
5
|
import { TextMask } from "./TextMask.js";
|
|
6
6
|
export class CanvasMask {
|
|
7
7
|
element;
|
|
8
|
-
enable;
|
|
8
|
+
enable = false;
|
|
9
9
|
image;
|
|
10
|
-
override;
|
|
11
|
-
pixels;
|
|
10
|
+
override = new CanvasMaskOverride();
|
|
11
|
+
pixels = new CanvasMaskPixels();
|
|
12
12
|
position;
|
|
13
|
-
scale;
|
|
13
|
+
scale = 1;
|
|
14
14
|
selector;
|
|
15
15
|
text;
|
|
16
16
|
constructor() {
|
|
17
|
-
this.enable = false;
|
|
18
|
-
this.override = new CanvasMaskOverride();
|
|
19
|
-
this.pixels = new CanvasMaskPixels();
|
|
20
17
|
this.position = {
|
|
21
18
|
x: 50,
|
|
22
19
|
y: 50,
|
|
23
20
|
};
|
|
24
|
-
this.scale = 1;
|
|
25
21
|
}
|
|
26
22
|
load(data) {
|
|
27
23
|
if (isNull(data)) {
|
|
@@ -30,9 +26,7 @@ export class CanvasMask {
|
|
|
30
26
|
if (data.element !== undefined && data.element instanceof HTMLCanvasElement) {
|
|
31
27
|
this.element = data.element;
|
|
32
28
|
}
|
|
33
|
-
|
|
34
|
-
this.enable = data.enable;
|
|
35
|
-
}
|
|
29
|
+
loadProperty(this, "enable", data.enable);
|
|
36
30
|
if (data.image) {
|
|
37
31
|
this.image ??= new ImageMask();
|
|
38
32
|
this.image.load(data.image);
|
|
@@ -45,12 +39,8 @@ export class CanvasMask {
|
|
|
45
39
|
};
|
|
46
40
|
}
|
|
47
41
|
this.override.load(data.override);
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
if (data.selector !== undefined) {
|
|
52
|
-
this.selector = data.selector;
|
|
53
|
-
}
|
|
42
|
+
loadProperty(this, "scale", data.scale);
|
|
43
|
+
loadProperty(this, "selector", data.selector);
|
|
54
44
|
if (data.text) {
|
|
55
45
|
this.text ??= new TextMask();
|
|
56
46
|
this.text.load(data.text);
|
|
@@ -1,20 +1,12 @@
|
|
|
1
|
-
import { isNull } from "@tsparticles/engine";
|
|
1
|
+
import { isNull, loadProperty } from "@tsparticles/engine";
|
|
2
2
|
export class CanvasMaskOverride {
|
|
3
|
-
color;
|
|
4
|
-
opacity;
|
|
5
|
-
constructor() {
|
|
6
|
-
this.color = true;
|
|
7
|
-
this.opacity = false;
|
|
8
|
-
}
|
|
3
|
+
color = true;
|
|
4
|
+
opacity = false;
|
|
9
5
|
load(data) {
|
|
10
6
|
if (isNull(data)) {
|
|
11
7
|
return;
|
|
12
8
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
if (data.opacity !== undefined) {
|
|
17
|
-
this.opacity = data.opacity;
|
|
18
|
-
}
|
|
9
|
+
loadProperty(this, "color", data.color);
|
|
10
|
+
loadProperty(this, "opacity", data.opacity);
|
|
19
11
|
}
|
|
20
12
|
}
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import { isFunction, isNull, isString, } from "@tsparticles/engine";
|
|
1
|
+
import { isFunction, isNull, isString, loadProperty, } from "@tsparticles/engine";
|
|
2
2
|
const minAlpha = 0;
|
|
3
3
|
export class CanvasMaskPixels {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
constructor() {
|
|
7
|
-
this.filter = (pixel) => pixel.a > minAlpha;
|
|
8
|
-
this.offset = 4;
|
|
9
|
-
}
|
|
4
|
+
offset = 4;
|
|
5
|
+
filter = (pixel) => pixel.a > minAlpha;
|
|
10
6
|
load(data) {
|
|
11
7
|
if (isNull(data)) {
|
|
12
8
|
return;
|
|
@@ -24,8 +20,6 @@ export class CanvasMaskPixels {
|
|
|
24
20
|
this.filter = data.filter;
|
|
25
21
|
}
|
|
26
22
|
}
|
|
27
|
-
|
|
28
|
-
this.offset = data.offset;
|
|
29
|
-
}
|
|
23
|
+
loadProperty(this, "offset", data.offset);
|
|
30
24
|
}
|
|
31
25
|
}
|
|
@@ -1,35 +1,18 @@
|
|
|
1
|
-
import { isNull } from "@tsparticles/engine";
|
|
1
|
+
import { isNull, loadProperty } from "@tsparticles/engine";
|
|
2
2
|
export class FontTextMask {
|
|
3
|
-
family;
|
|
4
|
-
size;
|
|
5
|
-
style;
|
|
6
|
-
variant;
|
|
7
|
-
weight;
|
|
8
|
-
constructor() {
|
|
9
|
-
this.family = "sans-serif";
|
|
10
|
-
this.size = 100;
|
|
11
|
-
this.style = "";
|
|
12
|
-
this.variant = "";
|
|
13
|
-
this.weight = "";
|
|
14
|
-
}
|
|
3
|
+
family = "sans-serif";
|
|
4
|
+
size = 100;
|
|
5
|
+
style = "";
|
|
6
|
+
variant = "";
|
|
7
|
+
weight = "";
|
|
15
8
|
load(data) {
|
|
16
9
|
if (isNull(data)) {
|
|
17
10
|
return;
|
|
18
11
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
if (data.style !== undefined) {
|
|
26
|
-
this.style = data.style;
|
|
27
|
-
}
|
|
28
|
-
if (data.variant !== undefined) {
|
|
29
|
-
this.variant = data.variant;
|
|
30
|
-
}
|
|
31
|
-
if (data.weight !== undefined) {
|
|
32
|
-
this.weight = data.weight;
|
|
33
|
-
}
|
|
12
|
+
loadProperty(this, "family", data.family);
|
|
13
|
+
loadProperty(this, "size", data.size);
|
|
14
|
+
loadProperty(this, "style", data.style);
|
|
15
|
+
loadProperty(this, "variant", data.variant);
|
|
16
|
+
loadProperty(this, "weight", data.weight);
|
|
34
17
|
}
|
|
35
18
|
}
|
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
import { isNull } from "@tsparticles/engine";
|
|
1
|
+
import { isNull, loadProperty } from "@tsparticles/engine";
|
|
2
2
|
export class ImageMask {
|
|
3
|
-
src;
|
|
4
|
-
constructor() {
|
|
5
|
-
this.src = "";
|
|
6
|
-
}
|
|
3
|
+
src = "";
|
|
7
4
|
load(data) {
|
|
8
5
|
if (isNull(data)) {
|
|
9
6
|
return;
|
|
10
7
|
}
|
|
11
|
-
|
|
12
|
-
this.src = data.src;
|
|
13
|
-
}
|
|
8
|
+
loadProperty(this, "src", data.src);
|
|
14
9
|
}
|
|
15
10
|
}
|
|
@@ -1,33 +1,20 @@
|
|
|
1
|
-
import { isNull } from "@tsparticles/engine";
|
|
1
|
+
import { isNull, loadProperty } from "@tsparticles/engine";
|
|
2
2
|
import { FontTextMask } from "./FontTextMask.js";
|
|
3
3
|
import { TextMaskLine } from "./TextMaskLine.js";
|
|
4
4
|
export class TextMask {
|
|
5
|
-
color;
|
|
6
|
-
fill;
|
|
7
|
-
font;
|
|
8
|
-
lines;
|
|
9
|
-
text;
|
|
10
|
-
constructor() {
|
|
11
|
-
this.color = "#000000";
|
|
12
|
-
this.fill = true;
|
|
13
|
-
this.font = new FontTextMask();
|
|
14
|
-
this.lines = new TextMaskLine();
|
|
15
|
-
this.text = "";
|
|
16
|
-
}
|
|
5
|
+
color = "#000000";
|
|
6
|
+
fill = true;
|
|
7
|
+
font = new FontTextMask();
|
|
8
|
+
lines = new TextMaskLine();
|
|
9
|
+
text = "";
|
|
17
10
|
load(data) {
|
|
18
11
|
if (isNull(data)) {
|
|
19
12
|
return;
|
|
20
13
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
if (data.fill !== undefined) {
|
|
25
|
-
this.fill = data.fill;
|
|
26
|
-
}
|
|
14
|
+
loadProperty(this, "color", data.color);
|
|
15
|
+
loadProperty(this, "fill", data.fill);
|
|
27
16
|
this.font.load(data.font);
|
|
28
17
|
this.lines.load(data.lines);
|
|
29
|
-
|
|
30
|
-
this.text = data.text;
|
|
31
|
-
}
|
|
18
|
+
loadProperty(this, "text", data.text);
|
|
32
19
|
}
|
|
33
20
|
}
|
|
@@ -1,20 +1,12 @@
|
|
|
1
|
-
import { isNull } from "@tsparticles/engine";
|
|
1
|
+
import { isNull, loadProperty } from "@tsparticles/engine";
|
|
2
2
|
export class TextMaskLine {
|
|
3
|
-
separator;
|
|
4
|
-
spacing;
|
|
5
|
-
constructor() {
|
|
6
|
-
this.separator = "\n";
|
|
7
|
-
this.spacing = 10;
|
|
8
|
-
}
|
|
3
|
+
separator = "\n";
|
|
4
|
+
spacing = 10;
|
|
9
5
|
load(data) {
|
|
10
6
|
if (isNull(data)) {
|
|
11
7
|
return;
|
|
12
8
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
if (data.spacing !== undefined) {
|
|
17
|
-
this.spacing = data.spacing;
|
|
18
|
-
}
|
|
9
|
+
loadProperty(this, "separator", data.separator);
|
|
10
|
+
loadProperty(this, "spacing", data.spacing);
|
|
19
11
|
}
|
|
20
12
|
}
|
package/browser/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CanvasMaskPlugin } from "./CanvasMaskPlugin.js";
|
|
2
2
|
export async function loadCanvasMaskPlugin(engine) {
|
|
3
|
-
engine.checkVersion("4.
|
|
3
|
+
engine.checkVersion("4.2.0");
|
|
4
4
|
await engine.pluginManager.register(e => {
|
|
5
5
|
e.pluginManager.addPlugin(new CanvasMaskPlugin());
|
|
6
6
|
});
|
package/browser/index.lazy.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export async function loadCanvasMaskPlugin(engine) {
|
|
2
|
-
engine.checkVersion("4.
|
|
2
|
+
engine.checkVersion("4.2.0");
|
|
3
3
|
await engine.pluginManager.register(async (e) => {
|
|
4
4
|
const { CanvasMaskPlugin } = await import("./CanvasMaskPlugin.js");
|
|
5
5
|
e.pluginManager.addPlugin(new CanvasMaskPlugin());
|
|
@@ -1,27 +1,23 @@
|
|
|
1
|
-
import { isNull } from "@tsparticles/engine";
|
|
1
|
+
import { isNull, loadProperty, } from "@tsparticles/engine";
|
|
2
2
|
import { CanvasMaskOverride } from "./CanvasMaskOverride.js";
|
|
3
3
|
import { CanvasMaskPixels } from "./CanvasMaskPixels.js";
|
|
4
4
|
import { ImageMask } from "./ImageMask.js";
|
|
5
5
|
import { TextMask } from "./TextMask.js";
|
|
6
6
|
export class CanvasMask {
|
|
7
7
|
element;
|
|
8
|
-
enable;
|
|
8
|
+
enable = false;
|
|
9
9
|
image;
|
|
10
|
-
override;
|
|
11
|
-
pixels;
|
|
10
|
+
override = new CanvasMaskOverride();
|
|
11
|
+
pixels = new CanvasMaskPixels();
|
|
12
12
|
position;
|
|
13
|
-
scale;
|
|
13
|
+
scale = 1;
|
|
14
14
|
selector;
|
|
15
15
|
text;
|
|
16
16
|
constructor() {
|
|
17
|
-
this.enable = false;
|
|
18
|
-
this.override = new CanvasMaskOverride();
|
|
19
|
-
this.pixels = new CanvasMaskPixels();
|
|
20
17
|
this.position = {
|
|
21
18
|
x: 50,
|
|
22
19
|
y: 50,
|
|
23
20
|
};
|
|
24
|
-
this.scale = 1;
|
|
25
21
|
}
|
|
26
22
|
load(data) {
|
|
27
23
|
if (isNull(data)) {
|
|
@@ -30,9 +26,7 @@ export class CanvasMask {
|
|
|
30
26
|
if (data.element !== undefined && data.element instanceof HTMLCanvasElement) {
|
|
31
27
|
this.element = data.element;
|
|
32
28
|
}
|
|
33
|
-
|
|
34
|
-
this.enable = data.enable;
|
|
35
|
-
}
|
|
29
|
+
loadProperty(this, "enable", data.enable);
|
|
36
30
|
if (data.image) {
|
|
37
31
|
this.image ??= new ImageMask();
|
|
38
32
|
this.image.load(data.image);
|
|
@@ -45,12 +39,8 @@ export class CanvasMask {
|
|
|
45
39
|
};
|
|
46
40
|
}
|
|
47
41
|
this.override.load(data.override);
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
if (data.selector !== undefined) {
|
|
52
|
-
this.selector = data.selector;
|
|
53
|
-
}
|
|
42
|
+
loadProperty(this, "scale", data.scale);
|
|
43
|
+
loadProperty(this, "selector", data.selector);
|
|
54
44
|
if (data.text) {
|
|
55
45
|
this.text ??= new TextMask();
|
|
56
46
|
this.text.load(data.text);
|
|
@@ -1,20 +1,12 @@
|
|
|
1
|
-
import { isNull } from "@tsparticles/engine";
|
|
1
|
+
import { isNull, loadProperty } from "@tsparticles/engine";
|
|
2
2
|
export class CanvasMaskOverride {
|
|
3
|
-
color;
|
|
4
|
-
opacity;
|
|
5
|
-
constructor() {
|
|
6
|
-
this.color = true;
|
|
7
|
-
this.opacity = false;
|
|
8
|
-
}
|
|
3
|
+
color = true;
|
|
4
|
+
opacity = false;
|
|
9
5
|
load(data) {
|
|
10
6
|
if (isNull(data)) {
|
|
11
7
|
return;
|
|
12
8
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
if (data.opacity !== undefined) {
|
|
17
|
-
this.opacity = data.opacity;
|
|
18
|
-
}
|
|
9
|
+
loadProperty(this, "color", data.color);
|
|
10
|
+
loadProperty(this, "opacity", data.opacity);
|
|
19
11
|
}
|
|
20
12
|
}
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import { isFunction, isNull, isString, } from "@tsparticles/engine";
|
|
1
|
+
import { isFunction, isNull, isString, loadProperty, } from "@tsparticles/engine";
|
|
2
2
|
const minAlpha = 0;
|
|
3
3
|
export class CanvasMaskPixels {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
constructor() {
|
|
7
|
-
this.filter = (pixel) => pixel.a > minAlpha;
|
|
8
|
-
this.offset = 4;
|
|
9
|
-
}
|
|
4
|
+
offset = 4;
|
|
5
|
+
filter = (pixel) => pixel.a > minAlpha;
|
|
10
6
|
load(data) {
|
|
11
7
|
if (isNull(data)) {
|
|
12
8
|
return;
|
|
@@ -24,8 +20,6 @@ export class CanvasMaskPixels {
|
|
|
24
20
|
this.filter = data.filter;
|
|
25
21
|
}
|
|
26
22
|
}
|
|
27
|
-
|
|
28
|
-
this.offset = data.offset;
|
|
29
|
-
}
|
|
23
|
+
loadProperty(this, "offset", data.offset);
|
|
30
24
|
}
|
|
31
25
|
}
|
|
@@ -1,35 +1,18 @@
|
|
|
1
|
-
import { isNull } from "@tsparticles/engine";
|
|
1
|
+
import { isNull, loadProperty } from "@tsparticles/engine";
|
|
2
2
|
export class FontTextMask {
|
|
3
|
-
family;
|
|
4
|
-
size;
|
|
5
|
-
style;
|
|
6
|
-
variant;
|
|
7
|
-
weight;
|
|
8
|
-
constructor() {
|
|
9
|
-
this.family = "sans-serif";
|
|
10
|
-
this.size = 100;
|
|
11
|
-
this.style = "";
|
|
12
|
-
this.variant = "";
|
|
13
|
-
this.weight = "";
|
|
14
|
-
}
|
|
3
|
+
family = "sans-serif";
|
|
4
|
+
size = 100;
|
|
5
|
+
style = "";
|
|
6
|
+
variant = "";
|
|
7
|
+
weight = "";
|
|
15
8
|
load(data) {
|
|
16
9
|
if (isNull(data)) {
|
|
17
10
|
return;
|
|
18
11
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
if (data.style !== undefined) {
|
|
26
|
-
this.style = data.style;
|
|
27
|
-
}
|
|
28
|
-
if (data.variant !== undefined) {
|
|
29
|
-
this.variant = data.variant;
|
|
30
|
-
}
|
|
31
|
-
if (data.weight !== undefined) {
|
|
32
|
-
this.weight = data.weight;
|
|
33
|
-
}
|
|
12
|
+
loadProperty(this, "family", data.family);
|
|
13
|
+
loadProperty(this, "size", data.size);
|
|
14
|
+
loadProperty(this, "style", data.style);
|
|
15
|
+
loadProperty(this, "variant", data.variant);
|
|
16
|
+
loadProperty(this, "weight", data.weight);
|
|
34
17
|
}
|
|
35
18
|
}
|
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
import { isNull } from "@tsparticles/engine";
|
|
1
|
+
import { isNull, loadProperty } from "@tsparticles/engine";
|
|
2
2
|
export class ImageMask {
|
|
3
|
-
src;
|
|
4
|
-
constructor() {
|
|
5
|
-
this.src = "";
|
|
6
|
-
}
|
|
3
|
+
src = "";
|
|
7
4
|
load(data) {
|
|
8
5
|
if (isNull(data)) {
|
|
9
6
|
return;
|
|
10
7
|
}
|
|
11
|
-
|
|
12
|
-
this.src = data.src;
|
|
13
|
-
}
|
|
8
|
+
loadProperty(this, "src", data.src);
|
|
14
9
|
}
|
|
15
10
|
}
|
|
@@ -1,33 +1,20 @@
|
|
|
1
|
-
import { isNull } from "@tsparticles/engine";
|
|
1
|
+
import { isNull, loadProperty } from "@tsparticles/engine";
|
|
2
2
|
import { FontTextMask } from "./FontTextMask.js";
|
|
3
3
|
import { TextMaskLine } from "./TextMaskLine.js";
|
|
4
4
|
export class TextMask {
|
|
5
|
-
color;
|
|
6
|
-
fill;
|
|
7
|
-
font;
|
|
8
|
-
lines;
|
|
9
|
-
text;
|
|
10
|
-
constructor() {
|
|
11
|
-
this.color = "#000000";
|
|
12
|
-
this.fill = true;
|
|
13
|
-
this.font = new FontTextMask();
|
|
14
|
-
this.lines = new TextMaskLine();
|
|
15
|
-
this.text = "";
|
|
16
|
-
}
|
|
5
|
+
color = "#000000";
|
|
6
|
+
fill = true;
|
|
7
|
+
font = new FontTextMask();
|
|
8
|
+
lines = new TextMaskLine();
|
|
9
|
+
text = "";
|
|
17
10
|
load(data) {
|
|
18
11
|
if (isNull(data)) {
|
|
19
12
|
return;
|
|
20
13
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
if (data.fill !== undefined) {
|
|
25
|
-
this.fill = data.fill;
|
|
26
|
-
}
|
|
14
|
+
loadProperty(this, "color", data.color);
|
|
15
|
+
loadProperty(this, "fill", data.fill);
|
|
27
16
|
this.font.load(data.font);
|
|
28
17
|
this.lines.load(data.lines);
|
|
29
|
-
|
|
30
|
-
this.text = data.text;
|
|
31
|
-
}
|
|
18
|
+
loadProperty(this, "text", data.text);
|
|
32
19
|
}
|
|
33
20
|
}
|
|
@@ -1,20 +1,12 @@
|
|
|
1
|
-
import { isNull } from "@tsparticles/engine";
|
|
1
|
+
import { isNull, loadProperty } from "@tsparticles/engine";
|
|
2
2
|
export class TextMaskLine {
|
|
3
|
-
separator;
|
|
4
|
-
spacing;
|
|
5
|
-
constructor() {
|
|
6
|
-
this.separator = "\n";
|
|
7
|
-
this.spacing = 10;
|
|
8
|
-
}
|
|
3
|
+
separator = "\n";
|
|
4
|
+
spacing = 10;
|
|
9
5
|
load(data) {
|
|
10
6
|
if (isNull(data)) {
|
|
11
7
|
return;
|
|
12
8
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
if (data.spacing !== undefined) {
|
|
17
|
-
this.spacing = data.spacing;
|
|
18
|
-
}
|
|
9
|
+
loadProperty(this, "separator", data.separator);
|
|
10
|
+
loadProperty(this, "spacing", data.spacing);
|
|
19
11
|
}
|
|
20
12
|
}
|
package/cjs/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CanvasMaskPlugin } from "./CanvasMaskPlugin.js";
|
|
2
2
|
export async function loadCanvasMaskPlugin(engine) {
|
|
3
|
-
engine.checkVersion("4.
|
|
3
|
+
engine.checkVersion("4.2.0");
|
|
4
4
|
await engine.pluginManager.register(e => {
|
|
5
5
|
e.pluginManager.addPlugin(new CanvasMaskPlugin());
|
|
6
6
|
});
|
package/cjs/index.lazy.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export async function loadCanvasMaskPlugin(engine) {
|
|
2
|
-
engine.checkVersion("4.
|
|
2
|
+
engine.checkVersion("4.2.0");
|
|
3
3
|
await engine.pluginManager.register(async (e) => {
|
|
4
4
|
const { CanvasMaskPlugin } = await import("./CanvasMaskPlugin.js");
|
|
5
5
|
e.pluginManager.addPlugin(new CanvasMaskPlugin());
|
|
@@ -1,27 +1,23 @@
|
|
|
1
|
-
import { isNull } from "@tsparticles/engine";
|
|
1
|
+
import { isNull, loadProperty, } from "@tsparticles/engine";
|
|
2
2
|
import { CanvasMaskOverride } from "./CanvasMaskOverride.js";
|
|
3
3
|
import { CanvasMaskPixels } from "./CanvasMaskPixels.js";
|
|
4
4
|
import { ImageMask } from "./ImageMask.js";
|
|
5
5
|
import { TextMask } from "./TextMask.js";
|
|
6
6
|
export class CanvasMask {
|
|
7
7
|
element;
|
|
8
|
-
enable;
|
|
8
|
+
enable = false;
|
|
9
9
|
image;
|
|
10
|
-
override;
|
|
11
|
-
pixels;
|
|
10
|
+
override = new CanvasMaskOverride();
|
|
11
|
+
pixels = new CanvasMaskPixels();
|
|
12
12
|
position;
|
|
13
|
-
scale;
|
|
13
|
+
scale = 1;
|
|
14
14
|
selector;
|
|
15
15
|
text;
|
|
16
16
|
constructor() {
|
|
17
|
-
this.enable = false;
|
|
18
|
-
this.override = new CanvasMaskOverride();
|
|
19
|
-
this.pixels = new CanvasMaskPixels();
|
|
20
17
|
this.position = {
|
|
21
18
|
x: 50,
|
|
22
19
|
y: 50,
|
|
23
20
|
};
|
|
24
|
-
this.scale = 1;
|
|
25
21
|
}
|
|
26
22
|
load(data) {
|
|
27
23
|
if (isNull(data)) {
|
|
@@ -30,9 +26,7 @@ export class CanvasMask {
|
|
|
30
26
|
if (data.element !== undefined && data.element instanceof HTMLCanvasElement) {
|
|
31
27
|
this.element = data.element;
|
|
32
28
|
}
|
|
33
|
-
|
|
34
|
-
this.enable = data.enable;
|
|
35
|
-
}
|
|
29
|
+
loadProperty(this, "enable", data.enable);
|
|
36
30
|
if (data.image) {
|
|
37
31
|
this.image ??= new ImageMask();
|
|
38
32
|
this.image.load(data.image);
|
|
@@ -45,12 +39,8 @@ export class CanvasMask {
|
|
|
45
39
|
};
|
|
46
40
|
}
|
|
47
41
|
this.override.load(data.override);
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
if (data.selector !== undefined) {
|
|
52
|
-
this.selector = data.selector;
|
|
53
|
-
}
|
|
42
|
+
loadProperty(this, "scale", data.scale);
|
|
43
|
+
loadProperty(this, "selector", data.selector);
|
|
54
44
|
if (data.text) {
|
|
55
45
|
this.text ??= new TextMask();
|
|
56
46
|
this.text.load(data.text);
|
|
@@ -1,20 +1,12 @@
|
|
|
1
|
-
import { isNull } from "@tsparticles/engine";
|
|
1
|
+
import { isNull, loadProperty } from "@tsparticles/engine";
|
|
2
2
|
export class CanvasMaskOverride {
|
|
3
|
-
color;
|
|
4
|
-
opacity;
|
|
5
|
-
constructor() {
|
|
6
|
-
this.color = true;
|
|
7
|
-
this.opacity = false;
|
|
8
|
-
}
|
|
3
|
+
color = true;
|
|
4
|
+
opacity = false;
|
|
9
5
|
load(data) {
|
|
10
6
|
if (isNull(data)) {
|
|
11
7
|
return;
|
|
12
8
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
if (data.opacity !== undefined) {
|
|
17
|
-
this.opacity = data.opacity;
|
|
18
|
-
}
|
|
9
|
+
loadProperty(this, "color", data.color);
|
|
10
|
+
loadProperty(this, "opacity", data.opacity);
|
|
19
11
|
}
|
|
20
12
|
}
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import { isFunction, isNull, isString, } from "@tsparticles/engine";
|
|
1
|
+
import { isFunction, isNull, isString, loadProperty, } from "@tsparticles/engine";
|
|
2
2
|
const minAlpha = 0;
|
|
3
3
|
export class CanvasMaskPixels {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
constructor() {
|
|
7
|
-
this.filter = (pixel) => pixel.a > minAlpha;
|
|
8
|
-
this.offset = 4;
|
|
9
|
-
}
|
|
4
|
+
offset = 4;
|
|
5
|
+
filter = (pixel) => pixel.a > minAlpha;
|
|
10
6
|
load(data) {
|
|
11
7
|
if (isNull(data)) {
|
|
12
8
|
return;
|
|
@@ -24,8 +20,6 @@ export class CanvasMaskPixels {
|
|
|
24
20
|
this.filter = data.filter;
|
|
25
21
|
}
|
|
26
22
|
}
|
|
27
|
-
|
|
28
|
-
this.offset = data.offset;
|
|
29
|
-
}
|
|
23
|
+
loadProperty(this, "offset", data.offset);
|
|
30
24
|
}
|
|
31
25
|
}
|
|
@@ -1,35 +1,18 @@
|
|
|
1
|
-
import { isNull } from "@tsparticles/engine";
|
|
1
|
+
import { isNull, loadProperty } from "@tsparticles/engine";
|
|
2
2
|
export class FontTextMask {
|
|
3
|
-
family;
|
|
4
|
-
size;
|
|
5
|
-
style;
|
|
6
|
-
variant;
|
|
7
|
-
weight;
|
|
8
|
-
constructor() {
|
|
9
|
-
this.family = "sans-serif";
|
|
10
|
-
this.size = 100;
|
|
11
|
-
this.style = "";
|
|
12
|
-
this.variant = "";
|
|
13
|
-
this.weight = "";
|
|
14
|
-
}
|
|
3
|
+
family = "sans-serif";
|
|
4
|
+
size = 100;
|
|
5
|
+
style = "";
|
|
6
|
+
variant = "";
|
|
7
|
+
weight = "";
|
|
15
8
|
load(data) {
|
|
16
9
|
if (isNull(data)) {
|
|
17
10
|
return;
|
|
18
11
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
if (data.style !== undefined) {
|
|
26
|
-
this.style = data.style;
|
|
27
|
-
}
|
|
28
|
-
if (data.variant !== undefined) {
|
|
29
|
-
this.variant = data.variant;
|
|
30
|
-
}
|
|
31
|
-
if (data.weight !== undefined) {
|
|
32
|
-
this.weight = data.weight;
|
|
33
|
-
}
|
|
12
|
+
loadProperty(this, "family", data.family);
|
|
13
|
+
loadProperty(this, "size", data.size);
|
|
14
|
+
loadProperty(this, "style", data.style);
|
|
15
|
+
loadProperty(this, "variant", data.variant);
|
|
16
|
+
loadProperty(this, "weight", data.weight);
|
|
34
17
|
}
|
|
35
18
|
}
|
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
import { isNull } from "@tsparticles/engine";
|
|
1
|
+
import { isNull, loadProperty } from "@tsparticles/engine";
|
|
2
2
|
export class ImageMask {
|
|
3
|
-
src;
|
|
4
|
-
constructor() {
|
|
5
|
-
this.src = "";
|
|
6
|
-
}
|
|
3
|
+
src = "";
|
|
7
4
|
load(data) {
|
|
8
5
|
if (isNull(data)) {
|
|
9
6
|
return;
|
|
10
7
|
}
|
|
11
|
-
|
|
12
|
-
this.src = data.src;
|
|
13
|
-
}
|
|
8
|
+
loadProperty(this, "src", data.src);
|
|
14
9
|
}
|
|
15
10
|
}
|
|
@@ -1,33 +1,20 @@
|
|
|
1
|
-
import { isNull } from "@tsparticles/engine";
|
|
1
|
+
import { isNull, loadProperty } from "@tsparticles/engine";
|
|
2
2
|
import { FontTextMask } from "./FontTextMask.js";
|
|
3
3
|
import { TextMaskLine } from "./TextMaskLine.js";
|
|
4
4
|
export class TextMask {
|
|
5
|
-
color;
|
|
6
|
-
fill;
|
|
7
|
-
font;
|
|
8
|
-
lines;
|
|
9
|
-
text;
|
|
10
|
-
constructor() {
|
|
11
|
-
this.color = "#000000";
|
|
12
|
-
this.fill = true;
|
|
13
|
-
this.font = new FontTextMask();
|
|
14
|
-
this.lines = new TextMaskLine();
|
|
15
|
-
this.text = "";
|
|
16
|
-
}
|
|
5
|
+
color = "#000000";
|
|
6
|
+
fill = true;
|
|
7
|
+
font = new FontTextMask();
|
|
8
|
+
lines = new TextMaskLine();
|
|
9
|
+
text = "";
|
|
17
10
|
load(data) {
|
|
18
11
|
if (isNull(data)) {
|
|
19
12
|
return;
|
|
20
13
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
if (data.fill !== undefined) {
|
|
25
|
-
this.fill = data.fill;
|
|
26
|
-
}
|
|
14
|
+
loadProperty(this, "color", data.color);
|
|
15
|
+
loadProperty(this, "fill", data.fill);
|
|
27
16
|
this.font.load(data.font);
|
|
28
17
|
this.lines.load(data.lines);
|
|
29
|
-
|
|
30
|
-
this.text = data.text;
|
|
31
|
-
}
|
|
18
|
+
loadProperty(this, "text", data.text);
|
|
32
19
|
}
|
|
33
20
|
}
|
|
@@ -1,20 +1,12 @@
|
|
|
1
|
-
import { isNull } from "@tsparticles/engine";
|
|
1
|
+
import { isNull, loadProperty } from "@tsparticles/engine";
|
|
2
2
|
export class TextMaskLine {
|
|
3
|
-
separator;
|
|
4
|
-
spacing;
|
|
5
|
-
constructor() {
|
|
6
|
-
this.separator = "\n";
|
|
7
|
-
this.spacing = 10;
|
|
8
|
-
}
|
|
3
|
+
separator = "\n";
|
|
4
|
+
spacing = 10;
|
|
9
5
|
load(data) {
|
|
10
6
|
if (isNull(data)) {
|
|
11
7
|
return;
|
|
12
8
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
if (data.spacing !== undefined) {
|
|
17
|
-
this.spacing = data.spacing;
|
|
18
|
-
}
|
|
9
|
+
loadProperty(this, "separator", data.separator);
|
|
10
|
+
loadProperty(this, "spacing", data.spacing);
|
|
19
11
|
}
|
|
20
12
|
}
|
package/esm/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CanvasMaskPlugin } from "./CanvasMaskPlugin.js";
|
|
2
2
|
export async function loadCanvasMaskPlugin(engine) {
|
|
3
|
-
engine.checkVersion("4.
|
|
3
|
+
engine.checkVersion("4.2.0");
|
|
4
4
|
await engine.pluginManager.register(e => {
|
|
5
5
|
e.pluginManager.addPlugin(new CanvasMaskPlugin());
|
|
6
6
|
});
|
package/esm/index.lazy.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export async function loadCanvasMaskPlugin(engine) {
|
|
2
|
-
engine.checkVersion("4.
|
|
2
|
+
engine.checkVersion("4.2.0");
|
|
3
3
|
await engine.pluginManager.register(async (e) => {
|
|
4
4
|
const { CanvasMaskPlugin } = await import("./CanvasMaskPlugin.js");
|
|
5
5
|
e.pluginManager.addPlugin(new CanvasMaskPlugin());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/plugin-canvas-mask",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"description": "tsParticles canvas mask plugin",
|
|
5
5
|
"homepage": "https://particles.js.org",
|
|
6
6
|
"repository": {
|
|
@@ -92,13 +92,13 @@
|
|
|
92
92
|
"./package.json": "./package.json"
|
|
93
93
|
},
|
|
94
94
|
"peerDependencies": {
|
|
95
|
-
"@tsparticles/engine": "4.
|
|
95
|
+
"@tsparticles/engine": "4.2.0"
|
|
96
96
|
},
|
|
97
97
|
"publishConfig": {
|
|
98
98
|
"access": "public"
|
|
99
99
|
},
|
|
100
100
|
"type": "module",
|
|
101
101
|
"dependencies": {
|
|
102
|
-
"@tsparticles/canvas-utils": "4.
|
|
102
|
+
"@tsparticles/canvas-utils": "4.2.0"
|
|
103
103
|
}
|
|
104
104
|
}
|
package/report.html
CHANGED
|
@@ -4930,7 +4930,7 @@ var drawChart = (function (exports) {
|
|
|
4930
4930
|
</script>
|
|
4931
4931
|
<script>
|
|
4932
4932
|
/*<!--*/
|
|
4933
|
-
const data = {"version":2,"tree":{"name":"root","children":[{"name":"tsparticles.plugin.canvas-mask.js","children":[{"name":"dist/browser","children":[{"name":"Options/Classes","children":[{"uid":"
|
|
4933
|
+
const data = {"version":2,"tree":{"name":"root","children":[{"name":"tsparticles.plugin.canvas-mask.js","children":[{"name":"dist/browser","children":[{"name":"Options/Classes","children":[{"uid":"4bc7236a-1","name":"CanvasMaskOverride.js"},{"uid":"4bc7236a-3","name":"CanvasMaskPixels.js"},{"uid":"4bc7236a-5","name":"ImageMask.js"},{"uid":"4bc7236a-7","name":"FontTextMask.js"},{"uid":"4bc7236a-9","name":"TextMaskLine.js"},{"uid":"4bc7236a-11","name":"TextMask.js"},{"uid":"4bc7236a-13","name":"CanvasMask.js"}]},{"uid":"4bc7236a-15","name":"CanvasMaskPlugin.js"},{"uid":"4bc7236a-17","name":"index.js"},{"uid":"4bc7236a-19","name":"browser.js"},{"uid":"4bc7236a-21","name":"utils.js"},{"uid":"4bc7236a-23","name":"CanvasMaskPluginInstance.js"}]}]}],"isRoot":true},"nodeParts":{"4bc7236a-1":{"renderedLength":315,"gzipLength":0,"brotliLength":0,"metaUid":"4bc7236a-0"},"4bc7236a-3":{"renderedLength":785,"gzipLength":0,"brotliLength":0,"metaUid":"4bc7236a-2"},"4bc7236a-5":{"renderedLength":209,"gzipLength":0,"brotliLength":0,"metaUid":"4bc7236a-4"},"4bc7236a-7":{"renderedLength":558,"gzipLength":0,"brotliLength":0,"metaUid":"4bc7236a-6"},"4bc7236a-9":{"renderedLength":318,"gzipLength":0,"brotliLength":0,"metaUid":"4bc7236a-8"},"4bc7236a-11":{"renderedLength":528,"gzipLength":0,"brotliLength":0,"metaUid":"4bc7236a-10"},"4bc7236a-13":{"renderedLength":1387,"gzipLength":0,"brotliLength":0,"metaUid":"4bc7236a-12"},"4bc7236a-15":{"renderedLength":830,"gzipLength":0,"brotliLength":0,"metaUid":"4bc7236a-14"},"4bc7236a-17":{"renderedLength":219,"gzipLength":0,"brotliLength":0,"metaUid":"4bc7236a-16"},"4bc7236a-19":{"renderedLength":183,"gzipLength":0,"brotliLength":0,"metaUid":"4bc7236a-18"},"4bc7236a-21":{"renderedLength":2641,"gzipLength":0,"brotliLength":0,"metaUid":"4bc7236a-20"},"4bc7236a-23":{"renderedLength":1796,"gzipLength":0,"brotliLength":0,"metaUid":"4bc7236a-22"}},"nodeMetas":{"4bc7236a-0":{"id":"/dist/browser/Options/Classes/CanvasMaskOverride.js","moduleParts":{"tsparticles.plugin.canvas-mask.js":"4bc7236a-1"},"imported":[{"uid":"4bc7236a-24"}],"importedBy":[{"uid":"4bc7236a-12"}]},"4bc7236a-2":{"id":"/dist/browser/Options/Classes/CanvasMaskPixels.js","moduleParts":{"tsparticles.plugin.canvas-mask.js":"4bc7236a-3"},"imported":[{"uid":"4bc7236a-24"}],"importedBy":[{"uid":"4bc7236a-12"}]},"4bc7236a-4":{"id":"/dist/browser/Options/Classes/ImageMask.js","moduleParts":{"tsparticles.plugin.canvas-mask.js":"4bc7236a-5"},"imported":[{"uid":"4bc7236a-24"}],"importedBy":[{"uid":"4bc7236a-12"}]},"4bc7236a-6":{"id":"/dist/browser/Options/Classes/FontTextMask.js","moduleParts":{"tsparticles.plugin.canvas-mask.js":"4bc7236a-7"},"imported":[{"uid":"4bc7236a-24"}],"importedBy":[{"uid":"4bc7236a-10"}]},"4bc7236a-8":{"id":"/dist/browser/Options/Classes/TextMaskLine.js","moduleParts":{"tsparticles.plugin.canvas-mask.js":"4bc7236a-9"},"imported":[{"uid":"4bc7236a-24"}],"importedBy":[{"uid":"4bc7236a-10"}]},"4bc7236a-10":{"id":"/dist/browser/Options/Classes/TextMask.js","moduleParts":{"tsparticles.plugin.canvas-mask.js":"4bc7236a-11"},"imported":[{"uid":"4bc7236a-24"},{"uid":"4bc7236a-6"},{"uid":"4bc7236a-8"}],"importedBy":[{"uid":"4bc7236a-12"}]},"4bc7236a-12":{"id":"/dist/browser/Options/Classes/CanvasMask.js","moduleParts":{"tsparticles.plugin.canvas-mask.js":"4bc7236a-13"},"imported":[{"uid":"4bc7236a-24"},{"uid":"4bc7236a-0"},{"uid":"4bc7236a-2"},{"uid":"4bc7236a-4"},{"uid":"4bc7236a-10"}],"importedBy":[{"uid":"4bc7236a-14"}]},"4bc7236a-14":{"id":"/dist/browser/CanvasMaskPlugin.js","moduleParts":{"tsparticles.plugin.canvas-mask.js":"4bc7236a-15"},"imported":[{"uid":"4bc7236a-12"},{"uid":"4bc7236a-22","dynamic":true}],"importedBy":[{"uid":"4bc7236a-16"}]},"4bc7236a-16":{"id":"/dist/browser/index.js","moduleParts":{"tsparticles.plugin.canvas-mask.js":"4bc7236a-17"},"imported":[{"uid":"4bc7236a-14"}],"importedBy":[{"uid":"4bc7236a-18"}]},"4bc7236a-18":{"id":"/dist/browser/browser.js","moduleParts":{"tsparticles.plugin.canvas-mask.js":"4bc7236a-19"},"imported":[{"uid":"4bc7236a-16"}],"importedBy":[],"isEntry":true},"4bc7236a-20":{"id":"/dist/browser/utils.js","moduleParts":{"tsparticles.plugin.canvas-mask.js":"4bc7236a-21"},"imported":[{"uid":"4bc7236a-24"}],"importedBy":[{"uid":"4bc7236a-22"}]},"4bc7236a-22":{"id":"/dist/browser/CanvasMaskPluginInstance.js","moduleParts":{"tsparticles.plugin.canvas-mask.js":"4bc7236a-23"},"imported":[{"uid":"4bc7236a-25"},{"uid":"4bc7236a-24"},{"uid":"4bc7236a-20"}],"importedBy":[{"uid":"4bc7236a-14"}]},"4bc7236a-24":{"id":"@tsparticles/engine","moduleParts":{},"imported":[],"importedBy":[{"uid":"4bc7236a-12"},{"uid":"4bc7236a-22"},{"uid":"4bc7236a-0"},{"uid":"4bc7236a-2"},{"uid":"4bc7236a-4"},{"uid":"4bc7236a-10"},{"uid":"4bc7236a-20"},{"uid":"4bc7236a-6"},{"uid":"4bc7236a-8"}],"isExternal":true},"4bc7236a-25":{"id":"@tsparticles/canvas-utils","moduleParts":{},"imported":[],"importedBy":[{"uid":"4bc7236a-22"}],"isExternal":true}},"env":{"rollup":"4.62.0"},"options":{"gzip":false,"brotli":false,"sourcemap":false}};
|
|
4934
4934
|
|
|
4935
4935
|
const run = () => {
|
|
4936
4936
|
const width = window.innerWidth;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
(function(g){g.__tsParticlesInternals=g.__tsParticlesInternals||{};g.__tsParticlesInternals.bundles=g.__tsParticlesInternals.bundles||{};g.__tsParticlesInternals.effects=g.__tsParticlesInternals.effects||{};g.__tsParticlesInternals.engine=g.__tsParticlesInternals.engine||{};g.__tsParticlesInternals.interactions=g.__tsParticlesInternals.interactions||{};g.__tsParticlesInternals.palettes=g.__tsParticlesInternals.palettes||{};g.__tsParticlesInternals.paths=g.__tsParticlesInternals.paths||{};g.__tsParticlesInternals.plugins=g.__tsParticlesInternals.plugins||{};g.__tsParticlesInternals.plugins=g.__tsParticlesInternals.plugins||{};g.__tsParticlesInternals.plugins.emittersShapes=g.__tsParticlesInternals.plugins.emittersShapes||{};g.__tsParticlesInternals.presets=g.__tsParticlesInternals.presets||{};g.__tsParticlesInternals.shapes=g.__tsParticlesInternals.shapes||{};g.__tsParticlesInternals.updaters=g.__tsParticlesInternals.updaters||{};g.__tsParticlesInternals.utils=g.__tsParticlesInternals.utils||{};g.__tsParticlesInternals.canvas=g.__tsParticlesInternals.canvas||{};g.__tsParticlesInternals.canvas=g.__tsParticlesInternals.canvas||{};g.__tsParticlesInternals.canvas.utils=g.__tsParticlesInternals.canvas.utils||{};g.__tsParticlesInternals.path=g.__tsParticlesInternals.path||{};g.__tsParticlesInternals.path=g.__tsParticlesInternals.path||{};g.__tsParticlesInternals.path.utils=g.__tsParticlesInternals.path.utils||{};var __tsProxyFactory=typeof Proxy!=="undefined"?function(obj){return new Proxy(obj,{get:function(target,key){if(!(key in target)){target[key]={};}return target[key];}});}:function(obj){return obj;};g.__tsParticlesInternals.bundles=__tsProxyFactory(g.__tsParticlesInternals.bundles);g.__tsParticlesInternals.effects=__tsProxyFactory(g.__tsParticlesInternals.effects);g.__tsParticlesInternals.interactions=__tsProxyFactory(g.__tsParticlesInternals.interactions);g.__tsParticlesInternals.palettes=__tsProxyFactory(g.__tsParticlesInternals.palettes);g.__tsParticlesInternals.paths=__tsProxyFactory(g.__tsParticlesInternals.paths);g.__tsParticlesInternals.plugins=__tsProxyFactory(g.__tsParticlesInternals.plugins);g.__tsParticlesInternals.plugins.emittersShapes=__tsProxyFactory(g.__tsParticlesInternals.plugins.emittersShapes);g.__tsParticlesInternals.presets=__tsProxyFactory(g.__tsParticlesInternals.presets);g.__tsParticlesInternals.shapes=__tsProxyFactory(g.__tsParticlesInternals.shapes);g.__tsParticlesInternals.updaters=__tsProxyFactory(g.__tsParticlesInternals.updaters);g.__tsParticlesInternals.utils=__tsProxyFactory(g.__tsParticlesInternals.utils);g.__tsParticlesInternals.canvas=__tsProxyFactory(g.__tsParticlesInternals.canvas);g.__tsParticlesInternals.path=__tsProxyFactory(g.__tsParticlesInternals.path);g.tsparticlesInternalExports=g.tsparticlesInternalExports||{};})(typeof globalThis!=="undefined"?globalThis:typeof window!=="undefined"?window:this);
|
|
2
|
-
/* Plugin v4.
|
|
2
|
+
/* Plugin v4.2.0 */
|
|
3
3
|
(function (global, factory) {
|
|
4
4
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@tsparticles/engine'), require('@tsparticles/canvas-utils')) :
|
|
5
5
|
typeof define === 'function' && define.amd ? define(['exports', '@tsparticles/engine', '@tsparticles/canvas-utils'], factory) :
|
|
@@ -7,33 +7,21 @@
|
|
|
7
7
|
})(this, (function (exports, engine, canvasUtils) { 'use strict';
|
|
8
8
|
|
|
9
9
|
class CanvasMaskOverride {
|
|
10
|
-
color;
|
|
11
|
-
opacity;
|
|
12
|
-
constructor() {
|
|
13
|
-
this.color = true;
|
|
14
|
-
this.opacity = false;
|
|
15
|
-
}
|
|
10
|
+
color = true;
|
|
11
|
+
opacity = false;
|
|
16
12
|
load(data) {
|
|
17
13
|
if (engine.isNull(data)) {
|
|
18
14
|
return;
|
|
19
15
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
if (data.opacity !== undefined) {
|
|
24
|
-
this.opacity = data.opacity;
|
|
25
|
-
}
|
|
16
|
+
engine.loadProperty(this, "color", data.color);
|
|
17
|
+
engine.loadProperty(this, "opacity", data.opacity);
|
|
26
18
|
}
|
|
27
19
|
}
|
|
28
20
|
|
|
29
21
|
const minAlpha = 0;
|
|
30
22
|
class CanvasMaskPixels {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
constructor() {
|
|
34
|
-
this.filter = (pixel) => pixel.a > minAlpha;
|
|
35
|
-
this.offset = 4;
|
|
36
|
-
}
|
|
23
|
+
offset = 4;
|
|
24
|
+
filter = (pixel) => pixel.a > minAlpha;
|
|
37
25
|
load(data) {
|
|
38
26
|
if (engine.isNull(data)) {
|
|
39
27
|
return;
|
|
@@ -51,132 +39,83 @@
|
|
|
51
39
|
this.filter = data.filter;
|
|
52
40
|
}
|
|
53
41
|
}
|
|
54
|
-
|
|
55
|
-
this.offset = data.offset;
|
|
56
|
-
}
|
|
42
|
+
engine.loadProperty(this, "offset", data.offset);
|
|
57
43
|
}
|
|
58
44
|
}
|
|
59
45
|
|
|
60
46
|
class ImageMask {
|
|
61
|
-
src;
|
|
62
|
-
constructor() {
|
|
63
|
-
this.src = "";
|
|
64
|
-
}
|
|
47
|
+
src = "";
|
|
65
48
|
load(data) {
|
|
66
49
|
if (engine.isNull(data)) {
|
|
67
50
|
return;
|
|
68
51
|
}
|
|
69
|
-
|
|
70
|
-
this.src = data.src;
|
|
71
|
-
}
|
|
52
|
+
engine.loadProperty(this, "src", data.src);
|
|
72
53
|
}
|
|
73
54
|
}
|
|
74
55
|
|
|
75
56
|
class FontTextMask {
|
|
76
|
-
family;
|
|
77
|
-
size;
|
|
78
|
-
style;
|
|
79
|
-
variant;
|
|
80
|
-
weight;
|
|
81
|
-
constructor() {
|
|
82
|
-
this.family = "sans-serif";
|
|
83
|
-
this.size = 100;
|
|
84
|
-
this.style = "";
|
|
85
|
-
this.variant = "";
|
|
86
|
-
this.weight = "";
|
|
87
|
-
}
|
|
57
|
+
family = "sans-serif";
|
|
58
|
+
size = 100;
|
|
59
|
+
style = "";
|
|
60
|
+
variant = "";
|
|
61
|
+
weight = "";
|
|
88
62
|
load(data) {
|
|
89
63
|
if (engine.isNull(data)) {
|
|
90
64
|
return;
|
|
91
65
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
if (data.style !== undefined) {
|
|
99
|
-
this.style = data.style;
|
|
100
|
-
}
|
|
101
|
-
if (data.variant !== undefined) {
|
|
102
|
-
this.variant = data.variant;
|
|
103
|
-
}
|
|
104
|
-
if (data.weight !== undefined) {
|
|
105
|
-
this.weight = data.weight;
|
|
106
|
-
}
|
|
66
|
+
engine.loadProperty(this, "family", data.family);
|
|
67
|
+
engine.loadProperty(this, "size", data.size);
|
|
68
|
+
engine.loadProperty(this, "style", data.style);
|
|
69
|
+
engine.loadProperty(this, "variant", data.variant);
|
|
70
|
+
engine.loadProperty(this, "weight", data.weight);
|
|
107
71
|
}
|
|
108
72
|
}
|
|
109
73
|
|
|
110
74
|
class TextMaskLine {
|
|
111
|
-
separator;
|
|
112
|
-
spacing;
|
|
113
|
-
constructor() {
|
|
114
|
-
this.separator = "\n";
|
|
115
|
-
this.spacing = 10;
|
|
116
|
-
}
|
|
75
|
+
separator = "\n";
|
|
76
|
+
spacing = 10;
|
|
117
77
|
load(data) {
|
|
118
78
|
if (engine.isNull(data)) {
|
|
119
79
|
return;
|
|
120
80
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}
|
|
124
|
-
if (data.spacing !== undefined) {
|
|
125
|
-
this.spacing = data.spacing;
|
|
126
|
-
}
|
|
81
|
+
engine.loadProperty(this, "separator", data.separator);
|
|
82
|
+
engine.loadProperty(this, "spacing", data.spacing);
|
|
127
83
|
}
|
|
128
84
|
}
|
|
129
85
|
|
|
130
86
|
class TextMask {
|
|
131
|
-
color;
|
|
132
|
-
fill;
|
|
133
|
-
font;
|
|
134
|
-
lines;
|
|
135
|
-
text;
|
|
136
|
-
constructor() {
|
|
137
|
-
this.color = "#000000";
|
|
138
|
-
this.fill = true;
|
|
139
|
-
this.font = new FontTextMask();
|
|
140
|
-
this.lines = new TextMaskLine();
|
|
141
|
-
this.text = "";
|
|
142
|
-
}
|
|
87
|
+
color = "#000000";
|
|
88
|
+
fill = true;
|
|
89
|
+
font = new FontTextMask();
|
|
90
|
+
lines = new TextMaskLine();
|
|
91
|
+
text = "";
|
|
143
92
|
load(data) {
|
|
144
93
|
if (engine.isNull(data)) {
|
|
145
94
|
return;
|
|
146
95
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
}
|
|
150
|
-
if (data.fill !== undefined) {
|
|
151
|
-
this.fill = data.fill;
|
|
152
|
-
}
|
|
96
|
+
engine.loadProperty(this, "color", data.color);
|
|
97
|
+
engine.loadProperty(this, "fill", data.fill);
|
|
153
98
|
this.font.load(data.font);
|
|
154
99
|
this.lines.load(data.lines);
|
|
155
|
-
|
|
156
|
-
this.text = data.text;
|
|
157
|
-
}
|
|
100
|
+
engine.loadProperty(this, "text", data.text);
|
|
158
101
|
}
|
|
159
102
|
}
|
|
160
103
|
|
|
161
104
|
class CanvasMask {
|
|
162
105
|
element;
|
|
163
|
-
enable;
|
|
106
|
+
enable = false;
|
|
164
107
|
image;
|
|
165
|
-
override;
|
|
166
|
-
pixels;
|
|
108
|
+
override = new CanvasMaskOverride();
|
|
109
|
+
pixels = new CanvasMaskPixels();
|
|
167
110
|
position;
|
|
168
|
-
scale;
|
|
111
|
+
scale = 1;
|
|
169
112
|
selector;
|
|
170
113
|
text;
|
|
171
114
|
constructor() {
|
|
172
|
-
this.enable = false;
|
|
173
|
-
this.override = new CanvasMaskOverride();
|
|
174
|
-
this.pixels = new CanvasMaskPixels();
|
|
175
115
|
this.position = {
|
|
176
116
|
x: 50,
|
|
177
117
|
y: 50,
|
|
178
118
|
};
|
|
179
|
-
this.scale = 1;
|
|
180
119
|
}
|
|
181
120
|
load(data) {
|
|
182
121
|
if (engine.isNull(data)) {
|
|
@@ -185,9 +124,7 @@
|
|
|
185
124
|
if (data.element !== undefined && data.element instanceof HTMLCanvasElement) {
|
|
186
125
|
this.element = data.element;
|
|
187
126
|
}
|
|
188
|
-
|
|
189
|
-
this.enable = data.enable;
|
|
190
|
-
}
|
|
127
|
+
engine.loadProperty(this, "enable", data.enable);
|
|
191
128
|
if (data.image) {
|
|
192
129
|
this.image ??= new ImageMask();
|
|
193
130
|
this.image.load(data.image);
|
|
@@ -200,12 +137,8 @@
|
|
|
200
137
|
};
|
|
201
138
|
}
|
|
202
139
|
this.override.load(data.override);
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
}
|
|
206
|
-
if (data.selector !== undefined) {
|
|
207
|
-
this.selector = data.selector;
|
|
208
|
-
}
|
|
140
|
+
engine.loadProperty(this, "scale", data.scale);
|
|
141
|
+
engine.loadProperty(this, "selector", data.selector);
|
|
209
142
|
if (data.text) {
|
|
210
143
|
this.text ??= new TextMask();
|
|
211
144
|
this.text.load(data.text);
|
|
@@ -235,7 +168,7 @@
|
|
|
235
168
|
}
|
|
236
169
|
|
|
237
170
|
async function loadCanvasMaskPlugin(engine) {
|
|
238
|
-
engine.checkVersion("4.
|
|
171
|
+
engine.checkVersion("4.2.0");
|
|
239
172
|
await engine.pluginManager.register(e => {
|
|
240
173
|
e.pluginManager.addPlugin(new CanvasMaskPlugin());
|
|
241
174
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t){t.__tsParticlesInternals=t.__tsParticlesInternals||{},t.__tsParticlesInternals.bundles=t.__tsParticlesInternals.bundles||{},t.__tsParticlesInternals.effects=t.__tsParticlesInternals.effects||{},t.__tsParticlesInternals.engine=t.__tsParticlesInternals.engine||{},t.__tsParticlesInternals.interactions=t.__tsParticlesInternals.interactions||{},t.__tsParticlesInternals.palettes=t.__tsParticlesInternals.palettes||{},t.__tsParticlesInternals.paths=t.__tsParticlesInternals.paths||{},t.__tsParticlesInternals.plugins=t.__tsParticlesInternals.plugins||{},t.__tsParticlesInternals.plugins=t.__tsParticlesInternals.plugins||{},t.__tsParticlesInternals.plugins.emittersShapes=t.__tsParticlesInternals.plugins.emittersShapes||{},t.__tsParticlesInternals.presets=t.__tsParticlesInternals.presets||{},t.__tsParticlesInternals.shapes=t.__tsParticlesInternals.shapes||{},t.__tsParticlesInternals.updaters=t.__tsParticlesInternals.updaters||{},t.__tsParticlesInternals.utils=t.__tsParticlesInternals.utils||{},t.__tsParticlesInternals.canvas=t.__tsParticlesInternals.canvas||{},t.__tsParticlesInternals.canvas=t.__tsParticlesInternals.canvas||{},t.__tsParticlesInternals.canvas.utils=t.__tsParticlesInternals.canvas.utils||{},t.__tsParticlesInternals.path=t.__tsParticlesInternals.path||{},t.__tsParticlesInternals.path=t.__tsParticlesInternals.path||{},t.__tsParticlesInternals.path.utils=t.__tsParticlesInternals.path.utils||{};var s="undefined"!=typeof Proxy?function(t){return new Proxy(t,{get:function(t,s){return s in t||(t[s]={}),t[s]}})}:function(t){return t};t.__tsParticlesInternals.bundles=s(t.__tsParticlesInternals.bundles),t.__tsParticlesInternals.effects=s(t.__tsParticlesInternals.effects),t.__tsParticlesInternals.interactions=s(t.__tsParticlesInternals.interactions),t.__tsParticlesInternals.palettes=s(t.__tsParticlesInternals.palettes),t.__tsParticlesInternals.paths=s(t.__tsParticlesInternals.paths),t.__tsParticlesInternals.plugins=s(t.__tsParticlesInternals.plugins),t.__tsParticlesInternals.plugins.emittersShapes=s(t.__tsParticlesInternals.plugins.emittersShapes),t.__tsParticlesInternals.presets=s(t.__tsParticlesInternals.presets),t.__tsParticlesInternals.shapes=s(t.__tsParticlesInternals.shapes),t.__tsParticlesInternals.updaters=s(t.__tsParticlesInternals.updaters),t.__tsParticlesInternals.utils=s(t.__tsParticlesInternals.utils),t.__tsParticlesInternals.canvas=s(t.__tsParticlesInternals.canvas),t.__tsParticlesInternals.path=s(t.__tsParticlesInternals.path),t.tsparticlesInternalExports=t.tsparticlesInternalExports||{}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:this),function(t,s){"object"==typeof exports&&"undefined"!=typeof module?s(exports,require("@tsparticles/engine"),require("@tsparticles/canvas-utils")):"function"==typeof define&&define.amd?define(["exports","@tsparticles/engine","@tsparticles/canvas-utils"],s):s(((t="undefined"!=typeof globalThis?globalThis:t||self).__tsParticlesInternals=t.__tsParticlesInternals||{},t.__tsParticlesInternals.plugins=t.__tsParticlesInternals.plugins||{},t.__tsParticlesInternals.plugins.canvasMask=t.__tsParticlesInternals.plugins.canvasMask||{}),t.__tsParticlesInternals.engine,t.__tsParticlesInternals.canvas.utils)}(this,function(t,s,e){"use strict";class
|
|
1
|
+
!function(t){t.__tsParticlesInternals=t.__tsParticlesInternals||{},t.__tsParticlesInternals.bundles=t.__tsParticlesInternals.bundles||{},t.__tsParticlesInternals.effects=t.__tsParticlesInternals.effects||{},t.__tsParticlesInternals.engine=t.__tsParticlesInternals.engine||{},t.__tsParticlesInternals.interactions=t.__tsParticlesInternals.interactions||{},t.__tsParticlesInternals.palettes=t.__tsParticlesInternals.palettes||{},t.__tsParticlesInternals.paths=t.__tsParticlesInternals.paths||{},t.__tsParticlesInternals.plugins=t.__tsParticlesInternals.plugins||{},t.__tsParticlesInternals.plugins=t.__tsParticlesInternals.plugins||{},t.__tsParticlesInternals.plugins.emittersShapes=t.__tsParticlesInternals.plugins.emittersShapes||{},t.__tsParticlesInternals.presets=t.__tsParticlesInternals.presets||{},t.__tsParticlesInternals.shapes=t.__tsParticlesInternals.shapes||{},t.__tsParticlesInternals.updaters=t.__tsParticlesInternals.updaters||{},t.__tsParticlesInternals.utils=t.__tsParticlesInternals.utils||{},t.__tsParticlesInternals.canvas=t.__tsParticlesInternals.canvas||{},t.__tsParticlesInternals.canvas=t.__tsParticlesInternals.canvas||{},t.__tsParticlesInternals.canvas.utils=t.__tsParticlesInternals.canvas.utils||{},t.__tsParticlesInternals.path=t.__tsParticlesInternals.path||{},t.__tsParticlesInternals.path=t.__tsParticlesInternals.path||{},t.__tsParticlesInternals.path.utils=t.__tsParticlesInternals.path.utils||{};var s="undefined"!=typeof Proxy?function(t){return new Proxy(t,{get:function(t,s){return s in t||(t[s]={}),t[s]}})}:function(t){return t};t.__tsParticlesInternals.bundles=s(t.__tsParticlesInternals.bundles),t.__tsParticlesInternals.effects=s(t.__tsParticlesInternals.effects),t.__tsParticlesInternals.interactions=s(t.__tsParticlesInternals.interactions),t.__tsParticlesInternals.palettes=s(t.__tsParticlesInternals.palettes),t.__tsParticlesInternals.paths=s(t.__tsParticlesInternals.paths),t.__tsParticlesInternals.plugins=s(t.__tsParticlesInternals.plugins),t.__tsParticlesInternals.plugins.emittersShapes=s(t.__tsParticlesInternals.plugins.emittersShapes),t.__tsParticlesInternals.presets=s(t.__tsParticlesInternals.presets),t.__tsParticlesInternals.shapes=s(t.__tsParticlesInternals.shapes),t.__tsParticlesInternals.updaters=s(t.__tsParticlesInternals.updaters),t.__tsParticlesInternals.utils=s(t.__tsParticlesInternals.utils),t.__tsParticlesInternals.canvas=s(t.__tsParticlesInternals.canvas),t.__tsParticlesInternals.path=s(t.__tsParticlesInternals.path),t.tsparticlesInternalExports=t.tsparticlesInternalExports||{}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:this),function(t,s){"object"==typeof exports&&"undefined"!=typeof module?s(exports,require("@tsparticles/engine"),require("@tsparticles/canvas-utils")):"function"==typeof define&&define.amd?define(["exports","@tsparticles/engine","@tsparticles/canvas-utils"],s):s(((t="undefined"!=typeof globalThis?globalThis:t||self).__tsParticlesInternals=t.__tsParticlesInternals||{},t.__tsParticlesInternals.plugins=t.__tsParticlesInternals.plugins||{},t.__tsParticlesInternals.plugins.canvasMask=t.__tsParticlesInternals.plugins.canvasMask||{}),t.__tsParticlesInternals.engine,t.__tsParticlesInternals.canvas.utils)}(this,function(t,s,e){"use strict";class a{color=!0;opacity=!1;load(t){s.isNull(t)||(s.loadProperty(this,"color",t.color),s.loadProperty(this,"opacity",t.opacity))}}class n{offset=4;filter=t=>t.a>0;load(t){if(!s.isNull(t)){if(void 0!==t.filter)if(s.isString(t.filter)){if(t.filter in globalThis){const e=globalThis[t.filter];s.isFunction(e)&&(this.filter=e)}}else this.filter=t.filter;s.loadProperty(this,"offset",t.offset)}}}class l{src="";load(t){s.isNull(t)||s.loadProperty(this,"src",t.src)}}class i{family="sans-serif";size=100;style="";variant="";weight="";load(t){s.isNull(t)||(s.loadProperty(this,"family",t.family),s.loadProperty(this,"size",t.size),s.loadProperty(this,"style",t.style),s.loadProperty(this,"variant",t.variant),s.loadProperty(this,"weight",t.weight))}}class r{separator="\n";spacing=10;load(t){s.isNull(t)||(s.loadProperty(this,"separator",t.separator),s.loadProperty(this,"spacing",t.spacing))}}class o{color="#000000";fill=!0;font=new i;lines=new r;text="";load(t){s.isNull(t)||(s.loadProperty(this,"color",t.color),s.loadProperty(this,"fill",t.fill),this.font.load(t.font),this.lines.load(t.lines),s.loadProperty(this,"text",t.text))}}class c{element;enable=!1;image;override=new a;pixels=new n;position;scale=1;selector;text;constructor(){this.position={x:50,y:50}}load(t){s.isNull(t)||(void 0!==t.element&&t.element instanceof HTMLCanvasElement&&(this.element=t.element),s.loadProperty(this,"enable",t.enable),t.image&&(this.image??=new l,this.image.load(t.image)),this.pixels.load(t.pixels),t.position&&(this.position={x:t.position.x??this.position.x,y:t.position.y??this.position.y}),this.override.load(t.override),s.loadProperty(this,"scale",t.scale),s.loadProperty(this,"selector",t.selector),t.text&&(this.text??=new o,this.text.load(t.text)))}}class _{id="canvas-mask";async getPlugin(t){const{CanvasMaskPluginInstance:s}=await Promise.resolve().then(function(){return d});return new s(t)}loadOptions(t,s,e){if(!this.needsPlugin(s)&&!this.needsPlugin(e))return;let a=s.canvasMask;void 0===a?.load&&(s.canvasMask=a=new c),a.load(e?.canvasMask)}needsPlugin(t){return t?.canvasMask?.enable??!1}}async function p(t){t.checkVersion("4.2.0"),await t.pluginManager.register(t=>{t.pluginManager.addPlugin(new _)})}const P=globalThis;function u(t,e,a,n,l,i){const{height:r,width:o}=e,c=r*o,_=function(t){const e=1,a=0;for(let n=t.length-e;n>=a;n--){const e=Math.floor(s.getRandom()*n),a=t[n],l=t[e];l!==a&&(void 0!==l&&void 0!==a&&(t[n]=l,t[e]=a))}return t}(h(c)),p=Math.min(c,t.actualOptions.particles.number.value),P=t.canvas.size;let u=0;const d=P.width*a.x/s.percentDenominator-o*n*s.half,f=P.height*a.y/s.percentDenominator-r*n*s.half;for(;u<p&&_.length;){const s=0,a=_.pop()??s,r={x:a%o,y:Math.floor(a/o)},c=e.pixels[r.y];if(!c)continue;const p=c[r.x];if(!p)continue;if(!i(p))continue;const P={x:r.x*n+d,y:r.y*n+f},h={};l.color&&(h.paint={fill:{color:{value:p},enable:!0}}),l.opacity&&(h.opacity={value:p.a}),t.particles.addParticle(P,h),u++}}P.__tsParticlesInternals=P.__tsParticlesInternals??{},P.loadCanvasMaskPlugin=p;const h=t=>[...Array(t).keys()];var d=Object.freeze({__proto__:null,CanvasMaskPluginInstance:class{#t;constructor(t){this.#t=t}async init(){const t=this.#t,a=t.actualOptions.canvasMask;if(!a?.enable)return;let n={pixels:[],height:0,width:0};const l=a.pixels.offset;if(a.image){const s=a.image.src;if(!s)return;n=await e.getImageData(s,l,t.canvas.render.settings)}else if(a.text){const i=a.text,r=e.getTextData(i,l,i.fill,t.canvas.render.settings);if(s.isNull(r))return;n=r}else if(a.element??a.selector){const i=a.element??(a.selector&&s.safeDocument().querySelector(a.selector));if(!i)return;const r=i.getContext("2d",t.canvas.render.settings);if(!r)return;n=e.getCanvasImageData(r,i,l)}u(t,n,a.position,a.scale,a.override,a.pixels.filter)}}});t.loadCanvasMaskPlugin=p}),Object.assign(globalThis.window||globalThis,{loadCanvasMaskPlugin:(globalThis.__tsParticlesInternals.plugins.canvasMask||{}).loadCanvasMaskPlugin}),delete(globalThis.window||globalThis).tsparticlesInternalExports;
|
|
@@ -3,6 +3,5 @@ import type { ICanvasMaskOverride } from "../Interfaces/ICanvasMaskOverride.js";
|
|
|
3
3
|
export declare class CanvasMaskOverride implements ICanvasMaskOverride, IOptionLoader<ICanvasMaskOverride> {
|
|
4
4
|
color: boolean;
|
|
5
5
|
opacity: boolean;
|
|
6
|
-
constructor();
|
|
7
6
|
load(data?: RecursivePartial<ICanvasMaskOverride>): void;
|
|
8
7
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { type IOptionLoader, type IRgba, type RecursivePartial } from "@tsparticles/engine";
|
|
2
2
|
import type { ICanvasMaskPixels } from "../Interfaces/ICanvasMaskPixels.js";
|
|
3
3
|
export declare class CanvasMaskPixels implements ICanvasMaskPixels, IOptionLoader<ICanvasMaskPixels> {
|
|
4
|
-
filter: (pixel: IRgba) => boolean;
|
|
5
4
|
offset: number;
|
|
6
|
-
|
|
5
|
+
filter: (pixel: IRgba) => boolean;
|
|
7
6
|
load(data?: RecursivePartial<ICanvasMaskPixels>): void;
|
|
8
7
|
}
|
|
@@ -2,6 +2,5 @@ import { type IOptionLoader, type RecursivePartial } from "@tsparticles/engine";
|
|
|
2
2
|
import type { IImageMask } from "../Interfaces/IImageMask.js";
|
|
3
3
|
export declare class ImageMask implements IImageMask, IOptionLoader<IImageMask> {
|
|
4
4
|
src: string;
|
|
5
|
-
constructor();
|
|
6
5
|
load(data?: RecursivePartial<IImageMask>): void;
|
|
7
6
|
}
|
|
@@ -5,9 +5,8 @@ import { TextMaskLine } from "./TextMaskLine.js";
|
|
|
5
5
|
export declare class TextMask implements ITextMask, IOptionLoader<ITextMask> {
|
|
6
6
|
color: string;
|
|
7
7
|
fill: boolean;
|
|
8
|
-
font: FontTextMask;
|
|
9
|
-
lines: TextMaskLine;
|
|
8
|
+
readonly font: FontTextMask;
|
|
9
|
+
readonly lines: TextMaskLine;
|
|
10
10
|
text: string;
|
|
11
|
-
constructor();
|
|
12
11
|
load(data?: RecursivePartial<ITextMask>): void;
|
|
13
12
|
}
|
|
@@ -3,6 +3,5 @@ import type { ITextMaskLine } from "../Interfaces/ITextMaskLine.js";
|
|
|
3
3
|
export declare class TextMaskLine implements ITextMaskLine, IOptionLoader<ITextMaskLine> {
|
|
4
4
|
separator: string;
|
|
5
5
|
spacing: number;
|
|
6
|
-
constructor();
|
|
7
6
|
load(data?: RecursivePartial<ITextMaskLine>): void;
|
|
8
7
|
}
|