@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/browser/Core/Canvas.js
CHANGED
package/browser/Core/Engine.js
CHANGED
package/browser/Core/Particle.js
CHANGED
|
@@ -159,7 +159,8 @@ export class Particle {
|
|
|
159
159
|
this.destroyed = true;
|
|
160
160
|
this.bubble.inRange = false;
|
|
161
161
|
this.slow.inRange = false;
|
|
162
|
-
const container = this.container, pathGenerator = this.pathGenerator;
|
|
162
|
+
const container = this.container, pathGenerator = this.pathGenerator, shapeDrawer = container.shapeDrawers.get(this.shape);
|
|
163
|
+
shapeDrawer && shapeDrawer.particleDestroy && shapeDrawer.particleDestroy(this);
|
|
163
164
|
for (const [, plugin] of container.plugins) {
|
|
164
165
|
plugin.particleDestroyed && plugin.particleDestroyed(this, override);
|
|
165
166
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { executeOnSingleOrMultiple, isBoolean } from "../../../../Utils/Utils.js";
|
|
2
1
|
import { ClickEvent } from "./ClickEvent.js";
|
|
3
2
|
import { DivEvent } from "./DivEvent.js";
|
|
4
3
|
import { HoverEvent } from "./HoverEvent.js";
|
|
5
4
|
import { ResizeEvent } from "./ResizeEvent.js";
|
|
5
|
+
import { executeOnSingleOrMultiple } from "../../../../Utils/Utils.js";
|
|
6
6
|
export class Events {
|
|
7
7
|
constructor() {
|
|
8
8
|
this.onClick = new ClickEvent();
|
|
@@ -24,11 +24,6 @@ export class Events {
|
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
26
|
this.onHover.load(data.onHover);
|
|
27
|
-
|
|
28
|
-
this.resize.enable = data.resize;
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
this.resize.load(data.resize);
|
|
32
|
-
}
|
|
27
|
+
this.resize.load(data.resize);
|
|
33
28
|
}
|
|
34
29
|
}
|
|
@@ -22,6 +22,7 @@ export class Options {
|
|
|
22
22
|
this.autoPlay = true;
|
|
23
23
|
this.background = new Background();
|
|
24
24
|
this.backgroundMask = new BackgroundMask();
|
|
25
|
+
this.clear = true;
|
|
25
26
|
this.defaultThemes = {};
|
|
26
27
|
this.delay = 0;
|
|
27
28
|
this.fullScreen = new FullScreen();
|
|
@@ -49,6 +50,12 @@ export class Options {
|
|
|
49
50
|
if (data.autoPlay !== undefined) {
|
|
50
51
|
this.autoPlay = data.autoPlay;
|
|
51
52
|
}
|
|
53
|
+
if (data.clear !== undefined) {
|
|
54
|
+
this.clear = data.clear;
|
|
55
|
+
}
|
|
56
|
+
if (data.name !== undefined) {
|
|
57
|
+
this.name = data.name;
|
|
58
|
+
}
|
|
52
59
|
if (data.delay !== undefined) {
|
|
53
60
|
this.delay = setRangeValue(data.delay);
|
|
54
61
|
}
|
|
@@ -35,23 +35,26 @@ export class ParticlesOptions {
|
|
|
35
35
|
if (!data) {
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
38
|
-
this.bounce.load(data.bounce);
|
|
39
|
-
this.color.load(AnimatableColor.create(this.color, data.color));
|
|
40
|
-
this.effect.load(data.effect);
|
|
41
38
|
if (data.groups !== undefined) {
|
|
42
|
-
for (const group
|
|
39
|
+
for (const group of Object.keys(data.groups)) {
|
|
40
|
+
if (!Object.hasOwn(data.groups, group)) {
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
43
|
const item = data.groups[group];
|
|
44
44
|
if (item !== undefined) {
|
|
45
45
|
this.groups[group] = deepExtend(this.groups[group] ?? {}, item);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
this.move.load(data.move);
|
|
50
|
-
this.number.load(data.number);
|
|
51
|
-
this.opacity.load(data.opacity);
|
|
52
49
|
if (data.reduceDuplicates !== undefined) {
|
|
53
50
|
this.reduceDuplicates = data.reduceDuplicates;
|
|
54
51
|
}
|
|
52
|
+
this.bounce.load(data.bounce);
|
|
53
|
+
this.color.load(AnimatableColor.create(this.color, data.color));
|
|
54
|
+
this.effect.load(data.effect);
|
|
55
|
+
this.move.load(data.move);
|
|
56
|
+
this.number.load(data.number);
|
|
57
|
+
this.opacity.load(data.opacity);
|
|
55
58
|
this.shape.load(data.shape);
|
|
56
59
|
this.size.load(data.size);
|
|
57
60
|
this.shadow.load(data.shadow);
|
|
@@ -50,7 +50,7 @@ export function drawParticle(data) {
|
|
|
50
50
|
if (colorStyles.stroke) {
|
|
51
51
|
context.strokeStyle = colorStyles.stroke;
|
|
52
52
|
}
|
|
53
|
-
const drawData = { container, context, particle, radius, opacity, delta };
|
|
53
|
+
const drawData = { container, context, particle, radius, opacity, delta, transformData };
|
|
54
54
|
context.beginPath();
|
|
55
55
|
drawShape(drawData);
|
|
56
56
|
if (particle.shapeClose) {
|
|
@@ -68,7 +68,7 @@ export function drawParticle(data) {
|
|
|
68
68
|
context.setTransform(1, 0, 0, 1, 0, 0);
|
|
69
69
|
}
|
|
70
70
|
export function drawEffect(data) {
|
|
71
|
-
const { container, context, particle, radius, opacity, delta } = data;
|
|
71
|
+
const { container, context, particle, radius, opacity, delta, transformData } = data;
|
|
72
72
|
if (!particle.effect) {
|
|
73
73
|
return;
|
|
74
74
|
}
|
|
@@ -76,10 +76,18 @@ export function drawEffect(data) {
|
|
|
76
76
|
if (!drawer) {
|
|
77
77
|
return;
|
|
78
78
|
}
|
|
79
|
-
drawer.draw({
|
|
79
|
+
drawer.draw({
|
|
80
|
+
context,
|
|
81
|
+
particle,
|
|
82
|
+
radius,
|
|
83
|
+
opacity,
|
|
84
|
+
delta,
|
|
85
|
+
pixelRatio: container.retina.pixelRatio,
|
|
86
|
+
transformData: { ...transformData },
|
|
87
|
+
});
|
|
80
88
|
}
|
|
81
89
|
export function drawShape(data) {
|
|
82
|
-
const { container, context, particle, radius, opacity, delta } = data;
|
|
90
|
+
const { container, context, particle, radius, opacity, delta, transformData } = data;
|
|
83
91
|
if (!particle.shape) {
|
|
84
92
|
return;
|
|
85
93
|
}
|
|
@@ -87,10 +95,18 @@ export function drawShape(data) {
|
|
|
87
95
|
if (!drawer) {
|
|
88
96
|
return;
|
|
89
97
|
}
|
|
90
|
-
drawer.draw({
|
|
98
|
+
drawer.draw({
|
|
99
|
+
context,
|
|
100
|
+
particle,
|
|
101
|
+
radius,
|
|
102
|
+
opacity,
|
|
103
|
+
delta,
|
|
104
|
+
pixelRatio: container.retina.pixelRatio,
|
|
105
|
+
transformData: { ...transformData },
|
|
106
|
+
});
|
|
91
107
|
}
|
|
92
108
|
export function drawShapeAfterDraw(data) {
|
|
93
|
-
const { container, context, particle, radius, opacity, delta } = data;
|
|
109
|
+
const { container, context, particle, radius, opacity, delta, transformData } = data;
|
|
94
110
|
if (!particle.shape) {
|
|
95
111
|
return;
|
|
96
112
|
}
|
|
@@ -98,7 +114,15 @@ export function drawShapeAfterDraw(data) {
|
|
|
98
114
|
if (!drawer || !drawer.afterDraw) {
|
|
99
115
|
return;
|
|
100
116
|
}
|
|
101
|
-
drawer.afterDraw({
|
|
117
|
+
drawer.afterDraw({
|
|
118
|
+
context,
|
|
119
|
+
particle,
|
|
120
|
+
radius,
|
|
121
|
+
opacity,
|
|
122
|
+
delta,
|
|
123
|
+
pixelRatio: container.retina.pixelRatio,
|
|
124
|
+
transformData: { ...transformData },
|
|
125
|
+
});
|
|
102
126
|
}
|
|
103
127
|
export function drawPlugin(context, plugin, delta) {
|
|
104
128
|
if (!plugin.draw) {
|
package/cjs/Core/Canvas.js
CHANGED
package/cjs/Core/Engine.js
CHANGED
package/cjs/Core/Particle.js
CHANGED
|
@@ -162,7 +162,8 @@ class Particle {
|
|
|
162
162
|
this.destroyed = true;
|
|
163
163
|
this.bubble.inRange = false;
|
|
164
164
|
this.slow.inRange = false;
|
|
165
|
-
const container = this.container, pathGenerator = this.pathGenerator;
|
|
165
|
+
const container = this.container, pathGenerator = this.pathGenerator, shapeDrawer = container.shapeDrawers.get(this.shape);
|
|
166
|
+
shapeDrawer && shapeDrawer.particleDestroy && shapeDrawer.particleDestroy(this);
|
|
166
167
|
for (const [, plugin] of container.plugins) {
|
|
167
168
|
plugin.particleDestroyed && plugin.particleDestroyed(this, override);
|
|
168
169
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Events = void 0;
|
|
4
|
-
const Utils_js_1 = require("../../../../Utils/Utils.js");
|
|
5
4
|
const ClickEvent_js_1 = require("./ClickEvent.js");
|
|
6
5
|
const DivEvent_js_1 = require("./DivEvent.js");
|
|
7
6
|
const HoverEvent_js_1 = require("./HoverEvent.js");
|
|
8
7
|
const ResizeEvent_js_1 = require("./ResizeEvent.js");
|
|
8
|
+
const Utils_js_1 = require("../../../../Utils/Utils.js");
|
|
9
9
|
class Events {
|
|
10
10
|
constructor() {
|
|
11
11
|
this.onClick = new ClickEvent_js_1.ClickEvent();
|
|
@@ -27,12 +27,7 @@ class Events {
|
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
29
|
this.onHover.load(data.onHover);
|
|
30
|
-
|
|
31
|
-
this.resize.enable = data.resize;
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
this.resize.load(data.resize);
|
|
35
|
-
}
|
|
30
|
+
this.resize.load(data.resize);
|
|
36
31
|
}
|
|
37
32
|
}
|
|
38
33
|
exports.Events = Events;
|
|
@@ -25,6 +25,7 @@ class Options {
|
|
|
25
25
|
this.autoPlay = true;
|
|
26
26
|
this.background = new Background_js_1.Background();
|
|
27
27
|
this.backgroundMask = new BackgroundMask_js_1.BackgroundMask();
|
|
28
|
+
this.clear = true;
|
|
28
29
|
this.defaultThemes = {};
|
|
29
30
|
this.delay = 0;
|
|
30
31
|
this.fullScreen = new FullScreen_js_1.FullScreen();
|
|
@@ -52,6 +53,12 @@ class Options {
|
|
|
52
53
|
if (data.autoPlay !== undefined) {
|
|
53
54
|
this.autoPlay = data.autoPlay;
|
|
54
55
|
}
|
|
56
|
+
if (data.clear !== undefined) {
|
|
57
|
+
this.clear = data.clear;
|
|
58
|
+
}
|
|
59
|
+
if (data.name !== undefined) {
|
|
60
|
+
this.name = data.name;
|
|
61
|
+
}
|
|
55
62
|
if (data.delay !== undefined) {
|
|
56
63
|
this.delay = (0, NumberUtils_js_1.setRangeValue)(data.delay);
|
|
57
64
|
}
|
|
@@ -38,23 +38,26 @@ class ParticlesOptions {
|
|
|
38
38
|
if (!data) {
|
|
39
39
|
return;
|
|
40
40
|
}
|
|
41
|
-
this.bounce.load(data.bounce);
|
|
42
|
-
this.color.load(AnimatableColor_js_1.AnimatableColor.create(this.color, data.color));
|
|
43
|
-
this.effect.load(data.effect);
|
|
44
41
|
if (data.groups !== undefined) {
|
|
45
|
-
for (const group
|
|
42
|
+
for (const group of Object.keys(data.groups)) {
|
|
43
|
+
if (!Object.hasOwn(data.groups, group)) {
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
46
|
const item = data.groups[group];
|
|
47
47
|
if (item !== undefined) {
|
|
48
48
|
this.groups[group] = (0, Utils_js_1.deepExtend)(this.groups[group] ?? {}, item);
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
this.move.load(data.move);
|
|
53
|
-
this.number.load(data.number);
|
|
54
|
-
this.opacity.load(data.opacity);
|
|
55
52
|
if (data.reduceDuplicates !== undefined) {
|
|
56
53
|
this.reduceDuplicates = data.reduceDuplicates;
|
|
57
54
|
}
|
|
55
|
+
this.bounce.load(data.bounce);
|
|
56
|
+
this.color.load(AnimatableColor_js_1.AnimatableColor.create(this.color, data.color));
|
|
57
|
+
this.effect.load(data.effect);
|
|
58
|
+
this.move.load(data.move);
|
|
59
|
+
this.number.load(data.number);
|
|
60
|
+
this.opacity.load(data.opacity);
|
|
58
61
|
this.shape.load(data.shape);
|
|
59
62
|
this.size.load(data.size);
|
|
60
63
|
this.shadow.load(data.shadow);
|
package/cjs/Utils/CanvasUtils.js
CHANGED
|
@@ -57,7 +57,7 @@ function drawParticle(data) {
|
|
|
57
57
|
if (colorStyles.stroke) {
|
|
58
58
|
context.strokeStyle = colorStyles.stroke;
|
|
59
59
|
}
|
|
60
|
-
const drawData = { container, context, particle, radius, opacity, delta };
|
|
60
|
+
const drawData = { container, context, particle, radius, opacity, delta, transformData };
|
|
61
61
|
context.beginPath();
|
|
62
62
|
drawShape(drawData);
|
|
63
63
|
if (particle.shapeClose) {
|
|
@@ -76,7 +76,7 @@ function drawParticle(data) {
|
|
|
76
76
|
}
|
|
77
77
|
exports.drawParticle = drawParticle;
|
|
78
78
|
function drawEffect(data) {
|
|
79
|
-
const { container, context, particle, radius, opacity, delta } = data;
|
|
79
|
+
const { container, context, particle, radius, opacity, delta, transformData } = data;
|
|
80
80
|
if (!particle.effect) {
|
|
81
81
|
return;
|
|
82
82
|
}
|
|
@@ -84,11 +84,19 @@ function drawEffect(data) {
|
|
|
84
84
|
if (!drawer) {
|
|
85
85
|
return;
|
|
86
86
|
}
|
|
87
|
-
drawer.draw({
|
|
87
|
+
drawer.draw({
|
|
88
|
+
context,
|
|
89
|
+
particle,
|
|
90
|
+
radius,
|
|
91
|
+
opacity,
|
|
92
|
+
delta,
|
|
93
|
+
pixelRatio: container.retina.pixelRatio,
|
|
94
|
+
transformData: { ...transformData },
|
|
95
|
+
});
|
|
88
96
|
}
|
|
89
97
|
exports.drawEffect = drawEffect;
|
|
90
98
|
function drawShape(data) {
|
|
91
|
-
const { container, context, particle, radius, opacity, delta } = data;
|
|
99
|
+
const { container, context, particle, radius, opacity, delta, transformData } = data;
|
|
92
100
|
if (!particle.shape) {
|
|
93
101
|
return;
|
|
94
102
|
}
|
|
@@ -96,11 +104,19 @@ function drawShape(data) {
|
|
|
96
104
|
if (!drawer) {
|
|
97
105
|
return;
|
|
98
106
|
}
|
|
99
|
-
drawer.draw({
|
|
107
|
+
drawer.draw({
|
|
108
|
+
context,
|
|
109
|
+
particle,
|
|
110
|
+
radius,
|
|
111
|
+
opacity,
|
|
112
|
+
delta,
|
|
113
|
+
pixelRatio: container.retina.pixelRatio,
|
|
114
|
+
transformData: { ...transformData },
|
|
115
|
+
});
|
|
100
116
|
}
|
|
101
117
|
exports.drawShape = drawShape;
|
|
102
118
|
function drawShapeAfterDraw(data) {
|
|
103
|
-
const { container, context, particle, radius, opacity, delta } = data;
|
|
119
|
+
const { container, context, particle, radius, opacity, delta, transformData } = data;
|
|
104
120
|
if (!particle.shape) {
|
|
105
121
|
return;
|
|
106
122
|
}
|
|
@@ -108,7 +124,15 @@ function drawShapeAfterDraw(data) {
|
|
|
108
124
|
if (!drawer || !drawer.afterDraw) {
|
|
109
125
|
return;
|
|
110
126
|
}
|
|
111
|
-
drawer.afterDraw({
|
|
127
|
+
drawer.afterDraw({
|
|
128
|
+
context,
|
|
129
|
+
particle,
|
|
130
|
+
radius,
|
|
131
|
+
opacity,
|
|
132
|
+
delta,
|
|
133
|
+
pixelRatio: container.retina.pixelRatio,
|
|
134
|
+
transformData: { ...transformData },
|
|
135
|
+
});
|
|
112
136
|
}
|
|
113
137
|
exports.drawShapeAfterDraw = drawShapeAfterDraw;
|
|
114
138
|
function drawPlugin(context, plugin, delta) {
|
package/esm/Core/Canvas.js
CHANGED
package/esm/Core/Engine.js
CHANGED
package/esm/Core/Particle.js
CHANGED
|
@@ -159,7 +159,8 @@ export class Particle {
|
|
|
159
159
|
this.destroyed = true;
|
|
160
160
|
this.bubble.inRange = false;
|
|
161
161
|
this.slow.inRange = false;
|
|
162
|
-
const container = this.container, pathGenerator = this.pathGenerator;
|
|
162
|
+
const container = this.container, pathGenerator = this.pathGenerator, shapeDrawer = container.shapeDrawers.get(this.shape);
|
|
163
|
+
shapeDrawer && shapeDrawer.particleDestroy && shapeDrawer.particleDestroy(this);
|
|
163
164
|
for (const [, plugin] of container.plugins) {
|
|
164
165
|
plugin.particleDestroyed && plugin.particleDestroyed(this, override);
|
|
165
166
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { executeOnSingleOrMultiple, isBoolean } from "../../../../Utils/Utils.js";
|
|
2
1
|
import { ClickEvent } from "./ClickEvent.js";
|
|
3
2
|
import { DivEvent } from "./DivEvent.js";
|
|
4
3
|
import { HoverEvent } from "./HoverEvent.js";
|
|
5
4
|
import { ResizeEvent } from "./ResizeEvent.js";
|
|
5
|
+
import { executeOnSingleOrMultiple } from "../../../../Utils/Utils.js";
|
|
6
6
|
export class Events {
|
|
7
7
|
constructor() {
|
|
8
8
|
this.onClick = new ClickEvent();
|
|
@@ -24,11 +24,6 @@ export class Events {
|
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
26
|
this.onHover.load(data.onHover);
|
|
27
|
-
|
|
28
|
-
this.resize.enable = data.resize;
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
this.resize.load(data.resize);
|
|
32
|
-
}
|
|
27
|
+
this.resize.load(data.resize);
|
|
33
28
|
}
|
|
34
29
|
}
|
|
@@ -22,6 +22,7 @@ export class Options {
|
|
|
22
22
|
this.autoPlay = true;
|
|
23
23
|
this.background = new Background();
|
|
24
24
|
this.backgroundMask = new BackgroundMask();
|
|
25
|
+
this.clear = true;
|
|
25
26
|
this.defaultThemes = {};
|
|
26
27
|
this.delay = 0;
|
|
27
28
|
this.fullScreen = new FullScreen();
|
|
@@ -49,6 +50,12 @@ export class Options {
|
|
|
49
50
|
if (data.autoPlay !== undefined) {
|
|
50
51
|
this.autoPlay = data.autoPlay;
|
|
51
52
|
}
|
|
53
|
+
if (data.clear !== undefined) {
|
|
54
|
+
this.clear = data.clear;
|
|
55
|
+
}
|
|
56
|
+
if (data.name !== undefined) {
|
|
57
|
+
this.name = data.name;
|
|
58
|
+
}
|
|
52
59
|
if (data.delay !== undefined) {
|
|
53
60
|
this.delay = setRangeValue(data.delay);
|
|
54
61
|
}
|
|
@@ -35,23 +35,26 @@ export class ParticlesOptions {
|
|
|
35
35
|
if (!data) {
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
38
|
-
this.bounce.load(data.bounce);
|
|
39
|
-
this.color.load(AnimatableColor.create(this.color, data.color));
|
|
40
|
-
this.effect.load(data.effect);
|
|
41
38
|
if (data.groups !== undefined) {
|
|
42
|
-
for (const group
|
|
39
|
+
for (const group of Object.keys(data.groups)) {
|
|
40
|
+
if (!Object.hasOwn(data.groups, group)) {
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
43
|
const item = data.groups[group];
|
|
44
44
|
if (item !== undefined) {
|
|
45
45
|
this.groups[group] = deepExtend(this.groups[group] ?? {}, item);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
this.move.load(data.move);
|
|
50
|
-
this.number.load(data.number);
|
|
51
|
-
this.opacity.load(data.opacity);
|
|
52
49
|
if (data.reduceDuplicates !== undefined) {
|
|
53
50
|
this.reduceDuplicates = data.reduceDuplicates;
|
|
54
51
|
}
|
|
52
|
+
this.bounce.load(data.bounce);
|
|
53
|
+
this.color.load(AnimatableColor.create(this.color, data.color));
|
|
54
|
+
this.effect.load(data.effect);
|
|
55
|
+
this.move.load(data.move);
|
|
56
|
+
this.number.load(data.number);
|
|
57
|
+
this.opacity.load(data.opacity);
|
|
55
58
|
this.shape.load(data.shape);
|
|
56
59
|
this.size.load(data.size);
|
|
57
60
|
this.shadow.load(data.shadow);
|
package/esm/Utils/CanvasUtils.js
CHANGED
|
@@ -50,7 +50,7 @@ export function drawParticle(data) {
|
|
|
50
50
|
if (colorStyles.stroke) {
|
|
51
51
|
context.strokeStyle = colorStyles.stroke;
|
|
52
52
|
}
|
|
53
|
-
const drawData = { container, context, particle, radius, opacity, delta };
|
|
53
|
+
const drawData = { container, context, particle, radius, opacity, delta, transformData };
|
|
54
54
|
context.beginPath();
|
|
55
55
|
drawShape(drawData);
|
|
56
56
|
if (particle.shapeClose) {
|
|
@@ -68,7 +68,7 @@ export function drawParticle(data) {
|
|
|
68
68
|
context.setTransform(1, 0, 0, 1, 0, 0);
|
|
69
69
|
}
|
|
70
70
|
export function drawEffect(data) {
|
|
71
|
-
const { container, context, particle, radius, opacity, delta } = data;
|
|
71
|
+
const { container, context, particle, radius, opacity, delta, transformData } = data;
|
|
72
72
|
if (!particle.effect) {
|
|
73
73
|
return;
|
|
74
74
|
}
|
|
@@ -76,10 +76,18 @@ export function drawEffect(data) {
|
|
|
76
76
|
if (!drawer) {
|
|
77
77
|
return;
|
|
78
78
|
}
|
|
79
|
-
drawer.draw({
|
|
79
|
+
drawer.draw({
|
|
80
|
+
context,
|
|
81
|
+
particle,
|
|
82
|
+
radius,
|
|
83
|
+
opacity,
|
|
84
|
+
delta,
|
|
85
|
+
pixelRatio: container.retina.pixelRatio,
|
|
86
|
+
transformData: { ...transformData },
|
|
87
|
+
});
|
|
80
88
|
}
|
|
81
89
|
export function drawShape(data) {
|
|
82
|
-
const { container, context, particle, radius, opacity, delta } = data;
|
|
90
|
+
const { container, context, particle, radius, opacity, delta, transformData } = data;
|
|
83
91
|
if (!particle.shape) {
|
|
84
92
|
return;
|
|
85
93
|
}
|
|
@@ -87,10 +95,18 @@ export function drawShape(data) {
|
|
|
87
95
|
if (!drawer) {
|
|
88
96
|
return;
|
|
89
97
|
}
|
|
90
|
-
drawer.draw({
|
|
98
|
+
drawer.draw({
|
|
99
|
+
context,
|
|
100
|
+
particle,
|
|
101
|
+
radius,
|
|
102
|
+
opacity,
|
|
103
|
+
delta,
|
|
104
|
+
pixelRatio: container.retina.pixelRatio,
|
|
105
|
+
transformData: { ...transformData },
|
|
106
|
+
});
|
|
91
107
|
}
|
|
92
108
|
export function drawShapeAfterDraw(data) {
|
|
93
|
-
const { container, context, particle, radius, opacity, delta } = data;
|
|
109
|
+
const { container, context, particle, radius, opacity, delta, transformData } = data;
|
|
94
110
|
if (!particle.shape) {
|
|
95
111
|
return;
|
|
96
112
|
}
|
|
@@ -98,7 +114,15 @@ export function drawShapeAfterDraw(data) {
|
|
|
98
114
|
if (!drawer || !drawer.afterDraw) {
|
|
99
115
|
return;
|
|
100
116
|
}
|
|
101
|
-
drawer.afterDraw({
|
|
117
|
+
drawer.afterDraw({
|
|
118
|
+
context,
|
|
119
|
+
particle,
|
|
120
|
+
radius,
|
|
121
|
+
opacity,
|
|
122
|
+
delta,
|
|
123
|
+
pixelRatio: container.retina.pixelRatio,
|
|
124
|
+
transformData: { ...transformData },
|
|
125
|
+
});
|
|
102
126
|
}
|
|
103
127
|
export function drawPlugin(context, plugin, delta) {
|
|
104
128
|
if (!plugin.draw) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/engine",
|
|
3
|
-
"version": "3.0.0
|
|
3
|
+
"version": "3.0.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": {
|