@tsparticles/engine 3.0.0-beta.4 → 3.0.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/Core/Canvas.js +1 -1
- package/browser/Core/Engine.js +1 -1
- package/browser/Core/Particle.js +2 -1
- package/browser/Options/Classes/Interactivity/Events/Events.js +2 -7
- package/browser/Options/Classes/Options.js +7 -0
- package/browser/Options/Classes/Particles/ParticlesOptions.js +10 -7
- package/browser/Utils/CanvasUtils.js +31 -7
- package/cjs/Core/Canvas.js +1 -1
- package/cjs/Core/Engine.js +1 -1
- package/cjs/Core/Particle.js +2 -1
- package/cjs/Options/Classes/Interactivity/Events/Events.js +2 -7
- package/cjs/Options/Classes/Options.js +7 -0
- package/cjs/Options/Classes/Particles/ParticlesOptions.js +10 -7
- package/cjs/Utils/CanvasUtils.js +31 -7
- package/esm/Core/Canvas.js +1 -1
- package/esm/Core/Engine.js +1 -1
- package/esm/Core/Particle.js +2 -1
- package/esm/Options/Classes/Interactivity/Events/Events.js +2 -7
- package/esm/Options/Classes/Options.js +7 -0
- package/esm/Options/Classes/Particles/ParticlesOptions.js +10 -7
- package/esm/Utils/CanvasUtils.js +31 -7
- package/package.json +1 -1
- package/report.html +3 -3
- package/tsparticles.engine.js +44 -23
- package/tsparticles.engine.min.js +1 -1
- package/tsparticles.engine.min.js.LICENSE.txt +1 -1
- package/types/Core/Interfaces/IShapeDrawData.d.ts +6 -0
- package/types/Core/Interfaces/IShapeDrawer.d.ts +1 -0
- package/types/Options/Classes/Options.d.ts +1 -0
- package/types/Options/Interfaces/IOptions.d.ts +1 -0
- package/types/Options/Interfaces/Interactivity/Events/IEvents.d.ts +1 -1
- package/types/Utils/CanvasUtils.d.ts +6 -0
- package/umd/Core/Canvas.js +1 -1
- package/umd/Core/Engine.js +1 -1
- package/umd/Core/Particle.js +2 -1
- package/umd/Options/Classes/Interactivity/Events/Events.js +3 -8
- package/umd/Options/Classes/Options.js +7 -0
- package/umd/Options/Classes/Particles/ParticlesOptions.js +10 -7
- package/umd/Utils/CanvasUtils.js +31 -7
package/umd/Core/Engine.js
CHANGED
package/umd/Core/Particle.js
CHANGED
|
@@ -171,7 +171,8 @@
|
|
|
171
171
|
this.destroyed = true;
|
|
172
172
|
this.bubble.inRange = false;
|
|
173
173
|
this.slow.inRange = false;
|
|
174
|
-
const container = this.container, pathGenerator = this.pathGenerator;
|
|
174
|
+
const container = this.container, pathGenerator = this.pathGenerator, shapeDrawer = container.shapeDrawers.get(this.shape);
|
|
175
|
+
shapeDrawer && shapeDrawer.particleDestroy && shapeDrawer.particleDestroy(this);
|
|
175
176
|
for (const [, plugin] of container.plugins) {
|
|
176
177
|
plugin.particleDestroyed && plugin.particleDestroyed(this, override);
|
|
177
178
|
}
|
|
@@ -4,17 +4,17 @@
|
|
|
4
4
|
if (v !== undefined) module.exports = v;
|
|
5
5
|
}
|
|
6
6
|
else if (typeof define === "function" && define.amd) {
|
|
7
|
-
define(["require", "exports", "
|
|
7
|
+
define(["require", "exports", "./ClickEvent.js", "./DivEvent.js", "./HoverEvent.js", "./ResizeEvent.js", "../../../../Utils/Utils.js"], factory);
|
|
8
8
|
}
|
|
9
9
|
})(function (require, exports) {
|
|
10
10
|
"use strict";
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.Events = void 0;
|
|
13
|
-
const Utils_js_1 = require("../../../../Utils/Utils.js");
|
|
14
13
|
const ClickEvent_js_1 = require("./ClickEvent.js");
|
|
15
14
|
const DivEvent_js_1 = require("./DivEvent.js");
|
|
16
15
|
const HoverEvent_js_1 = require("./HoverEvent.js");
|
|
17
16
|
const ResizeEvent_js_1 = require("./ResizeEvent.js");
|
|
17
|
+
const Utils_js_1 = require("../../../../Utils/Utils.js");
|
|
18
18
|
class Events {
|
|
19
19
|
constructor() {
|
|
20
20
|
this.onClick = new ClickEvent_js_1.ClickEvent();
|
|
@@ -36,12 +36,7 @@
|
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
38
|
this.onHover.load(data.onHover);
|
|
39
|
-
|
|
40
|
-
this.resize.enable = data.resize;
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
this.resize.load(data.resize);
|
|
44
|
-
}
|
|
39
|
+
this.resize.load(data.resize);
|
|
45
40
|
}
|
|
46
41
|
}
|
|
47
42
|
exports.Events = Events;
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
this.autoPlay = true;
|
|
35
35
|
this.background = new Background_js_1.Background();
|
|
36
36
|
this.backgroundMask = new BackgroundMask_js_1.BackgroundMask();
|
|
37
|
+
this.clear = true;
|
|
37
38
|
this.defaultThemes = {};
|
|
38
39
|
this.delay = 0;
|
|
39
40
|
this.fullScreen = new FullScreen_js_1.FullScreen();
|
|
@@ -61,6 +62,12 @@
|
|
|
61
62
|
if (data.autoPlay !== undefined) {
|
|
62
63
|
this.autoPlay = data.autoPlay;
|
|
63
64
|
}
|
|
65
|
+
if (data.clear !== undefined) {
|
|
66
|
+
this.clear = data.clear;
|
|
67
|
+
}
|
|
68
|
+
if (data.name !== undefined) {
|
|
69
|
+
this.name = data.name;
|
|
70
|
+
}
|
|
64
71
|
if (data.delay !== undefined) {
|
|
65
72
|
this.delay = (0, NumberUtils_js_1.setRangeValue)(data.delay);
|
|
66
73
|
}
|
|
@@ -47,23 +47,26 @@
|
|
|
47
47
|
if (!data) {
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
50
|
-
this.bounce.load(data.bounce);
|
|
51
|
-
this.color.load(AnimatableColor_js_1.AnimatableColor.create(this.color, data.color));
|
|
52
|
-
this.effect.load(data.effect);
|
|
53
50
|
if (data.groups !== undefined) {
|
|
54
|
-
for (const group
|
|
51
|
+
for (const group of Object.keys(data.groups)) {
|
|
52
|
+
if (!Object.hasOwn(data.groups, group)) {
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
55
|
const item = data.groups[group];
|
|
56
56
|
if (item !== undefined) {
|
|
57
57
|
this.groups[group] = (0, Utils_js_1.deepExtend)(this.groups[group] ?? {}, item);
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
-
this.move.load(data.move);
|
|
62
|
-
this.number.load(data.number);
|
|
63
|
-
this.opacity.load(data.opacity);
|
|
64
61
|
if (data.reduceDuplicates !== undefined) {
|
|
65
62
|
this.reduceDuplicates = data.reduceDuplicates;
|
|
66
63
|
}
|
|
64
|
+
this.bounce.load(data.bounce);
|
|
65
|
+
this.color.load(AnimatableColor_js_1.AnimatableColor.create(this.color, data.color));
|
|
66
|
+
this.effect.load(data.effect);
|
|
67
|
+
this.move.load(data.move);
|
|
68
|
+
this.number.load(data.number);
|
|
69
|
+
this.opacity.load(data.opacity);
|
|
67
70
|
this.shape.load(data.shape);
|
|
68
71
|
this.size.load(data.size);
|
|
69
72
|
this.shadow.load(data.shadow);
|
package/umd/Utils/CanvasUtils.js
CHANGED
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
if (colorStyles.stroke) {
|
|
67
67
|
context.strokeStyle = colorStyles.stroke;
|
|
68
68
|
}
|
|
69
|
-
const drawData = { container, context, particle, radius, opacity, delta };
|
|
69
|
+
const drawData = { container, context, particle, radius, opacity, delta, transformData };
|
|
70
70
|
context.beginPath();
|
|
71
71
|
drawShape(drawData);
|
|
72
72
|
if (particle.shapeClose) {
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
}
|
|
86
86
|
exports.drawParticle = drawParticle;
|
|
87
87
|
function drawEffect(data) {
|
|
88
|
-
const { container, context, particle, radius, opacity, delta } = data;
|
|
88
|
+
const { container, context, particle, radius, opacity, delta, transformData } = data;
|
|
89
89
|
if (!particle.effect) {
|
|
90
90
|
return;
|
|
91
91
|
}
|
|
@@ -93,11 +93,19 @@
|
|
|
93
93
|
if (!drawer) {
|
|
94
94
|
return;
|
|
95
95
|
}
|
|
96
|
-
drawer.draw({
|
|
96
|
+
drawer.draw({
|
|
97
|
+
context,
|
|
98
|
+
particle,
|
|
99
|
+
radius,
|
|
100
|
+
opacity,
|
|
101
|
+
delta,
|
|
102
|
+
pixelRatio: container.retina.pixelRatio,
|
|
103
|
+
transformData: { ...transformData },
|
|
104
|
+
});
|
|
97
105
|
}
|
|
98
106
|
exports.drawEffect = drawEffect;
|
|
99
107
|
function drawShape(data) {
|
|
100
|
-
const { container, context, particle, radius, opacity, delta } = data;
|
|
108
|
+
const { container, context, particle, radius, opacity, delta, transformData } = data;
|
|
101
109
|
if (!particle.shape) {
|
|
102
110
|
return;
|
|
103
111
|
}
|
|
@@ -105,11 +113,19 @@
|
|
|
105
113
|
if (!drawer) {
|
|
106
114
|
return;
|
|
107
115
|
}
|
|
108
|
-
drawer.draw({
|
|
116
|
+
drawer.draw({
|
|
117
|
+
context,
|
|
118
|
+
particle,
|
|
119
|
+
radius,
|
|
120
|
+
opacity,
|
|
121
|
+
delta,
|
|
122
|
+
pixelRatio: container.retina.pixelRatio,
|
|
123
|
+
transformData: { ...transformData },
|
|
124
|
+
});
|
|
109
125
|
}
|
|
110
126
|
exports.drawShape = drawShape;
|
|
111
127
|
function drawShapeAfterDraw(data) {
|
|
112
|
-
const { container, context, particle, radius, opacity, delta } = data;
|
|
128
|
+
const { container, context, particle, radius, opacity, delta, transformData } = data;
|
|
113
129
|
if (!particle.shape) {
|
|
114
130
|
return;
|
|
115
131
|
}
|
|
@@ -117,7 +133,15 @@
|
|
|
117
133
|
if (!drawer || !drawer.afterDraw) {
|
|
118
134
|
return;
|
|
119
135
|
}
|
|
120
|
-
drawer.afterDraw({
|
|
136
|
+
drawer.afterDraw({
|
|
137
|
+
context,
|
|
138
|
+
particle,
|
|
139
|
+
radius,
|
|
140
|
+
opacity,
|
|
141
|
+
delta,
|
|
142
|
+
pixelRatio: container.retina.pixelRatio,
|
|
143
|
+
transformData: { ...transformData },
|
|
144
|
+
});
|
|
121
145
|
}
|
|
122
146
|
exports.drawShapeAfterDraw = drawShapeAfterDraw;
|
|
123
147
|
function drawPlugin(context, plugin, delta) {
|