@tsparticles/confetti 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/package.json +17 -17
- package/report.html +3 -3
- package/tsparticles.confetti.bundle.js +71 -45
- package/tsparticles.confetti.bundle.min.js +1 -1
- package/tsparticles.confetti.bundle.min.js.LICENSE.txt +1 -1
- package/tsparticles.confetti.js +1 -1
- package/tsparticles.confetti.min.js.LICENSE.txt +1 -1
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Demo / Generator : https://particles.js.org/
|
|
5
5
|
* GitHub : https://www.github.com/matteobruni/tsparticles
|
|
6
6
|
* How to use? : Check the GitHub README
|
|
7
|
-
* v3.0.0
|
|
7
|
+
* v3.0.0
|
|
8
8
|
*/
|
|
9
9
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
10
10
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
@@ -1227,7 +1227,8 @@ function drawParticle(data) {
|
|
|
1227
1227
|
particle,
|
|
1228
1228
|
radius,
|
|
1229
1229
|
opacity,
|
|
1230
|
-
delta
|
|
1230
|
+
delta,
|
|
1231
|
+
transformData
|
|
1231
1232
|
};
|
|
1232
1233
|
context.beginPath();
|
|
1233
1234
|
drawShape(drawData);
|
|
@@ -1252,7 +1253,8 @@ function drawEffect(data) {
|
|
|
1252
1253
|
particle,
|
|
1253
1254
|
radius,
|
|
1254
1255
|
opacity,
|
|
1255
|
-
delta
|
|
1256
|
+
delta,
|
|
1257
|
+
transformData
|
|
1256
1258
|
} = data;
|
|
1257
1259
|
if (!particle.effect) {
|
|
1258
1260
|
return;
|
|
@@ -1267,7 +1269,10 @@ function drawEffect(data) {
|
|
|
1267
1269
|
radius,
|
|
1268
1270
|
opacity,
|
|
1269
1271
|
delta,
|
|
1270
|
-
pixelRatio: container.retina.pixelRatio
|
|
1272
|
+
pixelRatio: container.retina.pixelRatio,
|
|
1273
|
+
transformData: {
|
|
1274
|
+
...transformData
|
|
1275
|
+
}
|
|
1271
1276
|
});
|
|
1272
1277
|
}
|
|
1273
1278
|
function drawShape(data) {
|
|
@@ -1277,7 +1282,8 @@ function drawShape(data) {
|
|
|
1277
1282
|
particle,
|
|
1278
1283
|
radius,
|
|
1279
1284
|
opacity,
|
|
1280
|
-
delta
|
|
1285
|
+
delta,
|
|
1286
|
+
transformData
|
|
1281
1287
|
} = data;
|
|
1282
1288
|
if (!particle.shape) {
|
|
1283
1289
|
return;
|
|
@@ -1292,7 +1298,10 @@ function drawShape(data) {
|
|
|
1292
1298
|
radius,
|
|
1293
1299
|
opacity,
|
|
1294
1300
|
delta,
|
|
1295
|
-
pixelRatio: container.retina.pixelRatio
|
|
1301
|
+
pixelRatio: container.retina.pixelRatio,
|
|
1302
|
+
transformData: {
|
|
1303
|
+
...transformData
|
|
1304
|
+
}
|
|
1296
1305
|
});
|
|
1297
1306
|
}
|
|
1298
1307
|
function drawShapeAfterDraw(data) {
|
|
@@ -1302,7 +1311,8 @@ function drawShapeAfterDraw(data) {
|
|
|
1302
1311
|
particle,
|
|
1303
1312
|
radius,
|
|
1304
1313
|
opacity,
|
|
1305
|
-
delta
|
|
1314
|
+
delta,
|
|
1315
|
+
transformData
|
|
1306
1316
|
} = data;
|
|
1307
1317
|
if (!particle.shape) {
|
|
1308
1318
|
return;
|
|
@@ -1317,7 +1327,10 @@ function drawShapeAfterDraw(data) {
|
|
|
1317
1327
|
radius,
|
|
1318
1328
|
opacity,
|
|
1319
1329
|
delta,
|
|
1320
|
-
pixelRatio: container.retina.pixelRatio
|
|
1330
|
+
pixelRatio: container.retina.pixelRatio,
|
|
1331
|
+
transformData: {
|
|
1332
|
+
...transformData
|
|
1333
|
+
}
|
|
1321
1334
|
});
|
|
1322
1335
|
}
|
|
1323
1336
|
function drawPlugin(context, plugin, delta) {
|
|
@@ -1554,7 +1567,7 @@ class Canvas {
|
|
|
1554
1567
|
} else if (trailFill.image) {
|
|
1555
1568
|
this._paintImage(trailFill.image, trailFill.opacity);
|
|
1556
1569
|
}
|
|
1557
|
-
} else {
|
|
1570
|
+
} else if (options.clear) {
|
|
1558
1571
|
this.draw(ctx => {
|
|
1559
1572
|
clear(ctx, this.size);
|
|
1560
1573
|
});
|
|
@@ -2401,11 +2414,7 @@ class Events {
|
|
|
2401
2414
|
});
|
|
2402
2415
|
}
|
|
2403
2416
|
this.onHover.load(data.onHover);
|
|
2404
|
-
|
|
2405
|
-
this.resize.enable = data.resize;
|
|
2406
|
-
} else {
|
|
2407
|
-
this.resize.load(data.resize);
|
|
2408
|
-
}
|
|
2417
|
+
this.resize.load(data.resize);
|
|
2409
2418
|
}
|
|
2410
2419
|
}
|
|
2411
2420
|
;// CONCATENATED MODULE: ../../engine/dist/browser/Options/Classes/Interactivity/Modes/Modes.js
|
|
@@ -3430,23 +3439,26 @@ class ParticlesOptions {
|
|
|
3430
3439
|
if (!data) {
|
|
3431
3440
|
return;
|
|
3432
3441
|
}
|
|
3433
|
-
this.bounce.load(data.bounce);
|
|
3434
|
-
this.color.load(AnimatableColor.create(this.color, data.color));
|
|
3435
|
-
this.effect.load(data.effect);
|
|
3436
3442
|
if (data.groups !== undefined) {
|
|
3437
|
-
for (const group
|
|
3443
|
+
for (const group of Object.keys(data.groups)) {
|
|
3444
|
+
if (!Object.hasOwn(data.groups, group)) {
|
|
3445
|
+
continue;
|
|
3446
|
+
}
|
|
3438
3447
|
const item = data.groups[group];
|
|
3439
3448
|
if (item !== undefined) {
|
|
3440
3449
|
this.groups[group] = deepExtend(this.groups[group] ?? {}, item);
|
|
3441
3450
|
}
|
|
3442
3451
|
}
|
|
3443
3452
|
}
|
|
3444
|
-
this.move.load(data.move);
|
|
3445
|
-
this.number.load(data.number);
|
|
3446
|
-
this.opacity.load(data.opacity);
|
|
3447
3453
|
if (data.reduceDuplicates !== undefined) {
|
|
3448
3454
|
this.reduceDuplicates = data.reduceDuplicates;
|
|
3449
3455
|
}
|
|
3456
|
+
this.bounce.load(data.bounce);
|
|
3457
|
+
this.color.load(AnimatableColor.create(this.color, data.color));
|
|
3458
|
+
this.effect.load(data.effect);
|
|
3459
|
+
this.move.load(data.move);
|
|
3460
|
+
this.number.load(data.number);
|
|
3461
|
+
this.opacity.load(data.opacity);
|
|
3450
3462
|
this.shape.load(data.shape);
|
|
3451
3463
|
this.size.load(data.size);
|
|
3452
3464
|
this.shadow.load(data.shadow);
|
|
@@ -3519,6 +3531,7 @@ class Options {
|
|
|
3519
3531
|
this.autoPlay = true;
|
|
3520
3532
|
this.background = new Background();
|
|
3521
3533
|
this.backgroundMask = new BackgroundMask();
|
|
3534
|
+
this.clear = true;
|
|
3522
3535
|
this.defaultThemes = {};
|
|
3523
3536
|
this.delay = 0;
|
|
3524
3537
|
this.fullScreen = new FullScreen();
|
|
@@ -3546,6 +3559,12 @@ class Options {
|
|
|
3546
3559
|
if (data.autoPlay !== undefined) {
|
|
3547
3560
|
this.autoPlay = data.autoPlay;
|
|
3548
3561
|
}
|
|
3562
|
+
if (data.clear !== undefined) {
|
|
3563
|
+
this.clear = data.clear;
|
|
3564
|
+
}
|
|
3565
|
+
if (data.name !== undefined) {
|
|
3566
|
+
this.name = data.name;
|
|
3567
|
+
}
|
|
3549
3568
|
if (data.delay !== undefined) {
|
|
3550
3569
|
this.delay = setRangeValue(data.delay);
|
|
3551
3570
|
}
|
|
@@ -3871,7 +3890,9 @@ class Particle {
|
|
|
3871
3890
|
this.bubble.inRange = false;
|
|
3872
3891
|
this.slow.inRange = false;
|
|
3873
3892
|
const container = this.container,
|
|
3874
|
-
pathGenerator = this.pathGenerator
|
|
3893
|
+
pathGenerator = this.pathGenerator,
|
|
3894
|
+
shapeDrawer = container.shapeDrawers.get(this.shape);
|
|
3895
|
+
shapeDrawer && shapeDrawer.particleDestroy && shapeDrawer.particleDestroy(this);
|
|
3875
3896
|
for (const [, plugin] of container.plugins) {
|
|
3876
3897
|
plugin.particleDestroyed && plugin.particleDestroyed(this, override);
|
|
3877
3898
|
}
|
|
@@ -5125,7 +5146,7 @@ class Engine {
|
|
|
5125
5146
|
return res;
|
|
5126
5147
|
}
|
|
5127
5148
|
get version() {
|
|
5128
|
-
return "3.0.0
|
|
5149
|
+
return "3.0.0";
|
|
5129
5150
|
}
|
|
5130
5151
|
addConfig(config) {
|
|
5131
5152
|
const name = config.name ?? "default";
|
|
@@ -6358,7 +6379,7 @@ class OutOutMode {
|
|
|
6358
6379
|
}
|
|
6359
6380
|
case "normal":
|
|
6360
6381
|
{
|
|
6361
|
-
const
|
|
6382
|
+
const warp = particle.options.move.warp,
|
|
6362
6383
|
canvasSize = container.canvas.size,
|
|
6363
6384
|
newPos = {
|
|
6364
6385
|
bottom: canvasSize.height + particle.getRadius() + particle.offset.y,
|
|
@@ -6371,27 +6392,27 @@ class OutOutMode {
|
|
|
6371
6392
|
if (direction === "right" && nextBounds.left > canvasSize.width + particle.offset.x) {
|
|
6372
6393
|
particle.position.x = newPos.left;
|
|
6373
6394
|
particle.initialPosition.x = particle.position.x;
|
|
6374
|
-
if (!
|
|
6395
|
+
if (!warp) {
|
|
6375
6396
|
particle.position.y = getRandom() * canvasSize.height;
|
|
6376
6397
|
particle.initialPosition.y = particle.position.y;
|
|
6377
6398
|
}
|
|
6378
6399
|
} else if (direction === "left" && nextBounds.right < -particle.offset.x) {
|
|
6379
6400
|
particle.position.x = newPos.right;
|
|
6380
6401
|
particle.initialPosition.x = particle.position.x;
|
|
6381
|
-
if (!
|
|
6402
|
+
if (!warp) {
|
|
6382
6403
|
particle.position.y = getRandom() * canvasSize.height;
|
|
6383
6404
|
particle.initialPosition.y = particle.position.y;
|
|
6384
6405
|
}
|
|
6385
6406
|
}
|
|
6386
6407
|
if (direction === "bottom" && nextBounds.top > canvasSize.height + particle.offset.y) {
|
|
6387
|
-
if (!
|
|
6408
|
+
if (!warp) {
|
|
6388
6409
|
particle.position.x = getRandom() * canvasSize.width;
|
|
6389
6410
|
particle.initialPosition.x = particle.position.x;
|
|
6390
6411
|
}
|
|
6391
6412
|
particle.position.y = newPos.top;
|
|
6392
6413
|
particle.initialPosition.y = particle.position.y;
|
|
6393
6414
|
} else if (direction === "top" && nextBounds.bottom < -particle.offset.y) {
|
|
6394
|
-
if (!
|
|
6415
|
+
if (!warp) {
|
|
6395
6416
|
particle.position.x = getRandom() * canvasSize.width;
|
|
6396
6417
|
particle.initialPosition.x = particle.position.x;
|
|
6397
6418
|
}
|
|
@@ -7544,20 +7565,23 @@ async function loadEmittersPlugin(engine, refresh = true) {
|
|
|
7544
7565
|
class HeartDrawer_HeartDrawer {
|
|
7545
7566
|
draw(data) {
|
|
7546
7567
|
const {
|
|
7547
|
-
|
|
7548
|
-
|
|
7549
|
-
|
|
7550
|
-
|
|
7568
|
+
context,
|
|
7569
|
+
radius
|
|
7570
|
+
} = data,
|
|
7571
|
+
diameter = radius * 2,
|
|
7572
|
+
halfRadius = radius * 0.5,
|
|
7573
|
+
radiusAndHalf = radius + halfRadius,
|
|
7574
|
+
x = -radius,
|
|
7551
7575
|
y = -radius;
|
|
7552
7576
|
context.moveTo(x, y + radius / 2);
|
|
7553
|
-
context.quadraticCurveTo(x, y, x +
|
|
7554
|
-
context.quadraticCurveTo(x + radius, y, x + radius, y +
|
|
7555
|
-
context.quadraticCurveTo(x + radius, y, x +
|
|
7556
|
-
context.quadraticCurveTo(x +
|
|
7557
|
-
context.quadraticCurveTo(x +
|
|
7558
|
-
context.lineTo(x + radius, y +
|
|
7559
|
-
context.lineTo(x +
|
|
7560
|
-
context.quadraticCurveTo(x, y + radius, x, y +
|
|
7577
|
+
context.quadraticCurveTo(x, y, x + halfRadius, y);
|
|
7578
|
+
context.quadraticCurveTo(x + radius, y, x + radius, y + halfRadius);
|
|
7579
|
+
context.quadraticCurveTo(x + radius, y, x + radiusAndHalf, y);
|
|
7580
|
+
context.quadraticCurveTo(x + diameter, y, x + diameter, y + halfRadius);
|
|
7581
|
+
context.quadraticCurveTo(x + diameter, y + radius, x + radiusAndHalf, y + radiusAndHalf);
|
|
7582
|
+
context.lineTo(x + radius, y + diameter);
|
|
7583
|
+
context.lineTo(x + halfRadius, y + radiusAndHalf);
|
|
7584
|
+
context.quadraticCurveTo(x, y + radius, x, y + halfRadius);
|
|
7561
7585
|
}
|
|
7562
7586
|
}
|
|
7563
7587
|
;// CONCATENATED MODULE: ../../shapes/heart/dist/browser/index.js
|
|
@@ -8207,8 +8231,9 @@ class ImageDrawer {
|
|
|
8207
8231
|
pos = {
|
|
8208
8232
|
x: -radius,
|
|
8209
8233
|
y: -radius
|
|
8210
|
-
}
|
|
8211
|
-
|
|
8234
|
+
},
|
|
8235
|
+
diameter = radius * 2;
|
|
8236
|
+
context.drawImage(element, pos.x, pos.y, diameter, diameter / ratio);
|
|
8212
8237
|
}
|
|
8213
8238
|
context.globalAlpha = 1;
|
|
8214
8239
|
}
|
|
@@ -9115,11 +9140,12 @@ class TextDrawer {
|
|
|
9115
9140
|
pos = {
|
|
9116
9141
|
x: -offsetX,
|
|
9117
9142
|
y: radius / 2
|
|
9118
|
-
}
|
|
9143
|
+
},
|
|
9144
|
+
diameter = radius * 2;
|
|
9119
9145
|
if (fill) {
|
|
9120
|
-
context.fillText(line, pos.x, pos.y +
|
|
9146
|
+
context.fillText(line, pos.x, pos.y + diameter * index);
|
|
9121
9147
|
} else {
|
|
9122
|
-
context.strokeText(line, pos.x, pos.y +
|
|
9148
|
+
context.strokeText(line, pos.x, pos.y + diameter * index);
|
|
9123
9149
|
}
|
|
9124
9150
|
};
|
|
9125
9151
|
}
|