@tsparticles/engine 3.1.0 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/373.min.js +2 -0
- package/373.min.js.LICENSE.txt +1 -0
- package/438.min.js +2 -0
- package/438.min.js.LICENSE.txt +1 -0
- package/README.md +72 -71
- package/browser/Core/Canvas.js +85 -32
- package/browser/Core/Container.js +8 -7
- package/browser/Core/Engine.js +14 -15
- package/browser/Core/Particle.js +14 -15
- package/browser/Core/Particles.js +42 -35
- package/browser/Core/Utils/EventListeners.js +1 -1
- package/browser/Core/Utils/InteractionManager.js +3 -2
- package/browser/Options/Classes/BackgroundMask/BackgroundMask.js +1 -1
- package/browser/Options/Classes/BackgroundMask/BackgroundMaskCover.js +3 -2
- package/browser/Utils/CanvasUtils.js +14 -14
- package/cjs/Core/Canvas.js +85 -32
- package/cjs/Core/Container.js +8 -7
- package/cjs/Core/Engine.js +37 -15
- package/cjs/Core/Particle.js +14 -15
- package/cjs/Core/Particles.js +65 -35
- package/cjs/Core/Utils/EventListeners.js +1 -1
- package/cjs/Core/Utils/InteractionManager.js +3 -2
- package/cjs/Options/Classes/BackgroundMask/BackgroundMask.js +1 -1
- package/cjs/Options/Classes/BackgroundMask/BackgroundMaskCover.js +3 -2
- package/cjs/Utils/CanvasUtils.js +14 -14
- package/dist_browser_Core_Container_js.js +92 -0
- package/dist_browser_Core_Particle_js.js +32 -0
- package/esm/Core/Canvas.js +85 -32
- package/esm/Core/Container.js +8 -7
- package/esm/Core/Engine.js +14 -15
- package/esm/Core/Particle.js +14 -15
- package/esm/Core/Particles.js +42 -35
- package/esm/Core/Utils/EventListeners.js +1 -1
- package/esm/Core/Utils/InteractionManager.js +3 -2
- package/esm/Options/Classes/BackgroundMask/BackgroundMask.js +1 -1
- package/esm/Options/Classes/BackgroundMask/BackgroundMaskCover.js +3 -2
- package/esm/Utils/CanvasUtils.js +14 -14
- package/package.json +1 -1
- package/report.html +3 -3
- package/tsparticles.engine.js +894 -5820
- package/tsparticles.engine.min.js +1 -1
- package/tsparticles.engine.min.js.LICENSE.txt +1 -1
- package/types/Core/Canvas.d.ts +5 -3
- package/types/Core/Container.d.ts +1 -1
- package/types/Core/Engine.d.ts +13 -8
- package/types/Core/Interfaces/IContainerPlugin.d.ts +3 -3
- package/types/Core/Interfaces/IEffectDrawer.d.ts +3 -3
- 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/IPlugin.d.ts +1 -1
- package/types/Core/Interfaces/IShapeDrawer.d.ts +4 -4
- package/types/Core/Particle.d.ts +3 -3
- package/types/Core/Particles.d.ts +12 -8
- package/types/Core/Utils/InteractionManager.d.ts +2 -2
- package/types/Enums/Modes/OutMode.d.ts +0 -3
- package/types/Options/Classes/BackgroundMask/BackgroundMaskCover.d.ts +2 -1
- package/types/Options/Classes/Particles/Move/OutModes.d.ts +6 -6
- package/types/Options/Interfaces/BackgroundMask/IBackgroundMask.d.ts +2 -1
- package/types/Options/Interfaces/BackgroundMask/IBackgroundMaskCover.d.ts +2 -1
- package/types/Options/Interfaces/Particles/Move/IMove.d.ts +2 -2
- package/types/Options/Interfaces/Particles/Move/IOutModes.d.ts +6 -6
- package/types/Utils/CanvasUtils.d.ts +6 -6
- package/umd/Core/Canvas.js +85 -32
- package/umd/Core/Container.js +8 -7
- package/umd/Core/Engine.js +39 -16
- package/umd/Core/Particle.js +14 -15
- package/umd/Core/Particles.js +67 -36
- package/umd/Core/Utils/EventListeners.js +1 -1
- package/umd/Core/Utils/InteractionManager.js +3 -2
- package/umd/Options/Classes/BackgroundMask/BackgroundMask.js +1 -1
- package/umd/Options/Classes/BackgroundMask/BackgroundMaskCover.js +3 -2
- package/umd/Utils/CanvasUtils.js +14 -14
package/umd/Core/Particles.js
CHANGED
|
@@ -1,18 +1,41 @@
|
|
|
1
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
2
|
+
if (k2 === undefined) k2 = k;
|
|
3
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
4
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
5
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
6
|
+
}
|
|
7
|
+
Object.defineProperty(o, k2, desc);
|
|
8
|
+
}) : (function(o, m, k, k2) {
|
|
9
|
+
if (k2 === undefined) k2 = k;
|
|
10
|
+
o[k2] = m[k];
|
|
11
|
+
}));
|
|
12
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
13
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
14
|
+
}) : function(o, v) {
|
|
15
|
+
o["default"] = v;
|
|
16
|
+
});
|
|
17
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
18
|
+
if (mod && mod.__esModule) return mod;
|
|
19
|
+
var result = {};
|
|
20
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
21
|
+
__setModuleDefault(result, mod);
|
|
22
|
+
return result;
|
|
23
|
+
};
|
|
1
24
|
(function (factory) {
|
|
2
25
|
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
26
|
var v = factory(require, exports);
|
|
4
27
|
if (v !== undefined) module.exports = v;
|
|
5
28
|
}
|
|
6
29
|
else if (typeof define === "function" && define.amd) {
|
|
7
|
-
define(["require", "exports", "../Utils/Utils.js", "./Utils/InteractionManager.js", "./
|
|
30
|
+
define(["require", "exports", "../Utils/Utils.js", "./Utils/InteractionManager.js", "./Utils/Point.js", "./Utils/QuadTree.js", "./Utils/Rectangle.js", "./Utils/Constants.js"], factory);
|
|
8
31
|
}
|
|
9
32
|
})(function (require, exports) {
|
|
10
33
|
"use strict";
|
|
34
|
+
var __syncRequire = typeof module === "object" && typeof module.exports === "object";
|
|
11
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
36
|
exports.Particles = void 0;
|
|
13
37
|
const Utils_js_1 = require("../Utils/Utils.js");
|
|
14
38
|
const InteractionManager_js_1 = require("./Utils/InteractionManager.js");
|
|
15
|
-
const Particle_js_1 = require("./Particle.js");
|
|
16
39
|
const Point_js_1 = require("./Utils/Point.js");
|
|
17
40
|
const QuadTree_js_1 = require("./Utils/QuadTree.js");
|
|
18
41
|
const Rectangle_js_1 = require("./Utils/Rectangle.js");
|
|
@@ -29,7 +52,7 @@
|
|
|
29
52
|
this._pool.push(particle);
|
|
30
53
|
}
|
|
31
54
|
};
|
|
32
|
-
this._applyDensity = (options, manualCount, group) => {
|
|
55
|
+
this._applyDensity = async (options, manualCount, group) => {
|
|
33
56
|
const numberOptions = options.number;
|
|
34
57
|
if (!options.number.density?.enable) {
|
|
35
58
|
if (group === undefined) {
|
|
@@ -48,7 +71,7 @@
|
|
|
48
71
|
this._groupLimits.set(group, numberOptions.limit.value * densityFactor);
|
|
49
72
|
}
|
|
50
73
|
if (particlesCount < particlesNumber) {
|
|
51
|
-
this.push(Math.abs(particlesNumber - particlesCount), undefined, options, group);
|
|
74
|
+
await this.push(Math.abs(particlesNumber - particlesCount), undefined, options, group);
|
|
52
75
|
}
|
|
53
76
|
else if (particlesCount > particlesNumber) {
|
|
54
77
|
this.removeQuantity(particlesCount - particlesNumber, group);
|
|
@@ -62,15 +85,14 @@
|
|
|
62
85
|
const canvas = container.canvas.element, pxRatio = container.retina.pixelRatio;
|
|
63
86
|
return (canvas.width * canvas.height) / (densityOptions.height * densityOptions.width * pxRatio ** squareExp);
|
|
64
87
|
};
|
|
65
|
-
this._pushParticle = (position, overrideOptions, group, initializer) => {
|
|
88
|
+
this._pushParticle = async (position, overrideOptions, group, initializer) => {
|
|
66
89
|
try {
|
|
67
90
|
let particle = this._pool.pop();
|
|
68
|
-
if (particle) {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
else {
|
|
72
|
-
particle = new Particle_js_1.Particle(this._engine, this._nextId, this._container, position, overrideOptions, group);
|
|
91
|
+
if (!particle) {
|
|
92
|
+
const { Particle } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./Particle.js"))) : new Promise((resolve_1, reject_1) => { require(["./Particle.js"], resolve_1, reject_1); }).then(__importStar));
|
|
93
|
+
particle = new Particle(this._engine, this._container);
|
|
73
94
|
}
|
|
95
|
+
await particle.init(this._nextId, position, overrideOptions, group);
|
|
74
96
|
let canAdd = true;
|
|
75
97
|
if (initializer) {
|
|
76
98
|
canAdd = initializer(particle);
|
|
@@ -122,21 +144,22 @@
|
|
|
122
144
|
this._needsSort = false;
|
|
123
145
|
this._lastZIndex = 0;
|
|
124
146
|
this._interactionManager = new InteractionManager_js_1.InteractionManager(engine, container);
|
|
147
|
+
this._pluginsInitialized = false;
|
|
125
148
|
const canvasSize = container.canvas.size;
|
|
126
149
|
this.quadTree = new QuadTree_js_1.QuadTree(qTreeRectangle(canvasSize), qTreeCapacity);
|
|
127
|
-
this.movers =
|
|
128
|
-
this.updaters =
|
|
150
|
+
this.movers = [];
|
|
151
|
+
this.updaters = [];
|
|
129
152
|
}
|
|
130
153
|
get count() {
|
|
131
154
|
return this._array.length;
|
|
132
155
|
}
|
|
133
|
-
addManualParticles() {
|
|
156
|
+
async addManualParticles() {
|
|
134
157
|
const container = this._container, options = container.actualOptions;
|
|
135
158
|
for (const particle of options.manualParticles) {
|
|
136
|
-
this.addParticle(particle.position ? (0, Utils_js_1.getPosition)(particle.position, container.canvas.size) : undefined, particle.options);
|
|
159
|
+
await this.addParticle(particle.position ? (0, Utils_js_1.getPosition)(particle.position, container.canvas.size) : undefined, particle.options);
|
|
137
160
|
}
|
|
138
161
|
}
|
|
139
|
-
addParticle(position, overrideOptions, group, initializer) {
|
|
162
|
+
async addParticle(position, overrideOptions, group, initializer) {
|
|
140
163
|
const limitOptions = this._container.actualOptions.particles.number.limit, limit = group === undefined ? this._limit : this._groupLimits.get(group) ?? this._limit, currentCount = this.count, minLimit = 0;
|
|
141
164
|
if (limit > minLimit) {
|
|
142
165
|
if (limitOptions.mode === "delete") {
|
|
@@ -151,11 +174,12 @@
|
|
|
151
174
|
}
|
|
152
175
|
}
|
|
153
176
|
}
|
|
154
|
-
return this._pushParticle(position, overrideOptions, group, initializer);
|
|
177
|
+
return await this._pushParticle(position, overrideOptions, group, initializer);
|
|
155
178
|
}
|
|
156
179
|
clear() {
|
|
157
180
|
this._array = [];
|
|
158
181
|
this._zArray = [];
|
|
182
|
+
this._pluginsInitialized = false;
|
|
159
183
|
}
|
|
160
184
|
destroy() {
|
|
161
185
|
this._array = [];
|
|
@@ -168,10 +192,10 @@
|
|
|
168
192
|
canvas.clear();
|
|
169
193
|
await this.update(delta);
|
|
170
194
|
for (const [, plugin] of container.plugins) {
|
|
171
|
-
canvas.drawPlugin(plugin, delta);
|
|
195
|
+
await canvas.drawPlugin(plugin, delta);
|
|
172
196
|
}
|
|
173
197
|
for (const p of this._zArray) {
|
|
174
|
-
p.draw(delta);
|
|
198
|
+
await p.draw(delta);
|
|
175
199
|
}
|
|
176
200
|
}
|
|
177
201
|
filter(condition) {
|
|
@@ -186,13 +210,12 @@
|
|
|
186
210
|
handleClickMode(mode) {
|
|
187
211
|
this._interactionManager.handleClickMode(mode);
|
|
188
212
|
}
|
|
189
|
-
init() {
|
|
213
|
+
async init() {
|
|
190
214
|
const container = this._container, options = container.actualOptions;
|
|
191
215
|
this._lastZIndex = 0;
|
|
192
216
|
this._needsSort = false;
|
|
217
|
+
await this.initPlugins();
|
|
193
218
|
let handled = false;
|
|
194
|
-
this.updaters = this._engine.getUpdaters(container, true);
|
|
195
|
-
this._interactionManager.init();
|
|
196
219
|
for (const [, plugin] of container.plugins) {
|
|
197
220
|
if (plugin.particlesInitialization !== undefined) {
|
|
198
221
|
handled = plugin.particlesInitialization();
|
|
@@ -201,32 +224,40 @@
|
|
|
201
224
|
break;
|
|
202
225
|
}
|
|
203
226
|
}
|
|
204
|
-
this.
|
|
205
|
-
for (const [, pathGenerator] of container.pathGenerators) {
|
|
206
|
-
pathGenerator.init(container);
|
|
207
|
-
}
|
|
208
|
-
this.addManualParticles();
|
|
227
|
+
await this.addManualParticles();
|
|
209
228
|
if (!handled) {
|
|
210
229
|
const particlesOptions = options.particles, groups = particlesOptions.groups;
|
|
211
230
|
for (const group in groups) {
|
|
212
231
|
const groupOptions = groups[group];
|
|
213
232
|
for (let i = this.count, j = 0; j < groupOptions.number?.value && i < particlesOptions.number.value; i++, j++) {
|
|
214
|
-
this.addParticle(undefined, groupOptions, group);
|
|
233
|
+
await this.addParticle(undefined, groupOptions, group);
|
|
215
234
|
}
|
|
216
235
|
}
|
|
217
236
|
for (let i = this.count; i < particlesOptions.number.value; i++) {
|
|
218
|
-
this.addParticle();
|
|
237
|
+
await this.addParticle();
|
|
219
238
|
}
|
|
220
239
|
}
|
|
221
240
|
}
|
|
222
|
-
|
|
241
|
+
async initPlugins() {
|
|
242
|
+
if (this._pluginsInitialized) {
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
const container = this._container;
|
|
246
|
+
this.movers = await this._engine.getMovers(container, true);
|
|
247
|
+
this.updaters = await this._engine.getUpdaters(container, true);
|
|
248
|
+
await this._interactionManager.init();
|
|
249
|
+
for (const [, pathGenerator] of container.pathGenerators) {
|
|
250
|
+
await pathGenerator.init(container);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
async push(nb, mouse, overrideOptions, group) {
|
|
223
254
|
for (let i = 0; i < nb; i++) {
|
|
224
|
-
this.addParticle(mouse?.position, overrideOptions, group);
|
|
255
|
+
await this.addParticle(mouse?.position, overrideOptions, group);
|
|
225
256
|
}
|
|
226
257
|
}
|
|
227
258
|
async redraw() {
|
|
228
259
|
this.clear();
|
|
229
|
-
this.init();
|
|
260
|
+
await this.init();
|
|
230
261
|
await this.draw({ value: 0, factor: 0 });
|
|
231
262
|
}
|
|
232
263
|
remove(particle, group, override) {
|
|
@@ -248,12 +279,12 @@
|
|
|
248
279
|
const defaultIndex = 0;
|
|
249
280
|
this.removeAt(defaultIndex, quantity, group);
|
|
250
281
|
}
|
|
251
|
-
setDensity() {
|
|
282
|
+
async setDensity() {
|
|
252
283
|
const options = this._container.actualOptions, groups = options.particles.groups, manualCount = 0;
|
|
253
284
|
for (const group in groups) {
|
|
254
|
-
this._applyDensity(groups[group], manualCount, group);
|
|
285
|
+
await this._applyDensity(groups[group], manualCount, group);
|
|
255
286
|
}
|
|
256
|
-
this._applyDensity(options.particles, options.manualParticles.length);
|
|
287
|
+
await this._applyDensity(options.particles, options.manualParticles.length);
|
|
257
288
|
}
|
|
258
289
|
setLastZIndex(zIndex) {
|
|
259
290
|
this._lastZIndex = zIndex;
|
|
@@ -289,7 +320,7 @@
|
|
|
289
320
|
}
|
|
290
321
|
for (const mover of this.movers) {
|
|
291
322
|
if (mover.isEnabled(particle)) {
|
|
292
|
-
mover.move(particle, delta);
|
|
323
|
+
await mover.move(particle, delta);
|
|
293
324
|
}
|
|
294
325
|
}
|
|
295
326
|
if (particle.destroyed) {
|
|
@@ -315,7 +346,7 @@
|
|
|
315
346
|
await this._interactionManager.externalInteract(delta);
|
|
316
347
|
for (const particle of this._array) {
|
|
317
348
|
for (const updater of this.updaters) {
|
|
318
|
-
updater.update(particle, delta);
|
|
349
|
+
await updater.update(particle, delta);
|
|
319
350
|
}
|
|
320
351
|
if (!particle.destroyed && !particle.spawning) {
|
|
321
352
|
await this._interactionManager.particlesInteract(particle, delta);
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
constructor(engine, container) {
|
|
15
15
|
this.container = container;
|
|
16
16
|
this._engine = engine;
|
|
17
|
-
this._interactors =
|
|
17
|
+
this._interactors = [];
|
|
18
18
|
this._externalInteractors = [];
|
|
19
19
|
this._particleInteractors = [];
|
|
20
20
|
}
|
|
@@ -30,7 +30,8 @@
|
|
|
30
30
|
interactor.handleClickMode?.(mode);
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
init() {
|
|
33
|
+
async init() {
|
|
34
|
+
this._interactors = await this._engine.getInteractors(this.container, true);
|
|
34
35
|
this._externalInteractors = [];
|
|
35
36
|
this._particleInteractors = [];
|
|
36
37
|
for (const interactor of this._interactors) {
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
}
|
|
28
28
|
if (data.cover !== undefined) {
|
|
29
29
|
const cover = data.cover, color = ((0, Utils_js_1.isString)(data.cover) ? { color: data.cover } : data.cover);
|
|
30
|
-
this.cover.load(cover.color !== undefined ? cover : { color: color });
|
|
30
|
+
this.cover.load(cover.color !== undefined || cover.image !== undefined ? cover : { color: color });
|
|
31
31
|
}
|
|
32
32
|
if (data.enable !== undefined) {
|
|
33
33
|
this.enable = data.enable;
|
|
@@ -13,8 +13,6 @@
|
|
|
13
13
|
const OptionsColor_js_1 = require("../OptionsColor.js");
|
|
14
14
|
class BackgroundMaskCover {
|
|
15
15
|
constructor() {
|
|
16
|
-
this.color = new OptionsColor_js_1.OptionsColor();
|
|
17
|
-
this.color.value = "#fff";
|
|
18
16
|
this.opacity = 1;
|
|
19
17
|
}
|
|
20
18
|
load(data) {
|
|
@@ -24,6 +22,9 @@
|
|
|
24
22
|
if (data.color !== undefined) {
|
|
25
23
|
this.color = OptionsColor_js_1.OptionsColor.create(this.color, data.color);
|
|
26
24
|
}
|
|
25
|
+
if (data.image !== undefined) {
|
|
26
|
+
this.image = data.image;
|
|
27
|
+
}
|
|
27
28
|
if (data.opacity !== undefined) {
|
|
28
29
|
this.opacity = data.opacity;
|
|
29
30
|
}
|
package/umd/Utils/CanvasUtils.js
CHANGED
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
context.clearRect(origin.x, origin.y, dimension.width, dimension.height);
|
|
38
38
|
}
|
|
39
39
|
exports.clear = clear;
|
|
40
|
-
function drawParticle(data) {
|
|
40
|
+
async function drawParticle(data) {
|
|
41
41
|
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 = {
|
|
42
42
|
sin: Math.sin(angle),
|
|
43
43
|
cos: Math.cos(angle),
|
|
@@ -76,14 +76,14 @@
|
|
|
76
76
|
transformData,
|
|
77
77
|
strokeWidth,
|
|
78
78
|
};
|
|
79
|
-
drawShape(drawData);
|
|
80
|
-
drawShapeAfterDraw(drawData);
|
|
81
|
-
drawEffect(drawData);
|
|
79
|
+
await drawShape(drawData);
|
|
80
|
+
await drawShapeAfterDraw(drawData);
|
|
81
|
+
await drawEffect(drawData);
|
|
82
82
|
context.globalCompositeOperation = "source-over";
|
|
83
83
|
context.resetTransform();
|
|
84
84
|
}
|
|
85
85
|
exports.drawParticle = drawParticle;
|
|
86
|
-
function drawEffect(data) {
|
|
86
|
+
async function drawEffect(data) {
|
|
87
87
|
const { container, context, particle, radius, opacity, delta, transformData } = data;
|
|
88
88
|
if (!particle.effect) {
|
|
89
89
|
return;
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
if (!drawer) {
|
|
93
93
|
return;
|
|
94
94
|
}
|
|
95
|
-
drawer.draw({
|
|
95
|
+
await drawer.draw({
|
|
96
96
|
context,
|
|
97
97
|
particle,
|
|
98
98
|
radius,
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
});
|
|
104
104
|
}
|
|
105
105
|
exports.drawEffect = drawEffect;
|
|
106
|
-
function drawShape(data) {
|
|
106
|
+
async function drawShape(data) {
|
|
107
107
|
const { container, context, particle, radius, opacity, delta, strokeWidth, transformData } = data, minStrokeWidth = 0;
|
|
108
108
|
if (!particle.shape) {
|
|
109
109
|
return;
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
return;
|
|
114
114
|
}
|
|
115
115
|
context.beginPath();
|
|
116
|
-
drawer.draw({
|
|
116
|
+
await drawer.draw({
|
|
117
117
|
context,
|
|
118
118
|
particle,
|
|
119
119
|
radius,
|
|
@@ -133,7 +133,7 @@
|
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
135
|
exports.drawShape = drawShape;
|
|
136
|
-
function drawShapeAfterDraw(data) {
|
|
136
|
+
async function drawShapeAfterDraw(data) {
|
|
137
137
|
const { container, context, particle, radius, opacity, delta, transformData } = data;
|
|
138
138
|
if (!particle.shape) {
|
|
139
139
|
return;
|
|
@@ -142,7 +142,7 @@
|
|
|
142
142
|
if (!drawer?.afterDraw) {
|
|
143
143
|
return;
|
|
144
144
|
}
|
|
145
|
-
drawer.afterDraw({
|
|
145
|
+
await drawer.afterDraw({
|
|
146
146
|
context,
|
|
147
147
|
particle,
|
|
148
148
|
radius,
|
|
@@ -153,18 +153,18 @@
|
|
|
153
153
|
});
|
|
154
154
|
}
|
|
155
155
|
exports.drawShapeAfterDraw = drawShapeAfterDraw;
|
|
156
|
-
function drawPlugin(context, plugin, delta) {
|
|
156
|
+
async function drawPlugin(context, plugin, delta) {
|
|
157
157
|
if (!plugin.draw) {
|
|
158
158
|
return;
|
|
159
159
|
}
|
|
160
|
-
plugin.draw(context, delta);
|
|
160
|
+
await plugin.draw(context, delta);
|
|
161
161
|
}
|
|
162
162
|
exports.drawPlugin = drawPlugin;
|
|
163
|
-
function drawParticlePlugin(context, plugin, particle, delta) {
|
|
163
|
+
async function drawParticlePlugin(context, plugin, particle, delta) {
|
|
164
164
|
if (!plugin.drawParticle) {
|
|
165
165
|
return;
|
|
166
166
|
}
|
|
167
|
-
plugin.drawParticle(context, particle, delta);
|
|
167
|
+
await plugin.drawParticle(context, particle, delta);
|
|
168
168
|
}
|
|
169
169
|
exports.drawParticlePlugin = drawParticlePlugin;
|
|
170
170
|
function alterHsl(color, type, value) {
|