@tsparticles/plugin-emitters-shape-canvas 4.0.5 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/EmittersCanvasShape.js +5 -5
- package/browser/index.js +1 -1
- package/browser/index.lazy.js +1 -1
- package/cjs/EmittersCanvasShape.js +5 -5
- package/cjs/index.js +1 -1
- package/cjs/index.lazy.js +1 -1
- package/esm/EmittersCanvasShape.js +5 -5
- package/esm/index.js +1 -1
- package/esm/index.lazy.js +1 -1
- package/package.json +4 -4
- package/tsparticles.plugin.emitters.shape.canvas.js +7 -7
- package/tsparticles.plugin.emitters.shape.canvas.min.js +1 -1
- package/types/EmittersCanvasShape.d.ts +1 -1
|
@@ -6,10 +6,10 @@ export class EmittersCanvasShape extends EmitterShapeBase {
|
|
|
6
6
|
filter;
|
|
7
7
|
pixelData;
|
|
8
8
|
scale;
|
|
9
|
-
|
|
9
|
+
#container;
|
|
10
10
|
constructor(container, position, size, fill, options) {
|
|
11
11
|
super(position, size, fill, options);
|
|
12
|
-
this
|
|
12
|
+
this.#container = container;
|
|
13
13
|
const filter = options.filter, minAlpha = 0;
|
|
14
14
|
let filterFunc = (pixel) => pixel.a > minAlpha;
|
|
15
15
|
if (isString(filter)) {
|
|
@@ -39,21 +39,21 @@ export class EmittersCanvasShape extends EmitterShapeBase {
|
|
|
39
39
|
if (!url) {
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
|
-
pixelData = await getImageData(url, offset, this.
|
|
42
|
+
pixelData = await getImageData(url, offset, this.#container.canvas.render.settings);
|
|
43
43
|
}
|
|
44
44
|
else if (element ?? selector) {
|
|
45
45
|
const canvas = element ?? (selector && safeDocument().querySelector(selector));
|
|
46
46
|
if (!canvas) {
|
|
47
47
|
return;
|
|
48
48
|
}
|
|
49
|
-
const context = canvas.getContext("2d", this.
|
|
49
|
+
const context = canvas.getContext("2d", this.#container.canvas.render.settings);
|
|
50
50
|
if (!context) {
|
|
51
51
|
return;
|
|
52
52
|
}
|
|
53
53
|
pixelData = getCanvasImageData(context, canvas, offset);
|
|
54
54
|
}
|
|
55
55
|
else {
|
|
56
|
-
const data = getTextData(text, offset, this.fill, this.
|
|
56
|
+
const data = getTextData(text, offset, this.fill, this.#container.canvas.render.settings);
|
|
57
57
|
if (isNull(data)) {
|
|
58
58
|
return;
|
|
59
59
|
}
|
package/browser/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ensureEmittersPluginLoaded } from "@tsparticles/plugin-emitters";
|
|
2
2
|
import { EmittersCanvasShapeGenerator } from "./EmittersCanvasShapeGenerator.js";
|
|
3
3
|
export async function loadEmittersShapeCanvas(engine) {
|
|
4
|
-
engine.checkVersion("4.0
|
|
4
|
+
engine.checkVersion("4.1.0");
|
|
5
5
|
await engine.pluginManager.register((e) => {
|
|
6
6
|
ensureEmittersPluginLoaded(e);
|
|
7
7
|
e.pluginManager.addEmitterShapeGenerator?.("canvas", new EmittersCanvasShapeGenerator());
|
package/browser/index.lazy.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export async function loadEmittersShapeCanvas(engine) {
|
|
2
|
-
engine.checkVersion("4.0
|
|
2
|
+
engine.checkVersion("4.1.0");
|
|
3
3
|
await engine.pluginManager.register(async (e) => {
|
|
4
4
|
const { ensureEmittersPluginLoaded } = await import("@tsparticles/plugin-emitters/lazy");
|
|
5
5
|
ensureEmittersPluginLoaded(e);
|
|
@@ -6,10 +6,10 @@ export class EmittersCanvasShape extends EmitterShapeBase {
|
|
|
6
6
|
filter;
|
|
7
7
|
pixelData;
|
|
8
8
|
scale;
|
|
9
|
-
|
|
9
|
+
#container;
|
|
10
10
|
constructor(container, position, size, fill, options) {
|
|
11
11
|
super(position, size, fill, options);
|
|
12
|
-
this
|
|
12
|
+
this.#container = container;
|
|
13
13
|
const filter = options.filter, minAlpha = 0;
|
|
14
14
|
let filterFunc = (pixel) => pixel.a > minAlpha;
|
|
15
15
|
if (isString(filter)) {
|
|
@@ -39,21 +39,21 @@ export class EmittersCanvasShape extends EmitterShapeBase {
|
|
|
39
39
|
if (!url) {
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
|
-
pixelData = await getImageData(url, offset, this.
|
|
42
|
+
pixelData = await getImageData(url, offset, this.#container.canvas.render.settings);
|
|
43
43
|
}
|
|
44
44
|
else if (element ?? selector) {
|
|
45
45
|
const canvas = element ?? (selector && safeDocument().querySelector(selector));
|
|
46
46
|
if (!canvas) {
|
|
47
47
|
return;
|
|
48
48
|
}
|
|
49
|
-
const context = canvas.getContext("2d", this.
|
|
49
|
+
const context = canvas.getContext("2d", this.#container.canvas.render.settings);
|
|
50
50
|
if (!context) {
|
|
51
51
|
return;
|
|
52
52
|
}
|
|
53
53
|
pixelData = getCanvasImageData(context, canvas, offset);
|
|
54
54
|
}
|
|
55
55
|
else {
|
|
56
|
-
const data = getTextData(text, offset, this.fill, this.
|
|
56
|
+
const data = getTextData(text, offset, this.fill, this.#container.canvas.render.settings);
|
|
57
57
|
if (isNull(data)) {
|
|
58
58
|
return;
|
|
59
59
|
}
|
package/cjs/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ensureEmittersPluginLoaded } from "@tsparticles/plugin-emitters";
|
|
2
2
|
import { EmittersCanvasShapeGenerator } from "./EmittersCanvasShapeGenerator.js";
|
|
3
3
|
export async function loadEmittersShapeCanvas(engine) {
|
|
4
|
-
engine.checkVersion("4.0
|
|
4
|
+
engine.checkVersion("4.1.0");
|
|
5
5
|
await engine.pluginManager.register((e) => {
|
|
6
6
|
ensureEmittersPluginLoaded(e);
|
|
7
7
|
e.pluginManager.addEmitterShapeGenerator?.("canvas", new EmittersCanvasShapeGenerator());
|
package/cjs/index.lazy.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export async function loadEmittersShapeCanvas(engine) {
|
|
2
|
-
engine.checkVersion("4.0
|
|
2
|
+
engine.checkVersion("4.1.0");
|
|
3
3
|
await engine.pluginManager.register(async (e) => {
|
|
4
4
|
const { ensureEmittersPluginLoaded } = await import("@tsparticles/plugin-emitters/lazy");
|
|
5
5
|
ensureEmittersPluginLoaded(e);
|
|
@@ -6,10 +6,10 @@ export class EmittersCanvasShape extends EmitterShapeBase {
|
|
|
6
6
|
filter;
|
|
7
7
|
pixelData;
|
|
8
8
|
scale;
|
|
9
|
-
|
|
9
|
+
#container;
|
|
10
10
|
constructor(container, position, size, fill, options) {
|
|
11
11
|
super(position, size, fill, options);
|
|
12
|
-
this
|
|
12
|
+
this.#container = container;
|
|
13
13
|
const filter = options.filter, minAlpha = 0;
|
|
14
14
|
let filterFunc = (pixel) => pixel.a > minAlpha;
|
|
15
15
|
if (isString(filter)) {
|
|
@@ -39,21 +39,21 @@ export class EmittersCanvasShape extends EmitterShapeBase {
|
|
|
39
39
|
if (!url) {
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
|
-
pixelData = await getImageData(url, offset, this.
|
|
42
|
+
pixelData = await getImageData(url, offset, this.#container.canvas.render.settings);
|
|
43
43
|
}
|
|
44
44
|
else if (element ?? selector) {
|
|
45
45
|
const canvas = element ?? (selector && safeDocument().querySelector(selector));
|
|
46
46
|
if (!canvas) {
|
|
47
47
|
return;
|
|
48
48
|
}
|
|
49
|
-
const context = canvas.getContext("2d", this.
|
|
49
|
+
const context = canvas.getContext("2d", this.#container.canvas.render.settings);
|
|
50
50
|
if (!context) {
|
|
51
51
|
return;
|
|
52
52
|
}
|
|
53
53
|
pixelData = getCanvasImageData(context, canvas, offset);
|
|
54
54
|
}
|
|
55
55
|
else {
|
|
56
|
-
const data = getTextData(text, offset, this.fill, this.
|
|
56
|
+
const data = getTextData(text, offset, this.fill, this.#container.canvas.render.settings);
|
|
57
57
|
if (isNull(data)) {
|
|
58
58
|
return;
|
|
59
59
|
}
|
package/esm/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ensureEmittersPluginLoaded } from "@tsparticles/plugin-emitters";
|
|
2
2
|
import { EmittersCanvasShapeGenerator } from "./EmittersCanvasShapeGenerator.js";
|
|
3
3
|
export async function loadEmittersShapeCanvas(engine) {
|
|
4
|
-
engine.checkVersion("4.0
|
|
4
|
+
engine.checkVersion("4.1.0");
|
|
5
5
|
await engine.pluginManager.register((e) => {
|
|
6
6
|
ensureEmittersPluginLoaded(e);
|
|
7
7
|
e.pluginManager.addEmitterShapeGenerator?.("canvas", new EmittersCanvasShapeGenerator());
|
package/esm/index.lazy.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export async function loadEmittersShapeCanvas(engine) {
|
|
2
|
-
engine.checkVersion("4.0
|
|
2
|
+
engine.checkVersion("4.1.0");
|
|
3
3
|
await engine.pluginManager.register(async (e) => {
|
|
4
4
|
const { ensureEmittersPluginLoaded } = await import("@tsparticles/plugin-emitters/lazy");
|
|
5
5
|
ensureEmittersPluginLoaded(e);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/plugin-emitters-shape-canvas",
|
|
3
|
-
"version": "4.0
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"description": "tsParticles emitters shape canvas plugin",
|
|
5
5
|
"homepage": "https://particles.js.org",
|
|
6
6
|
"repository": {
|
|
@@ -106,14 +106,14 @@
|
|
|
106
106
|
"./package.json": "./package.json"
|
|
107
107
|
},
|
|
108
108
|
"peerDependencies": {
|
|
109
|
-
"@tsparticles/engine": "4.0
|
|
110
|
-
"@tsparticles/plugin-emitters": "4.0
|
|
109
|
+
"@tsparticles/engine": "4.1.0",
|
|
110
|
+
"@tsparticles/plugin-emitters": "4.1.0"
|
|
111
111
|
},
|
|
112
112
|
"publishConfig": {
|
|
113
113
|
"access": "public"
|
|
114
114
|
},
|
|
115
115
|
"type": "module",
|
|
116
116
|
"dependencies": {
|
|
117
|
-
"@tsparticles/canvas-utils": "4.0
|
|
117
|
+
"@tsparticles/canvas-utils": "4.1.0"
|
|
118
118
|
}
|
|
119
119
|
}
|
|
@@ -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
|
-
/* Emitters Shape v4.0
|
|
2
|
+
/* Emitters Shape v4.1.0 */
|
|
3
3
|
(function (global, factory) {
|
|
4
4
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@tsparticles/plugin-emitters'), require('@tsparticles/engine'), require('@tsparticles/canvas-utils')) :
|
|
5
5
|
typeof define === 'function' && define.amd ? define(['exports', '@tsparticles/plugin-emitters', '@tsparticles/engine', '@tsparticles/canvas-utils'], factory) :
|
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
filter;
|
|
12
12
|
pixelData;
|
|
13
13
|
scale;
|
|
14
|
-
|
|
14
|
+
#container;
|
|
15
15
|
constructor(container, position, size, fill, options) {
|
|
16
16
|
super(position, size, fill, options);
|
|
17
|
-
this
|
|
17
|
+
this.#container = container;
|
|
18
18
|
const filter = options.filter, minAlpha = 0;
|
|
19
19
|
let filterFunc = (pixel) => pixel.a > minAlpha;
|
|
20
20
|
if (engine.isString(filter)) {
|
|
@@ -44,21 +44,21 @@
|
|
|
44
44
|
if (!url) {
|
|
45
45
|
return;
|
|
46
46
|
}
|
|
47
|
-
pixelData = await canvasUtils.getImageData(url, offset, this.
|
|
47
|
+
pixelData = await canvasUtils.getImageData(url, offset, this.#container.canvas.render.settings);
|
|
48
48
|
}
|
|
49
49
|
else if (element ?? selector) {
|
|
50
50
|
const canvas = element ?? (selector && engine.safeDocument().querySelector(selector));
|
|
51
51
|
if (!canvas) {
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
|
-
const context = canvas.getContext("2d", this.
|
|
54
|
+
const context = canvas.getContext("2d", this.#container.canvas.render.settings);
|
|
55
55
|
if (!context) {
|
|
56
56
|
return;
|
|
57
57
|
}
|
|
58
58
|
pixelData = canvasUtils.getCanvasImageData(context, canvas, offset);
|
|
59
59
|
}
|
|
60
60
|
else {
|
|
61
|
-
const data = canvasUtils.getTextData(text, offset, this.fill, this.
|
|
61
|
+
const data = canvasUtils.getTextData(text, offset, this.fill, this.#container.canvas.render.settings);
|
|
62
62
|
if (engine.isNull(data)) {
|
|
63
63
|
return;
|
|
64
64
|
}
|
|
@@ -248,7 +248,7 @@
|
|
|
248
248
|
}
|
|
249
249
|
|
|
250
250
|
async function loadEmittersShapeCanvas(engine) {
|
|
251
|
-
engine.checkVersion("4.0
|
|
251
|
+
engine.checkVersion("4.1.0");
|
|
252
252
|
await engine.pluginManager.register((e) => {
|
|
253
253
|
pluginEmitters.ensureEmittersPluginLoaded(e);
|
|
254
254
|
e.pluginManager.addEmitterShapeGenerator?.("canvas", new EmittersCanvasShapeGenerator());
|
|
@@ -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/plugin-emitters"),require("@tsparticles/engine"),require("@tsparticles/canvas-utils")):"function"==typeof define&&define.amd?define(["exports","@tsparticles/plugin-emitters","@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.emittersShapes=t.__tsParticlesInternals.plugins.emittersShapes||{},t.__tsParticlesInternals.plugins.emittersShapes.canvas=t.__tsParticlesInternals.plugins.emittersShapes.canvas||{}),t.__tsParticlesInternals.plugins.emitters,t.__tsParticlesInternals.engine,t.__tsParticlesInternals.canvas.utils)}(this,function(t,s,e,a){"use strict";class n extends s.EmitterShapeBase{filter;pixelData;scale;
|
|
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/plugin-emitters"),require("@tsparticles/engine"),require("@tsparticles/canvas-utils")):"function"==typeof define&&define.amd?define(["exports","@tsparticles/plugin-emitters","@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.emittersShapes=t.__tsParticlesInternals.plugins.emittersShapes||{},t.__tsParticlesInternals.plugins.emittersShapes.canvas=t.__tsParticlesInternals.plugins.emittersShapes.canvas||{}),t.__tsParticlesInternals.plugins.emitters,t.__tsParticlesInternals.engine,t.__tsParticlesInternals.canvas.utils)}(this,function(t,s,e,a){"use strict";class n extends s.EmitterShapeBase{filter;pixelData;scale;#t;constructor(t,s,a,n,i){super(s,a,n,i),this.#t=t;const l=i.filter;let r=t=>t.a>0;if(e.isString(l)){if(l in globalThis){const t=globalThis[l];e.isFunction(t)&&(r=t)}}else r=l;this.filter=r,this.scale=i.scale,this.pixelData={pixels:[],height:0,width:0}}async init(){let t;const s=this.options,n=s.selector,i=s.pixels,l=s.image,r=s.element,c=s.text,o=i.offset;if(l){const s=l.src;if(!s)return;t=await a.getImageData(s,o,this.#t.canvas.render.settings)}else if(r??n){const s=r??(n&&e.safeDocument().querySelector(n));if(!s)return;const i=s.getContext("2d",this.#t.canvas.render.settings);if(!i)return;t=a.getCanvasImageData(i,s,o)}else{const s=a.getTextData(c,o,this.fill,this.#t.canvas.render.settings);if(e.isNull(s))return;t=s}this.pixelData=t}randomPosition(){const{height:t,width:s}=this.pixelData,a=this.pixelData,n=this.position,i=this.scale,l=n.x-s*i*e.half,r=n.y-t*i*e.half;for(let n=0;n<100;n++){const n=Math.floor(e.getRandom()*s*t),c={x:n%s,y:Math.floor(n/s)},o=a.pixels[c.y];if(!o)continue;const _=o[c.x];if(!_)continue;if(this.filter(_))return{position:{x:c.x*i+l,y:c.y*i+r},color:{..._},opacity:_.a}}return null}resize(t,s){super.resize(t,s)}}class i{offset;constructor(){this.offset=4}load(t){e.isNull(t)||void 0!==t.offset&&(this.offset=t.offset)}}class l{family;size;style;variant;weight;constructor(){this.family="Verdana",this.size=32,this.style="",this.variant="",this.weight=""}load(t){e.isNull(t)||(void 0!==t.family&&(this.family=t.family),void 0!==t.size&&(this.size=t.size),void 0!==t.style&&(this.style=t.style),void 0!==t.variant&&(this.variant=t.variant),void 0!==t.weight&&(this.weight=t.weight))}}class r{separator;spacing;constructor(){this.separator="\n",this.spacing=0}load(t){e.isNull(t)||(void 0!==t.separator&&(this.separator=t.separator),void 0!==t.spacing&&(this.spacing=t.spacing))}}class c{color;font;lines;text;constructor(){this.color="#000000",this.font=new l,this.lines=new r,this.text=""}load(t){e.isNull(t)||(void 0!==t.color&&(this.color=t.color),this.font.load(t.font),this.lines.load(t.lines),void 0!==t.text&&(this.text=t.text))}}class o{element;filter;image;pixels;scale;selector;text;constructor(){this.filter=t=>t.a>0,this.pixels=new i,this.scale=1,this.selector="",this.text=new c}load(t){e.isNull(t)||(void 0!==t.element&&(this.element=t.element),void 0!==t.filter&&(this.filter=t.filter),this.pixels.load(t.pixels),void 0!==t.scale&&(this.scale=t.scale),void 0!==t.selector&&(this.selector=t.selector),void 0!==t.image&&(this.image=t.image),this.text.load(t.text))}}class _{generate(t,s,e,a,i){const l=new o;return l.load(i),new n(t,s,e,a,l)}}async function p(t){t.checkVersion("4.1.0"),await t.pluginManager.register(t=>{s.ensureEmittersPluginLoaded(t),t.pluginManager.addEmitterShapeGenerator?.("canvas",new _)})}const h=globalThis;h.__tsParticlesInternals=h.__tsParticlesInternals??{},h.loadEmittersShapeCanvas=p,t.loadEmittersShapeCanvas=p}),Object.assign(globalThis.window||globalThis,{loadEmittersShapeCanvas:(globalThis.__tsParticlesInternals.plugins.emittersShapes.canvas||{}).loadEmittersShapeCanvas}),delete(globalThis.window||globalThis).tsparticlesInternalExports;
|
|
@@ -3,10 +3,10 @@ import { EmitterShapeBase, type IRandomPositionData } from "@tsparticles/plugin-
|
|
|
3
3
|
import type { CanvasPixelData } from "./types.js";
|
|
4
4
|
import type { EmittersCanvasShapeOptions } from "./Options/Classes/EmittersCanvasShapeOptions.js";
|
|
5
5
|
export declare class EmittersCanvasShape extends EmitterShapeBase<EmittersCanvasShapeOptions> {
|
|
6
|
+
#private;
|
|
6
7
|
filter: (pixel: IRgba) => boolean;
|
|
7
8
|
pixelData: CanvasPixelData;
|
|
8
9
|
scale: number;
|
|
9
|
-
private readonly _container;
|
|
10
10
|
constructor(container: Container, position: ICoordinates, size: IDimension, fill: boolean, options: EmittersCanvasShapeOptions);
|
|
11
11
|
init(): Promise<void>;
|
|
12
12
|
randomPosition(): IRandomPositionData | null;
|