@tsparticles/engine 3.2.2 → 3.3.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/174.min.js +2 -0
- package/174.min.js.LICENSE.txt +1 -0
- package/browser/Core/Canvas.js +9 -9
- package/browser/Core/Container.js +6 -6
- package/browser/Core/Engine.js +1 -1
- package/browser/Core/Particle.js +11 -11
- package/browser/Core/Particles.js +29 -29
- package/browser/Core/Utils/InteractionManager.js +4 -4
- package/browser/Utils/CanvasUtils.js +14 -14
- package/cjs/Core/Canvas.js +9 -9
- package/cjs/Core/Container.js +6 -6
- package/cjs/Core/Engine.js +2 -25
- package/cjs/Core/Particle.js +11 -11
- package/cjs/Core/Particles.js +30 -53
- package/cjs/Core/Utils/InteractionManager.js +4 -4
- package/cjs/Utils/CanvasUtils.js +14 -14
- package/dist_browser_Core_Container_js.js +15 -5
- package/esm/Core/Canvas.js +9 -9
- package/esm/Core/Container.js +6 -6
- package/esm/Core/Engine.js +1 -1
- package/esm/Core/Particle.js +11 -11
- package/esm/Core/Particles.js +29 -29
- package/esm/Core/Utils/InteractionManager.js +4 -4
- package/esm/Utils/CanvasUtils.js +14 -14
- package/package.json +1 -1
- package/report.html +1 -1
- package/tsparticles.engine.js +4 -4
- package/tsparticles.engine.min.js +1 -1
- package/tsparticles.engine.min.js.LICENSE.txt +1 -1
- package/types/Core/Canvas.d.ts +4 -4
- package/types/Core/Interfaces/IContainerPlugin.d.ts +4 -4
- package/types/Core/Interfaces/IEffectDrawer.d.ts +3 -3
- package/types/Core/Interfaces/IExternalInteractor.d.ts +1 -1
- package/types/Core/Interfaces/IMovePathGenerator.d.ts +2 -2
- package/types/Core/Interfaces/IParticleMover.d.ts +2 -2
- package/types/Core/Interfaces/IParticleUpdater.d.ts +2 -2
- package/types/Core/Interfaces/IParticlesInteractor.d.ts +1 -1
- package/types/Core/Interfaces/IShapeDrawer.d.ts +4 -4
- package/types/Core/Particle.d.ts +2 -2
- package/types/Core/Particles.d.ts +7 -7
- package/types/Core/Utils/ExternalInteractorBase.d.ts +1 -1
- package/types/Core/Utils/InteractionManager.d.ts +2 -2
- package/types/Core/Utils/ParticlesInteractorBase.d.ts +1 -1
- package/types/Utils/CanvasUtils.d.ts +6 -6
- package/umd/Core/Canvas.js +9 -9
- package/umd/Core/Container.js +6 -6
- package/umd/Core/Engine.js +1 -1
- package/umd/Core/Particle.js +11 -11
- package/umd/Core/Particles.js +31 -55
- package/umd/Core/Utils/InteractionManager.js +4 -4
- package/umd/Utils/CanvasUtils.js +14 -14
- package/373.min.js +0 -2
- package/373.min.js.LICENSE.txt +0 -1
- package/438.min.js +0 -2
- package/438.min.js.LICENSE.txt +0 -1
- package/dist_browser_Core_Particle_js.js +0 -32
package/esm/Core/Particles.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getLogger, getPosition } from "../Utils/Utils.js";
|
|
2
2
|
import { InteractionManager } from "./Utils/InteractionManager.js";
|
|
3
|
+
import { Particle } from "./Particle.js";
|
|
3
4
|
import { Point } from "./Utils/Point.js";
|
|
4
5
|
import { QuadTree } from "./Utils/QuadTree.js";
|
|
5
6
|
import { Rectangle } from "./Utils/Ranges.js";
|
|
@@ -16,7 +17,7 @@ export class Particles {
|
|
|
16
17
|
this._pool.push(particle);
|
|
17
18
|
}
|
|
18
19
|
};
|
|
19
|
-
this._applyDensity =
|
|
20
|
+
this._applyDensity = (options, manualCount, group) => {
|
|
20
21
|
const numberOptions = options.number;
|
|
21
22
|
if (!options.number.density?.enable) {
|
|
22
23
|
if (group === undefined) {
|
|
@@ -35,7 +36,7 @@ export class Particles {
|
|
|
35
36
|
this._groupLimits.set(group, numberOptions.limit.value * densityFactor);
|
|
36
37
|
}
|
|
37
38
|
if (particlesCount < particlesNumber) {
|
|
38
|
-
|
|
39
|
+
this.push(Math.abs(particlesNumber - particlesCount), undefined, options, group);
|
|
39
40
|
}
|
|
40
41
|
else if (particlesCount > particlesNumber) {
|
|
41
42
|
this.removeQuantity(particlesCount - particlesNumber, group);
|
|
@@ -49,14 +50,13 @@ export class Particles {
|
|
|
49
50
|
const canvas = container.canvas.element, pxRatio = container.retina.pixelRatio;
|
|
50
51
|
return (canvas.width * canvas.height) / (densityOptions.height * densityOptions.width * pxRatio ** squareExp);
|
|
51
52
|
};
|
|
52
|
-
this._pushParticle =
|
|
53
|
+
this._pushParticle = (position, overrideOptions, group, initializer) => {
|
|
53
54
|
try {
|
|
54
55
|
let particle = this._pool.pop();
|
|
55
56
|
if (!particle) {
|
|
56
|
-
const { Particle } = await import("./Particle.js");
|
|
57
57
|
particle = new Particle(this._engine, this._container);
|
|
58
58
|
}
|
|
59
|
-
|
|
59
|
+
particle.init(this._nextId, position, overrideOptions, group);
|
|
60
60
|
let canAdd = true;
|
|
61
61
|
if (initializer) {
|
|
62
62
|
canAdd = initializer(particle);
|
|
@@ -117,13 +117,13 @@ export class Particles {
|
|
|
117
117
|
get count() {
|
|
118
118
|
return this._array.length;
|
|
119
119
|
}
|
|
120
|
-
|
|
120
|
+
addManualParticles() {
|
|
121
121
|
const container = this._container, options = container.actualOptions;
|
|
122
122
|
for (const particle of options.manualParticles) {
|
|
123
|
-
|
|
123
|
+
this.addParticle(particle.position ? getPosition(particle.position, container.canvas.size) : undefined, particle.options);
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
|
-
|
|
126
|
+
addParticle(position, overrideOptions, group, initializer) {
|
|
127
127
|
const limitOptions = this._container.actualOptions.particles.number.limit, limit = group === undefined ? this._limit : this._groupLimits.get(group) ?? this._limit, currentCount = this.count, minLimit = 0;
|
|
128
128
|
if (limit > minLimit) {
|
|
129
129
|
if (limitOptions.mode === "delete") {
|
|
@@ -138,7 +138,7 @@ export class Particles {
|
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
|
-
return
|
|
141
|
+
return this._pushParticle(position, overrideOptions, group, initializer);
|
|
142
142
|
}
|
|
143
143
|
clear() {
|
|
144
144
|
this._array = [];
|
|
@@ -151,15 +151,15 @@ export class Particles {
|
|
|
151
151
|
this.movers = [];
|
|
152
152
|
this.updaters = [];
|
|
153
153
|
}
|
|
154
|
-
|
|
154
|
+
draw(delta) {
|
|
155
155
|
const container = this._container, canvas = container.canvas;
|
|
156
156
|
canvas.clear();
|
|
157
|
-
|
|
157
|
+
this.update(delta);
|
|
158
158
|
for (const [, plugin] of container.plugins) {
|
|
159
|
-
|
|
159
|
+
canvas.drawPlugin(plugin, delta);
|
|
160
160
|
}
|
|
161
161
|
for (const p of this._zArray) {
|
|
162
|
-
|
|
162
|
+
p.draw(delta);
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
165
|
filter(condition) {
|
|
@@ -188,17 +188,17 @@ export class Particles {
|
|
|
188
188
|
break;
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
|
-
|
|
191
|
+
this.addManualParticles();
|
|
192
192
|
if (!handled) {
|
|
193
193
|
const particlesOptions = options.particles, groups = particlesOptions.groups;
|
|
194
194
|
for (const group in groups) {
|
|
195
195
|
const groupOptions = groups[group];
|
|
196
196
|
for (let i = this.count, j = 0; j < groupOptions.number?.value && i < particlesOptions.number.value; i++, j++) {
|
|
197
|
-
|
|
197
|
+
this.addParticle(undefined, groupOptions, group);
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
200
|
for (let i = this.count; i < particlesOptions.number.value; i++) {
|
|
201
|
-
|
|
201
|
+
this.addParticle();
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
204
|
}
|
|
@@ -211,18 +211,18 @@ export class Particles {
|
|
|
211
211
|
this.updaters = await this._engine.getUpdaters(container, true);
|
|
212
212
|
await this._interactionManager.init();
|
|
213
213
|
for (const [, pathGenerator] of container.pathGenerators) {
|
|
214
|
-
|
|
214
|
+
pathGenerator.init(container);
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
|
-
|
|
217
|
+
push(nb, mouse, overrideOptions, group) {
|
|
218
218
|
for (let i = 0; i < nb; i++) {
|
|
219
|
-
|
|
219
|
+
this.addParticle(mouse?.position, overrideOptions, group);
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
222
|
async redraw() {
|
|
223
223
|
this.clear();
|
|
224
224
|
await this.init();
|
|
225
|
-
|
|
225
|
+
this.draw({ value: 0, factor: 0 });
|
|
226
226
|
}
|
|
227
227
|
remove(particle, group, override) {
|
|
228
228
|
this.removeAt(this._array.indexOf(particle), undefined, group, override);
|
|
@@ -243,12 +243,12 @@ export class Particles {
|
|
|
243
243
|
const defaultIndex = 0;
|
|
244
244
|
this.removeAt(defaultIndex, quantity, group);
|
|
245
245
|
}
|
|
246
|
-
|
|
246
|
+
setDensity() {
|
|
247
247
|
const options = this._container.actualOptions, groups = options.particles.groups, manualCount = 0;
|
|
248
248
|
for (const group in groups) {
|
|
249
|
-
|
|
249
|
+
this._applyDensity(groups[group], manualCount, group);
|
|
250
250
|
}
|
|
251
|
-
|
|
251
|
+
this._applyDensity(options.particles, options.manualParticles.length);
|
|
252
252
|
}
|
|
253
253
|
setLastZIndex(zIndex) {
|
|
254
254
|
this._lastZIndex = zIndex;
|
|
@@ -257,14 +257,14 @@ export class Particles {
|
|
|
257
257
|
setResizeFactor(factor) {
|
|
258
258
|
this._resizeFactor = factor;
|
|
259
259
|
}
|
|
260
|
-
|
|
260
|
+
update(delta) {
|
|
261
261
|
const container = this._container, particlesToDelete = new Set();
|
|
262
262
|
this.quadTree = new QuadTree(qTreeRectangle(container.canvas.size), qTreeCapacity);
|
|
263
263
|
for (const [, pathGenerator] of container.pathGenerators) {
|
|
264
264
|
pathGenerator.update();
|
|
265
265
|
}
|
|
266
266
|
for (const [, plugin] of container.plugins) {
|
|
267
|
-
|
|
267
|
+
plugin.update?.(delta);
|
|
268
268
|
}
|
|
269
269
|
const resizeFactor = this._resizeFactor;
|
|
270
270
|
for (const particle of this._array) {
|
|
@@ -284,7 +284,7 @@ export class Particles {
|
|
|
284
284
|
}
|
|
285
285
|
for (const mover of this.movers) {
|
|
286
286
|
if (mover.isEnabled(particle)) {
|
|
287
|
-
|
|
287
|
+
mover.move(particle, delta);
|
|
288
288
|
}
|
|
289
289
|
}
|
|
290
290
|
if (particle.destroyed) {
|
|
@@ -307,13 +307,13 @@ export class Particles {
|
|
|
307
307
|
}
|
|
308
308
|
this._addToPool(...particlesToDelete);
|
|
309
309
|
}
|
|
310
|
-
|
|
310
|
+
this._interactionManager.externalInteract(delta);
|
|
311
311
|
for (const particle of this._array) {
|
|
312
312
|
for (const updater of this.updaters) {
|
|
313
|
-
|
|
313
|
+
updater.update(particle, delta);
|
|
314
314
|
}
|
|
315
315
|
if (!particle.destroyed && !particle.spawning) {
|
|
316
|
-
|
|
316
|
+
this._interactionManager.particlesInteract(particle, delta);
|
|
317
317
|
}
|
|
318
318
|
}
|
|
319
319
|
delete this._resizeFactor;
|
|
@@ -6,10 +6,10 @@ export class InteractionManager {
|
|
|
6
6
|
this._externalInteractors = [];
|
|
7
7
|
this._particleInteractors = [];
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
externalInteract(delta) {
|
|
10
10
|
for (const interactor of this._externalInteractors) {
|
|
11
11
|
if (interactor.isEnabled()) {
|
|
12
|
-
|
|
12
|
+
interactor.interact(delta);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
}
|
|
@@ -34,13 +34,13 @@ export class InteractionManager {
|
|
|
34
34
|
interactor.init();
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
-
|
|
37
|
+
particlesInteract(particle, delta) {
|
|
38
38
|
for (const interactor of this._externalInteractors) {
|
|
39
39
|
interactor.clear(particle, delta);
|
|
40
40
|
}
|
|
41
41
|
for (const interactor of this._particleInteractors) {
|
|
42
42
|
if (interactor.isEnabled(particle)) {
|
|
43
|
-
|
|
43
|
+
interactor.interact(particle, delta);
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
}
|
package/esm/Utils/CanvasUtils.js
CHANGED
|
@@ -21,7 +21,7 @@ export function paintImage(context, dimension, image, opacity) {
|
|
|
21
21
|
export function clear(context, dimension) {
|
|
22
22
|
context.clearRect(origin.x, origin.y, dimension.width, dimension.height);
|
|
23
23
|
}
|
|
24
|
-
export
|
|
24
|
+
export function drawParticle(data) {
|
|
25
25
|
const { container, context, particle, delta, colorStyles, backgroundMask, composite, radius, opacity, shadow, transform, } = data, pos = particle.getPosition(), defaultAngle = 0, angle = particle.rotation + (particle.pathRotation ? particle.velocity.angle : defaultAngle), rotateData = {
|
|
26
26
|
sin: Math.sin(angle),
|
|
27
27
|
cos: Math.cos(angle),
|
|
@@ -60,13 +60,13 @@ export async function drawParticle(data) {
|
|
|
60
60
|
transformData,
|
|
61
61
|
strokeWidth,
|
|
62
62
|
};
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
drawShape(drawData);
|
|
64
|
+
drawShapeAfterDraw(drawData);
|
|
65
|
+
drawEffect(drawData);
|
|
66
66
|
context.globalCompositeOperation = "source-over";
|
|
67
67
|
context.resetTransform();
|
|
68
68
|
}
|
|
69
|
-
export
|
|
69
|
+
export function drawEffect(data) {
|
|
70
70
|
const { container, context, particle, radius, opacity, delta, transformData } = data;
|
|
71
71
|
if (!particle.effect) {
|
|
72
72
|
return;
|
|
@@ -75,7 +75,7 @@ export async function drawEffect(data) {
|
|
|
75
75
|
if (!drawer) {
|
|
76
76
|
return;
|
|
77
77
|
}
|
|
78
|
-
|
|
78
|
+
drawer.draw({
|
|
79
79
|
context,
|
|
80
80
|
particle,
|
|
81
81
|
radius,
|
|
@@ -85,7 +85,7 @@ export async function drawEffect(data) {
|
|
|
85
85
|
transformData: { ...transformData },
|
|
86
86
|
});
|
|
87
87
|
}
|
|
88
|
-
export
|
|
88
|
+
export function drawShape(data) {
|
|
89
89
|
const { container, context, particle, radius, opacity, delta, strokeWidth, transformData } = data, minStrokeWidth = 0;
|
|
90
90
|
if (!particle.shape) {
|
|
91
91
|
return;
|
|
@@ -95,7 +95,7 @@ export async function drawShape(data) {
|
|
|
95
95
|
return;
|
|
96
96
|
}
|
|
97
97
|
context.beginPath();
|
|
98
|
-
|
|
98
|
+
drawer.draw({
|
|
99
99
|
context,
|
|
100
100
|
particle,
|
|
101
101
|
radius,
|
|
@@ -114,7 +114,7 @@ export async function drawShape(data) {
|
|
|
114
114
|
context.fill();
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
|
-
export
|
|
117
|
+
export function drawShapeAfterDraw(data) {
|
|
118
118
|
const { container, context, particle, radius, opacity, delta, transformData } = data;
|
|
119
119
|
if (!particle.shape) {
|
|
120
120
|
return;
|
|
@@ -123,7 +123,7 @@ export async function drawShapeAfterDraw(data) {
|
|
|
123
123
|
if (!drawer?.afterDraw) {
|
|
124
124
|
return;
|
|
125
125
|
}
|
|
126
|
-
|
|
126
|
+
drawer.afterDraw({
|
|
127
127
|
context,
|
|
128
128
|
particle,
|
|
129
129
|
radius,
|
|
@@ -133,17 +133,17 @@ export async function drawShapeAfterDraw(data) {
|
|
|
133
133
|
transformData: { ...transformData },
|
|
134
134
|
});
|
|
135
135
|
}
|
|
136
|
-
export
|
|
136
|
+
export function drawPlugin(context, plugin, delta) {
|
|
137
137
|
if (!plugin.draw) {
|
|
138
138
|
return;
|
|
139
139
|
}
|
|
140
|
-
|
|
140
|
+
plugin.draw(context, delta);
|
|
141
141
|
}
|
|
142
|
-
export
|
|
142
|
+
export function drawParticlePlugin(context, plugin, particle, delta) {
|
|
143
143
|
if (!plugin.drawParticle) {
|
|
144
144
|
return;
|
|
145
145
|
}
|
|
146
|
-
|
|
146
|
+
plugin.drawParticle(context, particle, delta);
|
|
147
147
|
}
|
|
148
148
|
export function alterHsl(color, type, value) {
|
|
149
149
|
const lFactor = 1;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/engine",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"description": "Easily create highly customizable particle, confetti and fireworks animations and use them as animated backgrounds for your website. Ready to use components available also for React, Vue.js (2.x and 3.x), Angular, Svelte, jQuery, Preact, Riot.js, Inferno.",
|
|
5
5
|
"homepage": "https://particles.js.org",
|
|
6
6
|
"scripts": {
|
package/report.html
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8"/>
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
6
|
-
<title>@tsparticles/engine [
|
|
6
|
+
<title>@tsparticles/engine [27 Feb 2024 at 12:13]</title>
|
|
7
7
|
<link rel="shortcut icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAABrVBMVEUAAAD///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////+O1foceMD///+J0/qK1Pr7/v8Xdr/9///W8P4UdL7L7P0Scr2r4Pyj3vwad8D5/f/2/f+55f3E6f34+/2H0/ojfMKpzOd0rNgQcb3F3O/j9f7c8v6g3Pz0/P/w+v/q+P7n9v6T1/uQ1vuE0vqLut/y+v+Z2fvt+f+15Pzv9fuc2/vR7v2V2Pvd6/bg9P7I6/285/2y4/yp3/zp8vk8i8kqgMT7/P31+fyv4vxGkcz6/P6/6P3j7vfS5PNnpNUxhcbO7f7F6v3O4vHK3/DA2u631Ouy0eqXweKJud5wqthfoNMMbLvY8f73+v2dxeR8sNtTmdDx9/zX6PSjyeaCtd1YnNGX2PuQveCGt95Nls42h8dLlM3F4vBtAAAAM3RSTlMAAyOx0/sKBvik8opWGBMOAe3l1snDm2E9LSb06eHcu5JpHbarfHZCN9CBb08zzkdNS0kYaptYAAAFV0lEQVRYw92X51/aYBDHHS2O2qqttVbrqNq9m+TJIAYIShBkWwqIiCgoWvfeq7Z2/s29hyQNyUcR7LveGwVyXy6XH8/9rqxglLfUPLxVduUor3h0rfp2TYvpivk37929TkG037hffoX0+peVtZQc1589rigVUdXS/ABSAyEmGIO/1XfvldSK8vs3OqB6u3m0nxmIrvgB0dj7rr7Y9IbuF68hnfFaiHA/sxqm0wciIG43P60qKv9WXWc1RXGh/mFESFABTSBi0sNAKzqet17eCtOb3kZIDwxEEU0oAIJGYxNBDhBND29e0rtXXbcpuPmED9IhEAAQ/AXEaF8EPmnrrKsv0LvWR3fg5sWDNAFZOgAgaKvZDogHNU9MFwnnYROkc56RD5CjAbQX9Ow4g7upCsvYu55aSI/Nj0H1akgKQEUM94dwK65hYRmFU9MIcH/fqJYOZYcnuJSU/waKDgTOEVaVKhwrTRP5XzgSpAITYzom7UvkhFX5VutmxeNnWDjjswTKTyfgluNDGbUpWissXhF3s7mlSml+czWkg3D0l1nNjGNjz3myOQOa1KM/jOS6ebdbAVTCi4gljHSFrviza7tOgRWcS0MOUX9zdNgag5w7rRqA44Lzw0hr1WqES36dFliSJFlh2rXIae3FFcDDgKdxrUIDePr8jGcSClV1u7A9xeN0ModY/pHMxmR1EzRh8TJiwqsHmKW0l4FCEZI+jHio+JdPPE9qwQtTRxku2D8sIeRL2LnxWSllANCQGOIiqVHAz2ye2JR0DcH+HoxDkaADLjgxjKQ+AwCX/g0+DNgdG0ukYCONAe+dbc2IAc6fwt1ARoDSezNHxV2Cmzwv3O6lDMV55edBGwGK9n1+x2F8EDfAGCxug8MhpsMEcTEAWf3rx2vZhe/LAmtIn/6apE6PN0ULKgywD9mmdxbmFl3OvD5AS5fW5zLbv/YHmcsBTjf/afDz3MaZTVCfAP9z6/Bw6ycv8EUBWJIn9zYcoAWWlW9+OzO3vkTy8H+RANLmdrpOuYWdZYEXpo+TlCJrW5EARb7fF+bWdqf3hhyZI1nWJQHgznErZhbjoEsWqi8dQNoE294aldzFurwSABL2XXMf9+H1VQGke9exw5P/AnA5Pv5ngMul7LOvO922iwACu8WkCwLCafvM4CeWPxfA8lNHcWZSoi8EwMAIciKX2Z4SWCMAa3snCZ/G4EA8D6CMLNFsGQhkkz/gQNEBbPCbWsxGUpYVu3z8IyNAknwJkfPMEhLyrdi5RTyUVACkw4GSFRNWJNEW+fgPGwHD8/JxnRuLabN4CGNRkAE23na2+VmEAUmrYymSGjMAYqH84YUIyzgzs3XC7gNgH36Vcc4zKY9o9fgPBXUAiHHwVboBHGLiX6Zcjp1f2wu4tvzZKo0ecPnDtQYDQvJXaBeNzce45Fp28ZQLrEZVuFqgBwOalArKXnW1UzlnSusQKJqKYNuz4tOnI6sZG4zanpemv+7ySU2jbA9h6uhcgpfy6G2PahirDZ6zvq6zDduMVFTKvzw8wgyEdelwY9in3XkEPs3osJuwRQ4qTkfzifndg9Gfc4pdsu82+tTnHZTBa2EAMrqr2t43pguc8tNm7JQVQ2S0ukj2d22dhXYP0/veWtwKrCkNoNimAN5+Xr/oLrxswKbVJjteWrX7eR63o4j9q0GxnaBdWgGA5VStpanIjQmEhV0/nVt5VOFUvix6awJhPcAaTEShgrG+iGyvb5a0Ndb1YGHFPEwoqAinoaykaID1o1pdPNu7XsnCKQ3R+hwWIIhGvORcJUBYXe3Xa3vq/mF/N9V13ugufMkfXn+KHsRD0B8AAAAASUVORK5CYII=" type="image/x-icon" />
|
|
8
8
|
|
|
9
9
|
<script>
|
package/tsparticles.engine.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* tsParticles Engine v3.
|
|
2
|
+
* tsParticles Engine v3.3.0
|
|
3
3
|
* Author: Matteo Bruni
|
|
4
4
|
* MIT license: https://opensource.org/licenses/MIT
|
|
5
5
|
* Website: https://particles.js.org/
|
|
@@ -36,7 +36,7 @@ return /******/ (() => { // webpackBootstrap
|
|
|
36
36
|
\*************************************/
|
|
37
37
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
38
38
|
|
|
39
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Engine: () => (/* binding */ Engine)\n/* harmony export */ });\n/* harmony import */ var _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Utils/Constants.js */ \"./dist/browser/Core/Utils/Constants.js\");\n/* harmony import */ var _Utils_Utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Utils/Utils.js */ \"./dist/browser/Utils/Utils.js\");\n/* harmony import */ var _Utils_EventDispatcher_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Utils/EventDispatcher.js */ \"./dist/browser/Utils/EventDispatcher.js\");\n/* harmony import */ var _Utils_NumberUtils_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Utils/NumberUtils.js */ \"./dist/browser/Utils/NumberUtils.js\");\n\n\n\n\nasync function getItemsFromInitializer(container, map, initializers, force = false) {\n let res = map.get(container);\n if (!res || force) {\n res = await Promise.all([...initializers.values()].map(t => t(container)));\n map.set(container, res);\n }\n return res;\n}\nasync function getDataFromUrl(data) {\n const url = (0,_Utils_Utils_js__WEBPACK_IMPORTED_MODULE_0__.itemFromSingleOrMultiple)(data.url, data.index);\n if (!url) {\n return data.fallback;\n }\n const response = await fetch(url);\n if (response.ok) {\n return await response.json();\n }\n (0,_Utils_Utils_js__WEBPACK_IMPORTED_MODULE_0__.getLogger)().error(`${_Utils_Constants_js__WEBPACK_IMPORTED_MODULE_1__.errorPrefix} ${response.status} while retrieving config file`);\n return data.fallback;\n}\nclass Engine {\n constructor() {\n this._configs = new Map();\n this._domArray = [];\n this._eventDispatcher = new _Utils_EventDispatcher_js__WEBPACK_IMPORTED_MODULE_2__.EventDispatcher();\n this._initialized = false;\n this.plugins = [];\n this._initializers = {\n interactors: new Map(),\n movers: new Map(),\n updaters: new Map()\n };\n this.interactors = new Map();\n this.movers = new Map();\n this.updaters = new Map();\n this.presets = new Map();\n this.effectDrawers = new Map();\n this.shapeDrawers = new Map();\n this.pathGenerators = new Map();\n }\n get configs() {\n const res = {};\n for (const [name, config] of this._configs) {\n res[name] = config;\n }\n return res;\n }\n get version() {\n return \"3.2.2\";\n }\n addConfig(config) {\n const key = config.key ?? config.name ?? \"default\";\n this._configs.set(key, config);\n this._eventDispatcher.dispatchEvent(\"configAdded\", {\n data: {\n name: key,\n config\n }\n });\n }\n async addEffect(effect, drawer, refresh = true) {\n (0,_Utils_Utils_js__WEBPACK_IMPORTED_MODULE_0__.executeOnSingleOrMultiple)(effect, type => {\n if (!this.getEffectDrawer(type)) {\n this.effectDrawers.set(type, drawer);\n }\n });\n await this.refresh(refresh);\n }\n addEventListener(type, listener) {\n this._eventDispatcher.addEventListener(type, listener);\n }\n async addInteractor(name, interactorInitializer, refresh = true) {\n this._initializers.interactors.set(name, interactorInitializer);\n await this.refresh(refresh);\n }\n async addMover(name, moverInitializer, refresh = true) {\n this._initializers.movers.set(name, moverInitializer);\n await this.refresh(refresh);\n }\n async addParticleUpdater(name, updaterInitializer, refresh = true) {\n this._initializers.updaters.set(name, updaterInitializer);\n await this.refresh(refresh);\n }\n async addPathGenerator(name, generator, refresh = true) {\n if (!this.getPathGenerator(name)) {\n this.pathGenerators.set(name, generator);\n }\n await this.refresh(refresh);\n }\n async addPlugin(plugin, refresh = true) {\n if (!this.getPlugin(plugin.id)) {\n this.plugins.push(plugin);\n }\n await this.refresh(refresh);\n }\n async addPreset(preset, options, override = false, refresh = true) {\n if (override || !this.getPreset(preset)) {\n this.presets.set(preset, options);\n }\n await this.refresh(refresh);\n }\n async addShape(shape, drawer, refresh = true) {\n (0,_Utils_Utils_js__WEBPACK_IMPORTED_MODULE_0__.executeOnSingleOrMultiple)(shape, type => {\n if (!this.getShapeDrawer(type)) {\n this.shapeDrawers.set(type, drawer);\n }\n });\n await this.refresh(refresh);\n }\n clearPlugins(container) {\n this.updaters.delete(container);\n this.movers.delete(container);\n this.interactors.delete(container);\n }\n dispatchEvent(type, args) {\n this._eventDispatcher.dispatchEvent(type, args);\n }\n dom() {\n return this._domArray;\n }\n domItem(index) {\n const dom = this.dom(),\n item = dom[index];\n if (!item || item.destroyed) {\n const deleteCount = 1;\n dom.splice(index, deleteCount);\n return;\n }\n return item;\n }\n async getAvailablePlugins(container) {\n const res = new Map();\n for (const plugin of this.plugins) {\n if (plugin.needsPlugin(container.actualOptions)) {\n res.set(plugin.id, await plugin.getPlugin(container));\n }\n }\n return res;\n }\n getEffectDrawer(type) {\n return this.effectDrawers.get(type);\n }\n async getInteractors(container, force = false) {\n return await getItemsFromInitializer(container, this.interactors, this._initializers.interactors, force);\n }\n async getMovers(container, force = false) {\n return await getItemsFromInitializer(container, this.movers, this._initializers.movers, force);\n }\n getPathGenerator(type) {\n return this.pathGenerators.get(type);\n }\n getPlugin(plugin) {\n return this.plugins.find(t => t.id === plugin);\n }\n getPreset(preset) {\n return this.presets.get(preset);\n }\n getShapeDrawer(type) {\n return this.shapeDrawers.get(type);\n }\n getSupportedEffects() {\n return this.effectDrawers.keys();\n }\n getSupportedShapes() {\n return this.shapeDrawers.keys();\n }\n async getUpdaters(container, force = false) {\n return await getItemsFromInitializer(container, this.updaters, this._initializers.updaters, force);\n }\n init() {\n if (this._initialized) {\n return;\n }\n this._initialized = true;\n }\n async load(params) {\n const randomFactor = 10000,\n id = params.id ?? params.element?.id ?? `tsparticles${Math.floor((0,_Utils_NumberUtils_js__WEBPACK_IMPORTED_MODULE_3__.getRandom)() * randomFactor)}`,\n {\n index,\n url\n } = params,\n options = url ? await getDataFromUrl({\n fallback: params.options,\n url,\n index\n }) : params.options;\n let domContainer = params.element ?? document.getElementById(id);\n if (!domContainer) {\n domContainer = document.createElement(\"div\");\n domContainer.id = id;\n document.body.append(domContainer);\n }\n const currentOptions = (0,_Utils_Utils_js__WEBPACK_IMPORTED_MODULE_0__.itemFromSingleOrMultiple)(options, index),\n dom = this.dom(),\n oldIndex = dom.findIndex(v => v.id.description === id),\n minIndex = 0;\n if (oldIndex >= minIndex) {\n const old = this.domItem(oldIndex);\n if (old && !old.destroyed) {\n old.destroy();\n const deleteCount = 1;\n dom.splice(oldIndex, deleteCount);\n }\n }\n let canvasEl;\n if (domContainer.tagName.toLowerCase() === \"canvas\") {\n canvasEl = domContainer;\n canvasEl.dataset[_Utils_Constants_js__WEBPACK_IMPORTED_MODULE_1__.generatedAttribute] = \"false\";\n } else {\n const existingCanvases = domContainer.getElementsByTagName(\"canvas\");\n if (existingCanvases.length) {\n const firstIndex = 0;\n canvasEl = existingCanvases[firstIndex];\n canvasEl.dataset[_Utils_Constants_js__WEBPACK_IMPORTED_MODULE_1__.generatedAttribute] = \"false\";\n } else {\n canvasEl = document.createElement(\"canvas\");\n canvasEl.dataset[_Utils_Constants_js__WEBPACK_IMPORTED_MODULE_1__.generatedAttribute] = \"true\";\n domContainer.appendChild(canvasEl);\n }\n }\n if (!canvasEl.style.width) {\n canvasEl.style.width = \"100%\";\n }\n if (!canvasEl.style.height) {\n canvasEl.style.height = \"100%\";\n }\n const {\n Container\n } = await __webpack_require__.e(/*! import() */ \"dist_browser_Core_Container_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./Container.js */ \"./dist/browser/Core/Container.js\")),\n newItem = new Container(this, id, currentOptions);\n if (oldIndex >= minIndex) {\n const deleteCount = 0;\n dom.splice(oldIndex, deleteCount, newItem);\n } else {\n dom.push(newItem);\n }\n newItem.canvas.loadCanvas(canvasEl);\n await newItem.start();\n return newItem;\n }\n loadOptions(options, sourceOptions) {\n for (const plugin of this.plugins) {\n plugin.loadOptions(options, sourceOptions);\n }\n }\n loadParticlesOptions(container, options, ...sourceOptions) {\n const updaters = this.updaters.get(container);\n if (!updaters) {\n return;\n }\n for (const updater of updaters) {\n updater.loadOptions?.(options, ...sourceOptions);\n }\n }\n async refresh(refresh = true) {\n if (!refresh) {\n return;\n }\n await Promise.all(this.dom().map(t => t.refresh()));\n }\n removeEventListener(type, listener) {\n this._eventDispatcher.removeEventListener(type, listener);\n }\n setOnClickHandler(callback) {\n const dom = this.dom();\n if (!dom.length) {\n throw new Error(`${_Utils_Constants_js__WEBPACK_IMPORTED_MODULE_1__.errorPrefix} can only set click handlers after calling tsParticles.load()`);\n }\n for (const domItem of dom) {\n domItem.addClickHandler(callback);\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/engine/./dist/browser/Core/Engine.js?");
|
|
39
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Engine: () => (/* binding */ Engine)\n/* harmony export */ });\n/* harmony import */ var _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Utils/Constants.js */ \"./dist/browser/Core/Utils/Constants.js\");\n/* harmony import */ var _Utils_Utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Utils/Utils.js */ \"./dist/browser/Utils/Utils.js\");\n/* harmony import */ var _Utils_EventDispatcher_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Utils/EventDispatcher.js */ \"./dist/browser/Utils/EventDispatcher.js\");\n/* harmony import */ var _Utils_NumberUtils_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Utils/NumberUtils.js */ \"./dist/browser/Utils/NumberUtils.js\");\n\n\n\n\nasync function getItemsFromInitializer(container, map, initializers, force = false) {\n let res = map.get(container);\n if (!res || force) {\n res = await Promise.all([...initializers.values()].map(t => t(container)));\n map.set(container, res);\n }\n return res;\n}\nasync function getDataFromUrl(data) {\n const url = (0,_Utils_Utils_js__WEBPACK_IMPORTED_MODULE_0__.itemFromSingleOrMultiple)(data.url, data.index);\n if (!url) {\n return data.fallback;\n }\n const response = await fetch(url);\n if (response.ok) {\n return await response.json();\n }\n (0,_Utils_Utils_js__WEBPACK_IMPORTED_MODULE_0__.getLogger)().error(`${_Utils_Constants_js__WEBPACK_IMPORTED_MODULE_1__.errorPrefix} ${response.status} while retrieving config file`);\n return data.fallback;\n}\nclass Engine {\n constructor() {\n this._configs = new Map();\n this._domArray = [];\n this._eventDispatcher = new _Utils_EventDispatcher_js__WEBPACK_IMPORTED_MODULE_2__.EventDispatcher();\n this._initialized = false;\n this.plugins = [];\n this._initializers = {\n interactors: new Map(),\n movers: new Map(),\n updaters: new Map()\n };\n this.interactors = new Map();\n this.movers = new Map();\n this.updaters = new Map();\n this.presets = new Map();\n this.effectDrawers = new Map();\n this.shapeDrawers = new Map();\n this.pathGenerators = new Map();\n }\n get configs() {\n const res = {};\n for (const [name, config] of this._configs) {\n res[name] = config;\n }\n return res;\n }\n get version() {\n return \"3.3.0\";\n }\n addConfig(config) {\n const key = config.key ?? config.name ?? \"default\";\n this._configs.set(key, config);\n this._eventDispatcher.dispatchEvent(\"configAdded\", {\n data: {\n name: key,\n config\n }\n });\n }\n async addEffect(effect, drawer, refresh = true) {\n (0,_Utils_Utils_js__WEBPACK_IMPORTED_MODULE_0__.executeOnSingleOrMultiple)(effect, type => {\n if (!this.getEffectDrawer(type)) {\n this.effectDrawers.set(type, drawer);\n }\n });\n await this.refresh(refresh);\n }\n addEventListener(type, listener) {\n this._eventDispatcher.addEventListener(type, listener);\n }\n async addInteractor(name, interactorInitializer, refresh = true) {\n this._initializers.interactors.set(name, interactorInitializer);\n await this.refresh(refresh);\n }\n async addMover(name, moverInitializer, refresh = true) {\n this._initializers.movers.set(name, moverInitializer);\n await this.refresh(refresh);\n }\n async addParticleUpdater(name, updaterInitializer, refresh = true) {\n this._initializers.updaters.set(name, updaterInitializer);\n await this.refresh(refresh);\n }\n async addPathGenerator(name, generator, refresh = true) {\n if (!this.getPathGenerator(name)) {\n this.pathGenerators.set(name, generator);\n }\n await this.refresh(refresh);\n }\n async addPlugin(plugin, refresh = true) {\n if (!this.getPlugin(plugin.id)) {\n this.plugins.push(plugin);\n }\n await this.refresh(refresh);\n }\n async addPreset(preset, options, override = false, refresh = true) {\n if (override || !this.getPreset(preset)) {\n this.presets.set(preset, options);\n }\n await this.refresh(refresh);\n }\n async addShape(shape, drawer, refresh = true) {\n (0,_Utils_Utils_js__WEBPACK_IMPORTED_MODULE_0__.executeOnSingleOrMultiple)(shape, type => {\n if (!this.getShapeDrawer(type)) {\n this.shapeDrawers.set(type, drawer);\n }\n });\n await this.refresh(refresh);\n }\n clearPlugins(container) {\n this.updaters.delete(container);\n this.movers.delete(container);\n this.interactors.delete(container);\n }\n dispatchEvent(type, args) {\n this._eventDispatcher.dispatchEvent(type, args);\n }\n dom() {\n return this._domArray;\n }\n domItem(index) {\n const dom = this.dom(),\n item = dom[index];\n if (!item || item.destroyed) {\n const deleteCount = 1;\n dom.splice(index, deleteCount);\n return;\n }\n return item;\n }\n async getAvailablePlugins(container) {\n const res = new Map();\n for (const plugin of this.plugins) {\n if (plugin.needsPlugin(container.actualOptions)) {\n res.set(plugin.id, await plugin.getPlugin(container));\n }\n }\n return res;\n }\n getEffectDrawer(type) {\n return this.effectDrawers.get(type);\n }\n async getInteractors(container, force = false) {\n return await getItemsFromInitializer(container, this.interactors, this._initializers.interactors, force);\n }\n async getMovers(container, force = false) {\n return await getItemsFromInitializer(container, this.movers, this._initializers.movers, force);\n }\n getPathGenerator(type) {\n return this.pathGenerators.get(type);\n }\n getPlugin(plugin) {\n return this.plugins.find(t => t.id === plugin);\n }\n getPreset(preset) {\n return this.presets.get(preset);\n }\n getShapeDrawer(type) {\n return this.shapeDrawers.get(type);\n }\n getSupportedEffects() {\n return this.effectDrawers.keys();\n }\n getSupportedShapes() {\n return this.shapeDrawers.keys();\n }\n async getUpdaters(container, force = false) {\n return await getItemsFromInitializer(container, this.updaters, this._initializers.updaters, force);\n }\n init() {\n if (this._initialized) {\n return;\n }\n this._initialized = true;\n }\n async load(params) {\n const randomFactor = 10000,\n id = params.id ?? params.element?.id ?? `tsparticles${Math.floor((0,_Utils_NumberUtils_js__WEBPACK_IMPORTED_MODULE_3__.getRandom)() * randomFactor)}`,\n {\n index,\n url\n } = params,\n options = url ? await getDataFromUrl({\n fallback: params.options,\n url,\n index\n }) : params.options;\n let domContainer = params.element ?? document.getElementById(id);\n if (!domContainer) {\n domContainer = document.createElement(\"div\");\n domContainer.id = id;\n document.body.append(domContainer);\n }\n const currentOptions = (0,_Utils_Utils_js__WEBPACK_IMPORTED_MODULE_0__.itemFromSingleOrMultiple)(options, index),\n dom = this.dom(),\n oldIndex = dom.findIndex(v => v.id.description === id),\n minIndex = 0;\n if (oldIndex >= minIndex) {\n const old = this.domItem(oldIndex);\n if (old && !old.destroyed) {\n old.destroy();\n const deleteCount = 1;\n dom.splice(oldIndex, deleteCount);\n }\n }\n let canvasEl;\n if (domContainer.tagName.toLowerCase() === \"canvas\") {\n canvasEl = domContainer;\n canvasEl.dataset[_Utils_Constants_js__WEBPACK_IMPORTED_MODULE_1__.generatedAttribute] = \"false\";\n } else {\n const existingCanvases = domContainer.getElementsByTagName(\"canvas\");\n if (existingCanvases.length) {\n const firstIndex = 0;\n canvasEl = existingCanvases[firstIndex];\n canvasEl.dataset[_Utils_Constants_js__WEBPACK_IMPORTED_MODULE_1__.generatedAttribute] = \"false\";\n } else {\n canvasEl = document.createElement(\"canvas\");\n canvasEl.dataset[_Utils_Constants_js__WEBPACK_IMPORTED_MODULE_1__.generatedAttribute] = \"true\";\n domContainer.appendChild(canvasEl);\n }\n }\n if (!canvasEl.style.width) {\n canvasEl.style.width = \"100%\";\n }\n if (!canvasEl.style.height) {\n canvasEl.style.height = \"100%\";\n }\n const {\n Container\n } = await __webpack_require__.e(/*! import() */ \"dist_browser_Core_Container_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./Container.js */ \"./dist/browser/Core/Container.js\")),\n newItem = new Container(this, id, currentOptions);\n if (oldIndex >= minIndex) {\n const deleteCount = 0;\n dom.splice(oldIndex, deleteCount, newItem);\n } else {\n dom.push(newItem);\n }\n newItem.canvas.loadCanvas(canvasEl);\n await newItem.start();\n return newItem;\n }\n loadOptions(options, sourceOptions) {\n for (const plugin of this.plugins) {\n plugin.loadOptions(options, sourceOptions);\n }\n }\n loadParticlesOptions(container, options, ...sourceOptions) {\n const updaters = this.updaters.get(container);\n if (!updaters) {\n return;\n }\n for (const updater of updaters) {\n updater.loadOptions?.(options, ...sourceOptions);\n }\n }\n async refresh(refresh = true) {\n if (!refresh) {\n return;\n }\n await Promise.all(this.dom().map(t => t.refresh()));\n }\n removeEventListener(type, listener) {\n this._eventDispatcher.removeEventListener(type, listener);\n }\n setOnClickHandler(callback) {\n const dom = this.dom();\n if (!dom.length) {\n throw new Error(`${_Utils_Constants_js__WEBPACK_IMPORTED_MODULE_1__.errorPrefix} can only set click handlers after calling tsParticles.load()`);\n }\n for (const domItem of dom) {\n domItem.addClickHandler(callback);\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/engine/./dist/browser/Core/Engine.js?");
|
|
40
40
|
|
|
41
41
|
/***/ }),
|
|
42
42
|
|
|
@@ -616,7 +616,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
616
616
|
\*******************************************/
|
|
617
617
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
618
618
|
|
|
619
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ alterHsl: () => (/* binding */ alterHsl),\n/* harmony export */ clear: () => (/* binding */ clear),\n/* harmony export */ drawEffect: () => (/* binding */ drawEffect),\n/* harmony export */ drawLine: () => (/* binding */ drawLine),\n/* harmony export */ drawParticle: () => (/* binding */ drawParticle),\n/* harmony export */ drawParticlePlugin: () => (/* binding */ drawParticlePlugin),\n/* harmony export */ drawPlugin: () => (/* binding */ drawPlugin),\n/* harmony export */ drawShape: () => (/* binding */ drawShape),\n/* harmony export */ drawShapeAfterDraw: () => (/* binding */ drawShapeAfterDraw),\n/* harmony export */ paintBase: () => (/* binding */ paintBase),\n/* harmony export */ paintImage: () => (/* binding */ paintImage)\n/* harmony export */ });\n/* harmony import */ var _ColorUtils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ColorUtils.js */ \"./dist/browser/Utils/ColorUtils.js\");\n\nconst origin = {\n x: 0,\n y: 0\n};\nfunction drawLine(context, begin, end) {\n context.beginPath();\n context.moveTo(begin.x, begin.y);\n context.lineTo(end.x, end.y);\n context.closePath();\n}\nfunction paintBase(context, dimension, baseColor) {\n context.fillStyle = baseColor ?? \"rgba(0,0,0,0)\";\n context.fillRect(origin.x, origin.y, dimension.width, dimension.height);\n}\nfunction paintImage(context, dimension, image, opacity) {\n if (!image) {\n return;\n }\n context.globalAlpha = opacity;\n context.drawImage(image, origin.x, origin.y, dimension.width, dimension.height);\n context.globalAlpha = 1;\n}\nfunction clear(context, dimension) {\n context.clearRect(origin.x, origin.y, dimension.width, dimension.height);\n}\
|
|
619
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ alterHsl: () => (/* binding */ alterHsl),\n/* harmony export */ clear: () => (/* binding */ clear),\n/* harmony export */ drawEffect: () => (/* binding */ drawEffect),\n/* harmony export */ drawLine: () => (/* binding */ drawLine),\n/* harmony export */ drawParticle: () => (/* binding */ drawParticle),\n/* harmony export */ drawParticlePlugin: () => (/* binding */ drawParticlePlugin),\n/* harmony export */ drawPlugin: () => (/* binding */ drawPlugin),\n/* harmony export */ drawShape: () => (/* binding */ drawShape),\n/* harmony export */ drawShapeAfterDraw: () => (/* binding */ drawShapeAfterDraw),\n/* harmony export */ paintBase: () => (/* binding */ paintBase),\n/* harmony export */ paintImage: () => (/* binding */ paintImage)\n/* harmony export */ });\n/* harmony import */ var _ColorUtils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ColorUtils.js */ \"./dist/browser/Utils/ColorUtils.js\");\n\nconst origin = {\n x: 0,\n y: 0\n};\nfunction drawLine(context, begin, end) {\n context.beginPath();\n context.moveTo(begin.x, begin.y);\n context.lineTo(end.x, end.y);\n context.closePath();\n}\nfunction paintBase(context, dimension, baseColor) {\n context.fillStyle = baseColor ?? \"rgba(0,0,0,0)\";\n context.fillRect(origin.x, origin.y, dimension.width, dimension.height);\n}\nfunction paintImage(context, dimension, image, opacity) {\n if (!image) {\n return;\n }\n context.globalAlpha = opacity;\n context.drawImage(image, origin.x, origin.y, dimension.width, dimension.height);\n context.globalAlpha = 1;\n}\nfunction clear(context, dimension) {\n context.clearRect(origin.x, origin.y, dimension.width, dimension.height);\n}\nfunction drawParticle(data) {\n const {\n container,\n context,\n particle,\n delta,\n colorStyles,\n backgroundMask,\n composite,\n radius,\n opacity,\n shadow,\n transform\n } = data,\n pos = particle.getPosition(),\n defaultAngle = 0,\n angle = particle.rotation + (particle.pathRotation ? particle.velocity.angle : defaultAngle),\n rotateData = {\n sin: Math.sin(angle),\n cos: Math.cos(angle)\n },\n defaultTransformFactor = 1,\n transformData = {\n a: rotateData.cos * (transform.a ?? defaultTransformFactor),\n b: rotateData.sin * (transform.b ?? defaultTransformFactor),\n c: -rotateData.sin * (transform.c ?? defaultTransformFactor),\n d: rotateData.cos * (transform.d ?? defaultTransformFactor)\n };\n context.setTransform(transformData.a, transformData.b, transformData.c, transformData.d, pos.x, pos.y);\n if (backgroundMask) {\n context.globalCompositeOperation = composite;\n }\n const shadowColor = particle.shadowColor;\n if (shadow.enable && shadowColor) {\n context.shadowBlur = shadow.blur;\n context.shadowColor = (0,_ColorUtils_js__WEBPACK_IMPORTED_MODULE_0__.getStyleFromRgb)(shadowColor);\n context.shadowOffsetX = shadow.offset.x;\n context.shadowOffsetY = shadow.offset.y;\n }\n if (colorStyles.fill) {\n context.fillStyle = colorStyles.fill;\n }\n const minStrokeWidth = 0,\n strokeWidth = particle.strokeWidth ?? minStrokeWidth;\n context.lineWidth = strokeWidth;\n if (colorStyles.stroke) {\n context.strokeStyle = colorStyles.stroke;\n }\n const drawData = {\n container,\n context,\n particle,\n radius,\n opacity,\n delta,\n transformData,\n strokeWidth\n };\n drawShape(drawData);\n drawShapeAfterDraw(drawData);\n drawEffect(drawData);\n context.globalCompositeOperation = \"source-over\";\n context.resetTransform();\n}\nfunction drawEffect(data) {\n const {\n container,\n context,\n particle,\n radius,\n opacity,\n delta,\n transformData\n } = data;\n if (!particle.effect) {\n return;\n }\n const drawer = container.effectDrawers.get(particle.effect);\n if (!drawer) {\n return;\n }\n drawer.draw({\n context,\n particle,\n radius,\n opacity,\n delta,\n pixelRatio: container.retina.pixelRatio,\n transformData: {\n ...transformData\n }\n });\n}\nfunction drawShape(data) {\n const {\n container,\n context,\n particle,\n radius,\n opacity,\n delta,\n strokeWidth,\n transformData\n } = data,\n minStrokeWidth = 0;\n if (!particle.shape) {\n return;\n }\n const drawer = container.shapeDrawers.get(particle.shape);\n if (!drawer) {\n return;\n }\n context.beginPath();\n drawer.draw({\n context,\n particle,\n radius,\n opacity,\n delta,\n pixelRatio: container.retina.pixelRatio,\n transformData: {\n ...transformData\n }\n });\n if (particle.shapeClose) {\n context.closePath();\n }\n if (strokeWidth > minStrokeWidth) {\n context.stroke();\n }\n if (particle.shapeFill) {\n context.fill();\n }\n}\nfunction drawShapeAfterDraw(data) {\n const {\n container,\n context,\n particle,\n radius,\n opacity,\n delta,\n transformData\n } = data;\n if (!particle.shape) {\n return;\n }\n const drawer = container.shapeDrawers.get(particle.shape);\n if (!drawer?.afterDraw) {\n return;\n }\n drawer.afterDraw({\n context,\n particle,\n radius,\n opacity,\n delta,\n pixelRatio: container.retina.pixelRatio,\n transformData: {\n ...transformData\n }\n });\n}\nfunction drawPlugin(context, plugin, delta) {\n if (!plugin.draw) {\n return;\n }\n plugin.draw(context, delta);\n}\nfunction drawParticlePlugin(context, plugin, particle, delta) {\n if (!plugin.drawParticle) {\n return;\n }\n plugin.drawParticle(context, particle, delta);\n}\nfunction alterHsl(color, type, value) {\n const lFactor = 1;\n return {\n h: color.h,\n s: color.s,\n l: color.l + (type === \"darken\" ? -lFactor : lFactor) * value\n };\n}\n\n//# sourceURL=webpack://@tsparticles/engine/./dist/browser/Utils/CanvasUtils.js?");
|
|
620
620
|
|
|
621
621
|
/***/ }),
|
|
622
622
|
|
|
@@ -880,7 +880,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
880
880
|
/******/ var scripts = document.getElementsByTagName("script");
|
|
881
881
|
/******/ if(scripts.length) {
|
|
882
882
|
/******/ var i = scripts.length - 1;
|
|
883
|
-
/******/ while (i > -1 && !scriptUrl) scriptUrl = scripts[i--].src;
|
|
883
|
+
/******/ while (i > -1 && (!scriptUrl || !/^http(s?):/.test(scriptUrl))) scriptUrl = scripts[i--].src;
|
|
884
884
|
/******/ }
|
|
885
885
|
/******/ }
|
|
886
886
|
/******/ }
|