@tsparticles/confetti 4.1.2 → 4.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/browser/ConfettiOptions.js +12 -34
- package/browser/confetti.js +2 -2
- package/browser/confetti.lazy.js +2 -2
- package/browser/utils.js +3 -3
- package/cjs/ConfettiOptions.js +12 -34
- package/cjs/confetti.js +2 -2
- package/cjs/confetti.lazy.js +2 -2
- package/cjs/utils.js +3 -3
- package/esm/ConfettiOptions.js +12 -34
- package/esm/confetti.js +2 -2
- package/esm/confetti.lazy.js +2 -2
- package/esm/utils.js +3 -3
- package/package.json +18 -18
- package/report.html +1 -1
- package/tsparticles.confetti.bundle.js +1133 -1894
- package/tsparticles.confetti.bundle.min.js +1 -1
- package/tsparticles.confetti.js +16 -38
- package/tsparticles.confetti.min.js +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
(function(g){g.__tsParticlesInternals=g.__tsParticlesInternals||{};g.__tsParticlesInternals.bundles=g.__tsParticlesInternals.bundles||{};g.__tsParticlesInternals.effects=g.__tsParticlesInternals.effects||{};g.__tsParticlesInternals.engine=g.__tsParticlesInternals.engine||{};g.__tsParticlesInternals.interactions=g.__tsParticlesInternals.interactions||{};g.__tsParticlesInternals.palettes=g.__tsParticlesInternals.palettes||{};g.__tsParticlesInternals.paths=g.__tsParticlesInternals.paths||{};g.__tsParticlesInternals.plugins=g.__tsParticlesInternals.plugins||{};g.__tsParticlesInternals.plugins=g.__tsParticlesInternals.plugins||{};g.__tsParticlesInternals.plugins.emittersShapes=g.__tsParticlesInternals.plugins.emittersShapes||{};g.__tsParticlesInternals.presets=g.__tsParticlesInternals.presets||{};g.__tsParticlesInternals.shapes=g.__tsParticlesInternals.shapes||{};g.__tsParticlesInternals.updaters=g.__tsParticlesInternals.updaters||{};g.__tsParticlesInternals.utils=g.__tsParticlesInternals.utils||{};g.__tsParticlesInternals.canvas=g.__tsParticlesInternals.canvas||{};g.__tsParticlesInternals.canvas=g.__tsParticlesInternals.canvas||{};g.__tsParticlesInternals.canvas.utils=g.__tsParticlesInternals.canvas.utils||{};g.__tsParticlesInternals.path=g.__tsParticlesInternals.path||{};g.__tsParticlesInternals.path=g.__tsParticlesInternals.path||{};g.__tsParticlesInternals.path.utils=g.__tsParticlesInternals.path.utils||{};var __tsProxyFactory=typeof Proxy!=="undefined"?function(obj){return new Proxy(obj,{get:function(target,key){if(!(key in target)){target[key]={};}return target[key];}});}:function(obj){return obj;};g.__tsParticlesInternals.bundles=__tsProxyFactory(g.__tsParticlesInternals.bundles);g.__tsParticlesInternals.effects=__tsProxyFactory(g.__tsParticlesInternals.effects);g.__tsParticlesInternals.interactions=__tsProxyFactory(g.__tsParticlesInternals.interactions);g.__tsParticlesInternals.palettes=__tsProxyFactory(g.__tsParticlesInternals.palettes);g.__tsParticlesInternals.paths=__tsProxyFactory(g.__tsParticlesInternals.paths);g.__tsParticlesInternals.plugins=__tsProxyFactory(g.__tsParticlesInternals.plugins);g.__tsParticlesInternals.plugins.emittersShapes=__tsProxyFactory(g.__tsParticlesInternals.plugins.emittersShapes);g.__tsParticlesInternals.presets=__tsProxyFactory(g.__tsParticlesInternals.presets);g.__tsParticlesInternals.shapes=__tsProxyFactory(g.__tsParticlesInternals.shapes);g.__tsParticlesInternals.updaters=__tsProxyFactory(g.__tsParticlesInternals.updaters);g.__tsParticlesInternals.utils=__tsProxyFactory(g.__tsParticlesInternals.utils);g.__tsParticlesInternals.canvas=__tsProxyFactory(g.__tsParticlesInternals.canvas);g.__tsParticlesInternals.path=__tsProxyFactory(g.__tsParticlesInternals.path);g.tsparticlesInternalExports=g.tsparticlesInternalExports||{};})(typeof globalThis!=="undefined"?globalThis:typeof window!=="undefined"?window:this);
|
|
2
|
-
/* tsParticles v4.
|
|
2
|
+
/* tsParticles v4.2.0 */
|
|
3
3
|
(function (global, factory) {
|
|
4
4
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
5
5
|
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
b: 0,
|
|
16
16
|
c: 0,
|
|
17
17
|
d: 1,
|
|
18
|
-
}, randomColorValue = "random", midColorValue = "mid", double = 2, doublePI = Math.PI * double, defaultFps = 60, defaultAlpha$1 = 1, generatedTrue = "true", generatedFalse = "false", canvasTag = "canvas", defaultRetryCount = 0, squareExp = 2, spatialHashGridCellSize = 100, defaultRemoveQuantity = 1, defaultRatio = 1, defaultReduceFactor = 1, inverseFactorNumerator = 1, rgbMax = 255, hMax = 360, sMax = 100, lMax = 100, hMin = 0, sMin = 0, hPhase = 60, empty = 0, quarter = 0.25, threeQuarter = half + quarter, minVelocity$
|
|
18
|
+
}, randomColorValue = "random", midColorValue = "mid", double = 2, doublePI = Math.PI * double, defaultFps = 60, defaultAlpha$1 = 1, generatedTrue = "true", generatedFalse = "false", canvasTag = "canvas", defaultRetryCount = 0, squareExp = 2, spatialHashGridCellSize = 100, defaultRemoveQuantity = 1, defaultRatio = 1, defaultReduceFactor = 1, inverseFactorNumerator = 1, rgbMax = 255, hMax = 360, sMax = 100, lMax = 100, hMin = 0, sMin = 0, hPhase = 60, empty = 0, quarter = 0.25, threeQuarter = half + quarter, minVelocity = 0, minDistance = 0, minRadius$1 = 0, defaultTransformValue = 1, minimumSize = 0, zIndexFactorOffset = 1, defaultOpacity$2 = 1, removeDeleteCount = 1, removeMinIndex = 0, defaultFpsLimit = 120, minFpsLimit = 0, canvasFirstIndex = 0, loadRandomFactor = 10000, loadMinIndex = 0, one = 1, none = 0, decayOffset$1 = 1, tryCountIncrement = 1, minZ = 0, minLimit = 0, countOffset = 1, minCount = 0, minIndex = 0, lengthOffset = 1, defaultDensityFactor = 1, deleteCount = 1, defaultAngle = 0, identity$2 = 1, minStrokeWidth = 0, lFactor = 1, lMin = 0, maxNits = 400, triple = 3, sextuple = 6, sNormalizedOffset = 1, phaseNumerator = 1, defaultRgbMin = 0, defaultVelocity = 0, defaultLoops = 0, defaultTime = 0, defaultZoom = 1;
|
|
19
19
|
|
|
20
20
|
exports.MoveDirection = void 0;
|
|
21
21
|
(function (MoveDirection) {
|
|
@@ -82,11 +82,6 @@
|
|
|
82
82
|
div(n) {
|
|
83
83
|
return Vector3d.create(this.x / n, this.y / n, this.z / n);
|
|
84
84
|
}
|
|
85
|
-
divTo(n) {
|
|
86
|
-
this.x /= n;
|
|
87
|
-
this.y /= n;
|
|
88
|
-
this.z /= n;
|
|
89
|
-
}
|
|
90
85
|
getLengthSq() {
|
|
91
86
|
return this.x ** squareExp + this.y ** squareExp;
|
|
92
87
|
}
|
|
@@ -176,6 +171,9 @@
|
|
|
176
171
|
function setRandom(rnd = Math.random) {
|
|
177
172
|
_random = rnd;
|
|
178
173
|
}
|
|
174
|
+
function getRandomFn() {
|
|
175
|
+
return _random;
|
|
176
|
+
}
|
|
179
177
|
function getRandom() {
|
|
180
178
|
const min = 0, max = 1;
|
|
181
179
|
return clamp(_random(), min, max - Number.EPSILON);
|
|
@@ -311,13 +309,6 @@
|
|
|
311
309
|
y: position?.y ?? getRandom() * size.height,
|
|
312
310
|
};
|
|
313
311
|
}
|
|
314
|
-
function calcExactPositionOrRandomFromSizeRanged(data) {
|
|
315
|
-
const position = {
|
|
316
|
-
x: data.position?.x !== undefined ? getRangeValue(data.position.x) : undefined,
|
|
317
|
-
y: data.position?.y !== undefined ? getRangeValue(data.position.y) : undefined,
|
|
318
|
-
};
|
|
319
|
-
return calcExactPositionOrRandomFromSize({ size: data.size, position });
|
|
320
|
-
}
|
|
321
312
|
function parseAlpha(input) {
|
|
322
313
|
const defaultAlpha = 1;
|
|
323
314
|
if (!input) {
|
|
@@ -326,27 +317,6 @@
|
|
|
326
317
|
return input.endsWith("%") ? parseFloat(input) / percentDenominator : parseFloat(input);
|
|
327
318
|
}
|
|
328
319
|
|
|
329
|
-
exports.AnimationMode = void 0;
|
|
330
|
-
(function (AnimationMode) {
|
|
331
|
-
AnimationMode["auto"] = "auto";
|
|
332
|
-
AnimationMode["increase"] = "increase";
|
|
333
|
-
AnimationMode["decrease"] = "decrease";
|
|
334
|
-
AnimationMode["random"] = "random";
|
|
335
|
-
})(exports.AnimationMode || (exports.AnimationMode = {}));
|
|
336
|
-
|
|
337
|
-
exports.AnimationStatus = void 0;
|
|
338
|
-
(function (AnimationStatus) {
|
|
339
|
-
AnimationStatus["increasing"] = "increasing";
|
|
340
|
-
AnimationStatus["decreasing"] = "decreasing";
|
|
341
|
-
})(exports.AnimationStatus || (exports.AnimationStatus = {}));
|
|
342
|
-
|
|
343
|
-
exports.DestroyType = void 0;
|
|
344
|
-
(function (DestroyType) {
|
|
345
|
-
DestroyType["none"] = "none";
|
|
346
|
-
DestroyType["max"] = "max";
|
|
347
|
-
DestroyType["min"] = "min";
|
|
348
|
-
})(exports.DestroyType || (exports.DestroyType = {}));
|
|
349
|
-
|
|
350
320
|
exports.OutModeDirection = void 0;
|
|
351
321
|
(function (OutModeDirection) {
|
|
352
322
|
OutModeDirection["bottom"] = "bottom";
|
|
@@ -361,80 +331,7 @@
|
|
|
361
331
|
PixelMode["percent"] = "percent";
|
|
362
332
|
})(exports.PixelMode || (exports.PixelMode = {}));
|
|
363
333
|
|
|
364
|
-
|
|
365
|
-
(function (StartValueType) {
|
|
366
|
-
StartValueType["max"] = "max";
|
|
367
|
-
StartValueType["min"] = "min";
|
|
368
|
-
StartValueType["random"] = "random";
|
|
369
|
-
})(exports.StartValueType || (exports.StartValueType = {}));
|
|
370
|
-
|
|
371
|
-
const minRadius = 0, minMemoizeSize = 0;
|
|
372
|
-
function memoize(fn, options) {
|
|
373
|
-
const cache = new Map(), maxSize = options?.maxSize, ttlMs = options?.ttlMs, keyFn = options?.keyFn, stableStringify = (obj, seen = new WeakSet()) => {
|
|
374
|
-
if (obj === null) {
|
|
375
|
-
return "null";
|
|
376
|
-
}
|
|
377
|
-
const t = typeof obj;
|
|
378
|
-
if (t === "undefined") {
|
|
379
|
-
return "undefined";
|
|
380
|
-
}
|
|
381
|
-
if (t === "number" || t === "boolean" || t === "string") {
|
|
382
|
-
return JSON.stringify(obj);
|
|
383
|
-
}
|
|
384
|
-
if (t === "function") {
|
|
385
|
-
try {
|
|
386
|
-
const fn = obj;
|
|
387
|
-
return fn.toString();
|
|
388
|
-
}
|
|
389
|
-
catch {
|
|
390
|
-
return '"[Function]"';
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
if (t === "symbol") {
|
|
394
|
-
try {
|
|
395
|
-
return obj.toString();
|
|
396
|
-
}
|
|
397
|
-
catch {
|
|
398
|
-
return '"[Symbol]"';
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
if (Array.isArray(obj)) {
|
|
402
|
-
return `[${obj.map(i => stableStringify(i, seen)).join(",")}]`;
|
|
403
|
-
}
|
|
404
|
-
if (seen.has(obj)) {
|
|
405
|
-
return '"[Circular]"';
|
|
406
|
-
}
|
|
407
|
-
seen.add(obj);
|
|
408
|
-
const keys = Object.keys(obj).sort();
|
|
409
|
-
return `{${keys.map(k => `${JSON.stringify(k)}:${stableStringify(obj[k], seen)}`).join(",")}}`;
|
|
410
|
-
}, defaultKeyer = (args) => stableStringify(args), makeKey = (args) => (keyFn ? keyFn(args) : defaultKeyer(args)), ensureBounds = () => {
|
|
411
|
-
if (typeof maxSize === "number" && maxSize >= minMemoizeSize) {
|
|
412
|
-
while (cache.size > maxSize) {
|
|
413
|
-
const firstKey = cache.keys().next().value;
|
|
414
|
-
if (firstKey === undefined)
|
|
415
|
-
break;
|
|
416
|
-
cache.delete(firstKey);
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
};
|
|
420
|
-
return (...args) => {
|
|
421
|
-
const key = makeKey(args), now = Date.now(), entry = cache.get(key);
|
|
422
|
-
if (entry !== undefined) {
|
|
423
|
-
if (ttlMs && now - entry.ts > ttlMs) {
|
|
424
|
-
cache.delete(key);
|
|
425
|
-
}
|
|
426
|
-
else {
|
|
427
|
-
cache.delete(key);
|
|
428
|
-
cache.set(key, { value: entry.value, ts: entry.ts });
|
|
429
|
-
return entry.value;
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
const result = fn(...args);
|
|
433
|
-
cache.set(key, { value: result, ts: now });
|
|
434
|
-
ensureBounds();
|
|
435
|
-
return result;
|
|
436
|
-
};
|
|
437
|
-
}
|
|
334
|
+
const minRadius = 0;
|
|
438
335
|
function hasMatchMedia() {
|
|
439
336
|
return typeof matchMedia !== "undefined";
|
|
440
337
|
}
|
|
@@ -447,12 +344,6 @@
|
|
|
447
344
|
}
|
|
448
345
|
return matchMedia(query);
|
|
449
346
|
}
|
|
450
|
-
function safeIntersectionObserver(callback) {
|
|
451
|
-
if (typeof IntersectionObserver === "undefined") {
|
|
452
|
-
return;
|
|
453
|
-
}
|
|
454
|
-
return new IntersectionObserver(callback);
|
|
455
|
-
}
|
|
456
347
|
function safeMutationObserver(callback) {
|
|
457
348
|
if (typeof MutationObserver === "undefined") {
|
|
458
349
|
return;
|
|
@@ -462,11 +353,8 @@
|
|
|
462
353
|
function isInArray(value, array) {
|
|
463
354
|
return value === array || (isArray(array) && array.includes(value));
|
|
464
355
|
}
|
|
465
|
-
function arrayRandomIndex(array) {
|
|
466
|
-
return Math.floor(getRandom() * array.length);
|
|
467
|
-
}
|
|
468
356
|
function itemFromArray(array, index, useIndex = true) {
|
|
469
|
-
return array[index !== undefined && useIndex ? index % array.length :
|
|
357
|
+
return array[index !== undefined && useIndex ? index % array.length : Math.floor(getRandom() * array.length)];
|
|
470
358
|
}
|
|
471
359
|
function isPointInside(point, size, offset, radius, direction) {
|
|
472
360
|
return areBoundsInside(calculateBounds(point, radius ?? minRadius), size, offset, direction);
|
|
@@ -570,63 +458,6 @@
|
|
|
570
458
|
function itemFromSingleOrMultiple(obj, index, useIndex) {
|
|
571
459
|
return isArray(obj) ? itemFromArray(obj, index, useIndex) : obj;
|
|
572
460
|
}
|
|
573
|
-
function findItemFromSingleOrMultiple(obj, callback) {
|
|
574
|
-
if (isArray(obj)) {
|
|
575
|
-
return obj.find((t, index) => callback(t, index));
|
|
576
|
-
}
|
|
577
|
-
const defaultIndex = 0;
|
|
578
|
-
return callback(obj, defaultIndex) ? obj : undefined;
|
|
579
|
-
}
|
|
580
|
-
function initParticleNumericAnimationValue(options, pxRatio) {
|
|
581
|
-
const valueRange = options.value, animationOptions = options.animation, res = {
|
|
582
|
-
delayTime: getRangeValue(animationOptions.delay) * millisecondsToSeconds,
|
|
583
|
-
enable: animationOptions.enable,
|
|
584
|
-
value: getRangeValue(options.value) * pxRatio,
|
|
585
|
-
max: getRangeMax(valueRange) * pxRatio,
|
|
586
|
-
min: getRangeMin(valueRange) * pxRatio,
|
|
587
|
-
loops: 0,
|
|
588
|
-
maxLoops: getRangeValue(animationOptions.count),
|
|
589
|
-
time: 0,
|
|
590
|
-
}, decayOffset = 1;
|
|
591
|
-
if (animationOptions.enable) {
|
|
592
|
-
res.decay = decayOffset - getRangeValue(animationOptions.decay);
|
|
593
|
-
switch (animationOptions.mode) {
|
|
594
|
-
case exports.AnimationMode.increase:
|
|
595
|
-
res.status = exports.AnimationStatus.increasing;
|
|
596
|
-
break;
|
|
597
|
-
case exports.AnimationMode.decrease:
|
|
598
|
-
res.status = exports.AnimationStatus.decreasing;
|
|
599
|
-
break;
|
|
600
|
-
case exports.AnimationMode.random:
|
|
601
|
-
res.status = getRandom() >= half ? exports.AnimationStatus.increasing : exports.AnimationStatus.decreasing;
|
|
602
|
-
break;
|
|
603
|
-
}
|
|
604
|
-
const autoStatus = animationOptions.mode === exports.AnimationMode.auto;
|
|
605
|
-
switch (animationOptions.startValue) {
|
|
606
|
-
case exports.StartValueType.min:
|
|
607
|
-
res.value = res.min;
|
|
608
|
-
if (autoStatus) {
|
|
609
|
-
res.status = exports.AnimationStatus.increasing;
|
|
610
|
-
}
|
|
611
|
-
break;
|
|
612
|
-
case exports.StartValueType.max:
|
|
613
|
-
res.value = res.max;
|
|
614
|
-
if (autoStatus) {
|
|
615
|
-
res.status = exports.AnimationStatus.decreasing;
|
|
616
|
-
}
|
|
617
|
-
break;
|
|
618
|
-
case exports.StartValueType.random:
|
|
619
|
-
default:
|
|
620
|
-
res.value = randomInRangeValue(res);
|
|
621
|
-
if (autoStatus) {
|
|
622
|
-
res.status = getRandom() >= half ? exports.AnimationStatus.increasing : exports.AnimationStatus.decreasing;
|
|
623
|
-
}
|
|
624
|
-
break;
|
|
625
|
-
}
|
|
626
|
-
}
|
|
627
|
-
res.initialValue = res.value;
|
|
628
|
-
return res;
|
|
629
|
-
}
|
|
630
461
|
function getPositionOrSize(positionOrSize, canvasSize) {
|
|
631
462
|
const isPercent = positionOrSize.mode === exports.PixelMode.percent;
|
|
632
463
|
if (!isPercent) {
|
|
@@ -650,80 +481,6 @@
|
|
|
650
481
|
function getPosition(position, canvasSize) {
|
|
651
482
|
return getPositionOrSize(position, canvasSize);
|
|
652
483
|
}
|
|
653
|
-
function getSize(size, canvasSize) {
|
|
654
|
-
return getPositionOrSize(size, canvasSize);
|
|
655
|
-
}
|
|
656
|
-
function checkDestroy(particle, destroyType, value, minValue, maxValue) {
|
|
657
|
-
switch (destroyType) {
|
|
658
|
-
case exports.DestroyType.max:
|
|
659
|
-
if (value >= maxValue) {
|
|
660
|
-
particle.destroy();
|
|
661
|
-
}
|
|
662
|
-
break;
|
|
663
|
-
case exports.DestroyType.min:
|
|
664
|
-
if (value <= minValue) {
|
|
665
|
-
particle.destroy();
|
|
666
|
-
}
|
|
667
|
-
break;
|
|
668
|
-
}
|
|
669
|
-
}
|
|
670
|
-
function updateAnimation(particle, data, changeDirection, destroyType, delta) {
|
|
671
|
-
const minLoops = 0, minDelay = 0, identity = 1, minVelocity = 0, minDecay = 1;
|
|
672
|
-
if (particle.destroyed ||
|
|
673
|
-
!data.enable ||
|
|
674
|
-
((data.maxLoops ?? minLoops) > minLoops && (data.loops ?? minLoops) > (data.maxLoops ?? minLoops))) {
|
|
675
|
-
return;
|
|
676
|
-
}
|
|
677
|
-
const velocity = (data.velocity ?? minVelocity) * delta.factor, minValue = data.min, maxValue = data.max, decay = data.decay ?? minDecay;
|
|
678
|
-
data.time ??= 0;
|
|
679
|
-
if ((data.delayTime ?? minDelay) > minDelay && data.time < (data.delayTime ?? minDelay)) {
|
|
680
|
-
data.time += delta.value;
|
|
681
|
-
}
|
|
682
|
-
if ((data.delayTime ?? minDelay) > minDelay && data.time < (data.delayTime ?? minDelay)) {
|
|
683
|
-
return;
|
|
684
|
-
}
|
|
685
|
-
switch (data.status) {
|
|
686
|
-
case exports.AnimationStatus.increasing:
|
|
687
|
-
data.value += velocity;
|
|
688
|
-
break;
|
|
689
|
-
case exports.AnimationStatus.decreasing:
|
|
690
|
-
data.value -= velocity;
|
|
691
|
-
break;
|
|
692
|
-
}
|
|
693
|
-
if (data.velocity && decay !== identity) {
|
|
694
|
-
data.velocity *= decay;
|
|
695
|
-
}
|
|
696
|
-
switch (data.status) {
|
|
697
|
-
case exports.AnimationStatus.increasing:
|
|
698
|
-
if (data.value >= maxValue) {
|
|
699
|
-
if (changeDirection) {
|
|
700
|
-
data.status = exports.AnimationStatus.decreasing;
|
|
701
|
-
}
|
|
702
|
-
else {
|
|
703
|
-
data.value -= maxValue;
|
|
704
|
-
}
|
|
705
|
-
data.loops ??= minLoops;
|
|
706
|
-
data.loops++;
|
|
707
|
-
}
|
|
708
|
-
break;
|
|
709
|
-
case exports.AnimationStatus.decreasing:
|
|
710
|
-
if (data.value <= minValue) {
|
|
711
|
-
if (changeDirection) {
|
|
712
|
-
data.status = exports.AnimationStatus.increasing;
|
|
713
|
-
}
|
|
714
|
-
else {
|
|
715
|
-
data.value += maxValue;
|
|
716
|
-
}
|
|
717
|
-
data.loops ??= minLoops;
|
|
718
|
-
data.loops++;
|
|
719
|
-
}
|
|
720
|
-
break;
|
|
721
|
-
}
|
|
722
|
-
checkDestroy(particle, destroyType, data.value, minValue, maxValue);
|
|
723
|
-
if (!particle.destroyed) {
|
|
724
|
-
data.value = clamp(data.value, minValue, maxValue);
|
|
725
|
-
}
|
|
726
|
-
}
|
|
727
484
|
function cloneStyle(style) {
|
|
728
485
|
const clonedStyle = safeDocument().createElement("div").style;
|
|
729
486
|
for (const key in style) {
|
|
@@ -745,30 +502,34 @@
|
|
|
745
502
|
}
|
|
746
503
|
return clonedStyle;
|
|
747
504
|
}
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
505
|
+
let _cachedZIndex, _cachedStyle;
|
|
506
|
+
function getFullScreenStyle(zIndex) {
|
|
507
|
+
if (_cachedZIndex !== zIndex || !_cachedStyle) {
|
|
508
|
+
_cachedZIndex = zIndex;
|
|
509
|
+
const fullScreenStyle = safeDocument().createElement("div").style, radix = 10, style = {
|
|
510
|
+
width: "100%",
|
|
511
|
+
height: "100%",
|
|
512
|
+
margin: "0",
|
|
513
|
+
padding: "0",
|
|
514
|
+
borderWidth: "0",
|
|
515
|
+
position: "fixed",
|
|
516
|
+
zIndex: zIndex.toString(radix),
|
|
517
|
+
"z-index": zIndex.toString(radix),
|
|
518
|
+
top: "0",
|
|
519
|
+
left: "0",
|
|
520
|
+
"pointer-events": "none",
|
|
521
|
+
};
|
|
522
|
+
for (const key in style) {
|
|
523
|
+
const value = style[key];
|
|
524
|
+
if (value === undefined) {
|
|
525
|
+
continue;
|
|
526
|
+
}
|
|
527
|
+
fullScreenStyle.setProperty(key, value);
|
|
766
528
|
}
|
|
767
|
-
fullScreenStyle
|
|
529
|
+
_cachedStyle = fullScreenStyle;
|
|
768
530
|
}
|
|
769
|
-
return
|
|
531
|
+
return _cachedStyle;
|
|
770
532
|
}
|
|
771
|
-
const getFullScreenStyle = memoize(computeFullScreenStyle);
|
|
772
533
|
function manageListener(element, event, handler, add, options) {
|
|
773
534
|
if (add) {
|
|
774
535
|
let addOptions = { passive: true };
|
|
@@ -1118,7 +879,7 @@
|
|
|
1118
879
|
return this.#domArray;
|
|
1119
880
|
}
|
|
1120
881
|
get version() {
|
|
1121
|
-
return "4.
|
|
882
|
+
return "4.2.0";
|
|
1122
883
|
}
|
|
1123
884
|
addEventListener(type, listener) {
|
|
1124
885
|
this.#eventDispatcher.addEventListener(type, listener);
|
|
@@ -1288,6 +1049,14 @@
|
|
|
1288
1049
|
RotateDirection["random"] = "random";
|
|
1289
1050
|
})(exports.RotateDirection || (exports.RotateDirection = {}));
|
|
1290
1051
|
|
|
1052
|
+
exports.AnimationMode = void 0;
|
|
1053
|
+
(function (AnimationMode) {
|
|
1054
|
+
AnimationMode["auto"] = "auto";
|
|
1055
|
+
AnimationMode["increase"] = "increase";
|
|
1056
|
+
AnimationMode["decrease"] = "decrease";
|
|
1057
|
+
AnimationMode["random"] = "random";
|
|
1058
|
+
})(exports.AnimationMode || (exports.AnimationMode = {}));
|
|
1059
|
+
|
|
1291
1060
|
exports.LimitMode = void 0;
|
|
1292
1061
|
(function (LimitMode) {
|
|
1293
1062
|
LimitMode["delete"] = "delete";
|
|
@@ -1309,6 +1078,13 @@
|
|
|
1309
1078
|
AlterType["enlighten"] = "enlighten";
|
|
1310
1079
|
})(exports.AlterType || (exports.AlterType = {}));
|
|
1311
1080
|
|
|
1081
|
+
exports.DestroyType = void 0;
|
|
1082
|
+
(function (DestroyType) {
|
|
1083
|
+
DestroyType["none"] = "none";
|
|
1084
|
+
DestroyType["max"] = "max";
|
|
1085
|
+
DestroyType["min"] = "min";
|
|
1086
|
+
})(exports.DestroyType || (exports.DestroyType = {}));
|
|
1087
|
+
|
|
1312
1088
|
exports.GradientType = void 0;
|
|
1313
1089
|
(function (GradientType) {
|
|
1314
1090
|
GradientType["linear"] = "linear";
|
|
@@ -1323,160 +1099,126 @@
|
|
|
1323
1099
|
ParticleOutType["outside"] = "outside";
|
|
1324
1100
|
})(exports.ParticleOutType || (exports.ParticleOutType = {}));
|
|
1325
1101
|
|
|
1326
|
-
exports.
|
|
1327
|
-
(function (
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
EasingType["easeInSine"] = "ease-in-sine";
|
|
1341
|
-
EasingType["easeInSmoothstep"] = "ease-in-smoothstep";
|
|
1342
|
-
EasingType["easeOutBack"] = "ease-out-back";
|
|
1343
|
-
EasingType["easeOutBounce"] = "ease-out-bounce";
|
|
1344
|
-
EasingType["easeOutCirc"] = "ease-out-circ";
|
|
1345
|
-
EasingType["easeOutCubic"] = "ease-out-cubic";
|
|
1346
|
-
EasingType["easeOutElastic"] = "ease-out-elastic";
|
|
1347
|
-
EasingType["easeOutExpo"] = "ease-out-expo";
|
|
1348
|
-
EasingType["easeOutGaussian"] = "ease-out-gaussian";
|
|
1349
|
-
EasingType["easeOutLinear"] = "ease-out-linear";
|
|
1350
|
-
EasingType["easeOutQuad"] = "ease-out-quad";
|
|
1351
|
-
EasingType["easeOutQuart"] = "ease-out-quart";
|
|
1352
|
-
EasingType["easeOutQuint"] = "ease-out-quint";
|
|
1353
|
-
EasingType["easeOutSigmoid"] = "ease-out-sigmoid";
|
|
1354
|
-
EasingType["easeOutSine"] = "ease-out-sine";
|
|
1355
|
-
EasingType["easeOutSmoothstep"] = "ease-out-smoothstep";
|
|
1356
|
-
EasingType["easeInOutBack"] = "ease-in-out-back";
|
|
1357
|
-
EasingType["easeInOutBounce"] = "ease-in-out-bounce";
|
|
1358
|
-
EasingType["easeInOutCirc"] = "ease-in-out-circ";
|
|
1359
|
-
EasingType["easeInOutCubic"] = "ease-in-out-cubic";
|
|
1360
|
-
EasingType["easeInOutElastic"] = "ease-in-out-elastic";
|
|
1361
|
-
EasingType["easeInOutExpo"] = "ease-in-out-expo";
|
|
1362
|
-
EasingType["easeInOutGaussian"] = "ease-in-out-gaussian";
|
|
1363
|
-
EasingType["easeInOutLinear"] = "ease-in-out-linear";
|
|
1364
|
-
EasingType["easeInOutQuad"] = "ease-in-out-quad";
|
|
1365
|
-
EasingType["easeInOutQuart"] = "ease-in-out-quart";
|
|
1366
|
-
EasingType["easeInOutQuint"] = "ease-in-out-quint";
|
|
1367
|
-
EasingType["easeInOutSigmoid"] = "ease-in-out-sigmoid";
|
|
1368
|
-
EasingType["easeInOutSine"] = "ease-in-out-sine";
|
|
1369
|
-
EasingType["easeInOutSmoothstep"] = "ease-in-out-smoothstep";
|
|
1370
|
-
})(exports.EasingType || (exports.EasingType = {}));
|
|
1371
|
-
|
|
1372
|
-
class AnimationOptions {
|
|
1373
|
-
count;
|
|
1374
|
-
decay;
|
|
1375
|
-
delay;
|
|
1376
|
-
enable;
|
|
1377
|
-
speed;
|
|
1378
|
-
sync;
|
|
1379
|
-
constructor() {
|
|
1380
|
-
this.count = 0;
|
|
1381
|
-
this.enable = false;
|
|
1382
|
-
this.speed = 1;
|
|
1383
|
-
this.decay = 0;
|
|
1384
|
-
this.delay = 0;
|
|
1385
|
-
this.sync = false;
|
|
1386
|
-
}
|
|
1102
|
+
exports.StartValueType = void 0;
|
|
1103
|
+
(function (StartValueType) {
|
|
1104
|
+
StartValueType["max"] = "max";
|
|
1105
|
+
StartValueType["min"] = "min";
|
|
1106
|
+
StartValueType["random"] = "random";
|
|
1107
|
+
})(exports.StartValueType || (exports.StartValueType = {}));
|
|
1108
|
+
|
|
1109
|
+
exports.AnimationStatus = void 0;
|
|
1110
|
+
(function (AnimationStatus) {
|
|
1111
|
+
AnimationStatus["increasing"] = "increasing";
|
|
1112
|
+
AnimationStatus["decreasing"] = "decreasing";
|
|
1113
|
+
})(exports.AnimationStatus || (exports.AnimationStatus = {}));
|
|
1114
|
+
|
|
1115
|
+
class OptionLoader {
|
|
1387
1116
|
load(data) {
|
|
1388
1117
|
if (isNull(data)) {
|
|
1389
1118
|
return;
|
|
1390
1119
|
}
|
|
1391
|
-
|
|
1392
|
-
this.count = setRangeValue(data.count);
|
|
1393
|
-
}
|
|
1394
|
-
if (data.enable !== undefined) {
|
|
1395
|
-
this.enable = data.enable;
|
|
1396
|
-
}
|
|
1397
|
-
if (data.speed !== undefined) {
|
|
1398
|
-
this.speed = setRangeValue(data.speed);
|
|
1399
|
-
}
|
|
1400
|
-
if (data.decay !== undefined) {
|
|
1401
|
-
this.decay = setRangeValue(data.decay);
|
|
1402
|
-
}
|
|
1403
|
-
if (data.delay !== undefined) {
|
|
1404
|
-
this.delay = setRangeValue(data.delay);
|
|
1405
|
-
}
|
|
1406
|
-
if (data.sync !== undefined) {
|
|
1407
|
-
this.sync = data.sync;
|
|
1408
|
-
}
|
|
1120
|
+
this.doLoad(data);
|
|
1409
1121
|
}
|
|
1410
1122
|
}
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
constructor() {
|
|
1415
|
-
super();
|
|
1416
|
-
this.mode = exports.AnimationMode.auto;
|
|
1417
|
-
this.startValue = exports.StartValueType.random;
|
|
1418
|
-
}
|
|
1419
|
-
load(data) {
|
|
1420
|
-
super.load(data);
|
|
1421
|
-
if (isNull(data)) {
|
|
1422
|
-
return;
|
|
1423
|
-
}
|
|
1424
|
-
if (data.mode !== undefined) {
|
|
1425
|
-
this.mode = data.mode;
|
|
1426
|
-
}
|
|
1427
|
-
if (data.startValue !== undefined) {
|
|
1428
|
-
this.startValue = data.startValue;
|
|
1429
|
-
}
|
|
1123
|
+
function loadOptions(options, ...sourceOptionsArr) {
|
|
1124
|
+
for (const sourceOptions of sourceOptionsArr) {
|
|
1125
|
+
options.load(sourceOptions);
|
|
1430
1126
|
}
|
|
1431
1127
|
}
|
|
1432
1128
|
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
offset;
|
|
1437
|
-
constructor(min, max) {
|
|
1438
|
-
super();
|
|
1439
|
-
this.min = min;
|
|
1440
|
-
this.max = max;
|
|
1441
|
-
this.offset = 0;
|
|
1442
|
-
this.sync = true;
|
|
1129
|
+
function loadProperty(obj, key, value) {
|
|
1130
|
+
if (value !== undefined) {
|
|
1131
|
+
obj[key] = value;
|
|
1443
1132
|
}
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1133
|
+
}
|
|
1134
|
+
function loadRangeProperty(obj, key, value) {
|
|
1135
|
+
if (value !== undefined) {
|
|
1136
|
+
obj[key] = setRangeValue(value);
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
function loadNestedProperty(obj, key, value) {
|
|
1140
|
+
if (value !== undefined) {
|
|
1141
|
+
obj[key].load(value);
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
1144
|
+
function loadLazyProperty(obj, key, value, factory) {
|
|
1145
|
+
if (value !== undefined) {
|
|
1146
|
+
const objRecord = obj;
|
|
1147
|
+
objRecord[key] ??= factory();
|
|
1148
|
+
objRecord[key].load(value);
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1151
|
+
function loadExtendProperty(obj, key, value) {
|
|
1152
|
+
if (value !== undefined) {
|
|
1153
|
+
obj[key] = deepExtend(obj[key] ?? {}, value);
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
function loadOptionProperty(obj, key, optionClass, ...sources) {
|
|
1157
|
+
const objRecord = obj;
|
|
1158
|
+
objRecord[key] ??= new optionClass();
|
|
1159
|
+
const target = objRecord[key];
|
|
1160
|
+
for (const source of sources) {
|
|
1161
|
+
target.load(source?.[key]);
|
|
1162
|
+
}
|
|
1163
|
+
}
|
|
1164
|
+
|
|
1165
|
+
class AnimationOptions extends OptionLoader {
|
|
1166
|
+
count = 0;
|
|
1167
|
+
decay = 0;
|
|
1168
|
+
delay = 0;
|
|
1169
|
+
enable = false;
|
|
1170
|
+
speed = 1;
|
|
1171
|
+
sync = false;
|
|
1172
|
+
doLoad(data) {
|
|
1173
|
+
loadRangeProperty(this, "count", data.count);
|
|
1174
|
+
loadProperty(this, "enable", data.enable);
|
|
1175
|
+
loadRangeProperty(this, "speed", data.speed);
|
|
1176
|
+
loadRangeProperty(this, "decay", data.decay);
|
|
1177
|
+
loadRangeProperty(this, "delay", data.delay);
|
|
1178
|
+
loadProperty(this, "sync", data.sync);
|
|
1179
|
+
}
|
|
1180
|
+
}
|
|
1181
|
+
class RangedAnimationOptions extends AnimationOptions {
|
|
1182
|
+
mode = exports.AnimationMode.auto;
|
|
1183
|
+
startValue = exports.StartValueType.random;
|
|
1184
|
+
doLoad(data) {
|
|
1185
|
+
super.doLoad(data);
|
|
1186
|
+
loadProperty(this, "mode", data.mode);
|
|
1187
|
+
loadProperty(this, "startValue", data.startValue);
|
|
1458
1188
|
}
|
|
1459
1189
|
}
|
|
1460
1190
|
|
|
1461
|
-
class
|
|
1191
|
+
class ColorAnimation extends AnimationOptions {
|
|
1192
|
+
max;
|
|
1193
|
+
min;
|
|
1194
|
+
offset = 0;
|
|
1195
|
+
sync = true;
|
|
1196
|
+
constructor(min, max) {
|
|
1197
|
+
super();
|
|
1198
|
+
this.min = min;
|
|
1199
|
+
this.max = max;
|
|
1200
|
+
}
|
|
1201
|
+
doLoad(data) {
|
|
1202
|
+
super.doLoad(data);
|
|
1203
|
+
loadProperty(this, "max", data.max);
|
|
1204
|
+
loadProperty(this, "min", data.min);
|
|
1205
|
+
loadRangeProperty(this, "offset", data.offset);
|
|
1206
|
+
}
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
class HslAnimation extends OptionLoader {
|
|
1462
1210
|
h = new ColorAnimation(hMin, hMax);
|
|
1463
1211
|
l = new ColorAnimation(lMin, lMax);
|
|
1464
1212
|
s = new ColorAnimation(sMin, sMax);
|
|
1465
|
-
|
|
1466
|
-
if (isNull(data)) {
|
|
1467
|
-
return;
|
|
1468
|
-
}
|
|
1213
|
+
doLoad(data) {
|
|
1469
1214
|
this.h.load(data.h);
|
|
1470
1215
|
this.s.load(data.s);
|
|
1471
1216
|
this.l.load(data.l);
|
|
1472
1217
|
}
|
|
1473
1218
|
}
|
|
1474
1219
|
|
|
1475
|
-
class OptionsColor {
|
|
1476
|
-
value;
|
|
1477
|
-
constructor() {
|
|
1478
|
-
this.value = "";
|
|
1479
|
-
}
|
|
1220
|
+
class OptionsColor extends OptionLoader {
|
|
1221
|
+
value = "";
|
|
1480
1222
|
static create(source, data) {
|
|
1481
1223
|
const color = new OptionsColor();
|
|
1482
1224
|
color.load(source);
|
|
@@ -1490,10 +1232,7 @@
|
|
|
1490
1232
|
}
|
|
1491
1233
|
return color;
|
|
1492
1234
|
}
|
|
1493
|
-
|
|
1494
|
-
if (isNull(data)) {
|
|
1495
|
-
return;
|
|
1496
|
-
}
|
|
1235
|
+
doLoad(data) {
|
|
1497
1236
|
if (!isNull(data.value)) {
|
|
1498
1237
|
this.value = data.value;
|
|
1499
1238
|
}
|
|
@@ -1501,11 +1240,7 @@
|
|
|
1501
1240
|
}
|
|
1502
1241
|
|
|
1503
1242
|
class AnimatableColor extends OptionsColor {
|
|
1504
|
-
animation;
|
|
1505
|
-
constructor() {
|
|
1506
|
-
super();
|
|
1507
|
-
this.animation = new HslAnimation();
|
|
1508
|
-
}
|
|
1243
|
+
animation = new HslAnimation();
|
|
1509
1244
|
static create(source, data) {
|
|
1510
1245
|
const color = new AnimatableColor();
|
|
1511
1246
|
color.load(source);
|
|
@@ -1519,11 +1254,8 @@
|
|
|
1519
1254
|
}
|
|
1520
1255
|
return color;
|
|
1521
1256
|
}
|
|
1522
|
-
|
|
1523
|
-
super.
|
|
1524
|
-
if (isNull(data)) {
|
|
1525
|
-
return;
|
|
1526
|
-
}
|
|
1257
|
+
doLoad(data) {
|
|
1258
|
+
super.doLoad(data);
|
|
1527
1259
|
const colorAnimation = data.animation;
|
|
1528
1260
|
if (colorAnimation !== undefined) {
|
|
1529
1261
|
if (colorAnimation.enable === undefined) {
|
|
@@ -1536,100 +1268,53 @@
|
|
|
1536
1268
|
}
|
|
1537
1269
|
}
|
|
1538
1270
|
|
|
1539
|
-
class Background {
|
|
1271
|
+
class Background extends OptionLoader {
|
|
1540
1272
|
color;
|
|
1541
|
-
image;
|
|
1542
|
-
opacity;
|
|
1543
|
-
position;
|
|
1544
|
-
repeat;
|
|
1545
|
-
size;
|
|
1273
|
+
image = "";
|
|
1274
|
+
opacity = 1;
|
|
1275
|
+
position = "";
|
|
1276
|
+
repeat = "";
|
|
1277
|
+
size = "";
|
|
1546
1278
|
constructor() {
|
|
1279
|
+
super();
|
|
1547
1280
|
this.color = new OptionsColor();
|
|
1548
1281
|
this.color.value = "";
|
|
1549
|
-
this.image = "";
|
|
1550
|
-
this.position = "";
|
|
1551
|
-
this.repeat = "";
|
|
1552
|
-
this.size = "";
|
|
1553
|
-
this.opacity = 1;
|
|
1554
1282
|
}
|
|
1555
|
-
|
|
1556
|
-
if (isNull(data)) {
|
|
1557
|
-
return;
|
|
1558
|
-
}
|
|
1283
|
+
doLoad(data) {
|
|
1559
1284
|
if (data.color !== undefined) {
|
|
1560
1285
|
this.color = OptionsColor.create(this.color, data.color);
|
|
1561
1286
|
}
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
}
|
|
1568
|
-
if (data.repeat !== undefined) {
|
|
1569
|
-
this.repeat = data.repeat;
|
|
1570
|
-
}
|
|
1571
|
-
if (data.size !== undefined) {
|
|
1572
|
-
this.size = data.size;
|
|
1573
|
-
}
|
|
1574
|
-
if (data.opacity !== undefined) {
|
|
1575
|
-
this.opacity = data.opacity;
|
|
1576
|
-
}
|
|
1287
|
+
loadProperty(this, "image", data.image);
|
|
1288
|
+
loadProperty(this, "position", data.position);
|
|
1289
|
+
loadProperty(this, "repeat", data.repeat);
|
|
1290
|
+
loadProperty(this, "size", data.size);
|
|
1291
|
+
loadProperty(this, "opacity", data.opacity);
|
|
1577
1292
|
}
|
|
1578
1293
|
}
|
|
1579
1294
|
|
|
1580
|
-
class FullScreen {
|
|
1581
|
-
enable;
|
|
1582
|
-
zIndex;
|
|
1583
|
-
|
|
1584
|
-
this.enable
|
|
1585
|
-
this.zIndex
|
|
1586
|
-
}
|
|
1587
|
-
load(data) {
|
|
1588
|
-
if (isNull(data)) {
|
|
1589
|
-
return;
|
|
1590
|
-
}
|
|
1591
|
-
if (data.enable !== undefined) {
|
|
1592
|
-
this.enable = data.enable;
|
|
1593
|
-
}
|
|
1594
|
-
if (data.zIndex !== undefined) {
|
|
1595
|
-
this.zIndex = data.zIndex;
|
|
1596
|
-
}
|
|
1295
|
+
class FullScreen extends OptionLoader {
|
|
1296
|
+
enable = true;
|
|
1297
|
+
zIndex = 0;
|
|
1298
|
+
doLoad(data) {
|
|
1299
|
+
loadProperty(this, "enable", data.enable);
|
|
1300
|
+
loadProperty(this, "zIndex", data.zIndex);
|
|
1597
1301
|
}
|
|
1598
1302
|
}
|
|
1599
1303
|
|
|
1600
|
-
class ResizeEvent {
|
|
1601
|
-
delay;
|
|
1602
|
-
enable;
|
|
1603
|
-
|
|
1604
|
-
this
|
|
1605
|
-
this.enable
|
|
1606
|
-
}
|
|
1607
|
-
load(data) {
|
|
1608
|
-
if (isNull(data)) {
|
|
1609
|
-
return;
|
|
1610
|
-
}
|
|
1611
|
-
if (data.delay !== undefined) {
|
|
1612
|
-
this.delay = data.delay;
|
|
1613
|
-
}
|
|
1614
|
-
if (data.enable !== undefined) {
|
|
1615
|
-
this.enable = data.enable;
|
|
1616
|
-
}
|
|
1304
|
+
class ResizeEvent extends OptionLoader {
|
|
1305
|
+
delay = 0.5;
|
|
1306
|
+
enable = true;
|
|
1307
|
+
doLoad(data) {
|
|
1308
|
+
loadProperty(this, "delay", data.delay);
|
|
1309
|
+
loadProperty(this, "enable", data.enable);
|
|
1617
1310
|
}
|
|
1618
1311
|
}
|
|
1619
1312
|
|
|
1620
|
-
class Effect {
|
|
1621
|
-
close;
|
|
1622
|
-
options;
|
|
1623
|
-
type;
|
|
1624
|
-
|
|
1625
|
-
this.close = true;
|
|
1626
|
-
this.options = {};
|
|
1627
|
-
this.type = [];
|
|
1628
|
-
}
|
|
1629
|
-
load(data) {
|
|
1630
|
-
if (isNull(data)) {
|
|
1631
|
-
return;
|
|
1632
|
-
}
|
|
1313
|
+
class Effect extends OptionLoader {
|
|
1314
|
+
close = true;
|
|
1315
|
+
options = {};
|
|
1316
|
+
type = [];
|
|
1317
|
+
doLoad(data) {
|
|
1633
1318
|
const options = data.options;
|
|
1634
1319
|
if (options !== undefined) {
|
|
1635
1320
|
for (const effect in options) {
|
|
@@ -1639,128 +1324,62 @@
|
|
|
1639
1324
|
}
|
|
1640
1325
|
}
|
|
1641
1326
|
}
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
}
|
|
1645
|
-
if (data.type !== undefined) {
|
|
1646
|
-
this.type = data.type;
|
|
1647
|
-
}
|
|
1327
|
+
loadProperty(this, "close", data.close);
|
|
1328
|
+
loadProperty(this, "type", data.type);
|
|
1648
1329
|
}
|
|
1649
1330
|
}
|
|
1650
1331
|
|
|
1651
|
-
class Fill {
|
|
1332
|
+
class Fill extends OptionLoader {
|
|
1652
1333
|
color;
|
|
1653
|
-
enable;
|
|
1654
|
-
opacity;
|
|
1655
|
-
|
|
1656
|
-
this.enable = true;
|
|
1657
|
-
this.opacity = 1;
|
|
1658
|
-
}
|
|
1659
|
-
load(data) {
|
|
1660
|
-
if (isNull(data)) {
|
|
1661
|
-
return;
|
|
1662
|
-
}
|
|
1334
|
+
enable = true;
|
|
1335
|
+
opacity = 1;
|
|
1336
|
+
doLoad(data) {
|
|
1663
1337
|
if (data.color !== undefined) {
|
|
1664
1338
|
this.color = AnimatableColor.create(this.color, data.color);
|
|
1665
1339
|
}
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
}
|
|
1669
|
-
if (data.opacity !== undefined) {
|
|
1670
|
-
this.opacity = setRangeValue(data.opacity);
|
|
1671
|
-
}
|
|
1340
|
+
loadProperty(this, "enable", data.enable);
|
|
1341
|
+
loadRangeProperty(this, "opacity", data.opacity);
|
|
1672
1342
|
}
|
|
1673
1343
|
}
|
|
1674
1344
|
|
|
1675
|
-
class MoveAngle {
|
|
1676
|
-
offset;
|
|
1677
|
-
value;
|
|
1678
|
-
|
|
1679
|
-
this.offset
|
|
1680
|
-
this.value
|
|
1681
|
-
}
|
|
1682
|
-
load(data) {
|
|
1683
|
-
if (isNull(data)) {
|
|
1684
|
-
return;
|
|
1685
|
-
}
|
|
1686
|
-
if (data.offset !== undefined) {
|
|
1687
|
-
this.offset = setRangeValue(data.offset);
|
|
1688
|
-
}
|
|
1689
|
-
if (data.value !== undefined) {
|
|
1690
|
-
this.value = setRangeValue(data.value);
|
|
1691
|
-
}
|
|
1345
|
+
class MoveAngle extends OptionLoader {
|
|
1346
|
+
offset = 0;
|
|
1347
|
+
value = 90;
|
|
1348
|
+
doLoad(data) {
|
|
1349
|
+
loadRangeProperty(this, "offset", data.offset);
|
|
1350
|
+
loadRangeProperty(this, "value", data.value);
|
|
1692
1351
|
}
|
|
1693
1352
|
}
|
|
1694
1353
|
|
|
1695
|
-
class MoveCenter {
|
|
1696
|
-
mode;
|
|
1697
|
-
radius;
|
|
1698
|
-
x;
|
|
1699
|
-
y;
|
|
1700
|
-
|
|
1701
|
-
this.x
|
|
1702
|
-
this.y
|
|
1703
|
-
this
|
|
1704
|
-
this.radius
|
|
1705
|
-
}
|
|
1706
|
-
load(data) {
|
|
1707
|
-
if (isNull(data)) {
|
|
1708
|
-
return;
|
|
1709
|
-
}
|
|
1710
|
-
if (data.x !== undefined) {
|
|
1711
|
-
this.x = data.x;
|
|
1712
|
-
}
|
|
1713
|
-
if (data.y !== undefined) {
|
|
1714
|
-
this.y = data.y;
|
|
1715
|
-
}
|
|
1716
|
-
if (data.mode !== undefined) {
|
|
1717
|
-
this.mode = data.mode;
|
|
1718
|
-
}
|
|
1719
|
-
if (data.radius !== undefined) {
|
|
1720
|
-
this.radius = data.radius;
|
|
1721
|
-
}
|
|
1354
|
+
class MoveCenter extends OptionLoader {
|
|
1355
|
+
mode = exports.PixelMode.percent;
|
|
1356
|
+
radius = 0;
|
|
1357
|
+
x = 50;
|
|
1358
|
+
y = 50;
|
|
1359
|
+
doLoad(data) {
|
|
1360
|
+
loadProperty(this, "x", data.x);
|
|
1361
|
+
loadProperty(this, "y", data.y);
|
|
1362
|
+
loadProperty(this, "mode", data.mode);
|
|
1363
|
+
loadProperty(this, "radius", data.radius);
|
|
1722
1364
|
}
|
|
1723
1365
|
}
|
|
1724
1366
|
|
|
1725
|
-
class MoveGravity {
|
|
1726
|
-
acceleration;
|
|
1727
|
-
enable;
|
|
1728
|
-
inverse;
|
|
1729
|
-
maxSpeed;
|
|
1730
|
-
|
|
1731
|
-
this
|
|
1732
|
-
this.enable
|
|
1733
|
-
this.inverse
|
|
1734
|
-
this.maxSpeed
|
|
1735
|
-
}
|
|
1736
|
-
load(data) {
|
|
1737
|
-
if (isNull(data)) {
|
|
1738
|
-
return;
|
|
1739
|
-
}
|
|
1740
|
-
if (data.acceleration !== undefined) {
|
|
1741
|
-
this.acceleration = setRangeValue(data.acceleration);
|
|
1742
|
-
}
|
|
1743
|
-
if (data.enable !== undefined) {
|
|
1744
|
-
this.enable = data.enable;
|
|
1745
|
-
}
|
|
1746
|
-
if (data.inverse !== undefined) {
|
|
1747
|
-
this.inverse = data.inverse;
|
|
1748
|
-
}
|
|
1749
|
-
if (data.maxSpeed !== undefined) {
|
|
1750
|
-
this.maxSpeed = setRangeValue(data.maxSpeed);
|
|
1751
|
-
}
|
|
1367
|
+
class MoveGravity extends OptionLoader {
|
|
1368
|
+
acceleration = 9.81;
|
|
1369
|
+
enable = false;
|
|
1370
|
+
inverse = false;
|
|
1371
|
+
maxSpeed = 50;
|
|
1372
|
+
doLoad(data) {
|
|
1373
|
+
loadRangeProperty(this, "acceleration", data.acceleration);
|
|
1374
|
+
loadProperty(this, "enable", data.enable);
|
|
1375
|
+
loadProperty(this, "inverse", data.inverse);
|
|
1376
|
+
loadRangeProperty(this, "maxSpeed", data.maxSpeed);
|
|
1752
1377
|
}
|
|
1753
1378
|
}
|
|
1754
1379
|
|
|
1755
|
-
class ValueWithRandom {
|
|
1756
|
-
value;
|
|
1757
|
-
|
|
1758
|
-
this.value = 0;
|
|
1759
|
-
}
|
|
1760
|
-
load(data) {
|
|
1761
|
-
if (isNull(data)) {
|
|
1762
|
-
return;
|
|
1763
|
-
}
|
|
1380
|
+
class ValueWithRandom extends OptionLoader {
|
|
1381
|
+
value = 0;
|
|
1382
|
+
doLoad(data) {
|
|
1764
1383
|
if (!isNull(data.value)) {
|
|
1765
1384
|
this.value = setRangeValue(data.value);
|
|
1766
1385
|
}
|
|
@@ -1768,51 +1387,25 @@
|
|
|
1768
1387
|
}
|
|
1769
1388
|
class AnimationValueWithRandom extends ValueWithRandom {
|
|
1770
1389
|
animation = new AnimationOptions();
|
|
1771
|
-
|
|
1772
|
-
super.
|
|
1773
|
-
|
|
1774
|
-
return;
|
|
1775
|
-
}
|
|
1776
|
-
const animation = data.animation;
|
|
1777
|
-
if (animation !== undefined) {
|
|
1778
|
-
this.animation.load(animation);
|
|
1779
|
-
}
|
|
1390
|
+
doLoad(data) {
|
|
1391
|
+
super.doLoad(data);
|
|
1392
|
+
loadNestedProperty(this, "animation", data.animation);
|
|
1780
1393
|
}
|
|
1781
1394
|
}
|
|
1782
1395
|
class RangedAnimationValueWithRandom extends AnimationValueWithRandom {
|
|
1783
|
-
animation;
|
|
1784
|
-
constructor() {
|
|
1785
|
-
super();
|
|
1786
|
-
this.animation = new RangedAnimationOptions();
|
|
1787
|
-
}
|
|
1788
|
-
load(data) {
|
|
1789
|
-
super.load(data);
|
|
1790
|
-
}
|
|
1396
|
+
animation = new RangedAnimationOptions();
|
|
1791
1397
|
}
|
|
1792
1398
|
|
|
1793
|
-
class MovePath {
|
|
1794
|
-
clamp;
|
|
1795
|
-
delay;
|
|
1796
|
-
enable;
|
|
1399
|
+
class MovePath extends OptionLoader {
|
|
1400
|
+
clamp = true;
|
|
1401
|
+
delay = new ValueWithRandom();
|
|
1402
|
+
enable = false;
|
|
1797
1403
|
generator;
|
|
1798
|
-
options;
|
|
1799
|
-
|
|
1800
|
-
this.clamp
|
|
1801
|
-
this.delay = new ValueWithRandom();
|
|
1802
|
-
this.enable = false;
|
|
1803
|
-
this.options = {};
|
|
1804
|
-
}
|
|
1805
|
-
load(data) {
|
|
1806
|
-
if (isNull(data)) {
|
|
1807
|
-
return;
|
|
1808
|
-
}
|
|
1809
|
-
if (data.clamp !== undefined) {
|
|
1810
|
-
this.clamp = data.clamp;
|
|
1811
|
-
}
|
|
1404
|
+
options = {};
|
|
1405
|
+
doLoad(data) {
|
|
1406
|
+
loadProperty(this, "clamp", data.clamp);
|
|
1812
1407
|
this.delay.load(data.delay);
|
|
1813
|
-
|
|
1814
|
-
this.enable = data.enable;
|
|
1815
|
-
}
|
|
1408
|
+
loadProperty(this, "enable", data.enable);
|
|
1816
1409
|
this.generator = data.generator;
|
|
1817
1410
|
if (data.options) {
|
|
1818
1411
|
this.options = deepExtend(this.options, data.options);
|
|
@@ -1820,19 +1413,13 @@
|
|
|
1820
1413
|
}
|
|
1821
1414
|
}
|
|
1822
1415
|
|
|
1823
|
-
class OutModes {
|
|
1416
|
+
class OutModes extends OptionLoader {
|
|
1824
1417
|
bottom;
|
|
1825
|
-
default;
|
|
1418
|
+
default = exports.OutMode.out;
|
|
1826
1419
|
left;
|
|
1827
1420
|
right;
|
|
1828
1421
|
top;
|
|
1829
|
-
|
|
1830
|
-
this.default = exports.OutMode.out;
|
|
1831
|
-
}
|
|
1832
|
-
load(data) {
|
|
1833
|
-
if (isNull(data)) {
|
|
1834
|
-
return;
|
|
1835
|
-
}
|
|
1422
|
+
doLoad(data) {
|
|
1836
1423
|
if (data.default !== undefined) {
|
|
1837
1424
|
this.default = data.default;
|
|
1838
1425
|
}
|
|
@@ -1843,79 +1430,42 @@
|
|
|
1843
1430
|
}
|
|
1844
1431
|
}
|
|
1845
1432
|
|
|
1846
|
-
class Spin {
|
|
1847
|
-
acceleration;
|
|
1848
|
-
enable;
|
|
1433
|
+
class Spin extends OptionLoader {
|
|
1434
|
+
acceleration = 0;
|
|
1435
|
+
enable = false;
|
|
1849
1436
|
position;
|
|
1850
|
-
|
|
1851
|
-
this.acceleration
|
|
1852
|
-
this.enable
|
|
1853
|
-
}
|
|
1854
|
-
load(data) {
|
|
1855
|
-
if (isNull(data)) {
|
|
1856
|
-
return;
|
|
1857
|
-
}
|
|
1858
|
-
if (data.acceleration !== undefined) {
|
|
1859
|
-
this.acceleration = setRangeValue(data.acceleration);
|
|
1860
|
-
}
|
|
1861
|
-
if (data.enable !== undefined) {
|
|
1862
|
-
this.enable = data.enable;
|
|
1863
|
-
}
|
|
1437
|
+
doLoad(data) {
|
|
1438
|
+
loadRangeProperty(this, "acceleration", data.acceleration);
|
|
1439
|
+
loadProperty(this, "enable", data.enable);
|
|
1864
1440
|
if (data.position) {
|
|
1865
1441
|
this.position = deepExtend({}, data.position);
|
|
1866
1442
|
}
|
|
1867
1443
|
}
|
|
1868
1444
|
}
|
|
1869
1445
|
|
|
1870
|
-
class Move {
|
|
1871
|
-
angle;
|
|
1872
|
-
center;
|
|
1873
|
-
decay;
|
|
1874
|
-
direction;
|
|
1875
|
-
distance;
|
|
1876
|
-
drift;
|
|
1877
|
-
enable;
|
|
1878
|
-
gravity;
|
|
1879
|
-
outModes;
|
|
1880
|
-
path;
|
|
1881
|
-
random;
|
|
1882
|
-
size;
|
|
1883
|
-
speed;
|
|
1884
|
-
spin;
|
|
1885
|
-
straight;
|
|
1886
|
-
vibrate;
|
|
1887
|
-
warp;
|
|
1888
|
-
|
|
1889
|
-
this.angle = new MoveAngle();
|
|
1890
|
-
this.center = new MoveCenter();
|
|
1891
|
-
this.decay = 0;
|
|
1892
|
-
this.distance = {};
|
|
1893
|
-
this.direction = exports.MoveDirection.none;
|
|
1894
|
-
this.drift = 0;
|
|
1895
|
-
this.enable = false;
|
|
1896
|
-
this.gravity = new MoveGravity();
|
|
1897
|
-
this.path = new MovePath();
|
|
1898
|
-
this.outModes = new OutModes();
|
|
1899
|
-
this.random = false;
|
|
1900
|
-
this.size = false;
|
|
1901
|
-
this.speed = 2;
|
|
1902
|
-
this.spin = new Spin();
|
|
1903
|
-
this.straight = false;
|
|
1904
|
-
this.vibrate = false;
|
|
1905
|
-
this.warp = false;
|
|
1906
|
-
}
|
|
1907
|
-
load(data) {
|
|
1908
|
-
if (isNull(data)) {
|
|
1909
|
-
return;
|
|
1910
|
-
}
|
|
1446
|
+
class Move extends OptionLoader {
|
|
1447
|
+
angle = new MoveAngle();
|
|
1448
|
+
center = new MoveCenter();
|
|
1449
|
+
decay = 0;
|
|
1450
|
+
direction = exports.MoveDirection.none;
|
|
1451
|
+
distance = {};
|
|
1452
|
+
drift = 0;
|
|
1453
|
+
enable = false;
|
|
1454
|
+
gravity = new MoveGravity();
|
|
1455
|
+
outModes = new OutModes();
|
|
1456
|
+
path = new MovePath();
|
|
1457
|
+
random = false;
|
|
1458
|
+
size = false;
|
|
1459
|
+
speed = 2;
|
|
1460
|
+
spin = new Spin();
|
|
1461
|
+
straight = false;
|
|
1462
|
+
vibrate = false;
|
|
1463
|
+
warp = false;
|
|
1464
|
+
doLoad(data) {
|
|
1911
1465
|
this.angle.load(isNumber(data.angle) ? { value: data.angle } : data.angle);
|
|
1912
1466
|
this.center.load(data.center);
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
}
|
|
1916
|
-
if (data.direction !== undefined) {
|
|
1917
|
-
this.direction = data.direction;
|
|
1918
|
-
}
|
|
1467
|
+
loadRangeProperty(this, "decay", data.decay);
|
|
1468
|
+
loadProperty(this, "direction", data.direction);
|
|
1919
1469
|
if (data.distance !== undefined) {
|
|
1920
1470
|
this.distance = isNumber(data.distance)
|
|
1921
1471
|
? {
|
|
@@ -1924,12 +1474,8 @@
|
|
|
1924
1474
|
}
|
|
1925
1475
|
: { ...data.distance };
|
|
1926
1476
|
}
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
}
|
|
1930
|
-
if (data.enable !== undefined) {
|
|
1931
|
-
this.enable = data.enable;
|
|
1932
|
-
}
|
|
1477
|
+
loadRangeProperty(this, "drift", data.drift);
|
|
1478
|
+
loadProperty(this, "enable", data.enable);
|
|
1933
1479
|
this.gravity.load(data.gravity);
|
|
1934
1480
|
const outModes = data.outModes;
|
|
1935
1481
|
if (outModes !== undefined) {
|
|
@@ -1943,177 +1489,91 @@
|
|
|
1943
1489
|
}
|
|
1944
1490
|
}
|
|
1945
1491
|
this.path.load(data.path);
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
if (data.size !== undefined) {
|
|
1950
|
-
this.size = data.size;
|
|
1951
|
-
}
|
|
1952
|
-
if (data.speed !== undefined) {
|
|
1953
|
-
this.speed = setRangeValue(data.speed);
|
|
1954
|
-
}
|
|
1492
|
+
loadProperty(this, "random", data.random);
|
|
1493
|
+
loadProperty(this, "size", data.size);
|
|
1494
|
+
loadRangeProperty(this, "speed", data.speed);
|
|
1955
1495
|
this.spin.load(data.spin);
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
if (data.vibrate !== undefined) {
|
|
1960
|
-
this.vibrate = data.vibrate;
|
|
1961
|
-
}
|
|
1962
|
-
if (data.warp !== undefined) {
|
|
1963
|
-
this.warp = data.warp;
|
|
1964
|
-
}
|
|
1496
|
+
loadProperty(this, "straight", data.straight);
|
|
1497
|
+
loadProperty(this, "vibrate", data.vibrate);
|
|
1498
|
+
loadProperty(this, "warp", data.warp);
|
|
1965
1499
|
}
|
|
1966
1500
|
}
|
|
1967
1501
|
|
|
1968
|
-
class Stroke {
|
|
1502
|
+
class Stroke extends OptionLoader {
|
|
1969
1503
|
color;
|
|
1970
1504
|
opacity;
|
|
1971
|
-
width;
|
|
1972
|
-
|
|
1973
|
-
this.width = 0;
|
|
1974
|
-
}
|
|
1975
|
-
load(data) {
|
|
1976
|
-
if (isNull(data)) {
|
|
1977
|
-
return;
|
|
1978
|
-
}
|
|
1505
|
+
width = 0;
|
|
1506
|
+
doLoad(data) {
|
|
1979
1507
|
if (data.color !== undefined) {
|
|
1980
1508
|
this.color = AnimatableColor.create(this.color, data.color);
|
|
1981
1509
|
}
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
}
|
|
1985
|
-
if (data.opacity !== undefined) {
|
|
1986
|
-
this.opacity = setRangeValue(data.opacity);
|
|
1987
|
-
}
|
|
1510
|
+
loadRangeProperty(this, "width", data.width);
|
|
1511
|
+
loadRangeProperty(this, "opacity", data.opacity);
|
|
1988
1512
|
}
|
|
1989
1513
|
}
|
|
1990
1514
|
|
|
1991
|
-
class Paint {
|
|
1515
|
+
class Paint extends OptionLoader {
|
|
1992
1516
|
color;
|
|
1993
1517
|
fill;
|
|
1994
1518
|
stroke;
|
|
1995
|
-
|
|
1996
|
-
if (isNull(data)) {
|
|
1997
|
-
return;
|
|
1998
|
-
}
|
|
1519
|
+
doLoad(data) {
|
|
1999
1520
|
if (data.color !== undefined) {
|
|
2000
1521
|
this.color = AnimatableColor.create(this.color, data.color);
|
|
2001
1522
|
}
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
this.fill.load(data.fill);
|
|
2005
|
-
}
|
|
2006
|
-
if (data.stroke !== undefined) {
|
|
2007
|
-
this.stroke ??= new Stroke();
|
|
2008
|
-
this.stroke.load(data.stroke);
|
|
2009
|
-
}
|
|
1523
|
+
loadLazyProperty(this, "fill", data.fill, () => new Fill());
|
|
1524
|
+
loadLazyProperty(this, "stroke", data.stroke, () => new Stroke());
|
|
2010
1525
|
}
|
|
2011
1526
|
}
|
|
2012
1527
|
|
|
2013
1528
|
class ParticlesBounceFactor extends ValueWithRandom {
|
|
2014
|
-
|
|
2015
|
-
super();
|
|
2016
|
-
this.value = 1;
|
|
2017
|
-
}
|
|
1529
|
+
value = 1;
|
|
2018
1530
|
}
|
|
2019
1531
|
|
|
2020
|
-
class ParticlesBounce {
|
|
2021
|
-
horizontal;
|
|
2022
|
-
vertical;
|
|
2023
|
-
|
|
2024
|
-
this.horizontal = new ParticlesBounceFactor();
|
|
2025
|
-
this.vertical = new ParticlesBounceFactor();
|
|
2026
|
-
}
|
|
2027
|
-
load(data) {
|
|
2028
|
-
if (isNull(data)) {
|
|
2029
|
-
return;
|
|
2030
|
-
}
|
|
1532
|
+
class ParticlesBounce extends OptionLoader {
|
|
1533
|
+
horizontal = new ParticlesBounceFactor();
|
|
1534
|
+
vertical = new ParticlesBounceFactor();
|
|
1535
|
+
doLoad(data) {
|
|
2031
1536
|
this.horizontal.load(data.horizontal);
|
|
2032
1537
|
this.vertical.load(data.vertical);
|
|
2033
1538
|
}
|
|
2034
1539
|
}
|
|
2035
1540
|
|
|
2036
|
-
class ParticlesDensity {
|
|
2037
|
-
enable;
|
|
2038
|
-
height;
|
|
2039
|
-
width;
|
|
2040
|
-
|
|
2041
|
-
this.enable
|
|
2042
|
-
this.width
|
|
2043
|
-
this.height
|
|
2044
|
-
}
|
|
2045
|
-
load(data) {
|
|
2046
|
-
if (isNull(data)) {
|
|
2047
|
-
return;
|
|
2048
|
-
}
|
|
2049
|
-
if (data.enable !== undefined) {
|
|
2050
|
-
this.enable = data.enable;
|
|
2051
|
-
}
|
|
2052
|
-
const width = data.width;
|
|
2053
|
-
if (width !== undefined) {
|
|
2054
|
-
this.width = width;
|
|
2055
|
-
}
|
|
2056
|
-
const height = data.height;
|
|
2057
|
-
if (height !== undefined) {
|
|
2058
|
-
this.height = height;
|
|
2059
|
-
}
|
|
1541
|
+
class ParticlesDensity extends OptionLoader {
|
|
1542
|
+
enable = false;
|
|
1543
|
+
height = 1080;
|
|
1544
|
+
width = 1920;
|
|
1545
|
+
doLoad(data) {
|
|
1546
|
+
loadProperty(this, "enable", data.enable);
|
|
1547
|
+
loadProperty(this, "width", data.width);
|
|
1548
|
+
loadProperty(this, "height", data.height);
|
|
2060
1549
|
}
|
|
2061
1550
|
}
|
|
2062
1551
|
|
|
2063
|
-
class ParticlesNumberLimit {
|
|
2064
|
-
mode;
|
|
2065
|
-
value;
|
|
2066
|
-
|
|
2067
|
-
this
|
|
2068
|
-
this.value
|
|
2069
|
-
}
|
|
2070
|
-
load(data) {
|
|
2071
|
-
if (isNull(data)) {
|
|
2072
|
-
return;
|
|
2073
|
-
}
|
|
2074
|
-
if (data.mode !== undefined) {
|
|
2075
|
-
this.mode = data.mode;
|
|
2076
|
-
}
|
|
2077
|
-
if (data.value !== undefined) {
|
|
2078
|
-
this.value = data.value;
|
|
2079
|
-
}
|
|
1552
|
+
class ParticlesNumberLimit extends OptionLoader {
|
|
1553
|
+
mode = exports.LimitMode.delete;
|
|
1554
|
+
value = 0;
|
|
1555
|
+
doLoad(data) {
|
|
1556
|
+
loadProperty(this, "mode", data.mode);
|
|
1557
|
+
loadProperty(this, "value", data.value);
|
|
2080
1558
|
}
|
|
2081
1559
|
}
|
|
2082
1560
|
|
|
2083
|
-
class ParticlesNumber {
|
|
2084
|
-
density;
|
|
2085
|
-
limit;
|
|
2086
|
-
value;
|
|
2087
|
-
|
|
2088
|
-
this.density = new ParticlesDensity();
|
|
2089
|
-
this.limit = new ParticlesNumberLimit();
|
|
2090
|
-
this.value = 0;
|
|
2091
|
-
}
|
|
2092
|
-
load(data) {
|
|
2093
|
-
if (isNull(data)) {
|
|
2094
|
-
return;
|
|
2095
|
-
}
|
|
1561
|
+
class ParticlesNumber extends OptionLoader {
|
|
1562
|
+
density = new ParticlesDensity();
|
|
1563
|
+
limit = new ParticlesNumberLimit();
|
|
1564
|
+
value = 0;
|
|
1565
|
+
doLoad(data) {
|
|
2096
1566
|
this.density.load(data.density);
|
|
2097
1567
|
this.limit.load(data.limit);
|
|
2098
|
-
|
|
2099
|
-
this.value = data.value;
|
|
2100
|
-
}
|
|
1568
|
+
loadProperty(this, "value", data.value);
|
|
2101
1569
|
}
|
|
2102
1570
|
}
|
|
2103
1571
|
|
|
2104
|
-
class Shape {
|
|
2105
|
-
close;
|
|
2106
|
-
options;
|
|
2107
|
-
type;
|
|
2108
|
-
|
|
2109
|
-
this.close = true;
|
|
2110
|
-
this.options = {};
|
|
2111
|
-
this.type = "circle";
|
|
2112
|
-
}
|
|
2113
|
-
load(data) {
|
|
2114
|
-
if (isNull(data)) {
|
|
2115
|
-
return;
|
|
2116
|
-
}
|
|
1572
|
+
class Shape extends OptionLoader {
|
|
1573
|
+
close = true;
|
|
1574
|
+
options = {};
|
|
1575
|
+
type = "circle";
|
|
1576
|
+
doLoad(data) {
|
|
2117
1577
|
const options = data.options;
|
|
2118
1578
|
if (options !== undefined) {
|
|
2119
1579
|
for (const shape in options) {
|
|
@@ -2123,76 +1583,47 @@
|
|
|
2123
1583
|
}
|
|
2124
1584
|
}
|
|
2125
1585
|
}
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
}
|
|
2129
|
-
if (data.type !== undefined) {
|
|
2130
|
-
this.type = data.type;
|
|
2131
|
-
}
|
|
1586
|
+
loadProperty(this, "close", data.close);
|
|
1587
|
+
loadProperty(this, "type", data.type);
|
|
2132
1588
|
}
|
|
2133
1589
|
}
|
|
2134
1590
|
|
|
2135
1591
|
class ZIndex extends ValueWithRandom {
|
|
2136
|
-
opacityRate;
|
|
2137
|
-
sizeRate;
|
|
2138
|
-
velocityRate;
|
|
2139
|
-
|
|
2140
|
-
super();
|
|
2141
|
-
this.opacityRate
|
|
2142
|
-
this.sizeRate
|
|
2143
|
-
this.velocityRate
|
|
2144
|
-
}
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
if (data.sizeRate !== undefined) {
|
|
2154
|
-
this.sizeRate = data.sizeRate;
|
|
2155
|
-
}
|
|
2156
|
-
if (data.velocityRate !== undefined) {
|
|
2157
|
-
this.velocityRate = data.velocityRate;
|
|
2158
|
-
}
|
|
2159
|
-
}
|
|
2160
|
-
}
|
|
2161
|
-
|
|
2162
|
-
class ParticlesOptions {
|
|
2163
|
-
bounce;
|
|
2164
|
-
effect;
|
|
2165
|
-
groups;
|
|
2166
|
-
move;
|
|
2167
|
-
number;
|
|
1592
|
+
opacityRate = 1;
|
|
1593
|
+
sizeRate = 1;
|
|
1594
|
+
velocityRate = 1;
|
|
1595
|
+
doLoad(data) {
|
|
1596
|
+
super.doLoad(data);
|
|
1597
|
+
loadProperty(this, "opacityRate", data.opacityRate);
|
|
1598
|
+
loadProperty(this, "sizeRate", data.sizeRate);
|
|
1599
|
+
loadProperty(this, "velocityRate", data.velocityRate);
|
|
1600
|
+
}
|
|
1601
|
+
}
|
|
1602
|
+
|
|
1603
|
+
class ParticlesOptions extends OptionLoader {
|
|
1604
|
+
bounce = new ParticlesBounce();
|
|
1605
|
+
effect = new Effect();
|
|
1606
|
+
groups = {};
|
|
1607
|
+
move = new Move();
|
|
1608
|
+
number = new ParticlesNumber();
|
|
2168
1609
|
paint;
|
|
2169
1610
|
palette;
|
|
2170
|
-
reduceDuplicates;
|
|
2171
|
-
shape;
|
|
2172
|
-
zIndex;
|
|
1611
|
+
reduceDuplicates = false;
|
|
1612
|
+
shape = new Shape();
|
|
1613
|
+
zIndex = new ZIndex();
|
|
2173
1614
|
#container;
|
|
2174
1615
|
#pluginManager;
|
|
2175
1616
|
constructor(pluginManager, container) {
|
|
1617
|
+
super();
|
|
2176
1618
|
this.#pluginManager = pluginManager;
|
|
2177
1619
|
this.#container = container;
|
|
2178
|
-
this.bounce = new ParticlesBounce();
|
|
2179
|
-
this.effect = new Effect();
|
|
2180
|
-
this.groups = {};
|
|
2181
|
-
this.move = new Move();
|
|
2182
|
-
this.number = new ParticlesNumber();
|
|
2183
1620
|
this.paint = new Paint();
|
|
2184
1621
|
this.paint.color = new AnimatableColor();
|
|
2185
1622
|
this.paint.color.value = "#fff";
|
|
2186
1623
|
this.paint.fill = new Fill();
|
|
2187
1624
|
this.paint.fill.enable = true;
|
|
2188
|
-
this.reduceDuplicates = false;
|
|
2189
|
-
this.shape = new Shape();
|
|
2190
|
-
this.zIndex = new ZIndex();
|
|
2191
1625
|
}
|
|
2192
|
-
|
|
2193
|
-
if (isNull(data)) {
|
|
2194
|
-
return;
|
|
2195
|
-
}
|
|
1626
|
+
doLoad(data) {
|
|
2196
1627
|
if (data.palette) {
|
|
2197
1628
|
this.palette = data.palette;
|
|
2198
1629
|
this.#importPalette(this.palette);
|
|
@@ -2250,7 +1681,7 @@
|
|
|
2250
1681
|
}
|
|
2251
1682
|
}
|
|
2252
1683
|
}
|
|
2253
|
-
#importPalette
|
|
1684
|
+
#importPalette(palette) {
|
|
2254
1685
|
const paletteData = this.#pluginManager.getPalette(palette);
|
|
2255
1686
|
if (!paletteData) {
|
|
2256
1687
|
return;
|
|
@@ -2294,69 +1725,49 @@
|
|
|
2294
1725
|
mode: paletteData.blendMode,
|
|
2295
1726
|
},
|
|
2296
1727
|
});
|
|
2297
|
-
};
|
|
2298
|
-
}
|
|
2299
|
-
|
|
2300
|
-
function loadOptions(options, ...sourceOptionsArr) {
|
|
2301
|
-
for (const sourceOptions of sourceOptionsArr) {
|
|
2302
|
-
options.load(sourceOptions);
|
|
2303
1728
|
}
|
|
2304
1729
|
}
|
|
1730
|
+
|
|
2305
1731
|
function loadParticlesOptions(pluginManager, container, ...sourceOptionsArr) {
|
|
2306
1732
|
const options = new ParticlesOptions(pluginManager, container);
|
|
2307
1733
|
loadOptions(options, ...sourceOptionsArr);
|
|
2308
1734
|
return options;
|
|
2309
1735
|
}
|
|
2310
1736
|
|
|
2311
|
-
class Options {
|
|
2312
|
-
autoPlay;
|
|
1737
|
+
class Options extends OptionLoader {
|
|
1738
|
+
autoPlay = true;
|
|
2313
1739
|
background;
|
|
2314
|
-
clear;
|
|
2315
|
-
defaultThemes;
|
|
2316
|
-
delay;
|
|
2317
|
-
detectRetina;
|
|
2318
|
-
duration;
|
|
2319
|
-
fpsLimit;
|
|
1740
|
+
clear = true;
|
|
1741
|
+
defaultThemes = {};
|
|
1742
|
+
delay = 0;
|
|
1743
|
+
detectRetina = true;
|
|
1744
|
+
duration = 0;
|
|
1745
|
+
fpsLimit = 120;
|
|
2320
1746
|
fullScreen;
|
|
2321
|
-
hdr;
|
|
1747
|
+
hdr = true;
|
|
2322
1748
|
key;
|
|
2323
1749
|
name;
|
|
2324
1750
|
palette;
|
|
2325
1751
|
particles;
|
|
2326
|
-
pauseOnBlur;
|
|
2327
|
-
pauseOnOutsideViewport;
|
|
1752
|
+
pauseOnBlur = true;
|
|
1753
|
+
pauseOnOutsideViewport = true;
|
|
2328
1754
|
preset;
|
|
2329
1755
|
resize;
|
|
2330
|
-
smooth;
|
|
2331
|
-
style;
|
|
2332
|
-
zLayers;
|
|
1756
|
+
smooth = false;
|
|
1757
|
+
style = {};
|
|
1758
|
+
zLayers = 100;
|
|
2333
1759
|
#container;
|
|
2334
1760
|
#pluginManager;
|
|
2335
1761
|
constructor(pluginManager, container) {
|
|
1762
|
+
super();
|
|
2336
1763
|
this.#pluginManager = pluginManager;
|
|
2337
1764
|
this.#container = container;
|
|
2338
|
-
this.autoPlay = true;
|
|
2339
1765
|
this.background = new Background();
|
|
2340
|
-
this.clear = true;
|
|
2341
|
-
this.defaultThemes = {};
|
|
2342
|
-
this.delay = 0;
|
|
2343
1766
|
this.fullScreen = new FullScreen();
|
|
2344
|
-
this.detectRetina = true;
|
|
2345
|
-
this.duration = 0;
|
|
2346
|
-
this.fpsLimit = 120;
|
|
2347
|
-
this.hdr = true;
|
|
2348
1767
|
this.particles = loadParticlesOptions(this.#pluginManager, this.#container);
|
|
2349
|
-
this.pauseOnBlur = true;
|
|
2350
|
-
this.pauseOnOutsideViewport = true;
|
|
2351
1768
|
this.resize = new ResizeEvent();
|
|
2352
|
-
this.smooth = false;
|
|
2353
|
-
this.style = {};
|
|
2354
|
-
this.zLayers = 100;
|
|
2355
1769
|
}
|
|
2356
|
-
|
|
2357
|
-
if (isNull(data)) {
|
|
2358
|
-
return;
|
|
2359
|
-
}
|
|
1770
|
+
doLoad(data) {
|
|
2360
1771
|
if (data.preset !== undefined) {
|
|
2361
1772
|
this.preset = data.preset;
|
|
2362
1773
|
executeOnSingleOrMultiple(this.preset, preset => {
|
|
@@ -2367,44 +1778,18 @@
|
|
|
2367
1778
|
this.palette = data.palette;
|
|
2368
1779
|
this.#importPalette(this.palette);
|
|
2369
1780
|
}
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
if (data.delay !== undefined) {
|
|
2383
|
-
this.delay = setRangeValue(data.delay);
|
|
2384
|
-
}
|
|
2385
|
-
const detectRetina = data.detectRetina;
|
|
2386
|
-
if (detectRetina !== undefined) {
|
|
2387
|
-
this.detectRetina = detectRetina;
|
|
2388
|
-
}
|
|
2389
|
-
if (data.duration !== undefined) {
|
|
2390
|
-
this.duration = setRangeValue(data.duration);
|
|
2391
|
-
}
|
|
2392
|
-
const fpsLimit = data.fpsLimit;
|
|
2393
|
-
if (fpsLimit !== undefined) {
|
|
2394
|
-
this.fpsLimit = fpsLimit;
|
|
2395
|
-
}
|
|
2396
|
-
if (data.hdr !== undefined) {
|
|
2397
|
-
this.hdr = data.hdr;
|
|
2398
|
-
}
|
|
2399
|
-
if (data.pauseOnBlur !== undefined) {
|
|
2400
|
-
this.pauseOnBlur = data.pauseOnBlur;
|
|
2401
|
-
}
|
|
2402
|
-
if (data.pauseOnOutsideViewport !== undefined) {
|
|
2403
|
-
this.pauseOnOutsideViewport = data.pauseOnOutsideViewport;
|
|
2404
|
-
}
|
|
2405
|
-
if (data.zLayers !== undefined) {
|
|
2406
|
-
this.zLayers = data.zLayers;
|
|
2407
|
-
}
|
|
1781
|
+
loadProperty(this, "autoPlay", data.autoPlay);
|
|
1782
|
+
loadProperty(this, "clear", data.clear);
|
|
1783
|
+
loadProperty(this, "key", data.key);
|
|
1784
|
+
loadProperty(this, "name", data.name);
|
|
1785
|
+
loadRangeProperty(this, "delay", data.delay);
|
|
1786
|
+
loadProperty(this, "detectRetina", data.detectRetina);
|
|
1787
|
+
loadRangeProperty(this, "duration", data.duration);
|
|
1788
|
+
loadProperty(this, "fpsLimit", data.fpsLimit);
|
|
1789
|
+
loadProperty(this, "hdr", data.hdr);
|
|
1790
|
+
loadProperty(this, "pauseOnBlur", data.pauseOnBlur);
|
|
1791
|
+
loadProperty(this, "pauseOnOutsideViewport", data.pauseOnOutsideViewport);
|
|
1792
|
+
loadProperty(this, "zLayers", data.zLayers);
|
|
2408
1793
|
this.background.load(data.background);
|
|
2409
1794
|
const fullScreen = data.fullScreen;
|
|
2410
1795
|
if (isBoolean(fullScreen)) {
|
|
@@ -2416,14 +1801,12 @@
|
|
|
2416
1801
|
this.particles.load(data.particles);
|
|
2417
1802
|
this.resize.load(data.resize);
|
|
2418
1803
|
this.style = deepExtend(this.style, data.style);
|
|
2419
|
-
|
|
2420
|
-
this.smooth = data.smooth;
|
|
2421
|
-
}
|
|
1804
|
+
loadProperty(this, "smooth", data.smooth);
|
|
2422
1805
|
this.#pluginManager.plugins.forEach(plugin => {
|
|
2423
1806
|
plugin.loadOptions(this.#container, this, data);
|
|
2424
1807
|
});
|
|
2425
1808
|
}
|
|
2426
|
-
#importPalette
|
|
1809
|
+
#importPalette(palette) {
|
|
2427
1810
|
const paletteData = this.#pluginManager.getPalette(palette);
|
|
2428
1811
|
if (!paletteData) {
|
|
2429
1812
|
return;
|
|
@@ -2440,143 +1823,19 @@
|
|
|
2440
1823
|
palette,
|
|
2441
1824
|
},
|
|
2442
1825
|
});
|
|
2443
|
-
};
|
|
2444
|
-
#importPreset = preset => {
|
|
2445
|
-
this.load(this.#pluginManager.getPreset(preset));
|
|
2446
|
-
};
|
|
2447
|
-
}
|
|
2448
|
-
|
|
2449
|
-
function paintBase(context, dimension, baseColor) {
|
|
2450
|
-
context.fillStyle = baseColor ?? "rgba(0,0,0,0)";
|
|
2451
|
-
context.fillRect(originPoint.x, originPoint.y, dimension.width, dimension.height);
|
|
2452
|
-
}
|
|
2453
|
-
function paintImage(context, dimension, image, opacity) {
|
|
2454
|
-
if (!image) {
|
|
2455
|
-
return;
|
|
2456
|
-
}
|
|
2457
|
-
const prevAlpha = context.globalAlpha;
|
|
2458
|
-
context.globalAlpha = opacity;
|
|
2459
|
-
context.drawImage(image, originPoint.x, originPoint.y, dimension.width, dimension.height);
|
|
2460
|
-
context.globalAlpha = prevAlpha;
|
|
2461
|
-
}
|
|
2462
|
-
function clear(context, dimension) {
|
|
2463
|
-
context.clearRect(originPoint.x, originPoint.y, dimension.width, dimension.height);
|
|
2464
|
-
}
|
|
2465
|
-
function drawParticle(data) {
|
|
2466
|
-
const { container, context, particle, delta, colorStyles, radius, opacity, transform } = data, { effectDrawers, shapeDrawers } = container, pos = particle.getPosition(), transformData = particle.getTransformData(transform), drawScale = defaultZoom, drawPosition = {
|
|
2467
|
-
x: pos.x,
|
|
2468
|
-
y: pos.y,
|
|
2469
|
-
};
|
|
2470
|
-
context.setTransform(transformData.a, transformData.b, transformData.c, transformData.d, pos.x, pos.y);
|
|
2471
|
-
if (colorStyles.fill) {
|
|
2472
|
-
context.fillStyle = colorStyles.fill;
|
|
2473
|
-
}
|
|
2474
|
-
const fillEnabled = !!particle.fillEnabled, strokeWidth = particle.strokeWidth ?? minStrokeWidth;
|
|
2475
|
-
context.lineWidth = strokeWidth;
|
|
2476
|
-
if (colorStyles.stroke) {
|
|
2477
|
-
context.strokeStyle = colorStyles.stroke;
|
|
2478
|
-
}
|
|
2479
|
-
const drawData = {
|
|
2480
|
-
context,
|
|
2481
|
-
particle,
|
|
2482
|
-
radius,
|
|
2483
|
-
drawRadius: radius * drawScale,
|
|
2484
|
-
opacity,
|
|
2485
|
-
delta,
|
|
2486
|
-
pixelRatio: container.retina.pixelRatio,
|
|
2487
|
-
fill: fillEnabled,
|
|
2488
|
-
stroke: strokeWidth > minStrokeWidth,
|
|
2489
|
-
transformData,
|
|
2490
|
-
position: { ...pos },
|
|
2491
|
-
drawPosition,
|
|
2492
|
-
drawScale,
|
|
2493
|
-
};
|
|
2494
|
-
for (const plugin of container.plugins) {
|
|
2495
|
-
plugin.drawParticleTransform?.(drawData);
|
|
2496
|
-
}
|
|
2497
|
-
const effect = particle.effect ? effectDrawers.get(particle.effect) : undefined, shape = particle.shape ? shapeDrawers.get(particle.shape) : undefined;
|
|
2498
|
-
drawBeforeEffect(effect, drawData);
|
|
2499
|
-
drawShapeBeforeDraw(shape, drawData);
|
|
2500
|
-
drawShape(shape, drawData);
|
|
2501
|
-
drawShapeAfterDraw(shape, drawData);
|
|
2502
|
-
drawAfterEffect(effect, drawData);
|
|
2503
|
-
context.resetTransform();
|
|
2504
|
-
}
|
|
2505
|
-
function drawAfterEffect(drawer, data) {
|
|
2506
|
-
if (!drawer?.drawAfter) {
|
|
2507
|
-
return;
|
|
2508
|
-
}
|
|
2509
|
-
const { particle } = data;
|
|
2510
|
-
if (!particle.effect) {
|
|
2511
|
-
return;
|
|
2512
|
-
}
|
|
2513
|
-
drawer.drawAfter(data);
|
|
2514
|
-
}
|
|
2515
|
-
function drawBeforeEffect(drawer, data) {
|
|
2516
|
-
if (!drawer?.drawBefore) {
|
|
2517
|
-
return;
|
|
2518
|
-
}
|
|
2519
|
-
const { particle } = data;
|
|
2520
|
-
if (!particle.effect) {
|
|
2521
|
-
return;
|
|
2522
|
-
}
|
|
2523
|
-
drawer.drawBefore(data);
|
|
2524
|
-
}
|
|
2525
|
-
function drawShape(drawer, data) {
|
|
2526
|
-
if (!drawer) {
|
|
2527
|
-
return;
|
|
2528
|
-
}
|
|
2529
|
-
const { context, fill, particle, stroke } = data;
|
|
2530
|
-
if (!particle.shape) {
|
|
2531
|
-
return;
|
|
2532
|
-
}
|
|
2533
|
-
context.beginPath();
|
|
2534
|
-
drawer.draw(data);
|
|
2535
|
-
if (particle.shapeClose) {
|
|
2536
|
-
context.closePath();
|
|
2537
|
-
}
|
|
2538
|
-
if (fill) {
|
|
2539
|
-
context.fill();
|
|
2540
|
-
}
|
|
2541
|
-
if (stroke) {
|
|
2542
|
-
context.stroke();
|
|
2543
|
-
}
|
|
2544
|
-
}
|
|
2545
|
-
function drawShapeAfterDraw(drawer, data) {
|
|
2546
|
-
if (!drawer?.afterDraw) {
|
|
2547
|
-
return;
|
|
2548
|
-
}
|
|
2549
|
-
const { particle } = data;
|
|
2550
|
-
if (!particle.shape) {
|
|
2551
|
-
return;
|
|
2552
|
-
}
|
|
2553
|
-
drawer.afterDraw(data);
|
|
2554
|
-
}
|
|
2555
|
-
function drawShapeBeforeDraw(drawer, data) {
|
|
2556
|
-
if (!drawer?.beforeDraw) {
|
|
2557
|
-
return;
|
|
2558
|
-
}
|
|
2559
|
-
const { particle } = data;
|
|
2560
|
-
if (!particle.shape) {
|
|
2561
|
-
return;
|
|
2562
1826
|
}
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
function drawParticlePlugin(context, plugin, particle, delta) {
|
|
2566
|
-
if (!plugin.drawParticle) {
|
|
2567
|
-
return;
|
|
1827
|
+
#importPreset(preset) {
|
|
1828
|
+
this.load(this.#pluginManager.getPreset(preset));
|
|
2568
1829
|
}
|
|
2569
|
-
plugin.drawParticle(context, particle, delta);
|
|
2570
1830
|
}
|
|
2571
1831
|
|
|
2572
|
-
const styleCache = new Map(),
|
|
1832
|
+
const styleCache = new Map(), maxStyleCacheSize = 2000, rgbFixedPrecision = 2, hslFixedPrecision = 2, sdrReferenceWhiteNits = 203;
|
|
2573
1833
|
function getCachedStyle(key, generator) {
|
|
2574
1834
|
let cached = styleCache.get(key);
|
|
2575
1835
|
if (!cached) {
|
|
2576
1836
|
cached = generator();
|
|
2577
|
-
if (styleCache.size
|
|
2578
|
-
|
|
2579
|
-
keysToDelete.forEach(k => styleCache.delete(k));
|
|
1837
|
+
if (styleCache.size > maxStyleCacheSize) {
|
|
1838
|
+
styleCache.clear();
|
|
2580
1839
|
}
|
|
2581
1840
|
styleCache.set(key, cached);
|
|
2582
1841
|
}
|
|
@@ -2643,10 +1902,6 @@
|
|
|
2643
1902
|
}
|
|
2644
1903
|
return undefined;
|
|
2645
1904
|
}
|
|
2646
|
-
function colorToHsl(pluginManager, color, index, useIndex = true) {
|
|
2647
|
-
const rgb = colorToRgb(pluginManager, color, index, useIndex);
|
|
2648
|
-
return rgb ? rgbToHsl(rgb) : undefined;
|
|
2649
|
-
}
|
|
2650
1905
|
function rangeColorToHsl(pluginManager, color, index, useIndex = true) {
|
|
2651
1906
|
const rgb = rangeColorToRgb(pluginManager, color, index, useIndex);
|
|
2652
1907
|
return rgb ? rgbToHsl(rgb) : undefined;
|
|
@@ -2686,34 +1941,35 @@
|
|
|
2686
1941
|
function stringToRgb(pluginManager, input) {
|
|
2687
1942
|
return stringToRgba(pluginManager, input);
|
|
2688
1943
|
}
|
|
1944
|
+
function hslChannel(temp1, temp2, temp3) {
|
|
1945
|
+
const temp3Min = 0, temp3Max = 1;
|
|
1946
|
+
if (temp3 < temp3Min) {
|
|
1947
|
+
temp3++;
|
|
1948
|
+
}
|
|
1949
|
+
if (temp3 > temp3Max) {
|
|
1950
|
+
temp3--;
|
|
1951
|
+
}
|
|
1952
|
+
if (temp3 * sextuple < temp3Max) {
|
|
1953
|
+
return temp1 + (temp2 - temp1) * sextuple * temp3;
|
|
1954
|
+
}
|
|
1955
|
+
if (temp3 * double < temp3Max) {
|
|
1956
|
+
return temp2;
|
|
1957
|
+
}
|
|
1958
|
+
if (temp3 * triple < temp3Max * double) {
|
|
1959
|
+
const temp3Offset = double / triple;
|
|
1960
|
+
return temp1 + (temp2 - temp1) * (temp3Offset - temp3) * sextuple;
|
|
1961
|
+
}
|
|
1962
|
+
return temp1;
|
|
1963
|
+
}
|
|
2689
1964
|
function hslToRgb(hsl) {
|
|
2690
1965
|
const h = ((hsl.h % hMax) + hMax) % hMax, s = Math.max(sMin, Math.min(sMax, hsl.s)), l = Math.max(lMin, Math.min(lMax, hsl.l)), hNormalized = h / hMax, sNormalized = s / sMax, lNormalized = l / lMax;
|
|
2691
1966
|
if (s === sMin) {
|
|
2692
1967
|
const grayscaleValue = Math.round(lNormalized * rgbMax);
|
|
2693
|
-
return { r: grayscaleValue, g: grayscaleValue, b: grayscaleValue };
|
|
2694
|
-
}
|
|
2695
|
-
const
|
|
2696
|
-
const temp3Min = 0, temp3Max = 1;
|
|
2697
|
-
if (temp3 < temp3Min) {
|
|
2698
|
-
temp3++;
|
|
2699
|
-
}
|
|
2700
|
-
if (temp3 > temp3Max) {
|
|
2701
|
-
temp3--;
|
|
2702
|
-
}
|
|
2703
|
-
if (temp3 * sextuple < temp3Max) {
|
|
2704
|
-
return temp1 + (temp2 - temp1) * sextuple * temp3;
|
|
2705
|
-
}
|
|
2706
|
-
if (temp3 * double < temp3Max) {
|
|
2707
|
-
return temp2;
|
|
2708
|
-
}
|
|
2709
|
-
if (temp3 * triple < temp3Max * double) {
|
|
2710
|
-
const temp3Offset = double / triple;
|
|
2711
|
-
return temp1 + (temp2 - temp1) * (temp3Offset - temp3) * sextuple;
|
|
2712
|
-
}
|
|
2713
|
-
return temp1;
|
|
2714
|
-
}, temp1 = lNormalized < half
|
|
1968
|
+
return { r: grayscaleValue, g: grayscaleValue, b: grayscaleValue };
|
|
1969
|
+
}
|
|
1970
|
+
const temp1 = lNormalized < half
|
|
2715
1971
|
? lNormalized * (sNormalizedOffset + sNormalized)
|
|
2716
|
-
: lNormalized + sNormalized - lNormalized * sNormalized, temp2 = double * lNormalized - temp1, phaseThird = phaseNumerator / triple, red = Math.min(rgbMax, rgbMax *
|
|
1972
|
+
: lNormalized + sNormalized - lNormalized * sNormalized, temp2 = double * lNormalized - temp1, phaseThird = phaseNumerator / triple, red = Math.min(rgbMax, rgbMax * hslChannel(temp2, temp1, hNormalized + phaseThird)), green = Math.min(rgbMax, rgbMax * hslChannel(temp2, temp1, hNormalized)), blue = Math.min(rgbMax, rgbMax * hslChannel(temp2, temp1, hNormalized - phaseThird));
|
|
2717
1973
|
return { r: Math.round(red), g: Math.round(green), b: Math.round(blue) };
|
|
2718
1974
|
}
|
|
2719
1975
|
function hslaToRgba(hsla) {
|
|
@@ -2726,7 +1982,7 @@
|
|
|
2726
1982
|
};
|
|
2727
1983
|
}
|
|
2728
1984
|
function getRandomRgbColor(min) {
|
|
2729
|
-
const fixedMin = min ?? defaultRgbMin, fixedMax = rgbMax + identity$
|
|
1985
|
+
const fixedMin = min ?? defaultRgbMin, fixedMax = rgbMax + identity$2, getRgbInRangeValue = () => Math.floor(getRandomInRange(fixedMin, fixedMax));
|
|
2730
1986
|
return {
|
|
2731
1987
|
b: getRgbInRangeValue(),
|
|
2732
1988
|
g: getRgbInRangeValue(),
|
|
@@ -2737,21 +1993,18 @@
|
|
|
2737
1993
|
const op = opacity ?? defaultOpacity$2, key = `rgb-${color.r.toFixed(rgbFixedPrecision)}-${color.g.toFixed(rgbFixedPrecision)}-${color.b.toFixed(rgbFixedPrecision)}-${hdr ? "hdr" : "sdr"}-${op.toString()}`;
|
|
2738
1994
|
return getCachedStyle(key, () => (hdr ? getHdrStyleFromRgb(color, opacity) : getSdrStyleFromRgb(color, opacity)));
|
|
2739
1995
|
}
|
|
2740
|
-
function getHdrStyleFromRgb(color, opacity) {
|
|
2741
|
-
|
|
1996
|
+
function getHdrStyleFromRgb(color, opacity, peakNits = maxNits) {
|
|
1997
|
+
const headroom = peakNits / sdrReferenceWhiteNits;
|
|
1998
|
+
return `color(display-p3 ${((color.r / rgbMax) * headroom).toString()} ${((color.g / rgbMax) * headroom).toString()} ${((color.b / rgbMax) * headroom).toString()} / ${(opacity ?? defaultOpacity$2).toString()})`;
|
|
2742
1999
|
}
|
|
2743
2000
|
function getSdrStyleFromRgb(color, opacity) {
|
|
2744
2001
|
return `rgba(${color.r.toString()}, ${color.g.toString()}, ${color.b.toString()}, ${(opacity ?? defaultOpacity$2).toString()})`;
|
|
2745
2002
|
}
|
|
2746
2003
|
function getStyleFromHsl(color, hdr, opacity) {
|
|
2747
2004
|
const op = opacity ?? defaultOpacity$2, key = `hsl-${color.h.toFixed(hslFixedPrecision)}-${color.s.toFixed(hslFixedPrecision)}-${color.l.toFixed(hslFixedPrecision)}-${hdr ? "hdr" : "sdr"}-${op.toString()}`;
|
|
2748
|
-
return getCachedStyle(key, () =>
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
return getHdrStyleFromRgb(hslToRgb(color), opacity);
|
|
2752
|
-
}
|
|
2753
|
-
function getSdrStyleFromHsl(color, opacity) {
|
|
2754
|
-
return `hsla(${color.h.toString()}, ${color.s.toString()}%, ${color.l.toString()}%, ${(opacity ?? defaultOpacity$2).toString()})`;
|
|
2005
|
+
return getCachedStyle(key, () => hdr
|
|
2006
|
+
? getStyleFromRgb(hslToRgb(color), true, opacity)
|
|
2007
|
+
: `hsla(${color.h.toString()}, ${color.s.toString()}%, ${color.l.toString()}%, ${op.toString()})`);
|
|
2755
2008
|
}
|
|
2756
2009
|
function colorMix(color1, color2, size1, size2) {
|
|
2757
2010
|
let rgb1 = color1, rgb2 = color2;
|
|
@@ -2930,22 +2183,14 @@
|
|
|
2930
2183
|
const tsParticles = initEngine();
|
|
2931
2184
|
|
|
2932
2185
|
class Blend {
|
|
2933
|
-
enable;
|
|
2934
|
-
mode;
|
|
2935
|
-
constructor() {
|
|
2936
|
-
this.mode = "destination-out";
|
|
2937
|
-
this.enable = false;
|
|
2938
|
-
}
|
|
2186
|
+
enable = false;
|
|
2187
|
+
mode = "destination-out";
|
|
2939
2188
|
load(data) {
|
|
2940
2189
|
if (isNull(data)) {
|
|
2941
2190
|
return;
|
|
2942
2191
|
}
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
}
|
|
2946
|
-
if (data.enable !== undefined) {
|
|
2947
|
-
this.enable = data.enable;
|
|
2948
|
-
}
|
|
2192
|
+
loadProperty(this, "mode", data.mode);
|
|
2193
|
+
loadProperty(this, "enable", data.enable);
|
|
2949
2194
|
}
|
|
2950
2195
|
}
|
|
2951
2196
|
|
|
@@ -2975,7 +2220,7 @@
|
|
|
2975
2220
|
}
|
|
2976
2221
|
|
|
2977
2222
|
async function loadBlendPlugin(engine) {
|
|
2978
|
-
engine.checkVersion("4.
|
|
2223
|
+
engine.checkVersion("4.2.0");
|
|
2979
2224
|
await engine.pluginManager.register(e => {
|
|
2980
2225
|
e.pluginManager.addPlugin(new BlendPlugin());
|
|
2981
2226
|
});
|
|
@@ -3012,7 +2257,7 @@
|
|
|
3012
2257
|
}
|
|
3013
2258
|
|
|
3014
2259
|
async function loadCircleShape(engine) {
|
|
3015
|
-
engine.checkVersion("4.
|
|
2260
|
+
engine.checkVersion("4.2.0");
|
|
3016
2261
|
await engine.pluginManager.register(e => {
|
|
3017
2262
|
e.pluginManager.addShape(["circle"], () => {
|
|
3018
2263
|
return Promise.resolve(new CircleDrawer());
|
|
@@ -3060,7 +2305,7 @@
|
|
|
3060
2305
|
}
|
|
3061
2306
|
|
|
3062
2307
|
async function loadHexColorPlugin(engine) {
|
|
3063
|
-
engine.checkVersion("4.
|
|
2308
|
+
engine.checkVersion("4.2.0");
|
|
3064
2309
|
await engine.pluginManager.register(e => {
|
|
3065
2310
|
e.pluginManager.addColorManager("hex", new HexColorManager());
|
|
3066
2311
|
});
|
|
@@ -3113,7 +2358,7 @@
|
|
|
3113
2358
|
}
|
|
3114
2359
|
|
|
3115
2360
|
async function loadHslColorPlugin(engine) {
|
|
3116
|
-
engine.checkVersion("4.
|
|
2361
|
+
engine.checkVersion("4.2.0");
|
|
3117
2362
|
await engine.pluginManager.register(e => {
|
|
3118
2363
|
e.pluginManager.addColorManager("hsl", new HslColorManager());
|
|
3119
2364
|
});
|
|
@@ -3137,7 +2382,7 @@
|
|
|
3137
2382
|
}
|
|
3138
2383
|
|
|
3139
2384
|
async function loadMovePlugin(engine) {
|
|
3140
|
-
engine.checkVersion("4.
|
|
2385
|
+
engine.checkVersion("4.2.0");
|
|
3141
2386
|
await engine.pluginManager.register(e => {
|
|
3142
2387
|
const moveEngine = e, movePluginManager = moveEngine.pluginManager;
|
|
3143
2388
|
movePluginManager.initializers.pathGenerators ??= new Map();
|
|
@@ -3155,31 +2400,143 @@
|
|
|
3155
2400
|
});
|
|
3156
2401
|
}
|
|
3157
2402
|
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
2403
|
+
function checkDestroy(particle, destroyType, value, minValue, maxValue) {
|
|
2404
|
+
switch (destroyType) {
|
|
2405
|
+
case exports.DestroyType.max:
|
|
2406
|
+
if (value >= maxValue) {
|
|
2407
|
+
particle.destroy();
|
|
2408
|
+
}
|
|
2409
|
+
break;
|
|
2410
|
+
case exports.DestroyType.min:
|
|
2411
|
+
if (value <= minValue) {
|
|
2412
|
+
particle.destroy();
|
|
2413
|
+
}
|
|
2414
|
+
break;
|
|
2415
|
+
}
|
|
2416
|
+
}
|
|
2417
|
+
function initParticleNumericAnimationValue(options, pxRatio) {
|
|
2418
|
+
const valueRange = options.value, animationOptions = options.animation, res = {
|
|
2419
|
+
delayTime: getRangeValue(animationOptions.delay) * millisecondsToSeconds,
|
|
2420
|
+
enable: animationOptions.enable,
|
|
2421
|
+
value: getRangeValue(options.value) * pxRatio,
|
|
2422
|
+
max: getRangeMax(valueRange) * pxRatio,
|
|
2423
|
+
min: getRangeMin(valueRange) * pxRatio,
|
|
2424
|
+
loops: 0,
|
|
2425
|
+
maxLoops: getRangeValue(animationOptions.count),
|
|
2426
|
+
time: 0,
|
|
2427
|
+
}, decayOffset = 1;
|
|
2428
|
+
if (animationOptions.enable) {
|
|
2429
|
+
res.decay = decayOffset - getRangeValue(animationOptions.decay);
|
|
2430
|
+
switch (animationOptions.mode) {
|
|
2431
|
+
case exports.AnimationMode.increase:
|
|
2432
|
+
res.status = exports.AnimationStatus.increasing;
|
|
2433
|
+
break;
|
|
2434
|
+
case exports.AnimationMode.decrease:
|
|
2435
|
+
res.status = exports.AnimationStatus.decreasing;
|
|
2436
|
+
break;
|
|
2437
|
+
case exports.AnimationMode.random:
|
|
2438
|
+
res.status = getRandom() >= half ? exports.AnimationStatus.increasing : exports.AnimationStatus.decreasing;
|
|
2439
|
+
break;
|
|
2440
|
+
}
|
|
2441
|
+
const autoStatus = animationOptions.mode === exports.AnimationMode.auto;
|
|
2442
|
+
switch (animationOptions.startValue) {
|
|
2443
|
+
case exports.StartValueType.min:
|
|
2444
|
+
res.value = res.min;
|
|
2445
|
+
if (autoStatus) {
|
|
2446
|
+
res.status = exports.AnimationStatus.increasing;
|
|
2447
|
+
}
|
|
2448
|
+
break;
|
|
2449
|
+
case exports.StartValueType.max:
|
|
2450
|
+
res.value = res.max;
|
|
2451
|
+
if (autoStatus) {
|
|
2452
|
+
res.status = exports.AnimationStatus.decreasing;
|
|
2453
|
+
}
|
|
2454
|
+
break;
|
|
2455
|
+
case exports.StartValueType.random:
|
|
2456
|
+
default:
|
|
2457
|
+
res.value = randomInRangeValue(res);
|
|
2458
|
+
if (autoStatus) {
|
|
2459
|
+
res.status = getRandom() >= half ? exports.AnimationStatus.increasing : exports.AnimationStatus.decreasing;
|
|
2460
|
+
}
|
|
2461
|
+
break;
|
|
2462
|
+
}
|
|
2463
|
+
}
|
|
2464
|
+
res.initialValue = res.value;
|
|
2465
|
+
return res;
|
|
2466
|
+
}
|
|
2467
|
+
function updateAnimation(particle, data, changeDirection, destroyType, delta) {
|
|
2468
|
+
const minLoops = 0, minDelay = 0, identity = 1, minVelocity = 0, minDecay = 1;
|
|
2469
|
+
if (particle.destroyed ||
|
|
2470
|
+
!data.enable ||
|
|
2471
|
+
((data.maxLoops ?? minLoops) > minLoops && (data.loops ?? minLoops) > (data.maxLoops ?? minLoops))) {
|
|
2472
|
+
return;
|
|
2473
|
+
}
|
|
2474
|
+
const velocity = (data.velocity ?? minVelocity) * delta.factor, minValue = data.min, maxValue = data.max, decay = data.decay ?? minDecay;
|
|
2475
|
+
data.time ??= 0;
|
|
2476
|
+
const delayTime = data.delayTime ?? minDelay;
|
|
2477
|
+
if (delayTime > minDelay && data.time < delayTime) {
|
|
2478
|
+
data.time += delta.value;
|
|
2479
|
+
if (data.time < delayTime) {
|
|
2480
|
+
return;
|
|
2481
|
+
}
|
|
2482
|
+
}
|
|
2483
|
+
switch (data.status) {
|
|
2484
|
+
case exports.AnimationStatus.increasing:
|
|
2485
|
+
data.value += velocity;
|
|
2486
|
+
break;
|
|
2487
|
+
case exports.AnimationStatus.decreasing:
|
|
2488
|
+
data.value -= velocity;
|
|
2489
|
+
break;
|
|
2490
|
+
}
|
|
2491
|
+
if (data.velocity && decay !== identity) {
|
|
2492
|
+
data.velocity *= decay;
|
|
2493
|
+
}
|
|
2494
|
+
switch (data.status) {
|
|
2495
|
+
case exports.AnimationStatus.increasing:
|
|
2496
|
+
if (data.value >= maxValue) {
|
|
2497
|
+
if (changeDirection) {
|
|
2498
|
+
data.status = exports.AnimationStatus.decreasing;
|
|
2499
|
+
}
|
|
2500
|
+
else {
|
|
2501
|
+
data.value -= maxValue;
|
|
2502
|
+
}
|
|
2503
|
+
data.loops ??= minLoops;
|
|
2504
|
+
data.loops++;
|
|
2505
|
+
}
|
|
2506
|
+
break;
|
|
2507
|
+
case exports.AnimationStatus.decreasing:
|
|
2508
|
+
if (data.value <= minValue) {
|
|
2509
|
+
if (changeDirection) {
|
|
2510
|
+
data.status = exports.AnimationStatus.increasing;
|
|
2511
|
+
}
|
|
2512
|
+
else {
|
|
2513
|
+
data.value += maxValue;
|
|
2514
|
+
}
|
|
2515
|
+
data.loops ??= minLoops;
|
|
2516
|
+
data.loops++;
|
|
2517
|
+
}
|
|
2518
|
+
break;
|
|
2519
|
+
}
|
|
2520
|
+
checkDestroy(particle, destroyType, data.value, minValue, maxValue);
|
|
2521
|
+
if (!particle.destroyed) {
|
|
2522
|
+
data.value = clamp(data.value, minValue, maxValue);
|
|
3164
2523
|
}
|
|
2524
|
+
}
|
|
2525
|
+
|
|
2526
|
+
class OpacityAnimation extends RangedAnimationOptions {
|
|
2527
|
+
destroy = exports.DestroyType.none;
|
|
3165
2528
|
load(data) {
|
|
3166
2529
|
super.load(data);
|
|
3167
2530
|
if (isNull(data)) {
|
|
3168
2531
|
return;
|
|
3169
2532
|
}
|
|
3170
|
-
|
|
3171
|
-
this.destroy = data.destroy;
|
|
3172
|
-
}
|
|
2533
|
+
loadProperty(this, "destroy", data.destroy);
|
|
3173
2534
|
}
|
|
3174
2535
|
}
|
|
3175
2536
|
|
|
3176
2537
|
class Opacity extends RangedAnimationValueWithRandom {
|
|
3177
|
-
animation;
|
|
3178
|
-
|
|
3179
|
-
super();
|
|
3180
|
-
this.animation = new OpacityAnimation();
|
|
3181
|
-
this.value = 1;
|
|
3182
|
-
}
|
|
2538
|
+
animation = new OpacityAnimation();
|
|
2539
|
+
value = 1;
|
|
3183
2540
|
load(data) {
|
|
3184
2541
|
if (isNull(data)) {
|
|
3185
2542
|
return;
|
|
@@ -3223,10 +2580,7 @@
|
|
|
3223
2580
|
(particle.opacity.loops ?? none) < (particle.opacity.maxLoops ?? none))));
|
|
3224
2581
|
}
|
|
3225
2582
|
loadOptions(options, ...sources) {
|
|
3226
|
-
options
|
|
3227
|
-
for (const source of sources) {
|
|
3228
|
-
options.opacity.load(source?.opacity);
|
|
3229
|
-
}
|
|
2583
|
+
loadOptionProperty(options, "opacity", Opacity, ...sources);
|
|
3230
2584
|
}
|
|
3231
2585
|
reset(particle) {
|
|
3232
2586
|
if (!particle.opacity) {
|
|
@@ -3244,7 +2598,7 @@
|
|
|
3244
2598
|
}
|
|
3245
2599
|
|
|
3246
2600
|
async function loadOpacityUpdater(engine) {
|
|
3247
|
-
engine.checkVersion("4.
|
|
2601
|
+
engine.checkVersion("4.2.0");
|
|
3248
2602
|
await engine.pluginManager.register(e => {
|
|
3249
2603
|
e.pluginManager.addParticleUpdater("opacity", container => {
|
|
3250
2604
|
return Promise.resolve(new OpacityUpdater(container));
|
|
@@ -3252,7 +2606,7 @@
|
|
|
3252
2606
|
});
|
|
3253
2607
|
}
|
|
3254
2608
|
|
|
3255
|
-
const
|
|
2609
|
+
const boundsMin = 0;
|
|
3256
2610
|
function bounceHorizontal(data) {
|
|
3257
2611
|
if ((data.outMode !== exports.OutMode.bounce && data.outMode !== exports.OutMode.split) ||
|
|
3258
2612
|
(data.direction !== exports.OutModeDirection.left && data.direction !== exports.OutModeDirection.right)) {
|
|
@@ -3267,8 +2621,8 @@
|
|
|
3267
2621
|
const velocity = data.particle.velocity.x;
|
|
3268
2622
|
let bounced = false;
|
|
3269
2623
|
if (data.outOfCanvas &&
|
|
3270
|
-
((data.direction === exports.OutModeDirection.right && velocity > minVelocity
|
|
3271
|
-
(data.direction === exports.OutModeDirection.left && velocity < minVelocity
|
|
2624
|
+
((data.direction === exports.OutModeDirection.right && velocity > minVelocity) ||
|
|
2625
|
+
(data.direction === exports.OutModeDirection.left && velocity < minVelocity))) {
|
|
3272
2626
|
const newVelocity = getRangeValue(data.particle.options.bounce.horizontal.value);
|
|
3273
2627
|
data.particle.velocity.x *= -newVelocity;
|
|
3274
2628
|
bounced = true;
|
|
@@ -3301,8 +2655,8 @@
|
|
|
3301
2655
|
const velocity = data.particle.velocity.y;
|
|
3302
2656
|
let bounced = false;
|
|
3303
2657
|
if (data.outOfCanvas &&
|
|
3304
|
-
((data.direction === exports.OutModeDirection.bottom && velocity > minVelocity
|
|
3305
|
-
(data.direction === exports.OutModeDirection.top && velocity < minVelocity
|
|
2658
|
+
((data.direction === exports.OutModeDirection.bottom && velocity > minVelocity) ||
|
|
2659
|
+
(data.direction === exports.OutModeDirection.top && velocity < minVelocity))) {
|
|
3306
2660
|
const newVelocity = getRangeValue(data.particle.options.bounce.vertical.value);
|
|
3307
2661
|
data.particle.velocity.y *= -newVelocity;
|
|
3308
2662
|
bounced = true;
|
|
@@ -3355,7 +2709,6 @@
|
|
|
3355
2709
|
}
|
|
3356
2710
|
}
|
|
3357
2711
|
|
|
3358
|
-
const minVelocity$3 = 0;
|
|
3359
2712
|
class DestroyOutMode {
|
|
3360
2713
|
modes;
|
|
3361
2714
|
constructor(_container) {
|
|
@@ -3374,10 +2727,10 @@
|
|
|
3374
2727
|
break;
|
|
3375
2728
|
case exports.ParticleOutType.inside: {
|
|
3376
2729
|
const { dx, dy } = getDistances(particle.position, particle.moveCenter), { x: vx, y: vy } = particle.velocity;
|
|
3377
|
-
if ((vx < minVelocity
|
|
3378
|
-
(vy < minVelocity
|
|
3379
|
-
(vx >= minVelocity
|
|
3380
|
-
(vy >= minVelocity
|
|
2730
|
+
if ((vx < minVelocity && dx > particle.moveCenter.radius) ||
|
|
2731
|
+
(vy < minVelocity && dy > particle.moveCenter.radius) ||
|
|
2732
|
+
(vx >= minVelocity && dx < -particle.moveCenter.radius) ||
|
|
2733
|
+
(vy >= minVelocity && dy < -particle.moveCenter.radius)) {
|
|
3381
2734
|
return;
|
|
3382
2735
|
}
|
|
3383
2736
|
break;
|
|
@@ -3387,7 +2740,6 @@
|
|
|
3387
2740
|
}
|
|
3388
2741
|
}
|
|
3389
2742
|
|
|
3390
|
-
const minVelocity$2 = 0;
|
|
3391
2743
|
class NoneOutMode {
|
|
3392
2744
|
modes;
|
|
3393
2745
|
#container;
|
|
@@ -3407,10 +2759,10 @@
|
|
|
3407
2759
|
}
|
|
3408
2760
|
const gravityOptions = particle.options.move.gravity, container = this.#container, canvasSize = container.canvas.size, pRadius = particle.getRadius();
|
|
3409
2761
|
if (!gravityOptions.enable) {
|
|
3410
|
-
if ((particle.velocity.y > minVelocity
|
|
3411
|
-
(particle.velocity.y < minVelocity
|
|
3412
|
-
(particle.velocity.x > minVelocity
|
|
3413
|
-
(particle.velocity.x < minVelocity
|
|
2762
|
+
if ((particle.velocity.y > minVelocity && particle.position.y <= canvasSize.height + pRadius) ||
|
|
2763
|
+
(particle.velocity.y < minVelocity && particle.position.y >= -pRadius) ||
|
|
2764
|
+
(particle.velocity.x > minVelocity && particle.position.x <= canvasSize.width + pRadius) ||
|
|
2765
|
+
(particle.velocity.x < minVelocity && particle.position.x >= -pRadius)) {
|
|
3414
2766
|
return;
|
|
3415
2767
|
}
|
|
3416
2768
|
if (!isPointInside(particle.position, container.canvas.size, originPoint, pRadius, direction)) {
|
|
@@ -3429,7 +2781,7 @@
|
|
|
3429
2781
|
}
|
|
3430
2782
|
}
|
|
3431
2783
|
|
|
3432
|
-
const
|
|
2784
|
+
const updateVector = Vector.origin;
|
|
3433
2785
|
class OutOutMode {
|
|
3434
2786
|
modes;
|
|
3435
2787
|
#container;
|
|
@@ -3450,10 +2802,10 @@
|
|
|
3450
2802
|
updateVector.angle = particle.velocity.angle + Math.PI;
|
|
3451
2803
|
updateVector.addTo(particle.moveCenter);
|
|
3452
2804
|
const { dx, dy } = getDistances(particle.position, updateVector);
|
|
3453
|
-
if ((vx <= minVelocity
|
|
3454
|
-
(vy <= minVelocity
|
|
3455
|
-
(vx >= minVelocity
|
|
3456
|
-
(vy >= minVelocity
|
|
2805
|
+
if ((vx <= minVelocity && dx >= minDistance) ||
|
|
2806
|
+
(vy <= minVelocity && dy >= minDistance) ||
|
|
2807
|
+
(vx >= minVelocity && dx <= minDistance) ||
|
|
2808
|
+
(vy >= minVelocity && dy <= minDistance)) {
|
|
3457
2809
|
return;
|
|
3458
2810
|
}
|
|
3459
2811
|
particle.position.x = Math.floor(randomInRangeValue({
|
|
@@ -3577,21 +2929,21 @@
|
|
|
3577
2929
|
this.#updateOutMode(particle, delta, outModes.right ?? outModes.default, exports.OutModeDirection.right);
|
|
3578
2930
|
this.#updateOutMode(particle, delta, outModes.top ?? outModes.default, exports.OutModeDirection.top);
|
|
3579
2931
|
}
|
|
3580
|
-
#addUpdaterIfMissing
|
|
2932
|
+
#addUpdaterIfMissing(particle, outMode, getUpdater) {
|
|
3581
2933
|
const outModes = particle.options.move.outModes;
|
|
3582
2934
|
if (!this.updaters.has(outMode) && checkOutMode(outModes, outMode)) {
|
|
3583
2935
|
this.updaters.set(outMode, getUpdater(this.#container));
|
|
3584
2936
|
}
|
|
3585
|
-
}
|
|
3586
|
-
#updateOutMode
|
|
2937
|
+
}
|
|
2938
|
+
#updateOutMode(particle, delta, outMode, direction) {
|
|
3587
2939
|
for (const updater of this.updaters.values()) {
|
|
3588
2940
|
updater.update(particle, direction, delta, outMode);
|
|
3589
2941
|
}
|
|
3590
|
-
}
|
|
2942
|
+
}
|
|
3591
2943
|
}
|
|
3592
2944
|
|
|
3593
2945
|
async function loadOutModesUpdater(engine) {
|
|
3594
|
-
engine.checkVersion("4.
|
|
2946
|
+
engine.checkVersion("4.2.0");
|
|
3595
2947
|
await engine.pluginManager.register(e => {
|
|
3596
2948
|
e.pluginManager.addParticleUpdater("outModes", container => {
|
|
3597
2949
|
return Promise.resolve(new OutOfCanvasUpdater(container));
|
|
@@ -3662,7 +3014,7 @@
|
|
|
3662
3014
|
}
|
|
3663
3015
|
|
|
3664
3016
|
async function loadPaintUpdater(engine) {
|
|
3665
|
-
engine.checkVersion("4.
|
|
3017
|
+
engine.checkVersion("4.2.0");
|
|
3666
3018
|
await engine.pluginManager.register(e => {
|
|
3667
3019
|
e.pluginManager.addParticleUpdater("paint", container => {
|
|
3668
3020
|
return Promise.resolve(new PaintUpdater(e.pluginManager, container));
|
|
@@ -3717,37 +3069,26 @@
|
|
|
3717
3069
|
}
|
|
3718
3070
|
|
|
3719
3071
|
async function loadRgbColorPlugin(engine) {
|
|
3720
|
-
engine.checkVersion("4.
|
|
3072
|
+
engine.checkVersion("4.2.0");
|
|
3721
3073
|
await engine.pluginManager.register(e => {
|
|
3722
3074
|
e.pluginManager.addColorManager("rgb", new RgbColorManager());
|
|
3723
3075
|
});
|
|
3724
3076
|
}
|
|
3725
3077
|
|
|
3726
3078
|
class SizeAnimation extends RangedAnimationOptions {
|
|
3727
|
-
destroy;
|
|
3728
|
-
constructor() {
|
|
3729
|
-
super();
|
|
3730
|
-
this.destroy = exports.DestroyType.none;
|
|
3731
|
-
this.speed = 5;
|
|
3732
|
-
}
|
|
3079
|
+
destroy = exports.DestroyType.none;
|
|
3733
3080
|
load(data) {
|
|
3734
3081
|
super.load(data);
|
|
3735
3082
|
if (isNull(data)) {
|
|
3736
3083
|
return;
|
|
3737
3084
|
}
|
|
3738
|
-
|
|
3739
|
-
this.destroy = data.destroy;
|
|
3740
|
-
}
|
|
3085
|
+
loadProperty(this, "destroy", data.destroy);
|
|
3741
3086
|
}
|
|
3742
3087
|
}
|
|
3743
3088
|
|
|
3744
3089
|
class Size extends RangedAnimationValueWithRandom {
|
|
3745
|
-
animation;
|
|
3746
|
-
|
|
3747
|
-
super();
|
|
3748
|
-
this.animation = new SizeAnimation();
|
|
3749
|
-
this.value = 3;
|
|
3750
|
-
}
|
|
3090
|
+
animation = new SizeAnimation();
|
|
3091
|
+
value = 3;
|
|
3751
3092
|
load(data) {
|
|
3752
3093
|
super.load(data);
|
|
3753
3094
|
if (isNull(data)) {
|
|
@@ -3790,10 +3131,7 @@
|
|
|
3790
3131
|
(particle.size.loops ?? minLoops) < (particle.size.maxLoops ?? minLoops))));
|
|
3791
3132
|
}
|
|
3792
3133
|
loadOptions(options, ...sources) {
|
|
3793
|
-
options
|
|
3794
|
-
for (const source of sources) {
|
|
3795
|
-
options.size.load(source?.size);
|
|
3796
|
-
}
|
|
3134
|
+
loadOptionProperty(options, "size", Size, ...sources);
|
|
3797
3135
|
}
|
|
3798
3136
|
preInit(particle) {
|
|
3799
3137
|
const pxRatio = this.#container.retina.pixelRatio, options = particle.options, sizeOptions = options.size;
|
|
@@ -3816,7 +3154,7 @@
|
|
|
3816
3154
|
}
|
|
3817
3155
|
|
|
3818
3156
|
async function loadSizeUpdater(engine) {
|
|
3819
|
-
engine.checkVersion("4.
|
|
3157
|
+
engine.checkVersion("4.2.0");
|
|
3820
3158
|
await engine.pluginManager.register(e => {
|
|
3821
3159
|
e.pluginManager.addParticleUpdater("size", container => {
|
|
3822
3160
|
return Promise.resolve(new SizeUpdater(container));
|
|
@@ -3825,7 +3163,7 @@
|
|
|
3825
3163
|
}
|
|
3826
3164
|
|
|
3827
3165
|
async function loadBasic(engine) {
|
|
3828
|
-
engine.checkVersion("4.
|
|
3166
|
+
engine.checkVersion("4.2.0");
|
|
3829
3167
|
await engine.pluginManager.register(async (e) => {
|
|
3830
3168
|
await Promise.all([
|
|
3831
3169
|
loadBlendPlugin(e),
|
|
@@ -4125,7 +3463,7 @@
|
|
|
4125
3463
|
}
|
|
4126
3464
|
|
|
4127
3465
|
async function loadClubsSuitShape(engine) {
|
|
4128
|
-
engine.checkVersion("4.
|
|
3466
|
+
engine.checkVersion("4.2.0");
|
|
4129
3467
|
await engine.pluginManager.register(e => {
|
|
4130
3468
|
e.pluginManager.addShape(["club", "clubs"], () => Promise.resolve(new ClubDrawer()));
|
|
4131
3469
|
});
|
|
@@ -4139,7 +3477,7 @@
|
|
|
4139
3477
|
}
|
|
4140
3478
|
|
|
4141
3479
|
async function loadDiamondsSuitShape(engine) {
|
|
4142
|
-
engine.checkVersion("4.
|
|
3480
|
+
engine.checkVersion("4.2.0");
|
|
4143
3481
|
await engine.pluginManager.register(e => {
|
|
4144
3482
|
e.pluginManager.addShape(["diamond", "diamonds"], () => Promise.resolve(new DiamondDrawer()));
|
|
4145
3483
|
});
|
|
@@ -4153,7 +3491,7 @@
|
|
|
4153
3491
|
};
|
|
4154
3492
|
|
|
4155
3493
|
async function loadHeartsSuitShape(engine) {
|
|
4156
|
-
engine.checkVersion("4.
|
|
3494
|
+
engine.checkVersion("4.2.0");
|
|
4157
3495
|
await engine.pluginManager.register(e => {
|
|
4158
3496
|
e.pluginManager.addShape(["heart", "hearts"], () => Promise.resolve(new HeartDrawer$1()));
|
|
4159
3497
|
});
|
|
@@ -4167,14 +3505,14 @@
|
|
|
4167
3505
|
}
|
|
4168
3506
|
|
|
4169
3507
|
async function loadSpadesSuitShape(engine) {
|
|
4170
|
-
engine.checkVersion("4.
|
|
3508
|
+
engine.checkVersion("4.2.0");
|
|
4171
3509
|
await engine.pluginManager.register(e => {
|
|
4172
3510
|
e.pluginManager.addShape(["spade", "spades"], () => Promise.resolve(new SpadeDrawer()));
|
|
4173
3511
|
});
|
|
4174
3512
|
}
|
|
4175
3513
|
|
|
4176
3514
|
async function loadCardSuitsShape(engine) {
|
|
4177
|
-
engine.checkVersion("4.
|
|
3515
|
+
engine.checkVersion("4.2.0");
|
|
4178
3516
|
await Promise.all([
|
|
4179
3517
|
loadClubsSuitShape(engine),
|
|
4180
3518
|
loadDiamondsSuitShape(engine),
|
|
@@ -4187,78 +3525,46 @@
|
|
|
4187
3525
|
count;
|
|
4188
3526
|
delay;
|
|
4189
3527
|
duration;
|
|
4190
|
-
wait;
|
|
4191
|
-
constructor() {
|
|
4192
|
-
this.wait = false;
|
|
4193
|
-
}
|
|
3528
|
+
wait = false;
|
|
4194
3529
|
load(data) {
|
|
4195
3530
|
if (isNull(data)) {
|
|
4196
3531
|
return;
|
|
4197
3532
|
}
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
this.delay = setRangeValue(data.delay);
|
|
4203
|
-
}
|
|
4204
|
-
if (data.duration !== undefined) {
|
|
4205
|
-
this.duration = setRangeValue(data.duration);
|
|
4206
|
-
}
|
|
4207
|
-
if (data.wait !== undefined) {
|
|
4208
|
-
this.wait = data.wait;
|
|
4209
|
-
}
|
|
3533
|
+
loadProperty(this, "count", data.count);
|
|
3534
|
+
loadRangeProperty(this, "delay", data.delay);
|
|
3535
|
+
loadRangeProperty(this, "duration", data.duration);
|
|
3536
|
+
loadProperty(this, "wait", data.wait);
|
|
4210
3537
|
}
|
|
4211
3538
|
}
|
|
4212
3539
|
|
|
4213
3540
|
class EmitterRate {
|
|
4214
|
-
delay;
|
|
4215
|
-
quantity;
|
|
4216
|
-
constructor() {
|
|
4217
|
-
this.quantity = 1;
|
|
4218
|
-
this.delay = 0.1;
|
|
4219
|
-
}
|
|
3541
|
+
delay = 0.1;
|
|
3542
|
+
quantity = 1;
|
|
4220
3543
|
load(data) {
|
|
4221
3544
|
if (isNull(data)) {
|
|
4222
3545
|
return;
|
|
4223
3546
|
}
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
}
|
|
4227
|
-
if (data.delay !== undefined) {
|
|
4228
|
-
this.delay = setRangeValue(data.delay);
|
|
4229
|
-
}
|
|
3547
|
+
loadRangeProperty(this, "quantity", data.quantity);
|
|
3548
|
+
loadRangeProperty(this, "delay", data.delay);
|
|
4230
3549
|
}
|
|
4231
3550
|
}
|
|
4232
3551
|
|
|
4233
3552
|
class EmitterShapeReplace {
|
|
4234
|
-
color;
|
|
4235
|
-
opacity;
|
|
4236
|
-
constructor() {
|
|
4237
|
-
this.color = false;
|
|
4238
|
-
this.opacity = false;
|
|
4239
|
-
}
|
|
3553
|
+
color = false;
|
|
3554
|
+
opacity = false;
|
|
4240
3555
|
load(data) {
|
|
4241
3556
|
if (isNull(data)) {
|
|
4242
3557
|
return;
|
|
4243
3558
|
}
|
|
4244
|
-
|
|
4245
|
-
|
|
4246
|
-
}
|
|
4247
|
-
if (data.opacity !== undefined) {
|
|
4248
|
-
this.opacity = data.opacity;
|
|
4249
|
-
}
|
|
3559
|
+
loadProperty(this, "color", data.color);
|
|
3560
|
+
loadProperty(this, "opacity", data.opacity);
|
|
4250
3561
|
}
|
|
4251
3562
|
}
|
|
4252
3563
|
|
|
4253
3564
|
class EmitterShape {
|
|
4254
|
-
options;
|
|
4255
|
-
replace;
|
|
4256
|
-
type;
|
|
4257
|
-
constructor() {
|
|
4258
|
-
this.options = {};
|
|
4259
|
-
this.replace = new EmitterShapeReplace();
|
|
4260
|
-
this.type = "square";
|
|
4261
|
-
}
|
|
3565
|
+
options = {};
|
|
3566
|
+
replace = new EmitterShapeReplace();
|
|
3567
|
+
type = "square";
|
|
4262
3568
|
load(data) {
|
|
4263
3569
|
if (isNull(data)) {
|
|
4264
3570
|
return;
|
|
@@ -4267,34 +3573,21 @@
|
|
|
4267
3573
|
this.options = deepExtend({}, data.options ?? {});
|
|
4268
3574
|
}
|
|
4269
3575
|
this.replace.load(data.replace);
|
|
4270
|
-
|
|
4271
|
-
this.type = data.type;
|
|
4272
|
-
}
|
|
3576
|
+
loadProperty(this, "type", data.type);
|
|
4273
3577
|
}
|
|
4274
3578
|
}
|
|
4275
3579
|
|
|
4276
3580
|
class EmitterSize {
|
|
4277
|
-
height;
|
|
4278
|
-
mode;
|
|
4279
|
-
width;
|
|
4280
|
-
constructor() {
|
|
4281
|
-
this.mode = exports.PixelMode.percent;
|
|
4282
|
-
this.height = 0;
|
|
4283
|
-
this.width = 0;
|
|
4284
|
-
}
|
|
3581
|
+
height = 0;
|
|
3582
|
+
mode = exports.PixelMode.percent;
|
|
3583
|
+
width = 0;
|
|
4285
3584
|
load(data) {
|
|
4286
3585
|
if (isNull(data)) {
|
|
4287
3586
|
return;
|
|
4288
3587
|
}
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
if (data.height !== undefined) {
|
|
4293
|
-
this.height = data.height;
|
|
4294
|
-
}
|
|
4295
|
-
if (data.width !== undefined) {
|
|
4296
|
-
this.width = data.width;
|
|
4297
|
-
}
|
|
3588
|
+
loadProperty(this, "mode", data.mode);
|
|
3589
|
+
loadProperty(this, "height", data.height);
|
|
3590
|
+
loadProperty(this, "width", data.width);
|
|
4298
3591
|
}
|
|
4299
3592
|
}
|
|
4300
3593
|
|
|
@@ -4317,50 +3610,35 @@
|
|
|
4317
3610
|
}
|
|
4318
3611
|
|
|
4319
3612
|
class Emitter {
|
|
4320
|
-
autoPlay;
|
|
3613
|
+
autoPlay = true;
|
|
4321
3614
|
direction;
|
|
4322
3615
|
domId;
|
|
4323
|
-
fill;
|
|
4324
|
-
life;
|
|
3616
|
+
fill = true;
|
|
3617
|
+
life = new EmitterLife();
|
|
4325
3618
|
name;
|
|
4326
3619
|
particles;
|
|
4327
3620
|
position;
|
|
4328
|
-
rate;
|
|
4329
|
-
shape;
|
|
3621
|
+
rate = new EmitterRate();
|
|
3622
|
+
shape = new EmitterShape();
|
|
4330
3623
|
size;
|
|
4331
|
-
spawn;
|
|
3624
|
+
spawn = new EmitterSpawn();
|
|
4332
3625
|
spawnFillColor;
|
|
4333
3626
|
spawnStrokeColor;
|
|
4334
|
-
startCount;
|
|
4335
|
-
constructor() {
|
|
4336
|
-
this.autoPlay = true;
|
|
4337
|
-
this.fill = true;
|
|
4338
|
-
this.life = new EmitterLife();
|
|
4339
|
-
this.rate = new EmitterRate();
|
|
4340
|
-
this.shape = new EmitterShape();
|
|
4341
|
-
this.spawn = new EmitterSpawn();
|
|
4342
|
-
this.startCount = 0;
|
|
4343
|
-
}
|
|
3627
|
+
startCount = 0;
|
|
4344
3628
|
load(data) {
|
|
4345
3629
|
if (isNull(data)) {
|
|
4346
3630
|
return;
|
|
4347
3631
|
}
|
|
4348
|
-
|
|
4349
|
-
this.autoPlay = data.autoPlay;
|
|
4350
|
-
}
|
|
3632
|
+
loadProperty(this, "autoPlay", data.autoPlay);
|
|
4351
3633
|
if (data.size !== undefined) {
|
|
4352
3634
|
this.size ??= new EmitterSize();
|
|
4353
3635
|
this.size.load(data.size);
|
|
4354
3636
|
}
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
this.domId = data.domId;
|
|
4359
|
-
if (data.fill !== undefined) {
|
|
4360
|
-
this.fill = data.fill;
|
|
4361
|
-
}
|
|
3637
|
+
loadProperty(this, "direction", data.direction);
|
|
3638
|
+
loadProperty(this, "domId", data.domId);
|
|
3639
|
+
loadProperty(this, "fill", data.fill);
|
|
4362
3640
|
this.life.load(data.life);
|
|
4363
|
-
this
|
|
3641
|
+
loadProperty(this, "name", data.name);
|
|
4364
3642
|
this.particles = executeOnSingleOrMultiple(data.particles, particles => {
|
|
4365
3643
|
return deepExtend({}, particles);
|
|
4366
3644
|
});
|
|
@@ -4384,9 +3662,7 @@
|
|
|
4384
3662
|
this.spawnStrokeColor ??= new AnimatableColor();
|
|
4385
3663
|
this.spawnStrokeColor.load(data.spawnStrokeColor);
|
|
4386
3664
|
}
|
|
4387
|
-
|
|
4388
|
-
this.startCount = data.startCount;
|
|
4389
|
-
}
|
|
3665
|
+
loadProperty(this, "startCount", data.startCount);
|
|
4390
3666
|
}
|
|
4391
3667
|
}
|
|
4392
3668
|
|
|
@@ -4451,7 +3727,7 @@
|
|
|
4451
3727
|
})(EmitterClickMode || (EmitterClickMode = {}));
|
|
4452
3728
|
|
|
4453
3729
|
async function loadEmittersPluginSimple(engine) {
|
|
4454
|
-
engine.checkVersion("4.
|
|
3730
|
+
engine.checkVersion("4.2.0");
|
|
4455
3731
|
await engine.pluginManager.register(async (e) => {
|
|
4456
3732
|
const instancesManager = await getEmittersInstancesManager(e);
|
|
4457
3733
|
await addEmittersShapesManager(e);
|
|
@@ -4553,7 +3829,7 @@
|
|
|
4553
3829
|
}
|
|
4554
3830
|
|
|
4555
3831
|
async function loadEmojiShape(engine) {
|
|
4556
|
-
engine.checkVersion("4.
|
|
3832
|
+
engine.checkVersion("4.2.0");
|
|
4557
3833
|
await engine.pluginManager.register(e => {
|
|
4558
3834
|
e.pluginManager.addShape(validTypes, () => Promise.resolve(new EmojiDrawer()));
|
|
4559
3835
|
});
|
|
@@ -4579,7 +3855,7 @@
|
|
|
4579
3855
|
}
|
|
4580
3856
|
|
|
4581
3857
|
async function loadHeartShape(engine) {
|
|
4582
|
-
engine.checkVersion("4.
|
|
3858
|
+
engine.checkVersion("4.2.0");
|
|
4583
3859
|
await engine.pluginManager.register(e => {
|
|
4584
3860
|
e.pluginManager.addShape(["heart"], () => Promise.resolve(new HeartDrawer()));
|
|
4585
3861
|
});
|
|
@@ -5282,38 +4558,22 @@
|
|
|
5282
4558
|
}
|
|
5283
4559
|
|
|
5284
4560
|
class Preload {
|
|
5285
|
-
gif;
|
|
4561
|
+
gif = false;
|
|
5286
4562
|
height;
|
|
5287
4563
|
name;
|
|
5288
4564
|
replaceColor;
|
|
5289
|
-
src;
|
|
4565
|
+
src = "";
|
|
5290
4566
|
width;
|
|
5291
|
-
constructor() {
|
|
5292
|
-
this.src = "";
|
|
5293
|
-
this.gif = false;
|
|
5294
|
-
}
|
|
5295
4567
|
load(data) {
|
|
5296
4568
|
if (isNull(data)) {
|
|
5297
4569
|
return;
|
|
5298
4570
|
}
|
|
5299
|
-
|
|
5300
|
-
|
|
5301
|
-
|
|
5302
|
-
|
|
5303
|
-
|
|
5304
|
-
|
|
5305
|
-
if (data.name !== undefined) {
|
|
5306
|
-
this.name = data.name;
|
|
5307
|
-
}
|
|
5308
|
-
if (data.replaceColor !== undefined) {
|
|
5309
|
-
this.replaceColor = data.replaceColor;
|
|
5310
|
-
}
|
|
5311
|
-
if (data.src !== undefined) {
|
|
5312
|
-
this.src = data.src;
|
|
5313
|
-
}
|
|
5314
|
-
if (data.width !== undefined) {
|
|
5315
|
-
this.width = data.width;
|
|
5316
|
-
}
|
|
4571
|
+
loadProperty(this, "gif", data.gif);
|
|
4572
|
+
loadProperty(this, "height", data.height);
|
|
4573
|
+
loadProperty(this, "name", data.name);
|
|
4574
|
+
loadProperty(this, "replaceColor", data.replaceColor);
|
|
4575
|
+
loadProperty(this, "src", data.src);
|
|
4576
|
+
loadProperty(this, "width", data.width);
|
|
5317
4577
|
}
|
|
5318
4578
|
}
|
|
5319
4579
|
|
|
@@ -5404,7 +4664,7 @@
|
|
|
5404
4664
|
};
|
|
5405
4665
|
}
|
|
5406
4666
|
async function loadImageShape(engine) {
|
|
5407
|
-
engine.checkVersion("4.
|
|
4667
|
+
engine.checkVersion("4.2.0");
|
|
5408
4668
|
await engine.pluginManager.register(e => {
|
|
5409
4669
|
addLoadImageToEngine(e);
|
|
5410
4670
|
e.pluginManager.addPlugin(new ImagePreloaderPlugin(e));
|
|
@@ -5413,55 +4673,36 @@
|
|
|
5413
4673
|
}
|
|
5414
4674
|
|
|
5415
4675
|
class LifeDelay extends ValueWithRandom {
|
|
5416
|
-
sync;
|
|
5417
|
-
constructor() {
|
|
5418
|
-
super();
|
|
5419
|
-
this.sync = false;
|
|
5420
|
-
}
|
|
4676
|
+
sync = false;
|
|
5421
4677
|
load(data) {
|
|
5422
4678
|
if (isNull(data)) {
|
|
5423
4679
|
return;
|
|
5424
4680
|
}
|
|
5425
4681
|
super.load(data);
|
|
5426
|
-
|
|
5427
|
-
this.sync = data.sync;
|
|
5428
|
-
}
|
|
4682
|
+
loadProperty(this, "sync", data.sync);
|
|
5429
4683
|
}
|
|
5430
4684
|
}
|
|
5431
4685
|
|
|
5432
4686
|
class LifeDuration extends ValueWithRandom {
|
|
5433
|
-
sync;
|
|
5434
|
-
constructor() {
|
|
5435
|
-
super();
|
|
5436
|
-
this.sync = false;
|
|
5437
|
-
}
|
|
4687
|
+
sync = false;
|
|
5438
4688
|
load(data) {
|
|
5439
4689
|
if (isNull(data)) {
|
|
5440
4690
|
return;
|
|
5441
4691
|
}
|
|
5442
4692
|
super.load(data);
|
|
5443
|
-
|
|
5444
|
-
this.sync = data.sync;
|
|
5445
|
-
}
|
|
4693
|
+
loadProperty(this, "sync", data.sync);
|
|
5446
4694
|
}
|
|
5447
4695
|
}
|
|
5448
4696
|
|
|
5449
4697
|
class Life {
|
|
5450
|
-
count;
|
|
5451
|
-
delay;
|
|
5452
|
-
duration;
|
|
5453
|
-
constructor() {
|
|
5454
|
-
this.count = 0;
|
|
5455
|
-
this.delay = new LifeDelay();
|
|
5456
|
-
this.duration = new LifeDuration();
|
|
5457
|
-
}
|
|
4698
|
+
count = 0;
|
|
4699
|
+
delay = new LifeDelay();
|
|
4700
|
+
duration = new LifeDuration();
|
|
5458
4701
|
load(data) {
|
|
5459
4702
|
if (isNull(data)) {
|
|
5460
4703
|
return;
|
|
5461
4704
|
}
|
|
5462
|
-
|
|
5463
|
-
this.count = data.count;
|
|
5464
|
-
}
|
|
4705
|
+
loadProperty(this, "count", data.count);
|
|
5465
4706
|
this.delay.load(data.delay);
|
|
5466
4707
|
this.duration.load(data.duration);
|
|
5467
4708
|
}
|
|
@@ -5520,7 +4761,7 @@
|
|
|
5520
4761
|
}
|
|
5521
4762
|
}
|
|
5522
4763
|
|
|
5523
|
-
const noTime = 0, identity$
|
|
4764
|
+
const noTime = 0, identity$1 = 1, infiniteValue = -1;
|
|
5524
4765
|
class LifeUpdater {
|
|
5525
4766
|
#container;
|
|
5526
4767
|
constructor(container) {
|
|
@@ -5531,7 +4772,7 @@
|
|
|
5531
4772
|
if (!lifeOptions) {
|
|
5532
4773
|
return;
|
|
5533
4774
|
}
|
|
5534
|
-
const delayFactor = lifeOptions.delay.sync ? identity$
|
|
4775
|
+
const delayFactor = lifeOptions.delay.sync ? identity$1 : getRandom(), durationFactor = lifeOptions.duration.sync ? identity$1 : getRandom();
|
|
5535
4776
|
particle.life = {
|
|
5536
4777
|
delay: container.retina.reduceFactor
|
|
5537
4778
|
? ((getRangeValue(lifeOptions.delay.value) * delayFactor) / container.retina.reduceFactor) *
|
|
@@ -5557,10 +4798,7 @@
|
|
|
5557
4798
|
return !particle.destroyed;
|
|
5558
4799
|
}
|
|
5559
4800
|
loadOptions(options, ...sources) {
|
|
5560
|
-
options
|
|
5561
|
-
for (const source of sources) {
|
|
5562
|
-
options.life.load(source?.life);
|
|
5563
|
-
}
|
|
4801
|
+
loadOptionProperty(options, "life", Life, ...sources);
|
|
5564
4802
|
}
|
|
5565
4803
|
update(particle, delta) {
|
|
5566
4804
|
if (!this.isEnabled(particle) || !particle.life) {
|
|
@@ -5571,7 +4809,7 @@
|
|
|
5571
4809
|
}
|
|
5572
4810
|
|
|
5573
4811
|
async function loadLifeUpdater(engine) {
|
|
5574
|
-
engine.checkVersion("4.
|
|
4812
|
+
engine.checkVersion("4.2.0");
|
|
5575
4813
|
await engine.pluginManager.register(e => {
|
|
5576
4814
|
e.pluginManager.addParticleUpdater("life", container => {
|
|
5577
4815
|
return Promise.resolve(new LifeUpdater(container));
|
|
@@ -5580,39 +4818,25 @@
|
|
|
5580
4818
|
}
|
|
5581
4819
|
|
|
5582
4820
|
class MotionReduce {
|
|
5583
|
-
factor;
|
|
5584
|
-
value;
|
|
5585
|
-
constructor() {
|
|
5586
|
-
this.factor = 4;
|
|
5587
|
-
this.value = true;
|
|
5588
|
-
}
|
|
4821
|
+
factor = 4;
|
|
4822
|
+
value = true;
|
|
5589
4823
|
load(data) {
|
|
5590
4824
|
if (isNull(data)) {
|
|
5591
4825
|
return;
|
|
5592
4826
|
}
|
|
5593
|
-
|
|
5594
|
-
|
|
5595
|
-
}
|
|
5596
|
-
if (data.value !== undefined) {
|
|
5597
|
-
this.value = data.value;
|
|
5598
|
-
}
|
|
4827
|
+
loadProperty(this, "factor", data.factor);
|
|
4828
|
+
loadProperty(this, "value", data.value);
|
|
5599
4829
|
}
|
|
5600
4830
|
}
|
|
5601
4831
|
|
|
5602
4832
|
class Motion {
|
|
5603
|
-
disable;
|
|
5604
|
-
reduce;
|
|
5605
|
-
constructor() {
|
|
5606
|
-
this.disable = true;
|
|
5607
|
-
this.reduce = new MotionReduce();
|
|
5608
|
-
}
|
|
4833
|
+
disable = true;
|
|
4834
|
+
reduce = new MotionReduce();
|
|
5609
4835
|
load(data) {
|
|
5610
4836
|
if (isNull(data)) {
|
|
5611
4837
|
return;
|
|
5612
4838
|
}
|
|
5613
|
-
|
|
5614
|
-
this.disable = data.disable;
|
|
5615
|
-
}
|
|
4839
|
+
loadProperty(this, "disable", data.disable);
|
|
5616
4840
|
this.reduce.load(data.reduce);
|
|
5617
4841
|
}
|
|
5618
4842
|
}
|
|
@@ -5639,7 +4863,7 @@
|
|
|
5639
4863
|
}
|
|
5640
4864
|
|
|
5641
4865
|
async function loadMotionPlugin(engine) {
|
|
5642
|
-
engine.checkVersion("4.
|
|
4866
|
+
engine.checkVersion("4.2.0");
|
|
5643
4867
|
await engine.pluginManager.register(e => {
|
|
5644
4868
|
e.pluginManager.addPlugin(new MotionPlugin());
|
|
5645
4869
|
});
|
|
@@ -5724,19 +4948,19 @@
|
|
|
5724
4948
|
}
|
|
5725
4949
|
|
|
5726
4950
|
async function loadGenericPolygonShape(engine) {
|
|
5727
|
-
engine.checkVersion("4.
|
|
4951
|
+
engine.checkVersion("4.2.0");
|
|
5728
4952
|
await engine.pluginManager.register(e => {
|
|
5729
4953
|
e.pluginManager.addShape(["polygon"], () => Promise.resolve(new PolygonDrawer()));
|
|
5730
4954
|
});
|
|
5731
4955
|
}
|
|
5732
4956
|
async function loadTriangleShape(engine) {
|
|
5733
|
-
engine.checkVersion("4.
|
|
4957
|
+
engine.checkVersion("4.2.0");
|
|
5734
4958
|
await engine.pluginManager.register(e => {
|
|
5735
4959
|
e.pluginManager.addShape(["triangle"], () => Promise.resolve(new TriangleDrawer()));
|
|
5736
4960
|
});
|
|
5737
4961
|
}
|
|
5738
4962
|
async function loadPolygonShape(engine) {
|
|
5739
|
-
engine.checkVersion("4.
|
|
4963
|
+
engine.checkVersion("4.2.0");
|
|
5740
4964
|
await Promise.all([
|
|
5741
4965
|
loadGenericPolygonShape(engine),
|
|
5742
4966
|
loadTriangleShape(engine),
|
|
@@ -5806,39 +5030,24 @@
|
|
|
5806
5030
|
}
|
|
5807
5031
|
|
|
5808
5032
|
class RollLight {
|
|
5809
|
-
enable;
|
|
5810
|
-
value;
|
|
5811
|
-
constructor() {
|
|
5812
|
-
this.enable = false;
|
|
5813
|
-
this.value = 0;
|
|
5814
|
-
}
|
|
5033
|
+
enable = false;
|
|
5034
|
+
value = 0;
|
|
5815
5035
|
load(data) {
|
|
5816
5036
|
if (isNull(data)) {
|
|
5817
5037
|
return;
|
|
5818
5038
|
}
|
|
5819
|
-
|
|
5820
|
-
|
|
5821
|
-
}
|
|
5822
|
-
if (data.value !== undefined) {
|
|
5823
|
-
this.value = setRangeValue(data.value);
|
|
5824
|
-
}
|
|
5039
|
+
loadProperty(this, "enable", data.enable);
|
|
5040
|
+
loadRangeProperty(this, "value", data.value);
|
|
5825
5041
|
}
|
|
5826
5042
|
}
|
|
5827
5043
|
|
|
5828
5044
|
class Roll {
|
|
5829
5045
|
backColor;
|
|
5830
|
-
darken;
|
|
5831
|
-
enable;
|
|
5832
|
-
enlighten;
|
|
5833
|
-
mode;
|
|
5834
|
-
speed;
|
|
5835
|
-
constructor() {
|
|
5836
|
-
this.darken = new RollLight();
|
|
5837
|
-
this.enable = false;
|
|
5838
|
-
this.enlighten = new RollLight();
|
|
5839
|
-
this.mode = RollMode.vertical;
|
|
5840
|
-
this.speed = 25;
|
|
5841
|
-
}
|
|
5046
|
+
darken = new RollLight();
|
|
5047
|
+
enable = false;
|
|
5048
|
+
enlighten = new RollLight();
|
|
5049
|
+
mode = RollMode.vertical;
|
|
5050
|
+
speed = 25;
|
|
5842
5051
|
load(data) {
|
|
5843
5052
|
if (isNull(data)) {
|
|
5844
5053
|
return;
|
|
@@ -5847,16 +5056,10 @@
|
|
|
5847
5056
|
this.backColor = OptionsColor.create(this.backColor, data.backColor);
|
|
5848
5057
|
}
|
|
5849
5058
|
this.darken.load(data.darken);
|
|
5850
|
-
|
|
5851
|
-
this.enable = data.enable;
|
|
5852
|
-
}
|
|
5059
|
+
loadProperty(this, "enable", data.enable);
|
|
5853
5060
|
this.enlighten.load(data.enlighten);
|
|
5854
|
-
|
|
5855
|
-
|
|
5856
|
-
}
|
|
5857
|
-
if (data.speed !== undefined) {
|
|
5858
|
-
this.speed = setRangeValue(data.speed);
|
|
5859
|
-
}
|
|
5061
|
+
loadProperty(this, "mode", data.mode);
|
|
5062
|
+
loadRangeProperty(this, "speed", data.speed);
|
|
5860
5063
|
}
|
|
5861
5064
|
}
|
|
5862
5065
|
|
|
@@ -5880,10 +5083,7 @@
|
|
|
5880
5083
|
return !particle.destroyed && !particle.spawning && !!roll?.enable;
|
|
5881
5084
|
}
|
|
5882
5085
|
loadOptions(options, ...sources) {
|
|
5883
|
-
options
|
|
5884
|
-
for (const source of sources) {
|
|
5885
|
-
options.roll.load(source?.roll);
|
|
5886
|
-
}
|
|
5086
|
+
loadOptionProperty(options, "roll", Roll, ...sources);
|
|
5887
5087
|
}
|
|
5888
5088
|
update(particle, delta) {
|
|
5889
5089
|
if (!this.isEnabled(particle)) {
|
|
@@ -5894,7 +5094,7 @@
|
|
|
5894
5094
|
}
|
|
5895
5095
|
|
|
5896
5096
|
async function loadRollUpdater(engine) {
|
|
5897
|
-
engine.checkVersion("4.
|
|
5097
|
+
engine.checkVersion("4.2.0");
|
|
5898
5098
|
await engine.pluginManager.register(e => {
|
|
5899
5099
|
e.pluginManager.addParticleUpdater("roll", () => {
|
|
5900
5100
|
return Promise.resolve(new RollUpdater(e.pluginManager));
|
|
@@ -5903,58 +5103,33 @@
|
|
|
5903
5103
|
}
|
|
5904
5104
|
|
|
5905
5105
|
class RotateAnimation {
|
|
5906
|
-
decay;
|
|
5907
|
-
enable;
|
|
5908
|
-
speed;
|
|
5909
|
-
sync;
|
|
5910
|
-
constructor() {
|
|
5911
|
-
this.enable = false;
|
|
5912
|
-
this.speed = 0;
|
|
5913
|
-
this.decay = 0;
|
|
5914
|
-
this.sync = false;
|
|
5915
|
-
}
|
|
5106
|
+
decay = 0;
|
|
5107
|
+
enable = false;
|
|
5108
|
+
speed = 0;
|
|
5109
|
+
sync = false;
|
|
5916
5110
|
load(data) {
|
|
5917
5111
|
if (isNull(data)) {
|
|
5918
5112
|
return;
|
|
5919
5113
|
}
|
|
5920
|
-
|
|
5921
|
-
|
|
5922
|
-
|
|
5923
|
-
|
|
5924
|
-
this.speed = setRangeValue(data.speed);
|
|
5925
|
-
}
|
|
5926
|
-
if (data.decay !== undefined) {
|
|
5927
|
-
this.decay = setRangeValue(data.decay);
|
|
5928
|
-
}
|
|
5929
|
-
if (data.sync !== undefined) {
|
|
5930
|
-
this.sync = data.sync;
|
|
5931
|
-
}
|
|
5114
|
+
loadProperty(this, "enable", data.enable);
|
|
5115
|
+
loadRangeProperty(this, "speed", data.speed);
|
|
5116
|
+
loadRangeProperty(this, "decay", data.decay);
|
|
5117
|
+
loadProperty(this, "sync", data.sync);
|
|
5932
5118
|
}
|
|
5933
5119
|
}
|
|
5934
5120
|
|
|
5935
5121
|
class Rotate extends ValueWithRandom {
|
|
5936
|
-
animation;
|
|
5937
|
-
direction;
|
|
5938
|
-
path;
|
|
5939
|
-
constructor() {
|
|
5940
|
-
super();
|
|
5941
|
-
this.animation = new RotateAnimation();
|
|
5942
|
-
this.direction = exports.RotateDirection.clockwise;
|
|
5943
|
-
this.path = false;
|
|
5944
|
-
this.value = 0;
|
|
5945
|
-
}
|
|
5122
|
+
animation = new RotateAnimation();
|
|
5123
|
+
direction = exports.RotateDirection.clockwise;
|
|
5124
|
+
path = false;
|
|
5946
5125
|
load(data) {
|
|
5947
5126
|
if (isNull(data)) {
|
|
5948
5127
|
return;
|
|
5949
5128
|
}
|
|
5950
5129
|
super.load(data);
|
|
5951
|
-
|
|
5952
|
-
this.direction = data.direction;
|
|
5953
|
-
}
|
|
5130
|
+
loadProperty(this, "direction", data.direction);
|
|
5954
5131
|
this.animation.load(data.animation);
|
|
5955
|
-
|
|
5956
|
-
this.path = data.path;
|
|
5957
|
-
}
|
|
5132
|
+
loadProperty(this, "path", data.path);
|
|
5958
5133
|
}
|
|
5959
5134
|
}
|
|
5960
5135
|
|
|
@@ -5992,7 +5167,7 @@
|
|
|
5992
5167
|
}
|
|
5993
5168
|
const rotateAnimation = rotateOptions.animation;
|
|
5994
5169
|
if (rotateAnimation.enable) {
|
|
5995
|
-
particle.rotate.decay = identity$
|
|
5170
|
+
particle.rotate.decay = identity$2 - getRangeValue(rotateAnimation.decay);
|
|
5996
5171
|
particle.rotate.velocity =
|
|
5997
5172
|
(getRangeValue(rotateAnimation.speed) / doublePIDeg) * this.#container.retina.reduceFactor;
|
|
5998
5173
|
if (!rotateAnimation.sync) {
|
|
@@ -6009,10 +5184,7 @@
|
|
|
6009
5184
|
return !particle.destroyed && !particle.spawning && (!!rotate.value || rotate.animation.enable || rotate.path);
|
|
6010
5185
|
}
|
|
6011
5186
|
loadOptions(options, ...sources) {
|
|
6012
|
-
options
|
|
6013
|
-
for (const source of sources) {
|
|
6014
|
-
options.rotate.load(source?.rotate);
|
|
6015
|
-
}
|
|
5187
|
+
loadOptionProperty(options, "rotate", Rotate, ...sources);
|
|
6016
5188
|
}
|
|
6017
5189
|
update(particle, delta) {
|
|
6018
5190
|
if (!this.isEnabled(particle)) {
|
|
@@ -6028,7 +5200,7 @@
|
|
|
6028
5200
|
}
|
|
6029
5201
|
|
|
6030
5202
|
async function loadRotateUpdater(engine) {
|
|
6031
|
-
engine.checkVersion("4.
|
|
5203
|
+
engine.checkVersion("4.2.0");
|
|
6032
5204
|
await engine.pluginManager.register(e => {
|
|
6033
5205
|
e.pluginManager.addParticleUpdater("rotate", container => {
|
|
6034
5206
|
return Promise.resolve(new RotateUpdater(container));
|
|
@@ -6052,7 +5224,7 @@
|
|
|
6052
5224
|
}
|
|
6053
5225
|
|
|
6054
5226
|
async function loadSquareShape(engine) {
|
|
6055
|
-
engine.checkVersion("4.
|
|
5227
|
+
engine.checkVersion("4.2.0");
|
|
6056
5228
|
await engine.pluginManager.register(e => {
|
|
6057
5229
|
e.pluginManager.addShape(["edge", "square"], () => Promise.resolve(new SquareDrawer()));
|
|
6058
5230
|
});
|
|
@@ -6086,7 +5258,7 @@
|
|
|
6086
5258
|
}
|
|
6087
5259
|
|
|
6088
5260
|
async function loadStarShape(engine) {
|
|
6089
|
-
engine.checkVersion("4.
|
|
5261
|
+
engine.checkVersion("4.2.0");
|
|
6090
5262
|
await engine.pluginManager.register(e => {
|
|
6091
5263
|
e.pluginManager.addShape(["star"], () => Promise.resolve(new StarDrawer()));
|
|
6092
5264
|
});
|
|
@@ -6099,59 +5271,34 @@
|
|
|
6099
5271
|
TiltDirection["random"] = "random";
|
|
6100
5272
|
})(TiltDirection || (TiltDirection = {}));
|
|
6101
5273
|
|
|
6102
|
-
class TiltAnimation {
|
|
6103
|
-
decay;
|
|
6104
|
-
enable;
|
|
6105
|
-
speed;
|
|
6106
|
-
sync;
|
|
6107
|
-
|
|
6108
|
-
|
|
6109
|
-
|
|
6110
|
-
this.decay = 0;
|
|
6111
|
-
this.sync = false;
|
|
6112
|
-
}
|
|
6113
|
-
load(data) {
|
|
6114
|
-
if (isNull(data)) {
|
|
6115
|
-
return;
|
|
6116
|
-
}
|
|
6117
|
-
if (data.enable !== undefined) {
|
|
6118
|
-
this.enable = data.enable;
|
|
6119
|
-
}
|
|
6120
|
-
if (data.speed !== undefined) {
|
|
6121
|
-
this.speed = setRangeValue(data.speed);
|
|
6122
|
-
}
|
|
6123
|
-
if (data.decay !== undefined) {
|
|
6124
|
-
this.decay = setRangeValue(data.decay);
|
|
6125
|
-
}
|
|
6126
|
-
if (data.sync !== undefined) {
|
|
6127
|
-
this.sync = data.sync;
|
|
5274
|
+
class TiltAnimation {
|
|
5275
|
+
decay = 0;
|
|
5276
|
+
enable = false;
|
|
5277
|
+
speed = 0;
|
|
5278
|
+
sync = false;
|
|
5279
|
+
load(data) {
|
|
5280
|
+
if (isNull(data)) {
|
|
5281
|
+
return;
|
|
6128
5282
|
}
|
|
5283
|
+
loadProperty(this, "enable", data.enable);
|
|
5284
|
+
loadRangeProperty(this, "speed", data.speed);
|
|
5285
|
+
loadRangeProperty(this, "decay", data.decay);
|
|
5286
|
+
loadProperty(this, "sync", data.sync);
|
|
6129
5287
|
}
|
|
6130
5288
|
}
|
|
6131
5289
|
|
|
6132
5290
|
class Tilt extends ValueWithRandom {
|
|
6133
|
-
animation;
|
|
6134
|
-
direction;
|
|
6135
|
-
enable;
|
|
6136
|
-
constructor() {
|
|
6137
|
-
super();
|
|
6138
|
-
this.animation = new TiltAnimation();
|
|
6139
|
-
this.direction = TiltDirection.clockwise;
|
|
6140
|
-
this.enable = false;
|
|
6141
|
-
this.value = 0;
|
|
6142
|
-
}
|
|
5291
|
+
animation = new TiltAnimation();
|
|
5292
|
+
direction = TiltDirection.clockwise;
|
|
5293
|
+
enable = false;
|
|
6143
5294
|
load(data) {
|
|
6144
5295
|
super.load(data);
|
|
6145
5296
|
if (isNull(data)) {
|
|
6146
5297
|
return;
|
|
6147
5298
|
}
|
|
6148
5299
|
this.animation.load(data.animation);
|
|
6149
|
-
|
|
6150
|
-
|
|
6151
|
-
}
|
|
6152
|
-
if (data.enable !== undefined) {
|
|
6153
|
-
this.enable = data.enable;
|
|
6154
|
-
}
|
|
5300
|
+
loadProperty(this, "direction", data.direction);
|
|
5301
|
+
loadProperty(this, "enable", data.enable);
|
|
6155
5302
|
}
|
|
6156
5303
|
}
|
|
6157
5304
|
|
|
@@ -6176,8 +5323,8 @@
|
|
|
6176
5323
|
particle.tilt = {
|
|
6177
5324
|
enable: tiltOptions.enable,
|
|
6178
5325
|
value: degToRad(getRangeValue(tiltOptions.value)),
|
|
6179
|
-
sinDirection: getRandom() >= half ? identity$
|
|
6180
|
-
cosDirection: getRandom() >= half ? identity$
|
|
5326
|
+
sinDirection: getRandom() >= half ? identity$2 : -identity$2,
|
|
5327
|
+
cosDirection: getRandom() >= half ? identity$2 : -identity$2,
|
|
6181
5328
|
min: 0,
|
|
6182
5329
|
max: doublePI,
|
|
6183
5330
|
};
|
|
@@ -6197,7 +5344,7 @@
|
|
|
6197
5344
|
}
|
|
6198
5345
|
const tiltAnimation = particle.options.tilt?.animation;
|
|
6199
5346
|
if (tiltAnimation?.enable) {
|
|
6200
|
-
particle.tilt.decay = identity$
|
|
5347
|
+
particle.tilt.decay = identity$2 - getRangeValue(tiltAnimation.decay);
|
|
6201
5348
|
particle.tilt.velocity = (getRangeValue(tiltAnimation.speed) / maxAngle$1) * this.#container.retina.reduceFactor;
|
|
6202
5349
|
if (!tiltAnimation.sync) {
|
|
6203
5350
|
particle.tilt.velocity *= getRandom();
|
|
@@ -6209,10 +5356,7 @@
|
|
|
6209
5356
|
return !particle.destroyed && !particle.spawning && !!tiltAnimation?.enable;
|
|
6210
5357
|
}
|
|
6211
5358
|
loadOptions(options, ...sources) {
|
|
6212
|
-
options
|
|
6213
|
-
for (const source of sources) {
|
|
6214
|
-
options.tilt.load(source?.tilt);
|
|
6215
|
-
}
|
|
5359
|
+
loadOptionProperty(options, "tilt", Tilt, ...sources);
|
|
6216
5360
|
}
|
|
6217
5361
|
update(particle, delta) {
|
|
6218
5362
|
if (!this.isEnabled(particle) || !particle.tilt) {
|
|
@@ -6223,7 +5367,7 @@
|
|
|
6223
5367
|
}
|
|
6224
5368
|
|
|
6225
5369
|
async function loadTiltUpdater(engine) {
|
|
6226
|
-
engine.checkVersion("4.
|
|
5370
|
+
engine.checkVersion("4.2.0");
|
|
6227
5371
|
await engine.pluginManager.register(e => {
|
|
6228
5372
|
e.pluginManager.addParticleUpdater("tilt", container => {
|
|
6229
5373
|
return Promise.resolve(new TiltUpdater(container));
|
|
@@ -6232,44 +5376,27 @@
|
|
|
6232
5376
|
}
|
|
6233
5377
|
|
|
6234
5378
|
class WobbleSpeed {
|
|
6235
|
-
angle;
|
|
6236
|
-
move;
|
|
6237
|
-
constructor() {
|
|
6238
|
-
this.angle = 50;
|
|
6239
|
-
this.move = 10;
|
|
6240
|
-
}
|
|
5379
|
+
angle = 50;
|
|
5380
|
+
move = 10;
|
|
6241
5381
|
load(data) {
|
|
6242
5382
|
if (isNull(data)) {
|
|
6243
5383
|
return;
|
|
6244
5384
|
}
|
|
6245
|
-
|
|
6246
|
-
|
|
6247
|
-
}
|
|
6248
|
-
if (data.move !== undefined) {
|
|
6249
|
-
this.move = setRangeValue(data.move);
|
|
6250
|
-
}
|
|
5385
|
+
loadRangeProperty(this, "angle", data.angle);
|
|
5386
|
+
loadRangeProperty(this, "move", data.move);
|
|
6251
5387
|
}
|
|
6252
5388
|
}
|
|
6253
5389
|
|
|
6254
5390
|
class Wobble {
|
|
6255
|
-
distance;
|
|
6256
|
-
enable;
|
|
6257
|
-
speed;
|
|
6258
|
-
constructor() {
|
|
6259
|
-
this.distance = 5;
|
|
6260
|
-
this.enable = false;
|
|
6261
|
-
this.speed = new WobbleSpeed();
|
|
6262
|
-
}
|
|
5391
|
+
distance = 5;
|
|
5392
|
+
enable = false;
|
|
5393
|
+
speed = new WobbleSpeed();
|
|
6263
5394
|
load(data) {
|
|
6264
5395
|
if (isNull(data)) {
|
|
6265
5396
|
return;
|
|
6266
5397
|
}
|
|
6267
|
-
|
|
6268
|
-
|
|
6269
|
-
}
|
|
6270
|
-
if (data.enable !== undefined) {
|
|
6271
|
-
this.enable = data.enable;
|
|
6272
|
-
}
|
|
5398
|
+
loadRangeProperty(this, "distance", data.distance);
|
|
5399
|
+
loadProperty(this, "enable", data.enable);
|
|
6273
5400
|
if (data.speed !== undefined) {
|
|
6274
5401
|
if (isNumber(data.speed)) {
|
|
6275
5402
|
this.speed.load({ angle: data.speed });
|
|
@@ -6331,10 +5458,7 @@
|
|
|
6331
5458
|
return !particle.destroyed && !particle.spawning && !!particle.options.wobble?.enable;
|
|
6332
5459
|
}
|
|
6333
5460
|
loadOptions(options, ...sources) {
|
|
6334
|
-
options
|
|
6335
|
-
for (const source of sources) {
|
|
6336
|
-
options.wobble.load(source?.wobble);
|
|
6337
|
-
}
|
|
5461
|
+
loadOptionProperty(options, "wobble", Wobble, ...sources);
|
|
6338
5462
|
}
|
|
6339
5463
|
update(particle, delta) {
|
|
6340
5464
|
if (!this.isEnabled(particle)) {
|
|
@@ -6345,7 +5469,7 @@
|
|
|
6345
5469
|
}
|
|
6346
5470
|
|
|
6347
5471
|
async function loadWobbleUpdater(engine) {
|
|
6348
|
-
engine.checkVersion("4.
|
|
5472
|
+
engine.checkVersion("4.2.0");
|
|
6349
5473
|
await engine.pluginManager.register(e => {
|
|
6350
5474
|
e.pluginManager.addParticleUpdater("wobble", container => {
|
|
6351
5475
|
return Promise.resolve(new WobbleUpdater(container));
|
|
@@ -6411,34 +5535,18 @@
|
|
|
6411
5535
|
if (isNull(data)) {
|
|
6412
5536
|
return;
|
|
6413
5537
|
}
|
|
6414
|
-
|
|
6415
|
-
this.angle = data.angle;
|
|
6416
|
-
}
|
|
5538
|
+
loadProperty(this, "angle", data.angle);
|
|
6417
5539
|
const count = data.count ?? data.particleCount;
|
|
6418
5540
|
if (count !== undefined) {
|
|
6419
5541
|
this.count = count;
|
|
6420
5542
|
}
|
|
6421
|
-
|
|
6422
|
-
|
|
6423
|
-
|
|
6424
|
-
|
|
6425
|
-
|
|
6426
|
-
|
|
6427
|
-
|
|
6428
|
-
this.decay = data.decay;
|
|
6429
|
-
}
|
|
6430
|
-
if (data.flat !== undefined) {
|
|
6431
|
-
this.flat = data.flat;
|
|
6432
|
-
}
|
|
6433
|
-
if (data.gravity !== undefined) {
|
|
6434
|
-
this.gravity = data.gravity;
|
|
6435
|
-
}
|
|
6436
|
-
if (data.drift !== undefined) {
|
|
6437
|
-
this.drift = data.drift;
|
|
6438
|
-
}
|
|
6439
|
-
if (data.ticks !== undefined) {
|
|
6440
|
-
this.ticks = data.ticks;
|
|
6441
|
-
}
|
|
5543
|
+
loadProperty(this, "spread", data.spread);
|
|
5544
|
+
loadProperty(this, "startVelocity", data.startVelocity);
|
|
5545
|
+
loadProperty(this, "decay", data.decay);
|
|
5546
|
+
loadProperty(this, "flat", data.flat);
|
|
5547
|
+
loadProperty(this, "gravity", data.gravity);
|
|
5548
|
+
loadProperty(this, "drift", data.drift);
|
|
5549
|
+
loadProperty(this, "ticks", data.ticks);
|
|
6442
5550
|
const origin = data.origin;
|
|
6443
5551
|
if (origin && !data.position) {
|
|
6444
5552
|
data.position = {
|
|
@@ -6480,19 +5588,13 @@
|
|
|
6480
5588
|
this.shapes = data.shapes;
|
|
6481
5589
|
}
|
|
6482
5590
|
}
|
|
6483
|
-
|
|
6484
|
-
|
|
6485
|
-
|
|
6486
|
-
if (data.zIndex !== undefined) {
|
|
6487
|
-
this.zIndex = data.zIndex;
|
|
6488
|
-
}
|
|
6489
|
-
if (data.disableForReducedMotion !== undefined) {
|
|
6490
|
-
this.disableForReducedMotion = data.disableForReducedMotion;
|
|
6491
|
-
}
|
|
5591
|
+
loadProperty(this, "scalar", data.scalar);
|
|
5592
|
+
loadProperty(this, "zIndex", data.zIndex);
|
|
5593
|
+
loadProperty(this, "disableForReducedMotion", data.disableForReducedMotion);
|
|
6492
5594
|
}
|
|
6493
5595
|
}
|
|
6494
5596
|
|
|
6495
|
-
const defaultGravity = 9.81, sizeFactor = 5, speedFactor = 3, decayOffset = 1, disableRotate = 0, disableTilt = 0, ids = new Map();
|
|
5597
|
+
const defaultGravity = 9.81, sizeFactor = 5, speedFactor = 3, decayOffset = 1, disableRotate = 0, disableTilt = 0, noOpacityChange = 0, ids = new Map(), minTicks = 0;
|
|
6496
5598
|
async function addEmitter(container, actualOptions, opacitySpeed) {
|
|
6497
5599
|
await container.addEmitter?.({
|
|
6498
5600
|
startCount: actualOptions.count,
|
|
@@ -6743,7 +5845,7 @@
|
|
|
6743
5845
|
async function setConfetti(engine, params) {
|
|
6744
5846
|
const actualOptions = new ConfettiOptions();
|
|
6745
5847
|
actualOptions.load(params.options);
|
|
6746
|
-
const fpsLimit = 120,
|
|
5848
|
+
const fpsLimit = 120, safeTicks = Number.isFinite(actualOptions.ticks) && actualOptions.ticks > minTicks ? actualOptions.ticks : undefined, opacitySpeed = safeTicks === undefined ? noOpacityChange : (fpsLimit * percentDenominator) / (defaultFps * safeTicks);
|
|
6747
5849
|
let containerOrPromise = ids.get(params.id);
|
|
6748
5850
|
if (containerOrPromise instanceof Promise) {
|
|
6749
5851
|
await containerOrPromise;
|
|
@@ -6772,7 +5874,7 @@
|
|
|
6772
5874
|
|
|
6773
5875
|
let initPromise = null;
|
|
6774
5876
|
async function doInitPlugins(engine) {
|
|
6775
|
-
engine.checkVersion("4.
|
|
5877
|
+
engine.checkVersion("4.2.0");
|
|
6776
5878
|
await engine.pluginManager.register(async (e) => {
|
|
6777
5879
|
await Promise.all([
|
|
6778
5880
|
loadBasic(e),
|
|
@@ -6845,7 +5947,7 @@
|
|
|
6845
5947
|
confetti.init = async () => {
|
|
6846
5948
|
await initPlugins(tsParticles);
|
|
6847
5949
|
};
|
|
6848
|
-
confetti.version = "4.
|
|
5950
|
+
confetti.version = "4.2.0";
|
|
6849
5951
|
globalThis.confetti = confetti;
|
|
6850
5952
|
|
|
6851
5953
|
const globalObject = globalThis;
|
|
@@ -6906,7 +6008,7 @@
|
|
|
6906
6008
|
return;
|
|
6907
6009
|
}
|
|
6908
6010
|
this.draw(ctx => {
|
|
6909
|
-
|
|
6011
|
+
ctx.clearRect(originPoint.x, originPoint.y, this.#canvasManager.size.width, this.#canvasManager.size.height);
|
|
6910
6012
|
});
|
|
6911
6013
|
}
|
|
6912
6014
|
clear() {
|
|
@@ -6968,7 +6070,7 @@
|
|
|
6968
6070
|
plugin.drawParticleSetup?.(context, particle, delta);
|
|
6969
6071
|
}
|
|
6970
6072
|
this.#applyPreDrawUpdaters(context, particle, radius, opacity, colorStyles, transform);
|
|
6971
|
-
drawParticle({
|
|
6073
|
+
this.#drawParticle({
|
|
6972
6074
|
container,
|
|
6973
6075
|
context,
|
|
6974
6076
|
particle,
|
|
@@ -6987,7 +6089,7 @@
|
|
|
6987
6089
|
drawParticlePlugins(particle, delta) {
|
|
6988
6090
|
this.draw(ctx => {
|
|
6989
6091
|
for (const plugin of this.#drawParticlePlugins) {
|
|
6990
|
-
drawParticlePlugin(ctx, plugin, particle, delta);
|
|
6092
|
+
this.#drawParticlePlugin(ctx, plugin, particle, delta);
|
|
6991
6093
|
}
|
|
6992
6094
|
});
|
|
6993
6095
|
}
|
|
@@ -7087,12 +6189,19 @@
|
|
|
7087
6189
|
}
|
|
7088
6190
|
paintBase(baseColor) {
|
|
7089
6191
|
this.draw(ctx => {
|
|
7090
|
-
|
|
6192
|
+
ctx.fillStyle = baseColor ?? "rgba(0,0,0,0)";
|
|
6193
|
+
ctx.fillRect(originPoint.x, originPoint.y, this.#canvasManager.size.width, this.#canvasManager.size.height);
|
|
7091
6194
|
});
|
|
7092
6195
|
}
|
|
7093
6196
|
paintImage(image, opacity) {
|
|
7094
6197
|
this.draw(ctx => {
|
|
7095
|
-
|
|
6198
|
+
if (!image) {
|
|
6199
|
+
return;
|
|
6200
|
+
}
|
|
6201
|
+
const prevAlpha = ctx.globalAlpha;
|
|
6202
|
+
ctx.globalAlpha = opacity;
|
|
6203
|
+
ctx.drawImage(image, originPoint.x, originPoint.y, this.#canvasManager.size.width, this.#canvasManager.size.height);
|
|
6204
|
+
ctx.globalAlpha = prevAlpha;
|
|
7096
6205
|
});
|
|
7097
6206
|
}
|
|
7098
6207
|
setContext(context) {
|
|
@@ -7106,15 +6215,15 @@
|
|
|
7106
6215
|
}
|
|
7107
6216
|
stop() {
|
|
7108
6217
|
this.draw(ctx => {
|
|
7109
|
-
|
|
6218
|
+
ctx.clearRect(originPoint.x, originPoint.y, this.#canvasManager.size.width, this.#canvasManager.size.height);
|
|
7110
6219
|
});
|
|
7111
6220
|
}
|
|
7112
|
-
#applyPostDrawUpdaters
|
|
6221
|
+
#applyPostDrawUpdaters(particle) {
|
|
7113
6222
|
for (const updater of this.#postDrawUpdaters) {
|
|
7114
6223
|
updater.afterDraw?.(particle);
|
|
7115
6224
|
}
|
|
7116
|
-
}
|
|
7117
|
-
#applyPreDrawUpdaters
|
|
6225
|
+
}
|
|
6226
|
+
#applyPreDrawUpdaters(ctx, particle, radius, zOpacity, colorStyles, transform) {
|
|
7118
6227
|
for (const updater of this.#preDrawUpdaters) {
|
|
7119
6228
|
if (updater.getColorStyles) {
|
|
7120
6229
|
const { fill, stroke } = updater.getColorStyles(particle, ctx, radius, zOpacity);
|
|
@@ -7133,8 +6242,114 @@
|
|
|
7133
6242
|
}
|
|
7134
6243
|
updater.beforeDraw?.(particle);
|
|
7135
6244
|
}
|
|
7136
|
-
}
|
|
7137
|
-
#
|
|
6245
|
+
}
|
|
6246
|
+
#drawAfterEffect(drawer, data) {
|
|
6247
|
+
if (!drawer?.drawAfter) {
|
|
6248
|
+
return;
|
|
6249
|
+
}
|
|
6250
|
+
const { particle } = data;
|
|
6251
|
+
if (!particle.effect) {
|
|
6252
|
+
return;
|
|
6253
|
+
}
|
|
6254
|
+
drawer.drawAfter(data);
|
|
6255
|
+
}
|
|
6256
|
+
#drawBeforeEffect(drawer, data) {
|
|
6257
|
+
if (!drawer?.drawBefore) {
|
|
6258
|
+
return;
|
|
6259
|
+
}
|
|
6260
|
+
const { particle } = data;
|
|
6261
|
+
if (!particle.effect) {
|
|
6262
|
+
return;
|
|
6263
|
+
}
|
|
6264
|
+
drawer.drawBefore(data);
|
|
6265
|
+
}
|
|
6266
|
+
#drawParticle(data) {
|
|
6267
|
+
const { container, context, particle, delta, colorStyles, radius, opacity, transform } = data, { effectDrawers, shapeDrawers } = container, pos = particle.getPosition(), transformData = particle.getTransformData(transform), drawScale = defaultZoom, drawPosition = {
|
|
6268
|
+
x: pos.x,
|
|
6269
|
+
y: pos.y,
|
|
6270
|
+
};
|
|
6271
|
+
context.setTransform(transformData.a, transformData.b, transformData.c, transformData.d, pos.x, pos.y);
|
|
6272
|
+
if (colorStyles.fill) {
|
|
6273
|
+
context.fillStyle = colorStyles.fill;
|
|
6274
|
+
}
|
|
6275
|
+
const fillEnabled = !!particle.fillEnabled, strokeWidth = particle.strokeWidth ?? minStrokeWidth;
|
|
6276
|
+
context.lineWidth = strokeWidth;
|
|
6277
|
+
if (colorStyles.stroke) {
|
|
6278
|
+
context.strokeStyle = colorStyles.stroke;
|
|
6279
|
+
}
|
|
6280
|
+
const drawData = {
|
|
6281
|
+
context,
|
|
6282
|
+
particle,
|
|
6283
|
+
radius,
|
|
6284
|
+
drawRadius: radius * drawScale,
|
|
6285
|
+
opacity,
|
|
6286
|
+
delta,
|
|
6287
|
+
pixelRatio: container.retina.pixelRatio,
|
|
6288
|
+
fill: fillEnabled,
|
|
6289
|
+
stroke: strokeWidth > minStrokeWidth,
|
|
6290
|
+
transformData,
|
|
6291
|
+
position: { ...pos },
|
|
6292
|
+
drawPosition,
|
|
6293
|
+
drawScale,
|
|
6294
|
+
};
|
|
6295
|
+
for (const plugin of container.plugins) {
|
|
6296
|
+
plugin.drawParticleTransform?.(drawData);
|
|
6297
|
+
}
|
|
6298
|
+
const effect = particle.effect ? effectDrawers.get(particle.effect) : undefined, shape = particle.shape ? shapeDrawers.get(particle.shape) : undefined;
|
|
6299
|
+
this.#drawBeforeEffect(effect, drawData);
|
|
6300
|
+
this.#drawShapeBeforeDraw(shape, drawData);
|
|
6301
|
+
this.#drawShape(shape, drawData);
|
|
6302
|
+
this.#drawShapeAfterDraw(shape, drawData);
|
|
6303
|
+
this.#drawAfterEffect(effect, drawData);
|
|
6304
|
+
context.resetTransform();
|
|
6305
|
+
}
|
|
6306
|
+
#drawParticlePlugin(context, plugin, particle, delta) {
|
|
6307
|
+
if (!plugin.drawParticle) {
|
|
6308
|
+
return;
|
|
6309
|
+
}
|
|
6310
|
+
plugin.drawParticle(context, particle, delta);
|
|
6311
|
+
}
|
|
6312
|
+
#drawShape(drawer, data) {
|
|
6313
|
+
if (!drawer) {
|
|
6314
|
+
return;
|
|
6315
|
+
}
|
|
6316
|
+
const { context, fill, particle, stroke } = data;
|
|
6317
|
+
if (!particle.shape) {
|
|
6318
|
+
return;
|
|
6319
|
+
}
|
|
6320
|
+
context.beginPath();
|
|
6321
|
+
drawer.draw(data);
|
|
6322
|
+
if (particle.shapeClose) {
|
|
6323
|
+
context.closePath();
|
|
6324
|
+
}
|
|
6325
|
+
if (fill) {
|
|
6326
|
+
context.fill();
|
|
6327
|
+
}
|
|
6328
|
+
if (stroke) {
|
|
6329
|
+
context.stroke();
|
|
6330
|
+
}
|
|
6331
|
+
}
|
|
6332
|
+
#drawShapeAfterDraw(drawer, data) {
|
|
6333
|
+
if (!drawer?.afterDraw) {
|
|
6334
|
+
return;
|
|
6335
|
+
}
|
|
6336
|
+
const { particle } = data;
|
|
6337
|
+
if (!particle.shape) {
|
|
6338
|
+
return;
|
|
6339
|
+
}
|
|
6340
|
+
drawer.afterDraw(data);
|
|
6341
|
+
}
|
|
6342
|
+
#drawShapeBeforeDraw(drawer, data) {
|
|
6343
|
+
if (!drawer?.beforeDraw) {
|
|
6344
|
+
return;
|
|
6345
|
+
}
|
|
6346
|
+
const { particle } = data;
|
|
6347
|
+
if (!particle.shape) {
|
|
6348
|
+
return;
|
|
6349
|
+
}
|
|
6350
|
+
drawer.beforeDraw(data);
|
|
6351
|
+
}
|
|
6352
|
+
#getPluginParticleColors(particle) {
|
|
7138
6353
|
let fColor, sColor;
|
|
7139
6354
|
for (const plugin of this.#colorPlugins) {
|
|
7140
6355
|
if (!fColor && plugin.particleFillColor) {
|
|
@@ -7150,7 +6365,7 @@
|
|
|
7150
6365
|
this.#reusablePluginColors[fColorIndex] = fColor;
|
|
7151
6366
|
this.#reusablePluginColors[sColorIndex] = sColor;
|
|
7152
6367
|
return this.#reusablePluginColors;
|
|
7153
|
-
}
|
|
6368
|
+
}
|
|
7154
6369
|
}
|
|
7155
6370
|
|
|
7156
6371
|
const transferredCanvases = new WeakMap(), getTransferredCanvas = (canvas) => {
|
|
@@ -7282,6 +6497,7 @@
|
|
|
7282
6497
|
obs.observe(element, { attributes: true });
|
|
7283
6498
|
});
|
|
7284
6499
|
this.initPlugins();
|
|
6500
|
+
this.#initContext();
|
|
7285
6501
|
this.render.init();
|
|
7286
6502
|
}
|
|
7287
6503
|
initBackground() {
|
|
@@ -7291,7 +6507,7 @@
|
|
|
7291
6507
|
}
|
|
7292
6508
|
const elementStyle = element.style, color = rangeColorToRgb(this.#pluginManager, background.color);
|
|
7293
6509
|
if (color) {
|
|
7294
|
-
elementStyle.backgroundColor = getStyleFromRgb(color, container.hdr, background.opacity);
|
|
6510
|
+
elementStyle.backgroundColor = getStyleFromRgb(color, container.actualOptions.hdr, background.opacity);
|
|
7295
6511
|
}
|
|
7296
6512
|
else {
|
|
7297
6513
|
elementStyle.backgroundColor = "";
|
|
@@ -7313,7 +6529,7 @@
|
|
|
7313
6529
|
if (this.#generated && this.domElement) {
|
|
7314
6530
|
this.domElement.remove();
|
|
7315
6531
|
}
|
|
7316
|
-
const
|
|
6532
|
+
const domCanvas = isHtmlCanvasElement(canvas) ? canvas : undefined;
|
|
7317
6533
|
this.domElement = domCanvas;
|
|
7318
6534
|
this.#generated = domCanvas ? domCanvas.dataset[generatedAttribute] === "true" : false;
|
|
7319
6535
|
this.renderCanvas = domCanvas ? getTransferredCanvas(domCanvas) : canvas;
|
|
@@ -7334,26 +6550,6 @@
|
|
|
7334
6550
|
const pxRatio = this.#container.retina.pixelRatio, retinaSize = this.size;
|
|
7335
6551
|
renderCanvas.height = retinaSize.height = standardSize.height * pxRatio;
|
|
7336
6552
|
renderCanvas.width = retinaSize.width = standardSize.width * pxRatio;
|
|
7337
|
-
const canSupportHdrQuery = safeMatchMedia("(color-gamut: p3)");
|
|
7338
|
-
this.render.setContextSettings({
|
|
7339
|
-
alpha: true,
|
|
7340
|
-
colorSpace: canSupportHdrQuery?.matches && container.hdr ? "display-p3" : "srgb",
|
|
7341
|
-
desynchronized: true,
|
|
7342
|
-
willReadFrequently: false,
|
|
7343
|
-
});
|
|
7344
|
-
this.render.setContext(renderCanvas.getContext("2d", this.render.settings));
|
|
7345
|
-
this.#safeMutationObserver(obs => {
|
|
7346
|
-
obs.disconnect();
|
|
7347
|
-
});
|
|
7348
|
-
container.retina.init();
|
|
7349
|
-
this.initBackground();
|
|
7350
|
-
this.#safeMutationObserver(obs => {
|
|
7351
|
-
const element = this.domElement;
|
|
7352
|
-
if (!element || !(element instanceof Node)) {
|
|
7353
|
-
return;
|
|
7354
|
-
}
|
|
7355
|
-
obs.observe(element, { attributes: true });
|
|
7356
|
-
});
|
|
7357
6553
|
}
|
|
7358
6554
|
resize() {
|
|
7359
6555
|
const element = this.domElement;
|
|
@@ -7421,12 +6617,30 @@
|
|
|
7421
6617
|
await container.refresh();
|
|
7422
6618
|
}
|
|
7423
6619
|
}
|
|
7424
|
-
#applyResizePlugins
|
|
6620
|
+
#applyResizePlugins() {
|
|
7425
6621
|
for (const plugin of this.#resizePlugins) {
|
|
7426
6622
|
plugin.resize?.();
|
|
7427
6623
|
}
|
|
7428
|
-
}
|
|
7429
|
-
#
|
|
6624
|
+
}
|
|
6625
|
+
#initContext() {
|
|
6626
|
+
const container = this.#container, canSupportHdr = container.actualOptions.hdr &&
|
|
6627
|
+
safeMatchMedia("(color-gamut: p3)")?.matches &&
|
|
6628
|
+
safeMatchMedia("(dynamic-range: high)")?.matches;
|
|
6629
|
+
this.render.setContextSettings({
|
|
6630
|
+
alpha: true,
|
|
6631
|
+
desynchronized: true,
|
|
6632
|
+
willReadFrequently: false,
|
|
6633
|
+
...(canSupportHdr
|
|
6634
|
+
? { colorSpace: "display-p3", colorType: "float16" }
|
|
6635
|
+
: { colorSpace: "srgb" }),
|
|
6636
|
+
});
|
|
6637
|
+
const renderCanvas = this.renderCanvas;
|
|
6638
|
+
if (!renderCanvas) {
|
|
6639
|
+
return;
|
|
6640
|
+
}
|
|
6641
|
+
this.render.setContext(renderCanvas.getContext("2d", this.render.settings));
|
|
6642
|
+
}
|
|
6643
|
+
#initStyle() {
|
|
7430
6644
|
const element = this.domElement, options = this.#container.actualOptions;
|
|
7431
6645
|
if (!element) {
|
|
7432
6646
|
return;
|
|
@@ -7447,8 +6661,8 @@
|
|
|
7447
6661
|
}
|
|
7448
6662
|
element.style.setProperty(key, value, "important");
|
|
7449
6663
|
}
|
|
7450
|
-
}
|
|
7451
|
-
#repairStyle
|
|
6664
|
+
}
|
|
6665
|
+
#repairStyle() {
|
|
7452
6666
|
const element = this.domElement;
|
|
7453
6667
|
if (!element) {
|
|
7454
6668
|
return;
|
|
@@ -7467,27 +6681,27 @@
|
|
|
7467
6681
|
}
|
|
7468
6682
|
observer.observe(element, { attributes: true });
|
|
7469
6683
|
});
|
|
7470
|
-
}
|
|
7471
|
-
#resetOriginalStyle
|
|
6684
|
+
}
|
|
6685
|
+
#resetOriginalStyle() {
|
|
7472
6686
|
const element = this.domElement, originalStyle = this.#originalStyle;
|
|
7473
6687
|
if (!element || !originalStyle) {
|
|
7474
6688
|
return;
|
|
7475
6689
|
}
|
|
7476
6690
|
setStyle(element, originalStyle, true);
|
|
7477
|
-
}
|
|
7478
|
-
#safeMutationObserver
|
|
6691
|
+
}
|
|
6692
|
+
#safeMutationObserver(callback) {
|
|
7479
6693
|
if (!this.#mutationObserver) {
|
|
7480
6694
|
return;
|
|
7481
6695
|
}
|
|
7482
6696
|
callback(this.#mutationObserver);
|
|
7483
|
-
}
|
|
7484
|
-
#setFullScreenStyle
|
|
6697
|
+
}
|
|
6698
|
+
#setFullScreenStyle() {
|
|
7485
6699
|
const element = this.domElement;
|
|
7486
6700
|
if (!element) {
|
|
7487
6701
|
return;
|
|
7488
6702
|
}
|
|
7489
6703
|
setStyle(element, getFullScreenStyle(this.#container.actualOptions.fullScreen.zIndex), true);
|
|
7490
|
-
}
|
|
6704
|
+
}
|
|
7491
6705
|
}
|
|
7492
6706
|
|
|
7493
6707
|
class EventListeners {
|
|
@@ -7512,7 +6726,7 @@
|
|
|
7512
6726
|
removeListeners() {
|
|
7513
6727
|
this.#manageListeners(false);
|
|
7514
6728
|
}
|
|
7515
|
-
#handleVisibilityChange
|
|
6729
|
+
#handleVisibilityChange() {
|
|
7516
6730
|
const container = this.#container, options = container.actualOptions;
|
|
7517
6731
|
if (!options.pauseOnBlur) {
|
|
7518
6732
|
return;
|
|
@@ -7530,8 +6744,8 @@
|
|
|
7530
6744
|
container.draw(true);
|
|
7531
6745
|
}
|
|
7532
6746
|
}
|
|
7533
|
-
}
|
|
7534
|
-
#handleWindowResize
|
|
6747
|
+
}
|
|
6748
|
+
#handleWindowResize() {
|
|
7535
6749
|
if (this.#resizeTimeout) {
|
|
7536
6750
|
clearTimeout(this.#resizeTimeout);
|
|
7537
6751
|
this.#resizeTimeout = undefined;
|
|
@@ -7541,13 +6755,13 @@
|
|
|
7541
6755
|
await canvas.windowResize();
|
|
7542
6756
|
};
|
|
7543
6757
|
this.#resizeTimeout = setTimeout(() => void handleResize(), this.#container.actualOptions.resize.delay * millisecondsToSeconds);
|
|
7544
|
-
}
|
|
7545
|
-
#manageListeners
|
|
6758
|
+
}
|
|
6759
|
+
#manageListeners(add) {
|
|
7546
6760
|
const handlers = this.#handlers;
|
|
7547
6761
|
this.#manageResize(add);
|
|
7548
6762
|
manageListener(document, visibilityChangeEvent, handlers.visibilityChange, add, false);
|
|
7549
|
-
}
|
|
7550
|
-
#manageResize
|
|
6763
|
+
}
|
|
6764
|
+
#manageResize(add) {
|
|
7551
6765
|
const handlers = this.#handlers, container = this.#container, options = container.actualOptions;
|
|
7552
6766
|
if (!options.resize.enable) {
|
|
7553
6767
|
return;
|
|
@@ -7574,7 +6788,7 @@
|
|
|
7574
6788
|
});
|
|
7575
6789
|
this.#resizeObserver.observe(canvasEl);
|
|
7576
6790
|
}
|
|
7577
|
-
}
|
|
6791
|
+
}
|
|
7578
6792
|
}
|
|
7579
6793
|
|
|
7580
6794
|
function loadEffectData(effect, effectOptions, id, reduceDuplicates) {
|
|
@@ -7601,6 +6815,131 @@
|
|
|
7601
6815
|
data.setCb(data.radius);
|
|
7602
6816
|
}
|
|
7603
6817
|
}
|
|
6818
|
+
function normalizeAngle(angle, modulus) {
|
|
6819
|
+
const normalized = angle % modulus;
|
|
6820
|
+
return normalized < defaultAngle ? normalized + modulus : normalized;
|
|
6821
|
+
}
|
|
6822
|
+
function initParticleState(particle, id, group) {
|
|
6823
|
+
particle.id = id;
|
|
6824
|
+
particle.group = group;
|
|
6825
|
+
particle.justWarped = false;
|
|
6826
|
+
particle.effectClose = true;
|
|
6827
|
+
particle.shapeClose = true;
|
|
6828
|
+
particle.pathRotation = false;
|
|
6829
|
+
particle.lastPathTime = 0;
|
|
6830
|
+
particle.destroyed = false;
|
|
6831
|
+
particle.unbreakable = false;
|
|
6832
|
+
particle.isRotating = false;
|
|
6833
|
+
particle.rotation = 0;
|
|
6834
|
+
particle.misplaced = false;
|
|
6835
|
+
particle.retina = {
|
|
6836
|
+
maxDistance: {},
|
|
6837
|
+
maxSpeed: 0,
|
|
6838
|
+
moveDrift: 0,
|
|
6839
|
+
moveSpeed: 0,
|
|
6840
|
+
sizeAnimationSpeed: 0,
|
|
6841
|
+
};
|
|
6842
|
+
particle.size = {
|
|
6843
|
+
value: 1,
|
|
6844
|
+
max: 1,
|
|
6845
|
+
min: 1,
|
|
6846
|
+
enable: false,
|
|
6847
|
+
};
|
|
6848
|
+
particle.outType = exports.ParticleOutType.normal;
|
|
6849
|
+
particle.ignoresResizeRatio = true;
|
|
6850
|
+
}
|
|
6851
|
+
function resolveParticleOptions(particle, container, pluginManager, overrideOptions) {
|
|
6852
|
+
const mainOptions = container.actualOptions, particlesOptions = loadParticlesOptions(pluginManager, container, mainOptions.particles), reduceDuplicates = particlesOptions.reduceDuplicates;
|
|
6853
|
+
particle.effect = itemFromSingleOrMultiple(particlesOptions.effect.type, particle.id, reduceDuplicates);
|
|
6854
|
+
particle.shape = itemFromSingleOrMultiple(particlesOptions.shape.type, particle.id, reduceDuplicates);
|
|
6855
|
+
const effectOptions = particlesOptions.effect, shapeOptions = particlesOptions.shape;
|
|
6856
|
+
if (overrideOptions) {
|
|
6857
|
+
if (overrideOptions.effect) {
|
|
6858
|
+
const overrideEffectType = overrideOptions.effect.type;
|
|
6859
|
+
if (overrideEffectType && overrideEffectType !== particle.effect) {
|
|
6860
|
+
const effect = itemFromSingleOrMultiple(overrideEffectType, particle.id, reduceDuplicates);
|
|
6861
|
+
if (effect) {
|
|
6862
|
+
particle.effect = effect;
|
|
6863
|
+
}
|
|
6864
|
+
}
|
|
6865
|
+
effectOptions.load(overrideOptions.effect);
|
|
6866
|
+
}
|
|
6867
|
+
if (overrideOptions.shape) {
|
|
6868
|
+
const overrideShapeType = overrideOptions.shape.type;
|
|
6869
|
+
if (overrideShapeType && overrideShapeType !== particle.shape) {
|
|
6870
|
+
const shape = itemFromSingleOrMultiple(overrideShapeType, particle.id, reduceDuplicates);
|
|
6871
|
+
if (shape) {
|
|
6872
|
+
particle.shape = shape;
|
|
6873
|
+
}
|
|
6874
|
+
}
|
|
6875
|
+
shapeOptions.load(overrideOptions.shape);
|
|
6876
|
+
}
|
|
6877
|
+
}
|
|
6878
|
+
if (particle.effect === randomColorValue) {
|
|
6879
|
+
const availableEffects = [...container.effectDrawers.keys()];
|
|
6880
|
+
particle.effect = availableEffects[Math.floor(getRandom() * availableEffects.length)];
|
|
6881
|
+
}
|
|
6882
|
+
if (particle.shape === randomColorValue) {
|
|
6883
|
+
const availableShapes = [...container.shapeDrawers.keys()];
|
|
6884
|
+
particle.shape = availableShapes[Math.floor(getRandom() * availableShapes.length)];
|
|
6885
|
+
}
|
|
6886
|
+
particle.effectData = particle.effect
|
|
6887
|
+
? loadEffectData(particle.effect, effectOptions, particle.id, reduceDuplicates)
|
|
6888
|
+
: undefined;
|
|
6889
|
+
particle.shapeData = particle.shape
|
|
6890
|
+
? loadShapeData(particle.shape, shapeOptions, particle.id, reduceDuplicates)
|
|
6891
|
+
: undefined;
|
|
6892
|
+
particlesOptions.load(overrideOptions);
|
|
6893
|
+
const effectData = particle.effectData, shapeData = particle.shapeData;
|
|
6894
|
+
if (effectData) {
|
|
6895
|
+
particlesOptions.load(effectData.particles);
|
|
6896
|
+
}
|
|
6897
|
+
if (shapeData) {
|
|
6898
|
+
particlesOptions.load(shapeData.particles);
|
|
6899
|
+
}
|
|
6900
|
+
particle.effectClose = effectData?.close ?? particlesOptions.effect.close;
|
|
6901
|
+
particle.shapeClose = shapeData?.close ?? particlesOptions.shape.close;
|
|
6902
|
+
return particlesOptions;
|
|
6903
|
+
}
|
|
6904
|
+
function initParticleDrawers(particle, container) {
|
|
6905
|
+
let effectDrawer, shapeDrawer;
|
|
6906
|
+
if (particle.effect) {
|
|
6907
|
+
effectDrawer = container.effectDrawers.get(particle.effect);
|
|
6908
|
+
}
|
|
6909
|
+
if (effectDrawer?.loadEffect) {
|
|
6910
|
+
effectDrawer.loadEffect(particle);
|
|
6911
|
+
}
|
|
6912
|
+
if (particle.shape) {
|
|
6913
|
+
shapeDrawer = container.shapeDrawers.get(particle.shape);
|
|
6914
|
+
}
|
|
6915
|
+
if (shapeDrawer?.loadShape) {
|
|
6916
|
+
shapeDrawer.loadShape(particle);
|
|
6917
|
+
}
|
|
6918
|
+
const sideCountFunc = shapeDrawer?.getSidesCount;
|
|
6919
|
+
if (sideCountFunc) {
|
|
6920
|
+
particle.sides = sideCountFunc(particle);
|
|
6921
|
+
}
|
|
6922
|
+
}
|
|
6923
|
+
function runUpdaterPreInit(updaters, particle) {
|
|
6924
|
+
for (const updater of updaters) {
|
|
6925
|
+
updater.preInit?.(particle);
|
|
6926
|
+
}
|
|
6927
|
+
}
|
|
6928
|
+
function runUpdaterInit(updaters, particle) {
|
|
6929
|
+
for (const updater of updaters) {
|
|
6930
|
+
updater.init(particle);
|
|
6931
|
+
}
|
|
6932
|
+
}
|
|
6933
|
+
function runDrawerInit(container, particle) {
|
|
6934
|
+
const shapeDrawer = particle.shape ? container.shapeDrawers.get(particle.shape) : undefined, effectDrawer = particle.effect ? container.effectDrawers.get(particle.effect) : undefined;
|
|
6935
|
+
effectDrawer?.particleInit?.(container, particle);
|
|
6936
|
+
shapeDrawer?.particleInit?.(container, particle);
|
|
6937
|
+
}
|
|
6938
|
+
function runParticleCreatedPlugins(container, particle) {
|
|
6939
|
+
for (const plugin of container.particleCreatedPlugins) {
|
|
6940
|
+
plugin.particleCreated?.(particle);
|
|
6941
|
+
}
|
|
6942
|
+
}
|
|
7604
6943
|
class Particle {
|
|
7605
6944
|
backColor;
|
|
7606
6945
|
bubble;
|
|
@@ -7726,88 +7065,20 @@
|
|
|
7726
7065
|
const rotateData = this.getRotateData(), rotating = this.isRotating;
|
|
7727
7066
|
this.#cachedTransform.a = rotateData.cos * (externalTransform.a ?? defaultTransform.a);
|
|
7728
7067
|
this.#cachedTransform.b = rotating
|
|
7729
|
-
? rotateData.sin * (externalTransform.b ?? identity$
|
|
7068
|
+
? rotateData.sin * (externalTransform.b ?? identity$2)
|
|
7730
7069
|
: (externalTransform.b ?? defaultTransform.b);
|
|
7731
7070
|
this.#cachedTransform.c = rotating
|
|
7732
|
-
? -rotateData.sin * (externalTransform.c ?? identity$
|
|
7071
|
+
? -rotateData.sin * (externalTransform.c ?? identity$2)
|
|
7733
7072
|
: (externalTransform.c ?? defaultTransform.c);
|
|
7734
7073
|
this.#cachedTransform.d = rotateData.cos * (externalTransform.d ?? defaultTransform.d);
|
|
7735
7074
|
return this.#cachedTransform;
|
|
7736
7075
|
}
|
|
7737
7076
|
init(id, position, overrideOptions, group) {
|
|
7738
7077
|
const container = this.#container;
|
|
7739
|
-
this
|
|
7740
|
-
this.
|
|
7741
|
-
this.justWarped = false;
|
|
7742
|
-
this.effectClose = true;
|
|
7743
|
-
this.shapeClose = true;
|
|
7744
|
-
this.pathRotation = false;
|
|
7745
|
-
this.lastPathTime = 0;
|
|
7746
|
-
this.destroyed = false;
|
|
7747
|
-
this.unbreakable = false;
|
|
7748
|
-
this.isRotating = false;
|
|
7749
|
-
this.rotation = 0;
|
|
7750
|
-
this.misplaced = false;
|
|
7751
|
-
this.retina = {
|
|
7752
|
-
maxDistance: {},
|
|
7753
|
-
maxSpeed: 0,
|
|
7754
|
-
moveDrift: 0,
|
|
7755
|
-
moveSpeed: 0,
|
|
7756
|
-
sizeAnimationSpeed: 0,
|
|
7757
|
-
};
|
|
7758
|
-
this.size = {
|
|
7759
|
-
value: 1,
|
|
7760
|
-
max: 1,
|
|
7761
|
-
min: 1,
|
|
7762
|
-
enable: false,
|
|
7763
|
-
};
|
|
7764
|
-
this.outType = exports.ParticleOutType.normal;
|
|
7765
|
-
this.ignoresResizeRatio = true;
|
|
7766
|
-
const mainOptions = container.actualOptions, particlesOptions = loadParticlesOptions(this.#pluginManager, container, mainOptions.particles), reduceDuplicates = particlesOptions.reduceDuplicates, effectType = particlesOptions.effect.type, shapeType = particlesOptions.shape.type;
|
|
7767
|
-
this.effect = itemFromSingleOrMultiple(effectType, this.id, reduceDuplicates);
|
|
7768
|
-
this.shape = itemFromSingleOrMultiple(shapeType, this.id, reduceDuplicates);
|
|
7769
|
-
const effectOptions = particlesOptions.effect, shapeOptions = particlesOptions.shape;
|
|
7770
|
-
if (overrideOptions) {
|
|
7771
|
-
if (overrideOptions.effect?.type && overrideOptions.effect.type !== this.effect) {
|
|
7772
|
-
const overrideEffectType = overrideOptions.effect.type, effect = itemFromSingleOrMultiple(overrideEffectType, this.id, reduceDuplicates);
|
|
7773
|
-
if (effect) {
|
|
7774
|
-
this.effect = effect;
|
|
7775
|
-
effectOptions.load(overrideOptions.effect);
|
|
7776
|
-
}
|
|
7777
|
-
}
|
|
7778
|
-
if (overrideOptions.shape?.type && overrideOptions.shape.type !== this.shape) {
|
|
7779
|
-
const overrideShapeType = overrideOptions.shape.type, shape = itemFromSingleOrMultiple(overrideShapeType, this.id, reduceDuplicates);
|
|
7780
|
-
if (shape) {
|
|
7781
|
-
this.shape = shape;
|
|
7782
|
-
shapeOptions.load(overrideOptions.shape);
|
|
7783
|
-
}
|
|
7784
|
-
}
|
|
7785
|
-
}
|
|
7786
|
-
if (this.effect === randomColorValue) {
|
|
7787
|
-
const availableEffects = [...this.#container.effectDrawers.keys()];
|
|
7788
|
-
this.effect = availableEffects[Math.floor(getRandom() * availableEffects.length)];
|
|
7789
|
-
}
|
|
7790
|
-
if (this.shape === randomColorValue) {
|
|
7791
|
-
const availableShapes = [...this.#container.shapeDrawers.keys()];
|
|
7792
|
-
this.shape = availableShapes[Math.floor(getRandom() * availableShapes.length)];
|
|
7793
|
-
}
|
|
7794
|
-
this.effectData = this.effect ? loadEffectData(this.effect, effectOptions, this.id, reduceDuplicates) : undefined;
|
|
7795
|
-
this.shapeData = this.shape ? loadShapeData(this.shape, shapeOptions, this.id, reduceDuplicates) : undefined;
|
|
7796
|
-
particlesOptions.load(overrideOptions);
|
|
7797
|
-
const effectData = this.effectData, shapeData = this.shapeData;
|
|
7798
|
-
if (effectData) {
|
|
7799
|
-
particlesOptions.load(effectData.particles);
|
|
7800
|
-
}
|
|
7801
|
-
if (shapeData) {
|
|
7802
|
-
particlesOptions.load(shapeData.particles);
|
|
7803
|
-
}
|
|
7804
|
-
this.effectClose = effectData?.close ?? particlesOptions.effect.close;
|
|
7805
|
-
this.shapeClose = shapeData?.close ?? particlesOptions.shape.close;
|
|
7806
|
-
this.options = particlesOptions;
|
|
7078
|
+
initParticleState(this, id, group);
|
|
7079
|
+
this.options = resolveParticleOptions(this, container, this.#pluginManager, overrideOptions);
|
|
7807
7080
|
container.retina.initParticle(this);
|
|
7808
|
-
|
|
7809
|
-
updater.preInit?.(this);
|
|
7810
|
-
}
|
|
7081
|
+
runUpdaterPreInit(container.particleUpdaters, this);
|
|
7811
7082
|
this.bubble = {
|
|
7812
7083
|
inRange: false,
|
|
7813
7084
|
};
|
|
@@ -7820,32 +7091,11 @@
|
|
|
7820
7091
|
this.velocity = this.initialVelocity.copy();
|
|
7821
7092
|
this.zIndexFactor = this.position.z / container.zLayers;
|
|
7822
7093
|
this.sides = 24;
|
|
7823
|
-
|
|
7824
|
-
if (this.effect) {
|
|
7825
|
-
effectDrawer = container.effectDrawers.get(this.effect);
|
|
7826
|
-
}
|
|
7827
|
-
if (effectDrawer?.loadEffect) {
|
|
7828
|
-
effectDrawer.loadEffect(this);
|
|
7829
|
-
}
|
|
7830
|
-
if (this.shape) {
|
|
7831
|
-
shapeDrawer = container.shapeDrawers.get(this.shape);
|
|
7832
|
-
}
|
|
7833
|
-
if (shapeDrawer?.loadShape) {
|
|
7834
|
-
shapeDrawer.loadShape(this);
|
|
7835
|
-
}
|
|
7836
|
-
const sideCountFunc = shapeDrawer?.getSidesCount;
|
|
7837
|
-
if (sideCountFunc) {
|
|
7838
|
-
this.sides = sideCountFunc(this);
|
|
7839
|
-
}
|
|
7094
|
+
initParticleDrawers(this, container);
|
|
7840
7095
|
this.spawning = false;
|
|
7841
|
-
|
|
7842
|
-
|
|
7843
|
-
|
|
7844
|
-
effectDrawer?.particleInit?.(container, this);
|
|
7845
|
-
shapeDrawer?.particleInit?.(container, this);
|
|
7846
|
-
for (const plugin of container.particleCreatedPlugins) {
|
|
7847
|
-
plugin.particleCreated?.(this);
|
|
7848
|
-
}
|
|
7096
|
+
runUpdaterInit(container.particleUpdaters, this);
|
|
7097
|
+
runDrawerInit(container, this);
|
|
7098
|
+
runParticleCreatedPlugins(container, this);
|
|
7849
7099
|
}
|
|
7850
7100
|
isInsideCanvas(direction) {
|
|
7851
7101
|
return this.#getInsideCanvasResult({ direction }).inside;
|
|
@@ -7859,15 +7109,15 @@
|
|
|
7859
7109
|
}
|
|
7860
7110
|
const angle = this.roll.angle;
|
|
7861
7111
|
if (this.roll.horizontal && this.roll.vertical) {
|
|
7862
|
-
const
|
|
7112
|
+
const adjustedAngle = normalizeAngle(angle, doublePI);
|
|
7863
7113
|
return adjustedAngle >= Math.PI * half && adjustedAngle < Math.PI * triple * half;
|
|
7864
7114
|
}
|
|
7865
7115
|
if (this.roll.horizontal) {
|
|
7866
|
-
const
|
|
7116
|
+
const adjustedAngle = normalizeAngle(angle + Math.PI * half, doublePI);
|
|
7867
7117
|
return adjustedAngle >= Math.PI && adjustedAngle < Math.PI * double;
|
|
7868
7118
|
}
|
|
7869
7119
|
if (this.roll.vertical) {
|
|
7870
|
-
const
|
|
7120
|
+
const adjustedAngle = normalizeAngle(angle, doublePI);
|
|
7871
7121
|
return adjustedAngle >= Math.PI && adjustedAngle < Math.PI * double;
|
|
7872
7122
|
}
|
|
7873
7123
|
return false;
|
|
@@ -7880,10 +7130,10 @@
|
|
|
7880
7130
|
updater.reset?.(this);
|
|
7881
7131
|
}
|
|
7882
7132
|
}
|
|
7883
|
-
#calcPosition
|
|
7133
|
+
#calcPosition(position, zIndex) {
|
|
7884
7134
|
let tryCount = defaultRetryCount, posVec = position ? Vector3d.create(position.x, position.y, zIndex) : undefined;
|
|
7885
|
-
const container = this.#container, plugins = container.particlePositionPlugins, outModes = this.options.move.outModes, radius = this.getRadius(), canvasSize = container.canvas.size
|
|
7886
|
-
|
|
7135
|
+
const container = this.#container, plugins = container.particlePositionPlugins, outModes = this.options.move.outModes, radius = this.getRadius(), canvasSize = container.canvas.size;
|
|
7136
|
+
for (;;) {
|
|
7887
7137
|
for (const plugin of plugins) {
|
|
7888
7138
|
const pluginPos = plugin.particlePosition?.(posVec, this);
|
|
7889
7139
|
if (pluginPos) {
|
|
@@ -7911,9 +7161,8 @@
|
|
|
7911
7161
|
tryCount += tryCountIncrement;
|
|
7912
7162
|
posVec = undefined;
|
|
7913
7163
|
}
|
|
7914
|
-
|
|
7915
|
-
|
|
7916
|
-
#calculateVelocity = () => {
|
|
7164
|
+
}
|
|
7165
|
+
#calculateVelocity() {
|
|
7917
7166
|
const moveOptions = this.options.move, baseVelocity = getParticleBaseVelocity(this.direction), res = baseVelocity.copy();
|
|
7918
7167
|
if (moveOptions.direction === exports.MoveDirection.inside || moveOptions.direction === exports.MoveDirection.outside) {
|
|
7919
7168
|
return res;
|
|
@@ -7929,8 +7178,8 @@
|
|
|
7929
7178
|
res.length *= getRandom();
|
|
7930
7179
|
}
|
|
7931
7180
|
return res;
|
|
7932
|
-
}
|
|
7933
|
-
#fixHorizontal
|
|
7181
|
+
}
|
|
7182
|
+
#fixHorizontal(pos, radius, outMode) {
|
|
7934
7183
|
fixOutMode({
|
|
7935
7184
|
outMode,
|
|
7936
7185
|
checkModes: [exports.OutMode.bounce],
|
|
@@ -7939,8 +7188,8 @@
|
|
|
7939
7188
|
setCb: (value) => (pos.x += value),
|
|
7940
7189
|
radius,
|
|
7941
7190
|
});
|
|
7942
|
-
}
|
|
7943
|
-
#fixVertical
|
|
7191
|
+
}
|
|
7192
|
+
#fixVertical(pos, radius, outMode) {
|
|
7944
7193
|
fixOutMode({
|
|
7945
7194
|
outMode,
|
|
7946
7195
|
checkModes: [exports.OutMode.bounce],
|
|
@@ -7949,8 +7198,8 @@
|
|
|
7949
7198
|
setCb: (value) => (pos.y += value),
|
|
7950
7199
|
radius,
|
|
7951
7200
|
});
|
|
7952
|
-
}
|
|
7953
|
-
#getDefaultInsideCanvasResult
|
|
7201
|
+
}
|
|
7202
|
+
#getDefaultInsideCanvasResult(direction, outMode) {
|
|
7954
7203
|
const radius = this.getRadius(), canvasSize = this.#container.canvas.size, position = this.position, isBounce = outMode === exports.OutMode.bounce;
|
|
7955
7204
|
if (direction === exports.OutModeDirection.bottom) {
|
|
7956
7205
|
return {
|
|
@@ -7983,8 +7232,8 @@
|
|
|
7983
7232
|
position.x <= canvasSize.width + radius,
|
|
7984
7233
|
reason: "default",
|
|
7985
7234
|
};
|
|
7986
|
-
}
|
|
7987
|
-
#getInsideCanvasCallbackData
|
|
7235
|
+
}
|
|
7236
|
+
#getInsideCanvasCallbackData(direction, outMode) {
|
|
7988
7237
|
return {
|
|
7989
7238
|
canvasSize: this.#container.canvas.size,
|
|
7990
7239
|
direction,
|
|
@@ -7992,8 +7241,8 @@
|
|
|
7992
7241
|
particle: this,
|
|
7993
7242
|
radius: this.getRadius(),
|
|
7994
7243
|
};
|
|
7995
|
-
}
|
|
7996
|
-
#getInsideCanvasResult
|
|
7244
|
+
}
|
|
7245
|
+
#getInsideCanvasResult(data) {
|
|
7997
7246
|
const defaultResult = this.#getDefaultInsideCanvasResult(data.direction, data.outMode), container = this.#container, shapeDrawer = this.shape ? container.shapeDrawers.get(this.shape) : undefined, effectDrawer = this.effect ? container.effectDrawers.get(this.effect) : undefined, shapeCheck = shapeDrawer?.isInsideCanvas, effectCheck = effectDrawer?.isInsideCanvas;
|
|
7998
7247
|
if (!shapeCheck && !effectCheck) {
|
|
7999
7248
|
return defaultResult;
|
|
@@ -8008,8 +7257,8 @@
|
|
|
8008
7257
|
};
|
|
8009
7258
|
}
|
|
8010
7259
|
return shapeResult ?? effectResult ?? defaultResult;
|
|
8011
|
-
}
|
|
8012
|
-
#getRollColor
|
|
7260
|
+
}
|
|
7261
|
+
#getRollColor(color) {
|
|
8013
7262
|
if (!color || !this.roll || (!this.backColor && !this.roll.alter)) {
|
|
8014
7263
|
return color;
|
|
8015
7264
|
}
|
|
@@ -8023,8 +7272,8 @@
|
|
|
8023
7272
|
return alterHsl(color, this.roll.alter.type, this.roll.alter.value);
|
|
8024
7273
|
}
|
|
8025
7274
|
return color;
|
|
8026
|
-
}
|
|
8027
|
-
#initPosition
|
|
7275
|
+
}
|
|
7276
|
+
#initPosition(position) {
|
|
8028
7277
|
const container = this.#container, zIndexValue = Math.floor(getRangeValue(this.options.zIndex.value)), initialPosition = this.#calcPosition(position, clamp(zIndexValue, minZ, container.zLayers));
|
|
8029
7278
|
if (!initialPosition) {
|
|
8030
7279
|
throw new Error("a valid position cannot be found for particle");
|
|
@@ -8047,8 +7296,8 @@
|
|
|
8047
7296
|
break;
|
|
8048
7297
|
}
|
|
8049
7298
|
this.offset = Vector.origin;
|
|
8050
|
-
}
|
|
8051
|
-
#normalizeInsideCanvasResult
|
|
7299
|
+
}
|
|
7300
|
+
#normalizeInsideCanvasResult(result, reason) {
|
|
8052
7301
|
if (typeof result === "boolean") {
|
|
8053
7302
|
return {
|
|
8054
7303
|
inside: result,
|
|
@@ -8060,7 +7309,7 @@
|
|
|
8060
7309
|
margin: result.margin,
|
|
8061
7310
|
reason: result.reason ?? reason,
|
|
8062
7311
|
};
|
|
8063
|
-
}
|
|
7312
|
+
}
|
|
8064
7313
|
}
|
|
8065
7314
|
|
|
8066
7315
|
class SpatialHashGrid {
|
|
@@ -8413,10 +7662,10 @@
|
|
|
8413
7662
|
}
|
|
8414
7663
|
this.#resizeFactor = undefined;
|
|
8415
7664
|
}
|
|
8416
|
-
#addToPool
|
|
7665
|
+
#addToPool(...particles) {
|
|
8417
7666
|
this.#pool.push(...particles);
|
|
8418
|
-
}
|
|
8419
|
-
#applyDensity
|
|
7667
|
+
}
|
|
7668
|
+
#applyDensity(options, pluginsCount, group, groupOptions) {
|
|
8420
7669
|
const numberOptions = options.number;
|
|
8421
7670
|
if (!numberOptions.density.enable) {
|
|
8422
7671
|
if (group === undefined) {
|
|
@@ -8440,36 +7689,19 @@
|
|
|
8440
7689
|
else if (particlesCount > particlesNumber) {
|
|
8441
7690
|
this.removeQuantity(particlesCount - particlesNumber, group);
|
|
8442
7691
|
}
|
|
8443
|
-
}
|
|
8444
|
-
#createBuckets
|
|
7692
|
+
}
|
|
7693
|
+
#createBuckets(zLayers) {
|
|
8445
7694
|
const bucketCount = Math.max(Math.floor(zLayers), one);
|
|
8446
7695
|
return Array.from({ length: bucketCount }, () => []);
|
|
8447
|
-
}
|
|
8448
|
-
#getBucketIndex
|
|
7696
|
+
}
|
|
7697
|
+
#getBucketIndex(zIndex) {
|
|
8449
7698
|
const maxBucketIndex = this.#zBuckets.length - one;
|
|
8450
7699
|
if (maxBucketIndex <= minIndex) {
|
|
8451
7700
|
return minIndex;
|
|
8452
7701
|
}
|
|
8453
7702
|
return Math.min(Math.max(Math.floor(zIndex), minIndex), maxBucketIndex);
|
|
8454
|
-
}
|
|
8455
|
-
#
|
|
8456
|
-
let start = minIndex, end = bucket.length;
|
|
8457
|
-
while (start < end) {
|
|
8458
|
-
const middle = Math.floor((start + end) / double), middleParticle = bucket[middle];
|
|
8459
|
-
if (!middleParticle) {
|
|
8460
|
-
end = middle;
|
|
8461
|
-
continue;
|
|
8462
|
-
}
|
|
8463
|
-
if (middleParticle.id < particleId) {
|
|
8464
|
-
start = middle + one;
|
|
8465
|
-
}
|
|
8466
|
-
else {
|
|
8467
|
-
end = middle;
|
|
8468
|
-
}
|
|
8469
|
-
}
|
|
8470
|
-
return start;
|
|
8471
|
-
};
|
|
8472
|
-
#initDensityFactor = densityOptions => {
|
|
7703
|
+
}
|
|
7704
|
+
#initDensityFactor(densityOptions) {
|
|
8473
7705
|
const container = this.#container;
|
|
8474
7706
|
if (!densityOptions.enable) {
|
|
8475
7707
|
return defaultDensityFactor;
|
|
@@ -8479,16 +7711,16 @@
|
|
|
8479
7711
|
return defaultDensityFactor;
|
|
8480
7712
|
}
|
|
8481
7713
|
return ((canvasSize.width * canvasSize.height) / (densityOptions.height * densityOptions.width * pxRatio ** squareExp));
|
|
8482
|
-
}
|
|
8483
|
-
#insertParticleIntoBucket
|
|
7714
|
+
}
|
|
7715
|
+
#insertParticleIntoBucket(particle) {
|
|
8484
7716
|
const bucketIndex = this.#getBucketIndex(particle.position.z), bucket = this.#zBuckets[bucketIndex];
|
|
8485
7717
|
if (!bucket) {
|
|
8486
7718
|
return;
|
|
8487
7719
|
}
|
|
8488
|
-
bucket.
|
|
7720
|
+
bucket.push(particle);
|
|
8489
7721
|
this.#particleBuckets.set(particle.id, bucketIndex);
|
|
8490
|
-
}
|
|
8491
|
-
#removeParticle
|
|
7722
|
+
}
|
|
7723
|
+
#removeParticle(index, group, override) {
|
|
8492
7724
|
const particle = this.#array[index];
|
|
8493
7725
|
if (!particle) {
|
|
8494
7726
|
return false;
|
|
@@ -8504,22 +7736,20 @@
|
|
|
8504
7736
|
});
|
|
8505
7737
|
this.#addToPool(particle);
|
|
8506
7738
|
return true;
|
|
8507
|
-
}
|
|
8508
|
-
#removeParticleFromBucket
|
|
7739
|
+
}
|
|
7740
|
+
#removeParticleFromBucket(particle) {
|
|
8509
7741
|
const bucketIndex = this.#particleBuckets.get(particle.id) ?? this.#getBucketIndex(particle.position.z), bucket = this.#zBuckets[bucketIndex];
|
|
8510
7742
|
if (!bucket) {
|
|
8511
7743
|
this.#particleBuckets.delete(particle.id);
|
|
8512
7744
|
return;
|
|
8513
7745
|
}
|
|
8514
|
-
const
|
|
8515
|
-
if (
|
|
8516
|
-
|
|
8517
|
-
return;
|
|
7746
|
+
const idx = bucket.findIndex(p => p.id === particle.id);
|
|
7747
|
+
if (idx >= minIndex) {
|
|
7748
|
+
bucket.splice(idx, deleteCount);
|
|
8518
7749
|
}
|
|
8519
|
-
bucket.splice(particleIndex, deleteCount);
|
|
8520
7750
|
this.#particleBuckets.delete(particle.id);
|
|
8521
|
-
}
|
|
8522
|
-
#resetBuckets
|
|
7751
|
+
}
|
|
7752
|
+
#resetBuckets(zLayers) {
|
|
8523
7753
|
const bucketCount = Math.max(Math.floor(zLayers), one);
|
|
8524
7754
|
if (this.#zBuckets.length !== bucketCount) {
|
|
8525
7755
|
this.#zBuckets = this.#createBuckets(bucketCount);
|
|
@@ -8528,8 +7758,8 @@
|
|
|
8528
7758
|
for (const bucket of this.#zBuckets) {
|
|
8529
7759
|
bucket.length = minIndex;
|
|
8530
7760
|
}
|
|
8531
|
-
}
|
|
8532
|
-
#updateParticleBucket
|
|
7761
|
+
}
|
|
7762
|
+
#updateParticleBucket(particle) {
|
|
8533
7763
|
const newBucketIndex = this.#getBucketIndex(particle.position.z), currentBucketIndex = this.#particleBuckets.get(particle.id);
|
|
8534
7764
|
if (currentBucketIndex === undefined) {
|
|
8535
7765
|
this.#insertParticleIntoBucket(particle);
|
|
@@ -8540,9 +7770,9 @@
|
|
|
8540
7770
|
}
|
|
8541
7771
|
const currentBucket = this.#zBuckets[currentBucketIndex];
|
|
8542
7772
|
if (currentBucket) {
|
|
8543
|
-
const
|
|
8544
|
-
if (
|
|
8545
|
-
currentBucket.splice(
|
|
7773
|
+
const idx = currentBucket.findIndex(p => p.id === particle.id);
|
|
7774
|
+
if (idx >= minIndex) {
|
|
7775
|
+
currentBucket.splice(idx, deleteCount);
|
|
8546
7776
|
}
|
|
8547
7777
|
}
|
|
8548
7778
|
const newBucket = this.#zBuckets[newBucketIndex];
|
|
@@ -8550,10 +7780,16 @@
|
|
|
8550
7780
|
this.#particleBuckets.set(particle.id, newBucketIndex);
|
|
8551
7781
|
return;
|
|
8552
7782
|
}
|
|
8553
|
-
newBucket.
|
|
7783
|
+
newBucket.push(particle);
|
|
7784
|
+
if (newBucket.length >= double) {
|
|
7785
|
+
const prev = newBucket[newBucket.length - double];
|
|
7786
|
+
if (prev && particle.id < prev.id) {
|
|
7787
|
+
newBucket.sort((a, b) => a.id - b.id);
|
|
7788
|
+
}
|
|
7789
|
+
}
|
|
8554
7790
|
this.#particleBuckets.set(particle.id, newBucketIndex);
|
|
8555
|
-
}
|
|
8556
|
-
#updateParticlesPhase1
|
|
7791
|
+
}
|
|
7792
|
+
#updateParticlesPhase1(delta) {
|
|
8557
7793
|
const particlesToDelete = new Set(), resizeFactor = this.#resizeFactor;
|
|
8558
7794
|
for (const particle of this.#array) {
|
|
8559
7795
|
if (resizeFactor && !particle.ignoresResizeRatio) {
|
|
@@ -8579,8 +7815,8 @@
|
|
|
8579
7815
|
this.grid.insert(particle);
|
|
8580
7816
|
}
|
|
8581
7817
|
return particlesToDelete;
|
|
8582
|
-
}
|
|
8583
|
-
#updateParticlesPhase2
|
|
7818
|
+
}
|
|
7819
|
+
#updateParticlesPhase2(delta, particlesToDelete) {
|
|
8584
7820
|
for (const particle of this.#array) {
|
|
8585
7821
|
if (particle.destroyed) {
|
|
8586
7822
|
particlesToDelete.add(particle);
|
|
@@ -8596,7 +7832,7 @@
|
|
|
8596
7832
|
}
|
|
8597
7833
|
this.#updateParticleBucket(particle);
|
|
8598
7834
|
}
|
|
8599
|
-
}
|
|
7835
|
+
}
|
|
8600
7836
|
}
|
|
8601
7837
|
|
|
8602
7838
|
class Retina {
|
|
@@ -8958,7 +8194,7 @@
|
|
|
8958
8194
|
}
|
|
8959
8195
|
return refresh;
|
|
8960
8196
|
}
|
|
8961
|
-
#nextFrame
|
|
8197
|
+
#nextFrame(timestamp) {
|
|
8962
8198
|
try {
|
|
8963
8199
|
if (!this.#smooth &&
|
|
8964
8200
|
this.#lastFrameTime !== undefined &&
|
|
@@ -8986,7 +8222,7 @@
|
|
|
8986
8222
|
catch (e) {
|
|
8987
8223
|
getLogger().error("error in animation loop", e);
|
|
8988
8224
|
}
|
|
8989
|
-
}
|
|
8225
|
+
}
|
|
8990
8226
|
}
|
|
8991
8227
|
|
|
8992
8228
|
var Container$1 = /*#__PURE__*/Object.freeze({
|
|
@@ -9032,7 +8268,7 @@
|
|
|
9032
8268
|
BlendPluginInstance: BlendPluginInstance
|
|
9033
8269
|
});
|
|
9034
8270
|
|
|
9035
|
-
const
|
|
8271
|
+
const moveSpeedFactor = 60, minSpinRadius = 0, spinFactor = 0.01, defaultPathDelay = 0, noDecay = 1;
|
|
9036
8272
|
function applyDistance(particle) {
|
|
9037
8273
|
const initialPosition = particle.initialPosition, { dx, dy } = getDistances(initialPosition, particle.position), dxFixed = Math.abs(dx), dyFixed = Math.abs(dy), { maxDistance } = particle.retina, hDistance = maxDistance.horizontal, vDistance = maxDistance.vertical;
|
|
9038
8274
|
if (!hDistance && !vDistance) {
|
|
@@ -9065,7 +8301,7 @@
|
|
|
9065
8301
|
}
|
|
9066
8302
|
function move(particle, moveOptions, moveSpeed, maxSpeed, moveDrift, reduceFactor, delta) {
|
|
9067
8303
|
applyPath(particle, delta);
|
|
9068
|
-
const gravityOptions = particle.gravity, gravityFactor = gravityOptions?.enable && gravityOptions.inverse ? -identity$
|
|
8304
|
+
const gravityOptions = particle.gravity, gravityFactor = gravityOptions?.enable && gravityOptions.inverse ? -identity$2 : identity$2;
|
|
9069
8305
|
if (moveDrift && moveSpeed) {
|
|
9070
8306
|
particle.velocity.x += (moveDrift * delta.factor) / (moveSpeedFactor * moveSpeed);
|
|
9071
8307
|
}
|
|
@@ -9085,7 +8321,7 @@
|
|
|
9085
8321
|
particle.velocity.y = velocity.y / moveSpeed;
|
|
9086
8322
|
}
|
|
9087
8323
|
}
|
|
9088
|
-
const zIndexOptions = particle.options.zIndex, zVelocityFactor = (identity$
|
|
8324
|
+
const zIndexOptions = particle.options.zIndex, zVelocityFactor = (identity$2 - particle.zIndexFactor) ** zIndexOptions.velocityRate;
|
|
9089
8325
|
velocity.multTo(zVelocityFactor);
|
|
9090
8326
|
velocity.multTo(reduceFactor);
|
|
9091
8327
|
const { position } = particle;
|
|
@@ -9111,13 +8347,13 @@
|
|
|
9111
8347
|
const maxCanvasSize = Math.max(container.canvas.size.width, container.canvas.size.height), halfMaxSize = maxCanvasSize * half;
|
|
9112
8348
|
if (particle.spin.radius > halfMaxSize) {
|
|
9113
8349
|
particle.spin.radius = halfMaxSize;
|
|
9114
|
-
particle.spin.acceleration *= -identity$
|
|
8350
|
+
particle.spin.acceleration *= -identity$2;
|
|
9115
8351
|
}
|
|
9116
8352
|
else if (particle.spin.radius < minSpinRadius) {
|
|
9117
8353
|
particle.spin.radius = minSpinRadius;
|
|
9118
|
-
particle.spin.acceleration *= -identity$
|
|
8354
|
+
particle.spin.acceleration *= -identity$2;
|
|
9119
8355
|
}
|
|
9120
|
-
particle.spin.angle += moveSpeed * spinFactor * (identity$
|
|
8356
|
+
particle.spin.angle += moveSpeed * spinFactor * (identity$2 - particle.spin.radius / maxCanvasSize);
|
|
9121
8357
|
}
|
|
9122
8358
|
function applyPath(particle, delta) {
|
|
9123
8359
|
const particlesOptions = particle.options, pathOptions = particlesOptions.move.path, pathEnabled = pathOptions.enable;
|
|
@@ -9134,13 +8370,13 @@
|
|
|
9134
8370
|
particle.velocity.addTo(path);
|
|
9135
8371
|
}
|
|
9136
8372
|
if (pathOptions.clamp) {
|
|
9137
|
-
particle.velocity.x = clamp(particle.velocity.x, -identity$
|
|
9138
|
-
particle.velocity.y = clamp(particle.velocity.y, -identity$
|
|
8373
|
+
particle.velocity.x = clamp(particle.velocity.x, -identity$2, identity$2);
|
|
8374
|
+
particle.velocity.y = clamp(particle.velocity.y, -identity$2, identity$2);
|
|
9139
8375
|
}
|
|
9140
8376
|
particle.lastPathTime -= pathDelay;
|
|
9141
8377
|
}
|
|
9142
8378
|
function getProximitySpeedFactor(particle) {
|
|
9143
|
-
return particle.slow.inRange ? particle.slow.factor : identity$
|
|
8379
|
+
return particle.slow.inRange ? particle.slow.factor : identity$2;
|
|
9144
8380
|
}
|
|
9145
8381
|
function initSpin(container, particle) {
|
|
9146
8382
|
const options = particle.options, spinOptions = options.move.spin;
|
|
@@ -9441,7 +8677,7 @@
|
|
|
9441
8677
|
mediaQuery.addEventListener("change", handleChange);
|
|
9442
8678
|
await Promise.resolve();
|
|
9443
8679
|
}
|
|
9444
|
-
#handleMotionChange
|
|
8680
|
+
#handleMotionChange(mediaQuery) {
|
|
9445
8681
|
const container = this.#container, motion = container.actualOptions.motion;
|
|
9446
8682
|
if (!motion) {
|
|
9447
8683
|
return;
|
|
@@ -9457,7 +8693,7 @@
|
|
|
9457
8693
|
else {
|
|
9458
8694
|
container.retina.reduceFactor = defaultReduce;
|
|
9459
8695
|
}
|
|
9460
|
-
}
|
|
8696
|
+
}
|
|
9461
8697
|
}
|
|
9462
8698
|
|
|
9463
8699
|
var MotionPluginInstance$1 = /*#__PURE__*/Object.freeze({
|
|
@@ -9550,7 +8786,13 @@
|
|
|
9550
8786
|
this.#paused = !this.options.autoPlay;
|
|
9551
8787
|
this.#particlesOptions = particlesOptions;
|
|
9552
8788
|
this.#size = this.#calcSize();
|
|
9553
|
-
this.size =
|
|
8789
|
+
this.size =
|
|
8790
|
+
this.#size.mode === exports.PixelMode.percent
|
|
8791
|
+
? {
|
|
8792
|
+
width: (this.#size.width / percentDenominator) * this.#container.canvas.size.width,
|
|
8793
|
+
height: (this.#size.height / percentDenominator) * this.#container.canvas.size.height,
|
|
8794
|
+
}
|
|
8795
|
+
: { width: this.#size.width, height: this.#size.height };
|
|
9554
8796
|
this.#lifeCount = this.options.life.count ?? defaultLifeCount;
|
|
9555
8797
|
this.#immortal = this.#lifeCount <= minLifeCount;
|
|
9556
8798
|
if (this.options.domId) {
|
|
@@ -9621,7 +8863,13 @@
|
|
|
9621
8863
|
? initialPosition
|
|
9622
8864
|
: this.#calcPosition();
|
|
9623
8865
|
this.#size = this.#calcSize();
|
|
9624
|
-
this.size =
|
|
8866
|
+
this.size =
|
|
8867
|
+
this.#size.mode === exports.PixelMode.percent
|
|
8868
|
+
? {
|
|
8869
|
+
width: (this.#size.width / percentDenominator) * container.canvas.size.width,
|
|
8870
|
+
height: (this.#size.height / percentDenominator) * container.canvas.size.height,
|
|
8871
|
+
}
|
|
8872
|
+
: { width: this.#size.width, height: this.#size.height };
|
|
9625
8873
|
this.#shape?.resize(this.position, this.size);
|
|
9626
8874
|
}
|
|
9627
8875
|
update(delta) {
|
|
@@ -9721,7 +8969,7 @@
|
|
|
9721
8969
|
return size;
|
|
9722
8970
|
})());
|
|
9723
8971
|
}
|
|
9724
|
-
#destroy
|
|
8972
|
+
#destroy() {
|
|
9725
8973
|
this.#mutationObserver?.disconnect();
|
|
9726
8974
|
this.#mutationObserver = undefined;
|
|
9727
8975
|
this.#resizeObserver?.disconnect();
|
|
@@ -9730,7 +8978,7 @@
|
|
|
9730
8978
|
this.#container.dispatchEvent("emitterDestroyed", {
|
|
9731
8979
|
emitter: this,
|
|
9732
8980
|
});
|
|
9733
|
-
}
|
|
8981
|
+
}
|
|
9734
8982
|
#emit() {
|
|
9735
8983
|
if (this.#paused) {
|
|
9736
8984
|
return;
|
|
@@ -9790,7 +9038,7 @@
|
|
|
9790
9038
|
}
|
|
9791
9039
|
}
|
|
9792
9040
|
}
|
|
9793
|
-
#prepareToDie
|
|
9041
|
+
#prepareToDie() {
|
|
9794
9042
|
if (this.#paused) {
|
|
9795
9043
|
return;
|
|
9796
9044
|
}
|
|
@@ -9798,8 +9046,8 @@
|
|
|
9798
9046
|
if ((this.#lifeCount > minLifeCount || this.#immortal) && duration !== undefined && duration > minDuration) {
|
|
9799
9047
|
this.#duration = duration * millisecondsToSeconds;
|
|
9800
9048
|
}
|
|
9801
|
-
}
|
|
9802
|
-
#setColorAnimation
|
|
9049
|
+
}
|
|
9050
|
+
#setColorAnimation(animation, initValue, maxValue, factor = defaultColorAnimationFactor) {
|
|
9803
9051
|
const container = this.#container;
|
|
9804
9052
|
if (!animation.enable) {
|
|
9805
9053
|
return initValue;
|
|
@@ -9808,7 +9056,7 @@
|
|
|
9808
9056
|
? (delay * millisecondsToSeconds) / container.retina.reduceFactor
|
|
9809
9057
|
: Infinity, colorSpeed = getRangeValue(animation.speed);
|
|
9810
9058
|
return (initValue + (colorSpeed * container.fpsLimit) / emitFactor + colorOffset * factor) % maxValue;
|
|
9811
|
-
}
|
|
9059
|
+
}
|
|
9812
9060
|
}
|
|
9813
9061
|
|
|
9814
9062
|
var EmitterInstance$1 = /*#__PURE__*/Object.freeze({
|
|
@@ -9831,6 +9079,7 @@
|
|
|
9831
9079
|
exports.MoveCenter = MoveCenter;
|
|
9832
9080
|
exports.MoveGravity = MoveGravity;
|
|
9833
9081
|
exports.MovePath = MovePath;
|
|
9082
|
+
exports.OptionLoader = OptionLoader;
|
|
9834
9083
|
exports.Options = Options;
|
|
9835
9084
|
exports.OptionsColor = OptionsColor;
|
|
9836
9085
|
exports.OutModes = OutModes;
|
|
@@ -9855,9 +9104,7 @@
|
|
|
9855
9104
|
exports.alterHsl = alterHsl;
|
|
9856
9105
|
exports.animate = animate;
|
|
9857
9106
|
exports.areBoundsInside = areBoundsInside;
|
|
9858
|
-
exports.arrayRandomIndex = arrayRandomIndex;
|
|
9859
9107
|
exports.calcExactPositionOrRandomFromSize = calcExactPositionOrRandomFromSize;
|
|
9860
|
-
exports.calcExactPositionOrRandomFromSizeRanged = calcExactPositionOrRandomFromSizeRanged;
|
|
9861
9108
|
exports.calcPositionFromSize = calcPositionFromSize;
|
|
9862
9109
|
exports.calcPositionOrRandomFromSize = calcPositionOrRandomFromSize;
|
|
9863
9110
|
exports.calcPositionOrRandomFromSizeRanged = calcPositionOrRandomFromSizeRanged;
|
|
@@ -9869,11 +9116,9 @@
|
|
|
9869
9116
|
exports.circleBounce = circleBounce;
|
|
9870
9117
|
exports.circleBounceDataFromParticle = circleBounceDataFromParticle;
|
|
9871
9118
|
exports.clamp = clamp;
|
|
9872
|
-
exports.clear = clear;
|
|
9873
9119
|
exports.cloneStyle = cloneStyle;
|
|
9874
9120
|
exports.collisionVelocity = collisionVelocity;
|
|
9875
9121
|
exports.colorMix = colorMix;
|
|
9876
|
-
exports.colorToHsl = colorToHsl;
|
|
9877
9122
|
exports.colorToRgb = colorToRgb;
|
|
9878
9123
|
exports.confetti = confetti;
|
|
9879
9124
|
exports.countOffset = countOffset;
|
|
@@ -9901,16 +9146,8 @@
|
|
|
9901
9146
|
exports.deleteCount = deleteCount;
|
|
9902
9147
|
exports.double = double;
|
|
9903
9148
|
exports.doublePI = doublePI;
|
|
9904
|
-
exports.drawAfterEffect = drawAfterEffect;
|
|
9905
|
-
exports.drawBeforeEffect = drawBeforeEffect;
|
|
9906
|
-
exports.drawParticle = drawParticle;
|
|
9907
|
-
exports.drawParticlePlugin = drawParticlePlugin;
|
|
9908
|
-
exports.drawShape = drawShape;
|
|
9909
|
-
exports.drawShapeAfterDraw = drawShapeAfterDraw;
|
|
9910
|
-
exports.drawShapeBeforeDraw = drawShapeBeforeDraw;
|
|
9911
9149
|
exports.empty = empty;
|
|
9912
9150
|
exports.executeOnSingleOrMultiple = executeOnSingleOrMultiple;
|
|
9913
|
-
exports.findItemFromSingleOrMultiple = findItemFromSingleOrMultiple;
|
|
9914
9151
|
exports.generatedAttribute = generatedAttribute;
|
|
9915
9152
|
exports.generatedFalse = generatedFalse;
|
|
9916
9153
|
exports.generatedTrue = generatedTrue;
|
|
@@ -9929,23 +9166,21 @@
|
|
|
9929
9166
|
exports.getParticleDirectionAngle = getParticleDirectionAngle;
|
|
9930
9167
|
exports.getPosition = getPosition;
|
|
9931
9168
|
exports.getRandom = getRandom;
|
|
9169
|
+
exports.getRandomFn = getRandomFn;
|
|
9932
9170
|
exports.getRandomInRange = getRandomInRange;
|
|
9933
9171
|
exports.getRandomRgbColor = getRandomRgbColor;
|
|
9934
9172
|
exports.getRangeMax = getRangeMax;
|
|
9935
9173
|
exports.getRangeMin = getRangeMin;
|
|
9936
9174
|
exports.getRangeValue = getRangeValue;
|
|
9937
|
-
exports.getSize = getSize;
|
|
9938
9175
|
exports.getStyleFromHsl = getStyleFromHsl;
|
|
9939
9176
|
exports.getStyleFromRgb = getStyleFromRgb;
|
|
9940
9177
|
exports.hMax = hMax;
|
|
9941
9178
|
exports.hMin = hMin;
|
|
9942
9179
|
exports.hPhase = hPhase;
|
|
9943
9180
|
exports.half = half;
|
|
9944
|
-
exports.hasMatchMedia = hasMatchMedia;
|
|
9945
9181
|
exports.hslToRgb = hslToRgb;
|
|
9946
9182
|
exports.hslaToRgba = hslaToRgba;
|
|
9947
|
-
exports.identity = identity$
|
|
9948
|
-
exports.initParticleNumericAnimationValue = initParticleNumericAnimationValue;
|
|
9183
|
+
exports.identity = identity$2;
|
|
9949
9184
|
exports.inverseFactorNumerator = inverseFactorNumerator;
|
|
9950
9185
|
exports.isArray = isArray;
|
|
9951
9186
|
exports.isBoolean = isBoolean;
|
|
@@ -9962,28 +9197,34 @@
|
|
|
9962
9197
|
exports.lMax = lMax;
|
|
9963
9198
|
exports.lMin = lMin;
|
|
9964
9199
|
exports.lengthOffset = lengthOffset;
|
|
9200
|
+
exports.loadExtendProperty = loadExtendProperty;
|
|
9201
|
+
exports.loadLazyProperty = loadLazyProperty;
|
|
9965
9202
|
exports.loadMinIndex = loadMinIndex;
|
|
9203
|
+
exports.loadNestedProperty = loadNestedProperty;
|
|
9204
|
+
exports.loadOptionProperty = loadOptionProperty;
|
|
9966
9205
|
exports.loadOptions = loadOptions;
|
|
9967
9206
|
exports.loadParticlesOptions = loadParticlesOptions;
|
|
9207
|
+
exports.loadProperty = loadProperty;
|
|
9968
9208
|
exports.loadRandomFactor = loadRandomFactor;
|
|
9209
|
+
exports.loadRangeProperty = loadRangeProperty;
|
|
9969
9210
|
exports.manageListener = manageListener;
|
|
9970
|
-
exports.
|
|
9211
|
+
exports.maxNits = maxNits;
|
|
9971
9212
|
exports.midColorValue = midColorValue;
|
|
9972
9213
|
exports.millisecondsToSeconds = millisecondsToSeconds;
|
|
9973
9214
|
exports.minCount = minCount;
|
|
9215
|
+
exports.minDistance = minDistance;
|
|
9974
9216
|
exports.minFpsLimit = minFpsLimit;
|
|
9975
9217
|
exports.minIndex = minIndex;
|
|
9976
9218
|
exports.minLimit = minLimit;
|
|
9219
|
+
exports.minRadius = minRadius$1;
|
|
9977
9220
|
exports.minStrokeWidth = minStrokeWidth;
|
|
9978
|
-
exports.minVelocity = minVelocity
|
|
9221
|
+
exports.minVelocity = minVelocity;
|
|
9979
9222
|
exports.minZ = minZ;
|
|
9980
9223
|
exports.minimumSize = minimumSize;
|
|
9981
9224
|
exports.mix = mix;
|
|
9982
9225
|
exports.none = none;
|
|
9983
9226
|
exports.one = one;
|
|
9984
9227
|
exports.originPoint = originPoint;
|
|
9985
|
-
exports.paintBase = paintBase;
|
|
9986
|
-
exports.paintImage = paintImage;
|
|
9987
9228
|
exports.parseAlpha = parseAlpha;
|
|
9988
9229
|
exports.percentDenominator = percentDenominator;
|
|
9989
9230
|
exports.phaseNumerator = phaseNumerator;
|
|
@@ -10001,7 +9242,6 @@
|
|
|
10001
9242
|
exports.sMin = sMin;
|
|
10002
9243
|
exports.sNormalizedOffset = sNormalizedOffset;
|
|
10003
9244
|
exports.safeDocument = safeDocument;
|
|
10004
|
-
exports.safeIntersectionObserver = safeIntersectionObserver;
|
|
10005
9245
|
exports.safeMatchMedia = safeMatchMedia;
|
|
10006
9246
|
exports.safeMutationObserver = safeMutationObserver;
|
|
10007
9247
|
exports.setAnimationFunctions = setAnimationFunctions;
|
|
@@ -10017,7 +9257,6 @@
|
|
|
10017
9257
|
exports.triple = triple;
|
|
10018
9258
|
exports.tryCountIncrement = tryCountIncrement;
|
|
10019
9259
|
exports.tsParticles = tsParticles;
|
|
10020
|
-
exports.updateAnimation = updateAnimation;
|
|
10021
9260
|
exports.updateColor = updateColor;
|
|
10022
9261
|
exports.updateColorValue = updateColorValue;
|
|
10023
9262
|
exports.visibilityChangeEvent = visibilityChangeEvent;
|