tsparticles 3.0.0-beta.5 → 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 +14 -14
- package/report.html +2 -2
- package/tsparticles.bundle.js +62 -26
- package/tsparticles.bundle.min.js +1 -1
- package/tsparticles.bundle.min.js.LICENSE.txt +1 -1
- package/tsparticles.js +1 -1
- package/tsparticles.min.js.LICENSE.txt +1 -1
package/tsparticles.bundle.js
CHANGED
|
@@ -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')
|
|
@@ -1228,7 +1228,8 @@ function drawParticle(data) {
|
|
|
1228
1228
|
particle,
|
|
1229
1229
|
radius,
|
|
1230
1230
|
opacity,
|
|
1231
|
-
delta
|
|
1231
|
+
delta,
|
|
1232
|
+
transformData
|
|
1232
1233
|
};
|
|
1233
1234
|
context.beginPath();
|
|
1234
1235
|
drawShape(drawData);
|
|
@@ -1253,7 +1254,8 @@ function drawEffect(data) {
|
|
|
1253
1254
|
particle,
|
|
1254
1255
|
radius,
|
|
1255
1256
|
opacity,
|
|
1256
|
-
delta
|
|
1257
|
+
delta,
|
|
1258
|
+
transformData
|
|
1257
1259
|
} = data;
|
|
1258
1260
|
if (!particle.effect) {
|
|
1259
1261
|
return;
|
|
@@ -1268,7 +1270,10 @@ function drawEffect(data) {
|
|
|
1268
1270
|
radius,
|
|
1269
1271
|
opacity,
|
|
1270
1272
|
delta,
|
|
1271
|
-
pixelRatio: container.retina.pixelRatio
|
|
1273
|
+
pixelRatio: container.retina.pixelRatio,
|
|
1274
|
+
transformData: {
|
|
1275
|
+
...transformData
|
|
1276
|
+
}
|
|
1272
1277
|
});
|
|
1273
1278
|
}
|
|
1274
1279
|
function drawShape(data) {
|
|
@@ -1278,7 +1283,8 @@ function drawShape(data) {
|
|
|
1278
1283
|
particle,
|
|
1279
1284
|
radius,
|
|
1280
1285
|
opacity,
|
|
1281
|
-
delta
|
|
1286
|
+
delta,
|
|
1287
|
+
transformData
|
|
1282
1288
|
} = data;
|
|
1283
1289
|
if (!particle.shape) {
|
|
1284
1290
|
return;
|
|
@@ -1293,7 +1299,10 @@ function drawShape(data) {
|
|
|
1293
1299
|
radius,
|
|
1294
1300
|
opacity,
|
|
1295
1301
|
delta,
|
|
1296
|
-
pixelRatio: container.retina.pixelRatio
|
|
1302
|
+
pixelRatio: container.retina.pixelRatio,
|
|
1303
|
+
transformData: {
|
|
1304
|
+
...transformData
|
|
1305
|
+
}
|
|
1297
1306
|
});
|
|
1298
1307
|
}
|
|
1299
1308
|
function drawShapeAfterDraw(data) {
|
|
@@ -1303,7 +1312,8 @@ function drawShapeAfterDraw(data) {
|
|
|
1303
1312
|
particle,
|
|
1304
1313
|
radius,
|
|
1305
1314
|
opacity,
|
|
1306
|
-
delta
|
|
1315
|
+
delta,
|
|
1316
|
+
transformData
|
|
1307
1317
|
} = data;
|
|
1308
1318
|
if (!particle.shape) {
|
|
1309
1319
|
return;
|
|
@@ -1318,7 +1328,10 @@ function drawShapeAfterDraw(data) {
|
|
|
1318
1328
|
radius,
|
|
1319
1329
|
opacity,
|
|
1320
1330
|
delta,
|
|
1321
|
-
pixelRatio: container.retina.pixelRatio
|
|
1331
|
+
pixelRatio: container.retina.pixelRatio,
|
|
1332
|
+
transformData: {
|
|
1333
|
+
...transformData
|
|
1334
|
+
}
|
|
1322
1335
|
});
|
|
1323
1336
|
}
|
|
1324
1337
|
function drawPlugin(context, plugin, delta) {
|
|
@@ -1555,7 +1568,7 @@ class Canvas {
|
|
|
1555
1568
|
} else if (trailFill.image) {
|
|
1556
1569
|
this._paintImage(trailFill.image, trailFill.opacity);
|
|
1557
1570
|
}
|
|
1558
|
-
} else {
|
|
1571
|
+
} else if (options.clear) {
|
|
1559
1572
|
this.draw(ctx => {
|
|
1560
1573
|
clear(ctx, this.size);
|
|
1561
1574
|
});
|
|
@@ -3519,6 +3532,7 @@ class Options {
|
|
|
3519
3532
|
this.autoPlay = true;
|
|
3520
3533
|
this.background = new Background();
|
|
3521
3534
|
this.backgroundMask = new BackgroundMask();
|
|
3535
|
+
this.clear = true;
|
|
3522
3536
|
this.defaultThemes = {};
|
|
3523
3537
|
this.delay = 0;
|
|
3524
3538
|
this.fullScreen = new FullScreen();
|
|
@@ -3546,6 +3560,12 @@ class Options {
|
|
|
3546
3560
|
if (data.autoPlay !== undefined) {
|
|
3547
3561
|
this.autoPlay = data.autoPlay;
|
|
3548
3562
|
}
|
|
3563
|
+
if (data.clear !== undefined) {
|
|
3564
|
+
this.clear = data.clear;
|
|
3565
|
+
}
|
|
3566
|
+
if (data.name !== undefined) {
|
|
3567
|
+
this.name = data.name;
|
|
3568
|
+
}
|
|
3549
3569
|
if (data.delay !== undefined) {
|
|
3550
3570
|
this.delay = setRangeValue(data.delay);
|
|
3551
3571
|
}
|
|
@@ -5127,7 +5147,7 @@ class Engine {
|
|
|
5127
5147
|
return res;
|
|
5128
5148
|
}
|
|
5129
5149
|
get version() {
|
|
5130
|
-
return "3.0.0
|
|
5150
|
+
return "3.0.0";
|
|
5131
5151
|
}
|
|
5132
5152
|
addConfig(config) {
|
|
5133
5153
|
const name = config.name ?? "default";
|
|
@@ -7932,7 +7952,7 @@ class OutOutMode {
|
|
|
7932
7952
|
}
|
|
7933
7953
|
case "normal":
|
|
7934
7954
|
{
|
|
7935
|
-
const
|
|
7955
|
+
const warp = particle.options.move.warp,
|
|
7936
7956
|
canvasSize = container.canvas.size,
|
|
7937
7957
|
newPos = {
|
|
7938
7958
|
bottom: canvasSize.height + particle.getRadius() + particle.offset.y,
|
|
@@ -7945,27 +7965,27 @@ class OutOutMode {
|
|
|
7945
7965
|
if (direction === "right" && nextBounds.left > canvasSize.width + particle.offset.x) {
|
|
7946
7966
|
particle.position.x = newPos.left;
|
|
7947
7967
|
particle.initialPosition.x = particle.position.x;
|
|
7948
|
-
if (!
|
|
7968
|
+
if (!warp) {
|
|
7949
7969
|
particle.position.y = getRandom() * canvasSize.height;
|
|
7950
7970
|
particle.initialPosition.y = particle.position.y;
|
|
7951
7971
|
}
|
|
7952
7972
|
} else if (direction === "left" && nextBounds.right < -particle.offset.x) {
|
|
7953
7973
|
particle.position.x = newPos.right;
|
|
7954
7974
|
particle.initialPosition.x = particle.position.x;
|
|
7955
|
-
if (!
|
|
7975
|
+
if (!warp) {
|
|
7956
7976
|
particle.position.y = getRandom() * canvasSize.height;
|
|
7957
7977
|
particle.initialPosition.y = particle.position.y;
|
|
7958
7978
|
}
|
|
7959
7979
|
}
|
|
7960
7980
|
if (direction === "bottom" && nextBounds.top > canvasSize.height + particle.offset.y) {
|
|
7961
|
-
if (!
|
|
7981
|
+
if (!warp) {
|
|
7962
7982
|
particle.position.x = getRandom() * canvasSize.width;
|
|
7963
7983
|
particle.initialPosition.x = particle.position.x;
|
|
7964
7984
|
}
|
|
7965
7985
|
particle.position.y = newPos.top;
|
|
7966
7986
|
particle.initialPosition.y = particle.position.y;
|
|
7967
7987
|
} else if (direction === "top" && nextBounds.bottom < -particle.offset.y) {
|
|
7968
|
-
if (!
|
|
7988
|
+
if (!warp) {
|
|
7969
7989
|
particle.position.x = getRandom() * canvasSize.width;
|
|
7970
7990
|
particle.initialPosition.x = particle.position.x;
|
|
7971
7991
|
}
|
|
@@ -8143,7 +8163,7 @@ class EmojiDrawer {
|
|
|
8143
8163
|
}
|
|
8144
8164
|
destroy() {
|
|
8145
8165
|
for (const [, emojiData] of this._emojiShapeDict) {
|
|
8146
|
-
emojiData?.close();
|
|
8166
|
+
emojiData instanceof ImageBitmap && emojiData?.close();
|
|
8147
8167
|
}
|
|
8148
8168
|
}
|
|
8149
8169
|
draw(data) {
|
|
@@ -8194,17 +8214,33 @@ class EmojiDrawer {
|
|
|
8194
8214
|
particle.emojiData = existingData;
|
|
8195
8215
|
return;
|
|
8196
8216
|
}
|
|
8197
|
-
const canvasSize = getRangeMax(particle.size.value) * 2
|
|
8198
|
-
|
|
8199
|
-
|
|
8200
|
-
|
|
8201
|
-
|
|
8217
|
+
const canvasSize = getRangeMax(particle.size.value) * 2;
|
|
8218
|
+
let emojiData;
|
|
8219
|
+
if (typeof OffscreenCanvas !== "undefined") {
|
|
8220
|
+
const canvas = new OffscreenCanvas(canvasSize, canvasSize),
|
|
8221
|
+
context = canvas.getContext("2d");
|
|
8222
|
+
if (!context) {
|
|
8223
|
+
return;
|
|
8224
|
+
}
|
|
8225
|
+
context.font = `400 ${getRangeMax(particle.size.value) * 2}px ${font}`;
|
|
8226
|
+
context.textBaseline = "middle";
|
|
8227
|
+
context.textAlign = "center";
|
|
8228
|
+
context.fillText(emoji, getRangeMax(particle.size.value), getRangeMax(particle.size.value));
|
|
8229
|
+
emojiData = canvas.transferToImageBitmap();
|
|
8230
|
+
} else {
|
|
8231
|
+
const canvas = document.createElement("canvas");
|
|
8232
|
+
canvas.width = canvasSize;
|
|
8233
|
+
canvas.height = canvasSize;
|
|
8234
|
+
const context = canvas.getContext("2d");
|
|
8235
|
+
if (!context) {
|
|
8236
|
+
return;
|
|
8237
|
+
}
|
|
8238
|
+
context.font = `400 ${getRangeMax(particle.size.value) * 2}px ${font}`;
|
|
8239
|
+
context.textBaseline = "middle";
|
|
8240
|
+
context.textAlign = "center";
|
|
8241
|
+
context.fillText(emoji, getRangeMax(particle.size.value), getRangeMax(particle.size.value));
|
|
8242
|
+
emojiData = canvas;
|
|
8202
8243
|
}
|
|
8203
|
-
context.font = `400 ${getRangeMax(particle.size.value) * 2}px ${font}`;
|
|
8204
|
-
context.textBaseline = "middle";
|
|
8205
|
-
context.textAlign = "center";
|
|
8206
|
-
context.fillText(emoji, getRangeMax(particle.size.value), getRangeMax(particle.size.value));
|
|
8207
|
-
const emojiData = canvas.transferToImageBitmap();
|
|
8208
8244
|
this._emojiShapeDict.set(key, emojiData);
|
|
8209
8245
|
particle.emojiData = emojiData;
|
|
8210
8246
|
}
|