@tsparticles/preset-confetti-explosions 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.
|
@@ -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
|
-
/* Preset v4.
|
|
2
|
+
/* Preset 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", double = 2, doublePI = Math.PI * double, defaultFps = 60, 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, defaultTransformValue = 1, minimumSize = 0, zIndexFactorOffset = 1, defaultOpacity$1 = 1, removeDeleteCount = 1, removeMinIndex = 0, defaultFpsLimit = 120, minFpsLimit = 0, canvasFirstIndex = 0, loadRandomFactor = 10000, loadMinIndex = 0, one = 1, none = 0, decayOffset = 1, tryCountIncrement = 1, minZ = 0, minLimit = 0, countOffset = 1, minCount = 0, minIndex = 0, defaultDensityFactor = 1, deleteCount = 1, defaultAngle = 0, identity$
|
|
18
|
+
}, randomColorValue = "random", double = 2, doublePI = Math.PI * double, defaultFps = 60, 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, defaultTransformValue = 1, minimumSize = 0, zIndexFactorOffset = 1, defaultOpacity$1 = 1, removeDeleteCount = 1, removeMinIndex = 0, defaultFpsLimit = 120, minFpsLimit = 0, canvasFirstIndex = 0, loadRandomFactor = 10000, loadMinIndex = 0, one = 1, none = 0, decayOffset = 1, tryCountIncrement = 1, minZ = 0, minLimit = 0, countOffset = 1, minCount = 0, minIndex = 0, defaultDensityFactor = 1, deleteCount = 1, defaultAngle = 0, identity$1 = 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
|
var MoveDirection;
|
|
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
|
}
|
|
@@ -295,27 +290,6 @@
|
|
|
295
290
|
return input.endsWith("%") ? parseFloat(input) / percentDenominator : parseFloat(input);
|
|
296
291
|
}
|
|
297
292
|
|
|
298
|
-
var AnimationMode;
|
|
299
|
-
(function (AnimationMode) {
|
|
300
|
-
AnimationMode["auto"] = "auto";
|
|
301
|
-
AnimationMode["increase"] = "increase";
|
|
302
|
-
AnimationMode["decrease"] = "decrease";
|
|
303
|
-
AnimationMode["random"] = "random";
|
|
304
|
-
})(AnimationMode || (AnimationMode = {}));
|
|
305
|
-
|
|
306
|
-
var AnimationStatus;
|
|
307
|
-
(function (AnimationStatus) {
|
|
308
|
-
AnimationStatus["increasing"] = "increasing";
|
|
309
|
-
AnimationStatus["decreasing"] = "decreasing";
|
|
310
|
-
})(AnimationStatus || (AnimationStatus = {}));
|
|
311
|
-
|
|
312
|
-
var DestroyType;
|
|
313
|
-
(function (DestroyType) {
|
|
314
|
-
DestroyType["none"] = "none";
|
|
315
|
-
DestroyType["max"] = "max";
|
|
316
|
-
DestroyType["min"] = "min";
|
|
317
|
-
})(DestroyType || (DestroyType = {}));
|
|
318
|
-
|
|
319
293
|
var OutModeDirection;
|
|
320
294
|
(function (OutModeDirection) {
|
|
321
295
|
OutModeDirection["bottom"] = "bottom";
|
|
@@ -330,67 +304,7 @@
|
|
|
330
304
|
PixelMode["percent"] = "percent";
|
|
331
305
|
})(PixelMode || (PixelMode = {}));
|
|
332
306
|
|
|
333
|
-
var StartValueType;
|
|
334
|
-
(function (StartValueType) {
|
|
335
|
-
StartValueType["max"] = "max";
|
|
336
|
-
StartValueType["min"] = "min";
|
|
337
|
-
StartValueType["random"] = "random";
|
|
338
|
-
})(StartValueType || (StartValueType = {}));
|
|
339
|
-
|
|
340
307
|
const minRadius = 0;
|
|
341
|
-
function memoize(fn, options) {
|
|
342
|
-
const cache = new Map(), stableStringify = (obj, seen = new WeakSet()) => {
|
|
343
|
-
if (obj === null) {
|
|
344
|
-
return "null";
|
|
345
|
-
}
|
|
346
|
-
const t = typeof obj;
|
|
347
|
-
if (t === "undefined") {
|
|
348
|
-
return "undefined";
|
|
349
|
-
}
|
|
350
|
-
if (t === "number" || t === "boolean" || t === "string") {
|
|
351
|
-
return JSON.stringify(obj);
|
|
352
|
-
}
|
|
353
|
-
if (t === "function") {
|
|
354
|
-
try {
|
|
355
|
-
const fn = obj;
|
|
356
|
-
return fn.toString();
|
|
357
|
-
}
|
|
358
|
-
catch {
|
|
359
|
-
return '"[Function]"';
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
if (t === "symbol") {
|
|
363
|
-
try {
|
|
364
|
-
return obj.toString();
|
|
365
|
-
}
|
|
366
|
-
catch {
|
|
367
|
-
return '"[Symbol]"';
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
if (Array.isArray(obj)) {
|
|
371
|
-
return `[${obj.map(i => stableStringify(i, seen)).join(",")}]`;
|
|
372
|
-
}
|
|
373
|
-
if (seen.has(obj)) {
|
|
374
|
-
return '"[Circular]"';
|
|
375
|
-
}
|
|
376
|
-
seen.add(obj);
|
|
377
|
-
const keys = Object.keys(obj).sort();
|
|
378
|
-
return `{${keys.map(k => `${JSON.stringify(k)}:${stableStringify(obj[k], seen)}`).join(",")}}`;
|
|
379
|
-
}, defaultKeyer = (args) => stableStringify(args), makeKey = (args) => (defaultKeyer(args));
|
|
380
|
-
return (...args) => {
|
|
381
|
-
const key = makeKey(args), now = Date.now(), entry = cache.get(key);
|
|
382
|
-
if (entry !== undefined) {
|
|
383
|
-
{
|
|
384
|
-
cache.delete(key);
|
|
385
|
-
cache.set(key, { value: entry.value, ts: entry.ts });
|
|
386
|
-
return entry.value;
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
const result = fn(...args);
|
|
390
|
-
cache.set(key, { value: result, ts: now });
|
|
391
|
-
return result;
|
|
392
|
-
};
|
|
393
|
-
}
|
|
394
308
|
function hasMatchMedia() {
|
|
395
309
|
return typeof matchMedia !== "undefined";
|
|
396
310
|
}
|
|
@@ -412,11 +326,8 @@
|
|
|
412
326
|
function isInArray(value, array) {
|
|
413
327
|
return value === array || (isArray(array) && array.includes(value));
|
|
414
328
|
}
|
|
415
|
-
function arrayRandomIndex(array) {
|
|
416
|
-
return Math.floor(getRandom() * array.length);
|
|
417
|
-
}
|
|
418
329
|
function itemFromArray(array, index, useIndex = true) {
|
|
419
|
-
return array[index !== undefined && useIndex ? index % array.length :
|
|
330
|
+
return array[index !== undefined && useIndex ? index % array.length : Math.floor(getRandom() * array.length)];
|
|
420
331
|
}
|
|
421
332
|
function isPointInside(point, size, offset, radius, direction) {
|
|
422
333
|
return areBoundsInside(calculateBounds(point, radius ?? minRadius), size, offset, direction);
|
|
@@ -500,56 +411,6 @@
|
|
|
500
411
|
function itemFromSingleOrMultiple(obj, index, useIndex) {
|
|
501
412
|
return isArray(obj) ? itemFromArray(obj, index, useIndex) : obj;
|
|
502
413
|
}
|
|
503
|
-
function initParticleNumericAnimationValue(options, pxRatio) {
|
|
504
|
-
const valueRange = options.value, animationOptions = options.animation, res = {
|
|
505
|
-
delayTime: getRangeValue(animationOptions.delay) * millisecondsToSeconds,
|
|
506
|
-
enable: animationOptions.enable,
|
|
507
|
-
value: getRangeValue(options.value) * pxRatio,
|
|
508
|
-
max: getRangeMax(valueRange) * pxRatio,
|
|
509
|
-
min: getRangeMin(valueRange) * pxRatio,
|
|
510
|
-
loops: 0,
|
|
511
|
-
maxLoops: getRangeValue(animationOptions.count),
|
|
512
|
-
time: 0,
|
|
513
|
-
}, decayOffset = 1;
|
|
514
|
-
if (animationOptions.enable) {
|
|
515
|
-
res.decay = decayOffset - getRangeValue(animationOptions.decay);
|
|
516
|
-
switch (animationOptions.mode) {
|
|
517
|
-
case AnimationMode.increase:
|
|
518
|
-
res.status = AnimationStatus.increasing;
|
|
519
|
-
break;
|
|
520
|
-
case AnimationMode.decrease:
|
|
521
|
-
res.status = AnimationStatus.decreasing;
|
|
522
|
-
break;
|
|
523
|
-
case AnimationMode.random:
|
|
524
|
-
res.status = getRandom() >= half ? AnimationStatus.increasing : AnimationStatus.decreasing;
|
|
525
|
-
break;
|
|
526
|
-
}
|
|
527
|
-
const autoStatus = animationOptions.mode === AnimationMode.auto;
|
|
528
|
-
switch (animationOptions.startValue) {
|
|
529
|
-
case StartValueType.min:
|
|
530
|
-
res.value = res.min;
|
|
531
|
-
if (autoStatus) {
|
|
532
|
-
res.status = AnimationStatus.increasing;
|
|
533
|
-
}
|
|
534
|
-
break;
|
|
535
|
-
case StartValueType.max:
|
|
536
|
-
res.value = res.max;
|
|
537
|
-
if (autoStatus) {
|
|
538
|
-
res.status = AnimationStatus.decreasing;
|
|
539
|
-
}
|
|
540
|
-
break;
|
|
541
|
-
case StartValueType.random:
|
|
542
|
-
default:
|
|
543
|
-
res.value = randomInRangeValue(res);
|
|
544
|
-
if (autoStatus) {
|
|
545
|
-
res.status = getRandom() >= half ? AnimationStatus.increasing : AnimationStatus.decreasing;
|
|
546
|
-
}
|
|
547
|
-
break;
|
|
548
|
-
}
|
|
549
|
-
}
|
|
550
|
-
res.initialValue = res.value;
|
|
551
|
-
return res;
|
|
552
|
-
}
|
|
553
414
|
function getPositionOrSize(positionOrSize, canvasSize) {
|
|
554
415
|
const isPercent = positionOrSize.mode === PixelMode.percent;
|
|
555
416
|
if (!isPercent) {
|
|
@@ -573,80 +434,6 @@
|
|
|
573
434
|
function getPosition(position, canvasSize) {
|
|
574
435
|
return getPositionOrSize(position, canvasSize);
|
|
575
436
|
}
|
|
576
|
-
function getSize(size, canvasSize) {
|
|
577
|
-
return getPositionOrSize(size, canvasSize);
|
|
578
|
-
}
|
|
579
|
-
function checkDestroy(particle, destroyType, value, minValue, maxValue) {
|
|
580
|
-
switch (destroyType) {
|
|
581
|
-
case DestroyType.max:
|
|
582
|
-
if (value >= maxValue) {
|
|
583
|
-
particle.destroy();
|
|
584
|
-
}
|
|
585
|
-
break;
|
|
586
|
-
case DestroyType.min:
|
|
587
|
-
if (value <= minValue) {
|
|
588
|
-
particle.destroy();
|
|
589
|
-
}
|
|
590
|
-
break;
|
|
591
|
-
}
|
|
592
|
-
}
|
|
593
|
-
function updateAnimation(particle, data, changeDirection, destroyType, delta) {
|
|
594
|
-
const minLoops = 0, minDelay = 0, identity = 1, minVelocity = 0, minDecay = 1;
|
|
595
|
-
if (particle.destroyed ||
|
|
596
|
-
!data.enable ||
|
|
597
|
-
((data.maxLoops ?? minLoops) > minLoops && (data.loops ?? minLoops) > (data.maxLoops ?? minLoops))) {
|
|
598
|
-
return;
|
|
599
|
-
}
|
|
600
|
-
const velocity = (data.velocity ?? minVelocity) * delta.factor, minValue = data.min, maxValue = data.max, decay = data.decay ?? minDecay;
|
|
601
|
-
data.time ??= 0;
|
|
602
|
-
if ((data.delayTime ?? minDelay) > minDelay && data.time < (data.delayTime ?? minDelay)) {
|
|
603
|
-
data.time += delta.value;
|
|
604
|
-
}
|
|
605
|
-
if ((data.delayTime ?? minDelay) > minDelay && data.time < (data.delayTime ?? minDelay)) {
|
|
606
|
-
return;
|
|
607
|
-
}
|
|
608
|
-
switch (data.status) {
|
|
609
|
-
case AnimationStatus.increasing:
|
|
610
|
-
data.value += velocity;
|
|
611
|
-
break;
|
|
612
|
-
case AnimationStatus.decreasing:
|
|
613
|
-
data.value -= velocity;
|
|
614
|
-
break;
|
|
615
|
-
}
|
|
616
|
-
if (data.velocity && decay !== identity) {
|
|
617
|
-
data.velocity *= decay;
|
|
618
|
-
}
|
|
619
|
-
switch (data.status) {
|
|
620
|
-
case AnimationStatus.increasing:
|
|
621
|
-
if (data.value >= maxValue) {
|
|
622
|
-
if (changeDirection) {
|
|
623
|
-
data.status = AnimationStatus.decreasing;
|
|
624
|
-
}
|
|
625
|
-
else {
|
|
626
|
-
data.value -= maxValue;
|
|
627
|
-
}
|
|
628
|
-
data.loops ??= minLoops;
|
|
629
|
-
data.loops++;
|
|
630
|
-
}
|
|
631
|
-
break;
|
|
632
|
-
case AnimationStatus.decreasing:
|
|
633
|
-
if (data.value <= minValue) {
|
|
634
|
-
if (changeDirection) {
|
|
635
|
-
data.status = AnimationStatus.increasing;
|
|
636
|
-
}
|
|
637
|
-
else {
|
|
638
|
-
data.value += maxValue;
|
|
639
|
-
}
|
|
640
|
-
data.loops ??= minLoops;
|
|
641
|
-
data.loops++;
|
|
642
|
-
}
|
|
643
|
-
break;
|
|
644
|
-
}
|
|
645
|
-
checkDestroy(particle, destroyType, data.value, minValue, maxValue);
|
|
646
|
-
if (!particle.destroyed) {
|
|
647
|
-
data.value = clamp(data.value, minValue, maxValue);
|
|
648
|
-
}
|
|
649
|
-
}
|
|
650
437
|
function cloneStyle(style) {
|
|
651
438
|
const clonedStyle = safeDocument().createElement("div").style;
|
|
652
439
|
for (const key in style) {
|
|
@@ -668,30 +455,34 @@
|
|
|
668
455
|
}
|
|
669
456
|
return clonedStyle;
|
|
670
457
|
}
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
458
|
+
let _cachedZIndex, _cachedStyle;
|
|
459
|
+
function getFullScreenStyle(zIndex) {
|
|
460
|
+
if (_cachedZIndex !== zIndex || !_cachedStyle) {
|
|
461
|
+
_cachedZIndex = zIndex;
|
|
462
|
+
const fullScreenStyle = safeDocument().createElement("div").style, radix = 10, style = {
|
|
463
|
+
width: "100%",
|
|
464
|
+
height: "100%",
|
|
465
|
+
margin: "0",
|
|
466
|
+
padding: "0",
|
|
467
|
+
borderWidth: "0",
|
|
468
|
+
position: "fixed",
|
|
469
|
+
zIndex: zIndex.toString(radix),
|
|
470
|
+
"z-index": zIndex.toString(radix),
|
|
471
|
+
top: "0",
|
|
472
|
+
left: "0",
|
|
473
|
+
"pointer-events": "none",
|
|
474
|
+
};
|
|
475
|
+
for (const key in style) {
|
|
476
|
+
const value = style[key];
|
|
477
|
+
if (value === undefined) {
|
|
478
|
+
continue;
|
|
479
|
+
}
|
|
480
|
+
fullScreenStyle.setProperty(key, value);
|
|
689
481
|
}
|
|
690
|
-
fullScreenStyle
|
|
482
|
+
_cachedStyle = fullScreenStyle;
|
|
691
483
|
}
|
|
692
|
-
return
|
|
484
|
+
return _cachedStyle;
|
|
693
485
|
}
|
|
694
|
-
const getFullScreenStyle = memoize(computeFullScreenStyle);
|
|
695
486
|
function manageListener(element, event, handler, add, options) {
|
|
696
487
|
if (add) {
|
|
697
488
|
let addOptions = { passive: true };
|
|
@@ -1018,7 +809,7 @@
|
|
|
1018
809
|
return this.#domArray;
|
|
1019
810
|
}
|
|
1020
811
|
get version() {
|
|
1021
|
-
return "4.
|
|
812
|
+
return "4.2.0";
|
|
1022
813
|
}
|
|
1023
814
|
addEventListener(type, listener) {
|
|
1024
815
|
this.#eventDispatcher.addEventListener(type, listener);
|
|
@@ -1188,6 +979,14 @@
|
|
|
1188
979
|
RotateDirection["random"] = "random";
|
|
1189
980
|
})(RotateDirection || (RotateDirection = {}));
|
|
1190
981
|
|
|
982
|
+
var AnimationMode;
|
|
983
|
+
(function (AnimationMode) {
|
|
984
|
+
AnimationMode["auto"] = "auto";
|
|
985
|
+
AnimationMode["increase"] = "increase";
|
|
986
|
+
AnimationMode["decrease"] = "decrease";
|
|
987
|
+
AnimationMode["random"] = "random";
|
|
988
|
+
})(AnimationMode || (AnimationMode = {}));
|
|
989
|
+
|
|
1191
990
|
var LimitMode;
|
|
1192
991
|
(function (LimitMode) {
|
|
1193
992
|
LimitMode["delete"] = "delete";
|
|
@@ -1209,6 +1008,13 @@
|
|
|
1209
1008
|
AlterType["enlighten"] = "enlighten";
|
|
1210
1009
|
})(AlterType || (AlterType = {}));
|
|
1211
1010
|
|
|
1011
|
+
var DestroyType;
|
|
1012
|
+
(function (DestroyType) {
|
|
1013
|
+
DestroyType["none"] = "none";
|
|
1014
|
+
DestroyType["max"] = "max";
|
|
1015
|
+
DestroyType["min"] = "min";
|
|
1016
|
+
})(DestroyType || (DestroyType = {}));
|
|
1017
|
+
|
|
1212
1018
|
var GradientType;
|
|
1213
1019
|
(function (GradientType) {
|
|
1214
1020
|
GradientType["linear"] = "linear";
|
|
@@ -1223,160 +1029,121 @@
|
|
|
1223
1029
|
ParticleOutType["outside"] = "outside";
|
|
1224
1030
|
})(ParticleOutType || (ParticleOutType = {}));
|
|
1225
1031
|
|
|
1226
|
-
var
|
|
1227
|
-
(function (
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
EasingType["easeInSine"] = "ease-in-sine";
|
|
1241
|
-
EasingType["easeInSmoothstep"] = "ease-in-smoothstep";
|
|
1242
|
-
EasingType["easeOutBack"] = "ease-out-back";
|
|
1243
|
-
EasingType["easeOutBounce"] = "ease-out-bounce";
|
|
1244
|
-
EasingType["easeOutCirc"] = "ease-out-circ";
|
|
1245
|
-
EasingType["easeOutCubic"] = "ease-out-cubic";
|
|
1246
|
-
EasingType["easeOutElastic"] = "ease-out-elastic";
|
|
1247
|
-
EasingType["easeOutExpo"] = "ease-out-expo";
|
|
1248
|
-
EasingType["easeOutGaussian"] = "ease-out-gaussian";
|
|
1249
|
-
EasingType["easeOutLinear"] = "ease-out-linear";
|
|
1250
|
-
EasingType["easeOutQuad"] = "ease-out-quad";
|
|
1251
|
-
EasingType["easeOutQuart"] = "ease-out-quart";
|
|
1252
|
-
EasingType["easeOutQuint"] = "ease-out-quint";
|
|
1253
|
-
EasingType["easeOutSigmoid"] = "ease-out-sigmoid";
|
|
1254
|
-
EasingType["easeOutSine"] = "ease-out-sine";
|
|
1255
|
-
EasingType["easeOutSmoothstep"] = "ease-out-smoothstep";
|
|
1256
|
-
EasingType["easeInOutBack"] = "ease-in-out-back";
|
|
1257
|
-
EasingType["easeInOutBounce"] = "ease-in-out-bounce";
|
|
1258
|
-
EasingType["easeInOutCirc"] = "ease-in-out-circ";
|
|
1259
|
-
EasingType["easeInOutCubic"] = "ease-in-out-cubic";
|
|
1260
|
-
EasingType["easeInOutElastic"] = "ease-in-out-elastic";
|
|
1261
|
-
EasingType["easeInOutExpo"] = "ease-in-out-expo";
|
|
1262
|
-
EasingType["easeInOutGaussian"] = "ease-in-out-gaussian";
|
|
1263
|
-
EasingType["easeInOutLinear"] = "ease-in-out-linear";
|
|
1264
|
-
EasingType["easeInOutQuad"] = "ease-in-out-quad";
|
|
1265
|
-
EasingType["easeInOutQuart"] = "ease-in-out-quart";
|
|
1266
|
-
EasingType["easeInOutQuint"] = "ease-in-out-quint";
|
|
1267
|
-
EasingType["easeInOutSigmoid"] = "ease-in-out-sigmoid";
|
|
1268
|
-
EasingType["easeInOutSine"] = "ease-in-out-sine";
|
|
1269
|
-
EasingType["easeInOutSmoothstep"] = "ease-in-out-smoothstep";
|
|
1270
|
-
})(EasingType || (EasingType = {}));
|
|
1271
|
-
|
|
1272
|
-
class AnimationOptions {
|
|
1273
|
-
count;
|
|
1274
|
-
decay;
|
|
1275
|
-
delay;
|
|
1276
|
-
enable;
|
|
1277
|
-
speed;
|
|
1278
|
-
sync;
|
|
1279
|
-
constructor() {
|
|
1280
|
-
this.count = 0;
|
|
1281
|
-
this.enable = false;
|
|
1282
|
-
this.speed = 1;
|
|
1283
|
-
this.decay = 0;
|
|
1284
|
-
this.delay = 0;
|
|
1285
|
-
this.sync = false;
|
|
1286
|
-
}
|
|
1032
|
+
var StartValueType;
|
|
1033
|
+
(function (StartValueType) {
|
|
1034
|
+
StartValueType["max"] = "max";
|
|
1035
|
+
StartValueType["min"] = "min";
|
|
1036
|
+
StartValueType["random"] = "random";
|
|
1037
|
+
})(StartValueType || (StartValueType = {}));
|
|
1038
|
+
|
|
1039
|
+
var AnimationStatus;
|
|
1040
|
+
(function (AnimationStatus) {
|
|
1041
|
+
AnimationStatus["increasing"] = "increasing";
|
|
1042
|
+
AnimationStatus["decreasing"] = "decreasing";
|
|
1043
|
+
})(AnimationStatus || (AnimationStatus = {}));
|
|
1044
|
+
|
|
1045
|
+
class OptionLoader {
|
|
1287
1046
|
load(data) {
|
|
1288
1047
|
if (isNull(data)) {
|
|
1289
1048
|
return;
|
|
1290
1049
|
}
|
|
1291
|
-
|
|
1292
|
-
this.count = setRangeValue(data.count);
|
|
1293
|
-
}
|
|
1294
|
-
if (data.enable !== undefined) {
|
|
1295
|
-
this.enable = data.enable;
|
|
1296
|
-
}
|
|
1297
|
-
if (data.speed !== undefined) {
|
|
1298
|
-
this.speed = setRangeValue(data.speed);
|
|
1299
|
-
}
|
|
1300
|
-
if (data.decay !== undefined) {
|
|
1301
|
-
this.decay = setRangeValue(data.decay);
|
|
1302
|
-
}
|
|
1303
|
-
if (data.delay !== undefined) {
|
|
1304
|
-
this.delay = setRangeValue(data.delay);
|
|
1305
|
-
}
|
|
1306
|
-
if (data.sync !== undefined) {
|
|
1307
|
-
this.sync = data.sync;
|
|
1308
|
-
}
|
|
1050
|
+
this.doLoad(data);
|
|
1309
1051
|
}
|
|
1310
1052
|
}
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
constructor() {
|
|
1315
|
-
super();
|
|
1316
|
-
this.mode = AnimationMode.auto;
|
|
1317
|
-
this.startValue = StartValueType.random;
|
|
1053
|
+
function loadOptions(options, ...sourceOptionsArr) {
|
|
1054
|
+
for (const sourceOptions of sourceOptionsArr) {
|
|
1055
|
+
options.load(sourceOptions);
|
|
1318
1056
|
}
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1057
|
+
}
|
|
1058
|
+
|
|
1059
|
+
function loadProperty(obj, key, value) {
|
|
1060
|
+
if (value !== undefined) {
|
|
1061
|
+
obj[key] = value;
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
function loadRangeProperty(obj, key, value) {
|
|
1065
|
+
if (value !== undefined) {
|
|
1066
|
+
obj[key] = setRangeValue(value);
|
|
1067
|
+
}
|
|
1068
|
+
}
|
|
1069
|
+
function loadNestedProperty(obj, key, value) {
|
|
1070
|
+
if (value !== undefined) {
|
|
1071
|
+
obj[key].load(value);
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
function loadLazyProperty(obj, key, value, factory) {
|
|
1075
|
+
if (value !== undefined) {
|
|
1076
|
+
const objRecord = obj;
|
|
1077
|
+
objRecord[key] ??= factory();
|
|
1078
|
+
objRecord[key].load(value);
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1081
|
+
function loadOptionProperty(obj, key, optionClass, ...sources) {
|
|
1082
|
+
const objRecord = obj;
|
|
1083
|
+
objRecord[key] ??= new optionClass();
|
|
1084
|
+
const target = objRecord[key];
|
|
1085
|
+
for (const source of sources) {
|
|
1086
|
+
target.load(source?.[key]);
|
|
1087
|
+
}
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
class AnimationOptions extends OptionLoader {
|
|
1091
|
+
count = 0;
|
|
1092
|
+
decay = 0;
|
|
1093
|
+
delay = 0;
|
|
1094
|
+
enable = false;
|
|
1095
|
+
speed = 1;
|
|
1096
|
+
sync = false;
|
|
1097
|
+
doLoad(data) {
|
|
1098
|
+
loadRangeProperty(this, "count", data.count);
|
|
1099
|
+
loadProperty(this, "enable", data.enable);
|
|
1100
|
+
loadRangeProperty(this, "speed", data.speed);
|
|
1101
|
+
loadRangeProperty(this, "decay", data.decay);
|
|
1102
|
+
loadRangeProperty(this, "delay", data.delay);
|
|
1103
|
+
loadProperty(this, "sync", data.sync);
|
|
1104
|
+
}
|
|
1105
|
+
}
|
|
1106
|
+
class RangedAnimationOptions extends AnimationOptions {
|
|
1107
|
+
mode = AnimationMode.auto;
|
|
1108
|
+
startValue = StartValueType.random;
|
|
1109
|
+
doLoad(data) {
|
|
1110
|
+
super.doLoad(data);
|
|
1111
|
+
loadProperty(this, "mode", data.mode);
|
|
1112
|
+
loadProperty(this, "startValue", data.startValue);
|
|
1330
1113
|
}
|
|
1331
1114
|
}
|
|
1332
1115
|
|
|
1333
1116
|
class ColorAnimation extends AnimationOptions {
|
|
1334
1117
|
max;
|
|
1335
1118
|
min;
|
|
1336
|
-
offset;
|
|
1119
|
+
offset = 0;
|
|
1120
|
+
sync = true;
|
|
1337
1121
|
constructor(min, max) {
|
|
1338
1122
|
super();
|
|
1339
1123
|
this.min = min;
|
|
1340
1124
|
this.max = max;
|
|
1341
|
-
this.offset = 0;
|
|
1342
|
-
this.sync = true;
|
|
1343
1125
|
}
|
|
1344
|
-
|
|
1345
|
-
super.
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
if (data.max !== undefined) {
|
|
1350
|
-
this.max = data.max;
|
|
1351
|
-
}
|
|
1352
|
-
if (data.min !== undefined) {
|
|
1353
|
-
this.min = data.min;
|
|
1354
|
-
}
|
|
1355
|
-
if (data.offset !== undefined) {
|
|
1356
|
-
this.offset = setRangeValue(data.offset);
|
|
1357
|
-
}
|
|
1126
|
+
doLoad(data) {
|
|
1127
|
+
super.doLoad(data);
|
|
1128
|
+
loadProperty(this, "max", data.max);
|
|
1129
|
+
loadProperty(this, "min", data.min);
|
|
1130
|
+
loadRangeProperty(this, "offset", data.offset);
|
|
1358
1131
|
}
|
|
1359
1132
|
}
|
|
1360
1133
|
|
|
1361
|
-
class HslAnimation {
|
|
1134
|
+
class HslAnimation extends OptionLoader {
|
|
1362
1135
|
h = new ColorAnimation(hMin, hMax);
|
|
1363
1136
|
l = new ColorAnimation(lMin, lMax);
|
|
1364
1137
|
s = new ColorAnimation(sMin, sMax);
|
|
1365
|
-
|
|
1366
|
-
if (isNull(data)) {
|
|
1367
|
-
return;
|
|
1368
|
-
}
|
|
1138
|
+
doLoad(data) {
|
|
1369
1139
|
this.h.load(data.h);
|
|
1370
1140
|
this.s.load(data.s);
|
|
1371
1141
|
this.l.load(data.l);
|
|
1372
1142
|
}
|
|
1373
1143
|
}
|
|
1374
1144
|
|
|
1375
|
-
class OptionsColor {
|
|
1376
|
-
value;
|
|
1377
|
-
constructor() {
|
|
1378
|
-
this.value = "";
|
|
1379
|
-
}
|
|
1145
|
+
class OptionsColor extends OptionLoader {
|
|
1146
|
+
value = "";
|
|
1380
1147
|
static create(source, data) {
|
|
1381
1148
|
const color = new OptionsColor();
|
|
1382
1149
|
color.load(source);
|
|
@@ -1390,10 +1157,7 @@
|
|
|
1390
1157
|
}
|
|
1391
1158
|
return color;
|
|
1392
1159
|
}
|
|
1393
|
-
|
|
1394
|
-
if (isNull(data)) {
|
|
1395
|
-
return;
|
|
1396
|
-
}
|
|
1160
|
+
doLoad(data) {
|
|
1397
1161
|
if (!isNull(data.value)) {
|
|
1398
1162
|
this.value = data.value;
|
|
1399
1163
|
}
|
|
@@ -1401,11 +1165,7 @@
|
|
|
1401
1165
|
}
|
|
1402
1166
|
|
|
1403
1167
|
class AnimatableColor extends OptionsColor {
|
|
1404
|
-
animation;
|
|
1405
|
-
constructor() {
|
|
1406
|
-
super();
|
|
1407
|
-
this.animation = new HslAnimation();
|
|
1408
|
-
}
|
|
1168
|
+
animation = new HslAnimation();
|
|
1409
1169
|
static create(source, data) {
|
|
1410
1170
|
const color = new AnimatableColor();
|
|
1411
1171
|
color.load(source);
|
|
@@ -1419,11 +1179,8 @@
|
|
|
1419
1179
|
}
|
|
1420
1180
|
return color;
|
|
1421
1181
|
}
|
|
1422
|
-
|
|
1423
|
-
super.
|
|
1424
|
-
if (isNull(data)) {
|
|
1425
|
-
return;
|
|
1426
|
-
}
|
|
1182
|
+
doLoad(data) {
|
|
1183
|
+
super.doLoad(data);
|
|
1427
1184
|
const colorAnimation = data.animation;
|
|
1428
1185
|
if (colorAnimation !== undefined) {
|
|
1429
1186
|
if (colorAnimation.enable === undefined) {
|
|
@@ -1436,100 +1193,53 @@
|
|
|
1436
1193
|
}
|
|
1437
1194
|
}
|
|
1438
1195
|
|
|
1439
|
-
class Background {
|
|
1196
|
+
class Background extends OptionLoader {
|
|
1440
1197
|
color;
|
|
1441
|
-
image;
|
|
1442
|
-
opacity;
|
|
1443
|
-
position;
|
|
1444
|
-
repeat;
|
|
1445
|
-
size;
|
|
1198
|
+
image = "";
|
|
1199
|
+
opacity = 1;
|
|
1200
|
+
position = "";
|
|
1201
|
+
repeat = "";
|
|
1202
|
+
size = "";
|
|
1446
1203
|
constructor() {
|
|
1204
|
+
super();
|
|
1447
1205
|
this.color = new OptionsColor();
|
|
1448
1206
|
this.color.value = "";
|
|
1449
|
-
this.image = "";
|
|
1450
|
-
this.position = "";
|
|
1451
|
-
this.repeat = "";
|
|
1452
|
-
this.size = "";
|
|
1453
|
-
this.opacity = 1;
|
|
1454
1207
|
}
|
|
1455
|
-
|
|
1456
|
-
if (isNull(data)) {
|
|
1457
|
-
return;
|
|
1458
|
-
}
|
|
1208
|
+
doLoad(data) {
|
|
1459
1209
|
if (data.color !== undefined) {
|
|
1460
1210
|
this.color = OptionsColor.create(this.color, data.color);
|
|
1461
1211
|
}
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
}
|
|
1468
|
-
if (data.repeat !== undefined) {
|
|
1469
|
-
this.repeat = data.repeat;
|
|
1470
|
-
}
|
|
1471
|
-
if (data.size !== undefined) {
|
|
1472
|
-
this.size = data.size;
|
|
1473
|
-
}
|
|
1474
|
-
if (data.opacity !== undefined) {
|
|
1475
|
-
this.opacity = data.opacity;
|
|
1476
|
-
}
|
|
1212
|
+
loadProperty(this, "image", data.image);
|
|
1213
|
+
loadProperty(this, "position", data.position);
|
|
1214
|
+
loadProperty(this, "repeat", data.repeat);
|
|
1215
|
+
loadProperty(this, "size", data.size);
|
|
1216
|
+
loadProperty(this, "opacity", data.opacity);
|
|
1477
1217
|
}
|
|
1478
1218
|
}
|
|
1479
1219
|
|
|
1480
|
-
class FullScreen {
|
|
1481
|
-
enable;
|
|
1482
|
-
zIndex;
|
|
1483
|
-
|
|
1484
|
-
this.enable
|
|
1485
|
-
this.zIndex
|
|
1486
|
-
}
|
|
1487
|
-
load(data) {
|
|
1488
|
-
if (isNull(data)) {
|
|
1489
|
-
return;
|
|
1490
|
-
}
|
|
1491
|
-
if (data.enable !== undefined) {
|
|
1492
|
-
this.enable = data.enable;
|
|
1493
|
-
}
|
|
1494
|
-
if (data.zIndex !== undefined) {
|
|
1495
|
-
this.zIndex = data.zIndex;
|
|
1496
|
-
}
|
|
1220
|
+
class FullScreen extends OptionLoader {
|
|
1221
|
+
enable = true;
|
|
1222
|
+
zIndex = 0;
|
|
1223
|
+
doLoad(data) {
|
|
1224
|
+
loadProperty(this, "enable", data.enable);
|
|
1225
|
+
loadProperty(this, "zIndex", data.zIndex);
|
|
1497
1226
|
}
|
|
1498
1227
|
}
|
|
1499
1228
|
|
|
1500
|
-
class ResizeEvent {
|
|
1501
|
-
delay;
|
|
1502
|
-
enable;
|
|
1503
|
-
|
|
1504
|
-
this
|
|
1505
|
-
this.enable
|
|
1506
|
-
}
|
|
1507
|
-
load(data) {
|
|
1508
|
-
if (isNull(data)) {
|
|
1509
|
-
return;
|
|
1510
|
-
}
|
|
1511
|
-
if (data.delay !== undefined) {
|
|
1512
|
-
this.delay = data.delay;
|
|
1513
|
-
}
|
|
1514
|
-
if (data.enable !== undefined) {
|
|
1515
|
-
this.enable = data.enable;
|
|
1516
|
-
}
|
|
1229
|
+
class ResizeEvent extends OptionLoader {
|
|
1230
|
+
delay = 0.5;
|
|
1231
|
+
enable = true;
|
|
1232
|
+
doLoad(data) {
|
|
1233
|
+
loadProperty(this, "delay", data.delay);
|
|
1234
|
+
loadProperty(this, "enable", data.enable);
|
|
1517
1235
|
}
|
|
1518
1236
|
}
|
|
1519
1237
|
|
|
1520
|
-
class Effect {
|
|
1521
|
-
close;
|
|
1522
|
-
options;
|
|
1523
|
-
type;
|
|
1524
|
-
|
|
1525
|
-
this.close = true;
|
|
1526
|
-
this.options = {};
|
|
1527
|
-
this.type = [];
|
|
1528
|
-
}
|
|
1529
|
-
load(data) {
|
|
1530
|
-
if (isNull(data)) {
|
|
1531
|
-
return;
|
|
1532
|
-
}
|
|
1238
|
+
class Effect extends OptionLoader {
|
|
1239
|
+
close = true;
|
|
1240
|
+
options = {};
|
|
1241
|
+
type = [];
|
|
1242
|
+
doLoad(data) {
|
|
1533
1243
|
const options = data.options;
|
|
1534
1244
|
if (options !== undefined) {
|
|
1535
1245
|
for (const effect in options) {
|
|
@@ -1539,128 +1249,62 @@
|
|
|
1539
1249
|
}
|
|
1540
1250
|
}
|
|
1541
1251
|
}
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
}
|
|
1545
|
-
if (data.type !== undefined) {
|
|
1546
|
-
this.type = data.type;
|
|
1547
|
-
}
|
|
1252
|
+
loadProperty(this, "close", data.close);
|
|
1253
|
+
loadProperty(this, "type", data.type);
|
|
1548
1254
|
}
|
|
1549
1255
|
}
|
|
1550
1256
|
|
|
1551
|
-
class Fill {
|
|
1257
|
+
class Fill extends OptionLoader {
|
|
1552
1258
|
color;
|
|
1553
|
-
enable;
|
|
1554
|
-
opacity;
|
|
1555
|
-
|
|
1556
|
-
this.enable = true;
|
|
1557
|
-
this.opacity = 1;
|
|
1558
|
-
}
|
|
1559
|
-
load(data) {
|
|
1560
|
-
if (isNull(data)) {
|
|
1561
|
-
return;
|
|
1562
|
-
}
|
|
1259
|
+
enable = true;
|
|
1260
|
+
opacity = 1;
|
|
1261
|
+
doLoad(data) {
|
|
1563
1262
|
if (data.color !== undefined) {
|
|
1564
1263
|
this.color = AnimatableColor.create(this.color, data.color);
|
|
1565
1264
|
}
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
}
|
|
1569
|
-
if (data.opacity !== undefined) {
|
|
1570
|
-
this.opacity = setRangeValue(data.opacity);
|
|
1571
|
-
}
|
|
1265
|
+
loadProperty(this, "enable", data.enable);
|
|
1266
|
+
loadRangeProperty(this, "opacity", data.opacity);
|
|
1572
1267
|
}
|
|
1573
1268
|
}
|
|
1574
1269
|
|
|
1575
|
-
class MoveAngle {
|
|
1576
|
-
offset;
|
|
1577
|
-
value;
|
|
1578
|
-
|
|
1579
|
-
this.offset
|
|
1580
|
-
this.value
|
|
1581
|
-
}
|
|
1582
|
-
load(data) {
|
|
1583
|
-
if (isNull(data)) {
|
|
1584
|
-
return;
|
|
1585
|
-
}
|
|
1586
|
-
if (data.offset !== undefined) {
|
|
1587
|
-
this.offset = setRangeValue(data.offset);
|
|
1588
|
-
}
|
|
1589
|
-
if (data.value !== undefined) {
|
|
1590
|
-
this.value = setRangeValue(data.value);
|
|
1591
|
-
}
|
|
1270
|
+
class MoveAngle extends OptionLoader {
|
|
1271
|
+
offset = 0;
|
|
1272
|
+
value = 90;
|
|
1273
|
+
doLoad(data) {
|
|
1274
|
+
loadRangeProperty(this, "offset", data.offset);
|
|
1275
|
+
loadRangeProperty(this, "value", data.value);
|
|
1592
1276
|
}
|
|
1593
1277
|
}
|
|
1594
1278
|
|
|
1595
|
-
class MoveCenter {
|
|
1596
|
-
mode;
|
|
1597
|
-
radius;
|
|
1598
|
-
x;
|
|
1599
|
-
y;
|
|
1600
|
-
|
|
1601
|
-
this.x
|
|
1602
|
-
this.y
|
|
1603
|
-
this
|
|
1604
|
-
this.radius
|
|
1605
|
-
}
|
|
1606
|
-
load(data) {
|
|
1607
|
-
if (isNull(data)) {
|
|
1608
|
-
return;
|
|
1609
|
-
}
|
|
1610
|
-
if (data.x !== undefined) {
|
|
1611
|
-
this.x = data.x;
|
|
1612
|
-
}
|
|
1613
|
-
if (data.y !== undefined) {
|
|
1614
|
-
this.y = data.y;
|
|
1615
|
-
}
|
|
1616
|
-
if (data.mode !== undefined) {
|
|
1617
|
-
this.mode = data.mode;
|
|
1618
|
-
}
|
|
1619
|
-
if (data.radius !== undefined) {
|
|
1620
|
-
this.radius = data.radius;
|
|
1621
|
-
}
|
|
1279
|
+
class MoveCenter extends OptionLoader {
|
|
1280
|
+
mode = PixelMode.percent;
|
|
1281
|
+
radius = 0;
|
|
1282
|
+
x = 50;
|
|
1283
|
+
y = 50;
|
|
1284
|
+
doLoad(data) {
|
|
1285
|
+
loadProperty(this, "x", data.x);
|
|
1286
|
+
loadProperty(this, "y", data.y);
|
|
1287
|
+
loadProperty(this, "mode", data.mode);
|
|
1288
|
+
loadProperty(this, "radius", data.radius);
|
|
1622
1289
|
}
|
|
1623
1290
|
}
|
|
1624
1291
|
|
|
1625
|
-
class MoveGravity {
|
|
1626
|
-
acceleration;
|
|
1627
|
-
enable;
|
|
1628
|
-
inverse;
|
|
1629
|
-
maxSpeed;
|
|
1630
|
-
|
|
1631
|
-
this
|
|
1632
|
-
this.enable
|
|
1633
|
-
this.inverse
|
|
1634
|
-
this.maxSpeed
|
|
1635
|
-
}
|
|
1636
|
-
load(data) {
|
|
1637
|
-
if (isNull(data)) {
|
|
1638
|
-
return;
|
|
1639
|
-
}
|
|
1640
|
-
if (data.acceleration !== undefined) {
|
|
1641
|
-
this.acceleration = setRangeValue(data.acceleration);
|
|
1642
|
-
}
|
|
1643
|
-
if (data.enable !== undefined) {
|
|
1644
|
-
this.enable = data.enable;
|
|
1645
|
-
}
|
|
1646
|
-
if (data.inverse !== undefined) {
|
|
1647
|
-
this.inverse = data.inverse;
|
|
1648
|
-
}
|
|
1649
|
-
if (data.maxSpeed !== undefined) {
|
|
1650
|
-
this.maxSpeed = setRangeValue(data.maxSpeed);
|
|
1651
|
-
}
|
|
1292
|
+
class MoveGravity extends OptionLoader {
|
|
1293
|
+
acceleration = 9.81;
|
|
1294
|
+
enable = false;
|
|
1295
|
+
inverse = false;
|
|
1296
|
+
maxSpeed = 50;
|
|
1297
|
+
doLoad(data) {
|
|
1298
|
+
loadRangeProperty(this, "acceleration", data.acceleration);
|
|
1299
|
+
loadProperty(this, "enable", data.enable);
|
|
1300
|
+
loadProperty(this, "inverse", data.inverse);
|
|
1301
|
+
loadRangeProperty(this, "maxSpeed", data.maxSpeed);
|
|
1652
1302
|
}
|
|
1653
1303
|
}
|
|
1654
1304
|
|
|
1655
|
-
class ValueWithRandom {
|
|
1656
|
-
value;
|
|
1657
|
-
|
|
1658
|
-
this.value = 0;
|
|
1659
|
-
}
|
|
1660
|
-
load(data) {
|
|
1661
|
-
if (isNull(data)) {
|
|
1662
|
-
return;
|
|
1663
|
-
}
|
|
1305
|
+
class ValueWithRandom extends OptionLoader {
|
|
1306
|
+
value = 0;
|
|
1307
|
+
doLoad(data) {
|
|
1664
1308
|
if (!isNull(data.value)) {
|
|
1665
1309
|
this.value = setRangeValue(data.value);
|
|
1666
1310
|
}
|
|
@@ -1668,51 +1312,25 @@
|
|
|
1668
1312
|
}
|
|
1669
1313
|
class AnimationValueWithRandom extends ValueWithRandom {
|
|
1670
1314
|
animation = new AnimationOptions();
|
|
1671
|
-
|
|
1672
|
-
super.
|
|
1673
|
-
|
|
1674
|
-
return;
|
|
1675
|
-
}
|
|
1676
|
-
const animation = data.animation;
|
|
1677
|
-
if (animation !== undefined) {
|
|
1678
|
-
this.animation.load(animation);
|
|
1679
|
-
}
|
|
1315
|
+
doLoad(data) {
|
|
1316
|
+
super.doLoad(data);
|
|
1317
|
+
loadNestedProperty(this, "animation", data.animation);
|
|
1680
1318
|
}
|
|
1681
1319
|
}
|
|
1682
1320
|
class RangedAnimationValueWithRandom extends AnimationValueWithRandom {
|
|
1683
|
-
animation;
|
|
1684
|
-
constructor() {
|
|
1685
|
-
super();
|
|
1686
|
-
this.animation = new RangedAnimationOptions();
|
|
1687
|
-
}
|
|
1688
|
-
load(data) {
|
|
1689
|
-
super.load(data);
|
|
1690
|
-
}
|
|
1321
|
+
animation = new RangedAnimationOptions();
|
|
1691
1322
|
}
|
|
1692
1323
|
|
|
1693
|
-
class MovePath {
|
|
1694
|
-
clamp;
|
|
1695
|
-
delay;
|
|
1696
|
-
enable;
|
|
1324
|
+
class MovePath extends OptionLoader {
|
|
1325
|
+
clamp = true;
|
|
1326
|
+
delay = new ValueWithRandom();
|
|
1327
|
+
enable = false;
|
|
1697
1328
|
generator;
|
|
1698
|
-
options;
|
|
1699
|
-
|
|
1700
|
-
this.clamp
|
|
1701
|
-
this.delay = new ValueWithRandom();
|
|
1702
|
-
this.enable = false;
|
|
1703
|
-
this.options = {};
|
|
1704
|
-
}
|
|
1705
|
-
load(data) {
|
|
1706
|
-
if (isNull(data)) {
|
|
1707
|
-
return;
|
|
1708
|
-
}
|
|
1709
|
-
if (data.clamp !== undefined) {
|
|
1710
|
-
this.clamp = data.clamp;
|
|
1711
|
-
}
|
|
1329
|
+
options = {};
|
|
1330
|
+
doLoad(data) {
|
|
1331
|
+
loadProperty(this, "clamp", data.clamp);
|
|
1712
1332
|
this.delay.load(data.delay);
|
|
1713
|
-
|
|
1714
|
-
this.enable = data.enable;
|
|
1715
|
-
}
|
|
1333
|
+
loadProperty(this, "enable", data.enable);
|
|
1716
1334
|
this.generator = data.generator;
|
|
1717
1335
|
if (data.options) {
|
|
1718
1336
|
this.options = deepExtend(this.options, data.options);
|
|
@@ -1720,19 +1338,13 @@
|
|
|
1720
1338
|
}
|
|
1721
1339
|
}
|
|
1722
1340
|
|
|
1723
|
-
class OutModes {
|
|
1341
|
+
class OutModes extends OptionLoader {
|
|
1724
1342
|
bottom;
|
|
1725
|
-
default;
|
|
1343
|
+
default = OutMode.out;
|
|
1726
1344
|
left;
|
|
1727
1345
|
right;
|
|
1728
1346
|
top;
|
|
1729
|
-
|
|
1730
|
-
this.default = OutMode.out;
|
|
1731
|
-
}
|
|
1732
|
-
load(data) {
|
|
1733
|
-
if (isNull(data)) {
|
|
1734
|
-
return;
|
|
1735
|
-
}
|
|
1347
|
+
doLoad(data) {
|
|
1736
1348
|
if (data.default !== undefined) {
|
|
1737
1349
|
this.default = data.default;
|
|
1738
1350
|
}
|
|
@@ -1743,79 +1355,42 @@
|
|
|
1743
1355
|
}
|
|
1744
1356
|
}
|
|
1745
1357
|
|
|
1746
|
-
class Spin {
|
|
1747
|
-
acceleration;
|
|
1748
|
-
enable;
|
|
1358
|
+
class Spin extends OptionLoader {
|
|
1359
|
+
acceleration = 0;
|
|
1360
|
+
enable = false;
|
|
1749
1361
|
position;
|
|
1750
|
-
|
|
1751
|
-
this.acceleration
|
|
1752
|
-
this.enable
|
|
1753
|
-
}
|
|
1754
|
-
load(data) {
|
|
1755
|
-
if (isNull(data)) {
|
|
1756
|
-
return;
|
|
1757
|
-
}
|
|
1758
|
-
if (data.acceleration !== undefined) {
|
|
1759
|
-
this.acceleration = setRangeValue(data.acceleration);
|
|
1760
|
-
}
|
|
1761
|
-
if (data.enable !== undefined) {
|
|
1762
|
-
this.enable = data.enable;
|
|
1763
|
-
}
|
|
1362
|
+
doLoad(data) {
|
|
1363
|
+
loadRangeProperty(this, "acceleration", data.acceleration);
|
|
1364
|
+
loadProperty(this, "enable", data.enable);
|
|
1764
1365
|
if (data.position) {
|
|
1765
1366
|
this.position = deepExtend({}, data.position);
|
|
1766
1367
|
}
|
|
1767
1368
|
}
|
|
1768
1369
|
}
|
|
1769
1370
|
|
|
1770
|
-
class Move {
|
|
1771
|
-
angle;
|
|
1772
|
-
center;
|
|
1773
|
-
decay;
|
|
1774
|
-
direction;
|
|
1775
|
-
distance;
|
|
1776
|
-
drift;
|
|
1777
|
-
enable;
|
|
1778
|
-
gravity;
|
|
1779
|
-
outModes;
|
|
1780
|
-
path;
|
|
1781
|
-
random;
|
|
1782
|
-
size;
|
|
1783
|
-
speed;
|
|
1784
|
-
spin;
|
|
1785
|
-
straight;
|
|
1786
|
-
vibrate;
|
|
1787
|
-
warp;
|
|
1788
|
-
|
|
1789
|
-
this.angle = new MoveAngle();
|
|
1790
|
-
this.center = new MoveCenter();
|
|
1791
|
-
this.decay = 0;
|
|
1792
|
-
this.distance = {};
|
|
1793
|
-
this.direction = MoveDirection.none;
|
|
1794
|
-
this.drift = 0;
|
|
1795
|
-
this.enable = false;
|
|
1796
|
-
this.gravity = new MoveGravity();
|
|
1797
|
-
this.path = new MovePath();
|
|
1798
|
-
this.outModes = new OutModes();
|
|
1799
|
-
this.random = false;
|
|
1800
|
-
this.size = false;
|
|
1801
|
-
this.speed = 2;
|
|
1802
|
-
this.spin = new Spin();
|
|
1803
|
-
this.straight = false;
|
|
1804
|
-
this.vibrate = false;
|
|
1805
|
-
this.warp = false;
|
|
1806
|
-
}
|
|
1807
|
-
load(data) {
|
|
1808
|
-
if (isNull(data)) {
|
|
1809
|
-
return;
|
|
1810
|
-
}
|
|
1371
|
+
class Move extends OptionLoader {
|
|
1372
|
+
angle = new MoveAngle();
|
|
1373
|
+
center = new MoveCenter();
|
|
1374
|
+
decay = 0;
|
|
1375
|
+
direction = MoveDirection.none;
|
|
1376
|
+
distance = {};
|
|
1377
|
+
drift = 0;
|
|
1378
|
+
enable = false;
|
|
1379
|
+
gravity = new MoveGravity();
|
|
1380
|
+
outModes = new OutModes();
|
|
1381
|
+
path = new MovePath();
|
|
1382
|
+
random = false;
|
|
1383
|
+
size = false;
|
|
1384
|
+
speed = 2;
|
|
1385
|
+
spin = new Spin();
|
|
1386
|
+
straight = false;
|
|
1387
|
+
vibrate = false;
|
|
1388
|
+
warp = false;
|
|
1389
|
+
doLoad(data) {
|
|
1811
1390
|
this.angle.load(isNumber(data.angle) ? { value: data.angle } : data.angle);
|
|
1812
1391
|
this.center.load(data.center);
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
}
|
|
1816
|
-
if (data.direction !== undefined) {
|
|
1817
|
-
this.direction = data.direction;
|
|
1818
|
-
}
|
|
1392
|
+
loadRangeProperty(this, "decay", data.decay);
|
|
1393
|
+
loadProperty(this, "direction", data.direction);
|
|
1819
1394
|
if (data.distance !== undefined) {
|
|
1820
1395
|
this.distance = isNumber(data.distance)
|
|
1821
1396
|
? {
|
|
@@ -1824,12 +1399,8 @@
|
|
|
1824
1399
|
}
|
|
1825
1400
|
: { ...data.distance };
|
|
1826
1401
|
}
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
}
|
|
1830
|
-
if (data.enable !== undefined) {
|
|
1831
|
-
this.enable = data.enable;
|
|
1832
|
-
}
|
|
1402
|
+
loadRangeProperty(this, "drift", data.drift);
|
|
1403
|
+
loadProperty(this, "enable", data.enable);
|
|
1833
1404
|
this.gravity.load(data.gravity);
|
|
1834
1405
|
const outModes = data.outModes;
|
|
1835
1406
|
if (outModes !== undefined) {
|
|
@@ -1843,177 +1414,91 @@
|
|
|
1843
1414
|
}
|
|
1844
1415
|
}
|
|
1845
1416
|
this.path.load(data.path);
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
if (data.size !== undefined) {
|
|
1850
|
-
this.size = data.size;
|
|
1851
|
-
}
|
|
1852
|
-
if (data.speed !== undefined) {
|
|
1853
|
-
this.speed = setRangeValue(data.speed);
|
|
1854
|
-
}
|
|
1417
|
+
loadProperty(this, "random", data.random);
|
|
1418
|
+
loadProperty(this, "size", data.size);
|
|
1419
|
+
loadRangeProperty(this, "speed", data.speed);
|
|
1855
1420
|
this.spin.load(data.spin);
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
if (data.vibrate !== undefined) {
|
|
1860
|
-
this.vibrate = data.vibrate;
|
|
1861
|
-
}
|
|
1862
|
-
if (data.warp !== undefined) {
|
|
1863
|
-
this.warp = data.warp;
|
|
1864
|
-
}
|
|
1421
|
+
loadProperty(this, "straight", data.straight);
|
|
1422
|
+
loadProperty(this, "vibrate", data.vibrate);
|
|
1423
|
+
loadProperty(this, "warp", data.warp);
|
|
1865
1424
|
}
|
|
1866
1425
|
}
|
|
1867
1426
|
|
|
1868
|
-
class Stroke {
|
|
1427
|
+
class Stroke extends OptionLoader {
|
|
1869
1428
|
color;
|
|
1870
1429
|
opacity;
|
|
1871
|
-
width;
|
|
1872
|
-
|
|
1873
|
-
this.width = 0;
|
|
1874
|
-
}
|
|
1875
|
-
load(data) {
|
|
1876
|
-
if (isNull(data)) {
|
|
1877
|
-
return;
|
|
1878
|
-
}
|
|
1430
|
+
width = 0;
|
|
1431
|
+
doLoad(data) {
|
|
1879
1432
|
if (data.color !== undefined) {
|
|
1880
1433
|
this.color = AnimatableColor.create(this.color, data.color);
|
|
1881
1434
|
}
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
}
|
|
1885
|
-
if (data.opacity !== undefined) {
|
|
1886
|
-
this.opacity = setRangeValue(data.opacity);
|
|
1887
|
-
}
|
|
1435
|
+
loadRangeProperty(this, "width", data.width);
|
|
1436
|
+
loadRangeProperty(this, "opacity", data.opacity);
|
|
1888
1437
|
}
|
|
1889
1438
|
}
|
|
1890
1439
|
|
|
1891
|
-
class Paint {
|
|
1440
|
+
class Paint extends OptionLoader {
|
|
1892
1441
|
color;
|
|
1893
1442
|
fill;
|
|
1894
1443
|
stroke;
|
|
1895
|
-
|
|
1896
|
-
if (isNull(data)) {
|
|
1897
|
-
return;
|
|
1898
|
-
}
|
|
1444
|
+
doLoad(data) {
|
|
1899
1445
|
if (data.color !== undefined) {
|
|
1900
1446
|
this.color = AnimatableColor.create(this.color, data.color);
|
|
1901
1447
|
}
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
this.fill.load(data.fill);
|
|
1905
|
-
}
|
|
1906
|
-
if (data.stroke !== undefined) {
|
|
1907
|
-
this.stroke ??= new Stroke();
|
|
1908
|
-
this.stroke.load(data.stroke);
|
|
1909
|
-
}
|
|
1448
|
+
loadLazyProperty(this, "fill", data.fill, () => new Fill());
|
|
1449
|
+
loadLazyProperty(this, "stroke", data.stroke, () => new Stroke());
|
|
1910
1450
|
}
|
|
1911
1451
|
}
|
|
1912
1452
|
|
|
1913
1453
|
class ParticlesBounceFactor extends ValueWithRandom {
|
|
1914
|
-
|
|
1915
|
-
super();
|
|
1916
|
-
this.value = 1;
|
|
1917
|
-
}
|
|
1454
|
+
value = 1;
|
|
1918
1455
|
}
|
|
1919
1456
|
|
|
1920
|
-
class ParticlesBounce {
|
|
1921
|
-
horizontal;
|
|
1922
|
-
vertical;
|
|
1923
|
-
|
|
1924
|
-
this.horizontal = new ParticlesBounceFactor();
|
|
1925
|
-
this.vertical = new ParticlesBounceFactor();
|
|
1926
|
-
}
|
|
1927
|
-
load(data) {
|
|
1928
|
-
if (isNull(data)) {
|
|
1929
|
-
return;
|
|
1930
|
-
}
|
|
1457
|
+
class ParticlesBounce extends OptionLoader {
|
|
1458
|
+
horizontal = new ParticlesBounceFactor();
|
|
1459
|
+
vertical = new ParticlesBounceFactor();
|
|
1460
|
+
doLoad(data) {
|
|
1931
1461
|
this.horizontal.load(data.horizontal);
|
|
1932
1462
|
this.vertical.load(data.vertical);
|
|
1933
1463
|
}
|
|
1934
1464
|
}
|
|
1935
1465
|
|
|
1936
|
-
class ParticlesDensity {
|
|
1937
|
-
enable;
|
|
1938
|
-
height;
|
|
1939
|
-
width;
|
|
1940
|
-
|
|
1941
|
-
this.enable
|
|
1942
|
-
this.width
|
|
1943
|
-
this.height
|
|
1944
|
-
}
|
|
1945
|
-
load(data) {
|
|
1946
|
-
if (isNull(data)) {
|
|
1947
|
-
return;
|
|
1948
|
-
}
|
|
1949
|
-
if (data.enable !== undefined) {
|
|
1950
|
-
this.enable = data.enable;
|
|
1951
|
-
}
|
|
1952
|
-
const width = data.width;
|
|
1953
|
-
if (width !== undefined) {
|
|
1954
|
-
this.width = width;
|
|
1955
|
-
}
|
|
1956
|
-
const height = data.height;
|
|
1957
|
-
if (height !== undefined) {
|
|
1958
|
-
this.height = height;
|
|
1959
|
-
}
|
|
1466
|
+
class ParticlesDensity extends OptionLoader {
|
|
1467
|
+
enable = false;
|
|
1468
|
+
height = 1080;
|
|
1469
|
+
width = 1920;
|
|
1470
|
+
doLoad(data) {
|
|
1471
|
+
loadProperty(this, "enable", data.enable);
|
|
1472
|
+
loadProperty(this, "width", data.width);
|
|
1473
|
+
loadProperty(this, "height", data.height);
|
|
1960
1474
|
}
|
|
1961
1475
|
}
|
|
1962
1476
|
|
|
1963
|
-
class ParticlesNumberLimit {
|
|
1964
|
-
mode;
|
|
1965
|
-
value;
|
|
1966
|
-
|
|
1967
|
-
this
|
|
1968
|
-
this.value
|
|
1969
|
-
}
|
|
1970
|
-
load(data) {
|
|
1971
|
-
if (isNull(data)) {
|
|
1972
|
-
return;
|
|
1973
|
-
}
|
|
1974
|
-
if (data.mode !== undefined) {
|
|
1975
|
-
this.mode = data.mode;
|
|
1976
|
-
}
|
|
1977
|
-
if (data.value !== undefined) {
|
|
1978
|
-
this.value = data.value;
|
|
1979
|
-
}
|
|
1477
|
+
class ParticlesNumberLimit extends OptionLoader {
|
|
1478
|
+
mode = LimitMode.delete;
|
|
1479
|
+
value = 0;
|
|
1480
|
+
doLoad(data) {
|
|
1481
|
+
loadProperty(this, "mode", data.mode);
|
|
1482
|
+
loadProperty(this, "value", data.value);
|
|
1980
1483
|
}
|
|
1981
1484
|
}
|
|
1982
1485
|
|
|
1983
|
-
class ParticlesNumber {
|
|
1984
|
-
density;
|
|
1985
|
-
limit;
|
|
1986
|
-
value;
|
|
1987
|
-
|
|
1988
|
-
this.density = new ParticlesDensity();
|
|
1989
|
-
this.limit = new ParticlesNumberLimit();
|
|
1990
|
-
this.value = 0;
|
|
1991
|
-
}
|
|
1992
|
-
load(data) {
|
|
1993
|
-
if (isNull(data)) {
|
|
1994
|
-
return;
|
|
1995
|
-
}
|
|
1486
|
+
class ParticlesNumber extends OptionLoader {
|
|
1487
|
+
density = new ParticlesDensity();
|
|
1488
|
+
limit = new ParticlesNumberLimit();
|
|
1489
|
+
value = 0;
|
|
1490
|
+
doLoad(data) {
|
|
1996
1491
|
this.density.load(data.density);
|
|
1997
1492
|
this.limit.load(data.limit);
|
|
1998
|
-
|
|
1999
|
-
this.value = data.value;
|
|
2000
|
-
}
|
|
1493
|
+
loadProperty(this, "value", data.value);
|
|
2001
1494
|
}
|
|
2002
1495
|
}
|
|
2003
1496
|
|
|
2004
|
-
class Shape {
|
|
2005
|
-
close;
|
|
2006
|
-
options;
|
|
2007
|
-
type;
|
|
2008
|
-
|
|
2009
|
-
this.close = true;
|
|
2010
|
-
this.options = {};
|
|
2011
|
-
this.type = "circle";
|
|
2012
|
-
}
|
|
2013
|
-
load(data) {
|
|
2014
|
-
if (isNull(data)) {
|
|
2015
|
-
return;
|
|
2016
|
-
}
|
|
1497
|
+
class Shape extends OptionLoader {
|
|
1498
|
+
close = true;
|
|
1499
|
+
options = {};
|
|
1500
|
+
type = "circle";
|
|
1501
|
+
doLoad(data) {
|
|
2017
1502
|
const options = data.options;
|
|
2018
1503
|
if (options !== undefined) {
|
|
2019
1504
|
for (const shape in options) {
|
|
@@ -2023,76 +1508,47 @@
|
|
|
2023
1508
|
}
|
|
2024
1509
|
}
|
|
2025
1510
|
}
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
}
|
|
2029
|
-
if (data.type !== undefined) {
|
|
2030
|
-
this.type = data.type;
|
|
2031
|
-
}
|
|
1511
|
+
loadProperty(this, "close", data.close);
|
|
1512
|
+
loadProperty(this, "type", data.type);
|
|
2032
1513
|
}
|
|
2033
1514
|
}
|
|
2034
1515
|
|
|
2035
1516
|
class ZIndex extends ValueWithRandom {
|
|
2036
|
-
opacityRate;
|
|
2037
|
-
sizeRate;
|
|
2038
|
-
velocityRate;
|
|
2039
|
-
|
|
2040
|
-
super();
|
|
2041
|
-
this.opacityRate
|
|
2042
|
-
this.sizeRate
|
|
2043
|
-
this.velocityRate
|
|
2044
|
-
}
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
if (data.sizeRate !== undefined) {
|
|
2054
|
-
this.sizeRate = data.sizeRate;
|
|
2055
|
-
}
|
|
2056
|
-
if (data.velocityRate !== undefined) {
|
|
2057
|
-
this.velocityRate = data.velocityRate;
|
|
2058
|
-
}
|
|
2059
|
-
}
|
|
2060
|
-
}
|
|
2061
|
-
|
|
2062
|
-
class ParticlesOptions {
|
|
2063
|
-
bounce;
|
|
2064
|
-
effect;
|
|
2065
|
-
groups;
|
|
2066
|
-
move;
|
|
2067
|
-
number;
|
|
1517
|
+
opacityRate = 1;
|
|
1518
|
+
sizeRate = 1;
|
|
1519
|
+
velocityRate = 1;
|
|
1520
|
+
doLoad(data) {
|
|
1521
|
+
super.doLoad(data);
|
|
1522
|
+
loadProperty(this, "opacityRate", data.opacityRate);
|
|
1523
|
+
loadProperty(this, "sizeRate", data.sizeRate);
|
|
1524
|
+
loadProperty(this, "velocityRate", data.velocityRate);
|
|
1525
|
+
}
|
|
1526
|
+
}
|
|
1527
|
+
|
|
1528
|
+
class ParticlesOptions extends OptionLoader {
|
|
1529
|
+
bounce = new ParticlesBounce();
|
|
1530
|
+
effect = new Effect();
|
|
1531
|
+
groups = {};
|
|
1532
|
+
move = new Move();
|
|
1533
|
+
number = new ParticlesNumber();
|
|
2068
1534
|
paint;
|
|
2069
1535
|
palette;
|
|
2070
|
-
reduceDuplicates;
|
|
2071
|
-
shape;
|
|
2072
|
-
zIndex;
|
|
1536
|
+
reduceDuplicates = false;
|
|
1537
|
+
shape = new Shape();
|
|
1538
|
+
zIndex = new ZIndex();
|
|
2073
1539
|
#container;
|
|
2074
1540
|
#pluginManager;
|
|
2075
1541
|
constructor(pluginManager, container) {
|
|
1542
|
+
super();
|
|
2076
1543
|
this.#pluginManager = pluginManager;
|
|
2077
1544
|
this.#container = container;
|
|
2078
|
-
this.bounce = new ParticlesBounce();
|
|
2079
|
-
this.effect = new Effect();
|
|
2080
|
-
this.groups = {};
|
|
2081
|
-
this.move = new Move();
|
|
2082
|
-
this.number = new ParticlesNumber();
|
|
2083
1545
|
this.paint = new Paint();
|
|
2084
1546
|
this.paint.color = new AnimatableColor();
|
|
2085
1547
|
this.paint.color.value = "#fff";
|
|
2086
1548
|
this.paint.fill = new Fill();
|
|
2087
1549
|
this.paint.fill.enable = true;
|
|
2088
|
-
this.reduceDuplicates = false;
|
|
2089
|
-
this.shape = new Shape();
|
|
2090
|
-
this.zIndex = new ZIndex();
|
|
2091
1550
|
}
|
|
2092
|
-
|
|
2093
|
-
if (isNull(data)) {
|
|
2094
|
-
return;
|
|
2095
|
-
}
|
|
1551
|
+
doLoad(data) {
|
|
2096
1552
|
if (data.palette) {
|
|
2097
1553
|
this.palette = data.palette;
|
|
2098
1554
|
this.#importPalette(this.palette);
|
|
@@ -2150,7 +1606,7 @@
|
|
|
2150
1606
|
}
|
|
2151
1607
|
}
|
|
2152
1608
|
}
|
|
2153
|
-
#importPalette
|
|
1609
|
+
#importPalette(palette) {
|
|
2154
1610
|
const paletteData = this.#pluginManager.getPalette(palette);
|
|
2155
1611
|
if (!paletteData) {
|
|
2156
1612
|
return;
|
|
@@ -2194,289 +1650,117 @@
|
|
|
2194
1650
|
mode: paletteData.blendMode,
|
|
2195
1651
|
},
|
|
2196
1652
|
});
|
|
2197
|
-
};
|
|
2198
|
-
}
|
|
2199
|
-
|
|
2200
|
-
function loadOptions(options, ...sourceOptionsArr) {
|
|
2201
|
-
for (const sourceOptions of sourceOptionsArr) {
|
|
2202
|
-
options.load(sourceOptions);
|
|
2203
1653
|
}
|
|
2204
1654
|
}
|
|
1655
|
+
|
|
2205
1656
|
function loadParticlesOptions(pluginManager, container, ...sourceOptionsArr) {
|
|
2206
1657
|
const options = new ParticlesOptions(pluginManager, container);
|
|
2207
1658
|
loadOptions(options, ...sourceOptionsArr);
|
|
2208
1659
|
return options;
|
|
2209
1660
|
}
|
|
2210
1661
|
|
|
2211
|
-
class Options {
|
|
2212
|
-
autoPlay;
|
|
1662
|
+
class Options extends OptionLoader {
|
|
1663
|
+
autoPlay = true;
|
|
2213
1664
|
background;
|
|
2214
|
-
clear;
|
|
2215
|
-
defaultThemes;
|
|
2216
|
-
delay;
|
|
2217
|
-
detectRetina;
|
|
2218
|
-
duration;
|
|
2219
|
-
fpsLimit;
|
|
1665
|
+
clear = true;
|
|
1666
|
+
defaultThemes = {};
|
|
1667
|
+
delay = 0;
|
|
1668
|
+
detectRetina = true;
|
|
1669
|
+
duration = 0;
|
|
1670
|
+
fpsLimit = 120;
|
|
2220
1671
|
fullScreen;
|
|
2221
|
-
hdr;
|
|
1672
|
+
hdr = true;
|
|
2222
1673
|
key;
|
|
2223
1674
|
name;
|
|
2224
1675
|
palette;
|
|
2225
1676
|
particles;
|
|
2226
|
-
pauseOnBlur;
|
|
2227
|
-
pauseOnOutsideViewport;
|
|
1677
|
+
pauseOnBlur = true;
|
|
1678
|
+
pauseOnOutsideViewport = true;
|
|
2228
1679
|
preset;
|
|
2229
1680
|
resize;
|
|
2230
|
-
smooth;
|
|
2231
|
-
style;
|
|
2232
|
-
zLayers;
|
|
1681
|
+
smooth = false;
|
|
1682
|
+
style = {};
|
|
1683
|
+
zLayers = 100;
|
|
2233
1684
|
#container;
|
|
2234
1685
|
#pluginManager;
|
|
2235
1686
|
constructor(pluginManager, container) {
|
|
1687
|
+
super();
|
|
2236
1688
|
this.#pluginManager = pluginManager;
|
|
2237
1689
|
this.#container = container;
|
|
2238
|
-
this.autoPlay = true;
|
|
2239
1690
|
this.background = new Background();
|
|
2240
|
-
this.clear = true;
|
|
2241
|
-
this.defaultThemes = {};
|
|
2242
|
-
this.delay = 0;
|
|
2243
1691
|
this.fullScreen = new FullScreen();
|
|
2244
|
-
this.detectRetina = true;
|
|
2245
|
-
this.duration = 0;
|
|
2246
|
-
this.fpsLimit = 120;
|
|
2247
|
-
this.hdr = true;
|
|
2248
1692
|
this.particles = loadParticlesOptions(this.#pluginManager, this.#container);
|
|
2249
|
-
this.pauseOnBlur = true;
|
|
2250
|
-
this.pauseOnOutsideViewport = true;
|
|
2251
1693
|
this.resize = new ResizeEvent();
|
|
2252
|
-
this.smooth = false;
|
|
2253
|
-
this.style = {};
|
|
2254
|
-
this.zLayers = 100;
|
|
2255
1694
|
}
|
|
2256
|
-
|
|
2257
|
-
if (isNull(data)) {
|
|
2258
|
-
return;
|
|
2259
|
-
}
|
|
1695
|
+
doLoad(data) {
|
|
2260
1696
|
if (data.preset !== undefined) {
|
|
2261
1697
|
this.preset = data.preset;
|
|
2262
1698
|
executeOnSingleOrMultiple(this.preset, preset => {
|
|
2263
|
-
this.#importPreset(preset);
|
|
2264
|
-
});
|
|
2265
|
-
}
|
|
2266
|
-
if (data.palette !== undefined) {
|
|
2267
|
-
this.palette = data.palette;
|
|
2268
|
-
this.#importPalette(this.palette);
|
|
2269
|
-
}
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
this.hdr = data.hdr;
|
|
2298
|
-
}
|
|
2299
|
-
if (data.pauseOnBlur !== undefined) {
|
|
2300
|
-
this.pauseOnBlur = data.pauseOnBlur;
|
|
2301
|
-
}
|
|
2302
|
-
if (data.pauseOnOutsideViewport !== undefined) {
|
|
2303
|
-
this.pauseOnOutsideViewport = data.pauseOnOutsideViewport;
|
|
2304
|
-
}
|
|
2305
|
-
if (data.zLayers !== undefined) {
|
|
2306
|
-
this.zLayers = data.zLayers;
|
|
2307
|
-
}
|
|
2308
|
-
this.background.load(data.background);
|
|
2309
|
-
const fullScreen = data.fullScreen;
|
|
2310
|
-
if (isBoolean(fullScreen)) {
|
|
2311
|
-
this.fullScreen.enable = fullScreen;
|
|
2312
|
-
}
|
|
2313
|
-
else {
|
|
2314
|
-
this.fullScreen.load(fullScreen);
|
|
2315
|
-
}
|
|
2316
|
-
this.particles.load(data.particles);
|
|
2317
|
-
this.resize.load(data.resize);
|
|
2318
|
-
this.style = deepExtend(this.style, data.style);
|
|
2319
|
-
if (data.smooth !== undefined) {
|
|
2320
|
-
this.smooth = data.smooth;
|
|
2321
|
-
}
|
|
2322
|
-
this.#pluginManager.plugins.forEach(plugin => {
|
|
2323
|
-
plugin.loadOptions(this.#container, this, data);
|
|
2324
|
-
});
|
|
2325
|
-
}
|
|
2326
|
-
#importPalette = palette => {
|
|
2327
|
-
const paletteData = this.#pluginManager.getPalette(palette);
|
|
2328
|
-
if (!paletteData) {
|
|
2329
|
-
return;
|
|
2330
|
-
}
|
|
2331
|
-
this.load({
|
|
2332
|
-
background: {
|
|
2333
|
-
color: paletteData.background,
|
|
2334
|
-
},
|
|
2335
|
-
blend: {
|
|
2336
|
-
enable: true,
|
|
2337
|
-
mode: paletteData.blendMode,
|
|
2338
|
-
},
|
|
2339
|
-
particles: {
|
|
2340
|
-
palette,
|
|
2341
|
-
},
|
|
2342
|
-
});
|
|
2343
|
-
};
|
|
2344
|
-
#importPreset = preset => {
|
|
2345
|
-
this.load(this.#pluginManager.getPreset(preset));
|
|
2346
|
-
};
|
|
2347
|
-
}
|
|
2348
|
-
|
|
2349
|
-
function paintBase(context, dimension, baseColor) {
|
|
2350
|
-
context.fillStyle = baseColor ?? "rgba(0,0,0,0)";
|
|
2351
|
-
context.fillRect(originPoint.x, originPoint.y, dimension.width, dimension.height);
|
|
2352
|
-
}
|
|
2353
|
-
function paintImage(context, dimension, image, opacity) {
|
|
2354
|
-
if (!image) {
|
|
2355
|
-
return;
|
|
2356
|
-
}
|
|
2357
|
-
const prevAlpha = context.globalAlpha;
|
|
2358
|
-
context.globalAlpha = opacity;
|
|
2359
|
-
context.drawImage(image, originPoint.x, originPoint.y, dimension.width, dimension.height);
|
|
2360
|
-
context.globalAlpha = prevAlpha;
|
|
2361
|
-
}
|
|
2362
|
-
function clear(context, dimension) {
|
|
2363
|
-
context.clearRect(originPoint.x, originPoint.y, dimension.width, dimension.height);
|
|
2364
|
-
}
|
|
2365
|
-
function drawParticle(data) {
|
|
2366
|
-
const { container, context, particle, delta, colorStyles, radius, opacity, transform } = data, { effectDrawers, shapeDrawers } = container, pos = particle.getPosition(), transformData = particle.getTransformData(transform), drawScale = defaultZoom, drawPosition = {
|
|
2367
|
-
x: pos.x,
|
|
2368
|
-
y: pos.y,
|
|
2369
|
-
};
|
|
2370
|
-
context.setTransform(transformData.a, transformData.b, transformData.c, transformData.d, pos.x, pos.y);
|
|
2371
|
-
if (colorStyles.fill) {
|
|
2372
|
-
context.fillStyle = colorStyles.fill;
|
|
2373
|
-
}
|
|
2374
|
-
const fillEnabled = !!particle.fillEnabled, strokeWidth = particle.strokeWidth ?? minStrokeWidth;
|
|
2375
|
-
context.lineWidth = strokeWidth;
|
|
2376
|
-
if (colorStyles.stroke) {
|
|
2377
|
-
context.strokeStyle = colorStyles.stroke;
|
|
2378
|
-
}
|
|
2379
|
-
const drawData = {
|
|
2380
|
-
context,
|
|
2381
|
-
particle,
|
|
2382
|
-
radius,
|
|
2383
|
-
drawRadius: radius * drawScale,
|
|
2384
|
-
opacity,
|
|
2385
|
-
delta,
|
|
2386
|
-
pixelRatio: container.retina.pixelRatio,
|
|
2387
|
-
fill: fillEnabled,
|
|
2388
|
-
stroke: strokeWidth > minStrokeWidth,
|
|
2389
|
-
transformData,
|
|
2390
|
-
position: { ...pos },
|
|
2391
|
-
drawPosition,
|
|
2392
|
-
drawScale,
|
|
2393
|
-
};
|
|
2394
|
-
for (const plugin of container.plugins) {
|
|
2395
|
-
plugin.drawParticleTransform?.(drawData);
|
|
2396
|
-
}
|
|
2397
|
-
const effect = particle.effect ? effectDrawers.get(particle.effect) : undefined, shape = particle.shape ? shapeDrawers.get(particle.shape) : undefined;
|
|
2398
|
-
drawBeforeEffect(effect, drawData);
|
|
2399
|
-
drawShapeBeforeDraw(shape, drawData);
|
|
2400
|
-
drawShape(shape, drawData);
|
|
2401
|
-
drawShapeAfterDraw(shape, drawData);
|
|
2402
|
-
drawAfterEffect(effect, drawData);
|
|
2403
|
-
context.resetTransform();
|
|
2404
|
-
}
|
|
2405
|
-
function drawAfterEffect(drawer, data) {
|
|
2406
|
-
if (!drawer?.drawAfter) {
|
|
2407
|
-
return;
|
|
2408
|
-
}
|
|
2409
|
-
const { particle } = data;
|
|
2410
|
-
if (!particle.effect) {
|
|
2411
|
-
return;
|
|
2412
|
-
}
|
|
2413
|
-
drawer.drawAfter(data);
|
|
2414
|
-
}
|
|
2415
|
-
function drawBeforeEffect(drawer, data) {
|
|
2416
|
-
if (!drawer?.drawBefore) {
|
|
2417
|
-
return;
|
|
2418
|
-
}
|
|
2419
|
-
const { particle } = data;
|
|
2420
|
-
if (!particle.effect) {
|
|
2421
|
-
return;
|
|
2422
|
-
}
|
|
2423
|
-
drawer.drawBefore(data);
|
|
2424
|
-
}
|
|
2425
|
-
function drawShape(drawer, data) {
|
|
2426
|
-
if (!drawer) {
|
|
2427
|
-
return;
|
|
2428
|
-
}
|
|
2429
|
-
const { context, fill, particle, stroke } = data;
|
|
2430
|
-
if (!particle.shape) {
|
|
2431
|
-
return;
|
|
2432
|
-
}
|
|
2433
|
-
context.beginPath();
|
|
2434
|
-
drawer.draw(data);
|
|
2435
|
-
if (particle.shapeClose) {
|
|
2436
|
-
context.closePath();
|
|
2437
|
-
}
|
|
2438
|
-
if (fill) {
|
|
2439
|
-
context.fill();
|
|
2440
|
-
}
|
|
2441
|
-
if (stroke) {
|
|
2442
|
-
context.stroke();
|
|
2443
|
-
}
|
|
2444
|
-
}
|
|
2445
|
-
function drawShapeAfterDraw(drawer, data) {
|
|
2446
|
-
if (!drawer?.afterDraw) {
|
|
2447
|
-
return;
|
|
2448
|
-
}
|
|
2449
|
-
const { particle } = data;
|
|
2450
|
-
if (!particle.shape) {
|
|
2451
|
-
return;
|
|
2452
|
-
}
|
|
2453
|
-
drawer.afterDraw(data);
|
|
2454
|
-
}
|
|
2455
|
-
function drawShapeBeforeDraw(drawer, data) {
|
|
2456
|
-
if (!drawer?.beforeDraw) {
|
|
2457
|
-
return;
|
|
1699
|
+
this.#importPreset(preset);
|
|
1700
|
+
});
|
|
1701
|
+
}
|
|
1702
|
+
if (data.palette !== undefined) {
|
|
1703
|
+
this.palette = data.palette;
|
|
1704
|
+
this.#importPalette(this.palette);
|
|
1705
|
+
}
|
|
1706
|
+
loadProperty(this, "autoPlay", data.autoPlay);
|
|
1707
|
+
loadProperty(this, "clear", data.clear);
|
|
1708
|
+
loadProperty(this, "key", data.key);
|
|
1709
|
+
loadProperty(this, "name", data.name);
|
|
1710
|
+
loadRangeProperty(this, "delay", data.delay);
|
|
1711
|
+
loadProperty(this, "detectRetina", data.detectRetina);
|
|
1712
|
+
loadRangeProperty(this, "duration", data.duration);
|
|
1713
|
+
loadProperty(this, "fpsLimit", data.fpsLimit);
|
|
1714
|
+
loadProperty(this, "hdr", data.hdr);
|
|
1715
|
+
loadProperty(this, "pauseOnBlur", data.pauseOnBlur);
|
|
1716
|
+
loadProperty(this, "pauseOnOutsideViewport", data.pauseOnOutsideViewport);
|
|
1717
|
+
loadProperty(this, "zLayers", data.zLayers);
|
|
1718
|
+
this.background.load(data.background);
|
|
1719
|
+
const fullScreen = data.fullScreen;
|
|
1720
|
+
if (isBoolean(fullScreen)) {
|
|
1721
|
+
this.fullScreen.enable = fullScreen;
|
|
1722
|
+
}
|
|
1723
|
+
else {
|
|
1724
|
+
this.fullScreen.load(fullScreen);
|
|
1725
|
+
}
|
|
1726
|
+
this.particles.load(data.particles);
|
|
1727
|
+
this.resize.load(data.resize);
|
|
1728
|
+
this.style = deepExtend(this.style, data.style);
|
|
1729
|
+
loadProperty(this, "smooth", data.smooth);
|
|
1730
|
+
this.#pluginManager.plugins.forEach(plugin => {
|
|
1731
|
+
plugin.loadOptions(this.#container, this, data);
|
|
1732
|
+
});
|
|
2458
1733
|
}
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
1734
|
+
#importPalette(palette) {
|
|
1735
|
+
const paletteData = this.#pluginManager.getPalette(palette);
|
|
1736
|
+
if (!paletteData) {
|
|
1737
|
+
return;
|
|
1738
|
+
}
|
|
1739
|
+
this.load({
|
|
1740
|
+
background: {
|
|
1741
|
+
color: paletteData.background,
|
|
1742
|
+
},
|
|
1743
|
+
blend: {
|
|
1744
|
+
enable: true,
|
|
1745
|
+
mode: paletteData.blendMode,
|
|
1746
|
+
},
|
|
1747
|
+
particles: {
|
|
1748
|
+
palette,
|
|
1749
|
+
},
|
|
1750
|
+
});
|
|
2462
1751
|
}
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
function drawParticlePlugin(context, plugin, particle, delta) {
|
|
2466
|
-
if (!plugin.drawParticle) {
|
|
2467
|
-
return;
|
|
1752
|
+
#importPreset(preset) {
|
|
1753
|
+
this.load(this.#pluginManager.getPreset(preset));
|
|
2468
1754
|
}
|
|
2469
|
-
plugin.drawParticle(context, particle, delta);
|
|
2470
1755
|
}
|
|
2471
1756
|
|
|
2472
|
-
const styleCache = new Map(),
|
|
1757
|
+
const styleCache = new Map(), maxStyleCacheSize = 2000, rgbFixedPrecision = 2, hslFixedPrecision = 2, sdrReferenceWhiteNits = 203;
|
|
2473
1758
|
function getCachedStyle(key, generator) {
|
|
2474
1759
|
let cached = styleCache.get(key);
|
|
2475
1760
|
if (!cached) {
|
|
2476
1761
|
cached = generator();
|
|
2477
|
-
if (styleCache.size
|
|
2478
|
-
|
|
2479
|
-
keysToDelete.forEach(k => styleCache.delete(k));
|
|
1762
|
+
if (styleCache.size > maxStyleCacheSize) {
|
|
1763
|
+
styleCache.clear();
|
|
2480
1764
|
}
|
|
2481
1765
|
styleCache.set(key, cached);
|
|
2482
1766
|
}
|
|
@@ -2579,34 +1863,35 @@
|
|
|
2579
1863
|
function stringToRgb(pluginManager, input) {
|
|
2580
1864
|
return stringToRgba(pluginManager, input);
|
|
2581
1865
|
}
|
|
1866
|
+
function hslChannel(temp1, temp2, temp3) {
|
|
1867
|
+
const temp3Min = 0, temp3Max = 1;
|
|
1868
|
+
if (temp3 < temp3Min) {
|
|
1869
|
+
temp3++;
|
|
1870
|
+
}
|
|
1871
|
+
if (temp3 > temp3Max) {
|
|
1872
|
+
temp3--;
|
|
1873
|
+
}
|
|
1874
|
+
if (temp3 * sextuple < temp3Max) {
|
|
1875
|
+
return temp1 + (temp2 - temp1) * sextuple * temp3;
|
|
1876
|
+
}
|
|
1877
|
+
if (temp3 * double < temp3Max) {
|
|
1878
|
+
return temp2;
|
|
1879
|
+
}
|
|
1880
|
+
if (temp3 * triple < temp3Max * double) {
|
|
1881
|
+
const temp3Offset = double / triple;
|
|
1882
|
+
return temp1 + (temp2 - temp1) * (temp3Offset - temp3) * sextuple;
|
|
1883
|
+
}
|
|
1884
|
+
return temp1;
|
|
1885
|
+
}
|
|
2582
1886
|
function hslToRgb(hsl) {
|
|
2583
1887
|
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;
|
|
2584
1888
|
if (s === sMin) {
|
|
2585
1889
|
const grayscaleValue = Math.round(lNormalized * rgbMax);
|
|
2586
1890
|
return { r: grayscaleValue, g: grayscaleValue, b: grayscaleValue };
|
|
2587
1891
|
}
|
|
2588
|
-
const
|
|
2589
|
-
const temp3Min = 0, temp3Max = 1;
|
|
2590
|
-
if (temp3 < temp3Min) {
|
|
2591
|
-
temp3++;
|
|
2592
|
-
}
|
|
2593
|
-
if (temp3 > temp3Max) {
|
|
2594
|
-
temp3--;
|
|
2595
|
-
}
|
|
2596
|
-
if (temp3 * sextuple < temp3Max) {
|
|
2597
|
-
return temp1 + (temp2 - temp1) * sextuple * temp3;
|
|
2598
|
-
}
|
|
2599
|
-
if (temp3 * double < temp3Max) {
|
|
2600
|
-
return temp2;
|
|
2601
|
-
}
|
|
2602
|
-
if (temp3 * triple < temp3Max * double) {
|
|
2603
|
-
const temp3Offset = double / triple;
|
|
2604
|
-
return temp1 + (temp2 - temp1) * (temp3Offset - temp3) * sextuple;
|
|
2605
|
-
}
|
|
2606
|
-
return temp1;
|
|
2607
|
-
}, temp1 = lNormalized < half
|
|
1892
|
+
const temp1 = lNormalized < half
|
|
2608
1893
|
? lNormalized * (sNormalizedOffset + sNormalized)
|
|
2609
|
-
: lNormalized + sNormalized - lNormalized * sNormalized, temp2 = double * lNormalized - temp1, phaseThird = phaseNumerator / triple, red = Math.min(rgbMax, rgbMax *
|
|
1894
|
+
: 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));
|
|
2610
1895
|
return { r: Math.round(red), g: Math.round(green), b: Math.round(blue) };
|
|
2611
1896
|
}
|
|
2612
1897
|
function hslaToRgba(hsla) {
|
|
@@ -2619,7 +1904,7 @@
|
|
|
2619
1904
|
};
|
|
2620
1905
|
}
|
|
2621
1906
|
function getRandomRgbColor(min) {
|
|
2622
|
-
const fixedMin = defaultRgbMin, fixedMax = rgbMax + identity$
|
|
1907
|
+
const fixedMin = defaultRgbMin, fixedMax = rgbMax + identity$1, getRgbInRangeValue = () => Math.floor(getRandomInRange(fixedMin, fixedMax));
|
|
2623
1908
|
return {
|
|
2624
1909
|
b: getRgbInRangeValue(),
|
|
2625
1910
|
g: getRgbInRangeValue(),
|
|
@@ -2630,21 +1915,18 @@
|
|
|
2630
1915
|
const op = opacity ?? defaultOpacity$1, key = `rgb-${color.r.toFixed(rgbFixedPrecision)}-${color.g.toFixed(rgbFixedPrecision)}-${color.b.toFixed(rgbFixedPrecision)}-${hdr ? "hdr" : "sdr"}-${op.toString()}`;
|
|
2631
1916
|
return getCachedStyle(key, () => (hdr ? getHdrStyleFromRgb(color, opacity) : getSdrStyleFromRgb(color, opacity)));
|
|
2632
1917
|
}
|
|
2633
|
-
function getHdrStyleFromRgb(color, opacity) {
|
|
2634
|
-
|
|
1918
|
+
function getHdrStyleFromRgb(color, opacity, peakNits = maxNits) {
|
|
1919
|
+
const headroom = peakNits / sdrReferenceWhiteNits;
|
|
1920
|
+
return `color(display-p3 ${((color.r / rgbMax) * headroom).toString()} ${((color.g / rgbMax) * headroom).toString()} ${((color.b / rgbMax) * headroom).toString()} / ${(opacity ?? defaultOpacity$1).toString()})`;
|
|
2635
1921
|
}
|
|
2636
1922
|
function getSdrStyleFromRgb(color, opacity) {
|
|
2637
1923
|
return `rgba(${color.r.toString()}, ${color.g.toString()}, ${color.b.toString()}, ${(opacity ?? defaultOpacity$1).toString()})`;
|
|
2638
1924
|
}
|
|
2639
1925
|
function getStyleFromHsl(color, hdr, opacity) {
|
|
2640
1926
|
const op = opacity ?? defaultOpacity$1, key = `hsl-${color.h.toFixed(hslFixedPrecision)}-${color.s.toFixed(hslFixedPrecision)}-${color.l.toFixed(hslFixedPrecision)}-${hdr ? "hdr" : "sdr"}-${op.toString()}`;
|
|
2641
|
-
return getCachedStyle(key, () =>
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
return getHdrStyleFromRgb(hslToRgb(color), opacity);
|
|
2645
|
-
}
|
|
2646
|
-
function getSdrStyleFromHsl(color, opacity) {
|
|
2647
|
-
return `hsla(${color.h.toString()}, ${color.s.toString()}%, ${color.l.toString()}%, ${(opacity ?? defaultOpacity$1).toString()})`;
|
|
1927
|
+
return getCachedStyle(key, () => hdr
|
|
1928
|
+
? getStyleFromRgb(hslToRgb(color), true, opacity)
|
|
1929
|
+
: `hsla(${color.h.toString()}, ${color.s.toString()}%, ${color.l.toString()}%, ${op.toString()})`);
|
|
2648
1930
|
}
|
|
2649
1931
|
function getHslFromAnimation(animation) {
|
|
2650
1932
|
return animation === undefined
|
|
@@ -2766,22 +2048,14 @@
|
|
|
2766
2048
|
const tsParticles = initEngine();
|
|
2767
2049
|
|
|
2768
2050
|
class Blend {
|
|
2769
|
-
enable;
|
|
2770
|
-
mode;
|
|
2771
|
-
constructor() {
|
|
2772
|
-
this.mode = "destination-out";
|
|
2773
|
-
this.enable = false;
|
|
2774
|
-
}
|
|
2051
|
+
enable = false;
|
|
2052
|
+
mode = "destination-out";
|
|
2775
2053
|
load(data) {
|
|
2776
2054
|
if (isNull(data)) {
|
|
2777
2055
|
return;
|
|
2778
2056
|
}
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
}
|
|
2782
|
-
if (data.enable !== undefined) {
|
|
2783
|
-
this.enable = data.enable;
|
|
2784
|
-
}
|
|
2057
|
+
loadProperty(this, "mode", data.mode);
|
|
2058
|
+
loadProperty(this, "enable", data.enable);
|
|
2785
2059
|
}
|
|
2786
2060
|
}
|
|
2787
2061
|
|
|
@@ -2811,7 +2085,7 @@
|
|
|
2811
2085
|
}
|
|
2812
2086
|
|
|
2813
2087
|
async function loadBlendPlugin(engine) {
|
|
2814
|
-
engine.checkVersion("4.
|
|
2088
|
+
engine.checkVersion("4.2.0");
|
|
2815
2089
|
await engine.pluginManager.register(e => {
|
|
2816
2090
|
e.pluginManager.addPlugin(new BlendPlugin());
|
|
2817
2091
|
});
|
|
@@ -2848,7 +2122,7 @@
|
|
|
2848
2122
|
}
|
|
2849
2123
|
|
|
2850
2124
|
async function loadCircleShape(engine) {
|
|
2851
|
-
engine.checkVersion("4.
|
|
2125
|
+
engine.checkVersion("4.2.0");
|
|
2852
2126
|
await engine.pluginManager.register(e => {
|
|
2853
2127
|
e.pluginManager.addShape(["circle"], () => {
|
|
2854
2128
|
return Promise.resolve(new CircleDrawer());
|
|
@@ -2896,7 +2170,7 @@
|
|
|
2896
2170
|
}
|
|
2897
2171
|
|
|
2898
2172
|
async function loadHexColorPlugin(engine) {
|
|
2899
|
-
engine.checkVersion("4.
|
|
2173
|
+
engine.checkVersion("4.2.0");
|
|
2900
2174
|
await engine.pluginManager.register(e => {
|
|
2901
2175
|
e.pluginManager.addColorManager("hex", new HexColorManager());
|
|
2902
2176
|
});
|
|
@@ -2949,7 +2223,7 @@
|
|
|
2949
2223
|
}
|
|
2950
2224
|
|
|
2951
2225
|
async function loadHslColorPlugin(engine) {
|
|
2952
|
-
engine.checkVersion("4.
|
|
2226
|
+
engine.checkVersion("4.2.0");
|
|
2953
2227
|
await engine.pluginManager.register(e => {
|
|
2954
2228
|
e.pluginManager.addColorManager("hsl", new HslColorManager());
|
|
2955
2229
|
});
|
|
@@ -2973,7 +2247,7 @@
|
|
|
2973
2247
|
}
|
|
2974
2248
|
|
|
2975
2249
|
async function loadMovePlugin(engine) {
|
|
2976
|
-
engine.checkVersion("4.
|
|
2250
|
+
engine.checkVersion("4.2.0");
|
|
2977
2251
|
await engine.pluginManager.register(e => {
|
|
2978
2252
|
const moveEngine = e, movePluginManager = moveEngine.pluginManager;
|
|
2979
2253
|
movePluginManager.initializers.pathGenerators ??= new Map();
|
|
@@ -2991,31 +2265,143 @@
|
|
|
2991
2265
|
});
|
|
2992
2266
|
}
|
|
2993
2267
|
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
2268
|
+
function checkDestroy(particle, destroyType, value, minValue, maxValue) {
|
|
2269
|
+
switch (destroyType) {
|
|
2270
|
+
case DestroyType.max:
|
|
2271
|
+
if (value >= maxValue) {
|
|
2272
|
+
particle.destroy();
|
|
2273
|
+
}
|
|
2274
|
+
break;
|
|
2275
|
+
case DestroyType.min:
|
|
2276
|
+
if (value <= minValue) {
|
|
2277
|
+
particle.destroy();
|
|
2278
|
+
}
|
|
2279
|
+
break;
|
|
2280
|
+
}
|
|
2281
|
+
}
|
|
2282
|
+
function initParticleNumericAnimationValue(options, pxRatio) {
|
|
2283
|
+
const valueRange = options.value, animationOptions = options.animation, res = {
|
|
2284
|
+
delayTime: getRangeValue(animationOptions.delay) * millisecondsToSeconds,
|
|
2285
|
+
enable: animationOptions.enable,
|
|
2286
|
+
value: getRangeValue(options.value) * pxRatio,
|
|
2287
|
+
max: getRangeMax(valueRange) * pxRatio,
|
|
2288
|
+
min: getRangeMin(valueRange) * pxRatio,
|
|
2289
|
+
loops: 0,
|
|
2290
|
+
maxLoops: getRangeValue(animationOptions.count),
|
|
2291
|
+
time: 0,
|
|
2292
|
+
}, decayOffset = 1;
|
|
2293
|
+
if (animationOptions.enable) {
|
|
2294
|
+
res.decay = decayOffset - getRangeValue(animationOptions.decay);
|
|
2295
|
+
switch (animationOptions.mode) {
|
|
2296
|
+
case AnimationMode.increase:
|
|
2297
|
+
res.status = AnimationStatus.increasing;
|
|
2298
|
+
break;
|
|
2299
|
+
case AnimationMode.decrease:
|
|
2300
|
+
res.status = AnimationStatus.decreasing;
|
|
2301
|
+
break;
|
|
2302
|
+
case AnimationMode.random:
|
|
2303
|
+
res.status = getRandom() >= half ? AnimationStatus.increasing : AnimationStatus.decreasing;
|
|
2304
|
+
break;
|
|
2305
|
+
}
|
|
2306
|
+
const autoStatus = animationOptions.mode === AnimationMode.auto;
|
|
2307
|
+
switch (animationOptions.startValue) {
|
|
2308
|
+
case StartValueType.min:
|
|
2309
|
+
res.value = res.min;
|
|
2310
|
+
if (autoStatus) {
|
|
2311
|
+
res.status = AnimationStatus.increasing;
|
|
2312
|
+
}
|
|
2313
|
+
break;
|
|
2314
|
+
case StartValueType.max:
|
|
2315
|
+
res.value = res.max;
|
|
2316
|
+
if (autoStatus) {
|
|
2317
|
+
res.status = AnimationStatus.decreasing;
|
|
2318
|
+
}
|
|
2319
|
+
break;
|
|
2320
|
+
case StartValueType.random:
|
|
2321
|
+
default:
|
|
2322
|
+
res.value = randomInRangeValue(res);
|
|
2323
|
+
if (autoStatus) {
|
|
2324
|
+
res.status = getRandom() >= half ? AnimationStatus.increasing : AnimationStatus.decreasing;
|
|
2325
|
+
}
|
|
2326
|
+
break;
|
|
2327
|
+
}
|
|
2328
|
+
}
|
|
2329
|
+
res.initialValue = res.value;
|
|
2330
|
+
return res;
|
|
2331
|
+
}
|
|
2332
|
+
function updateAnimation(particle, data, changeDirection, destroyType, delta) {
|
|
2333
|
+
const minLoops = 0, minDelay = 0, identity = 1, minVelocity = 0, minDecay = 1;
|
|
2334
|
+
if (particle.destroyed ||
|
|
2335
|
+
!data.enable ||
|
|
2336
|
+
((data.maxLoops ?? minLoops) > minLoops && (data.loops ?? minLoops) > (data.maxLoops ?? minLoops))) {
|
|
2337
|
+
return;
|
|
2338
|
+
}
|
|
2339
|
+
const velocity = (data.velocity ?? minVelocity) * delta.factor, minValue = data.min, maxValue = data.max, decay = data.decay ?? minDecay;
|
|
2340
|
+
data.time ??= 0;
|
|
2341
|
+
const delayTime = data.delayTime ?? minDelay;
|
|
2342
|
+
if (delayTime > minDelay && data.time < delayTime) {
|
|
2343
|
+
data.time += delta.value;
|
|
2344
|
+
if (data.time < delayTime) {
|
|
2345
|
+
return;
|
|
2346
|
+
}
|
|
2347
|
+
}
|
|
2348
|
+
switch (data.status) {
|
|
2349
|
+
case AnimationStatus.increasing:
|
|
2350
|
+
data.value += velocity;
|
|
2351
|
+
break;
|
|
2352
|
+
case AnimationStatus.decreasing:
|
|
2353
|
+
data.value -= velocity;
|
|
2354
|
+
break;
|
|
2355
|
+
}
|
|
2356
|
+
if (data.velocity && decay !== identity) {
|
|
2357
|
+
data.velocity *= decay;
|
|
2358
|
+
}
|
|
2359
|
+
switch (data.status) {
|
|
2360
|
+
case AnimationStatus.increasing:
|
|
2361
|
+
if (data.value >= maxValue) {
|
|
2362
|
+
if (changeDirection) {
|
|
2363
|
+
data.status = AnimationStatus.decreasing;
|
|
2364
|
+
}
|
|
2365
|
+
else {
|
|
2366
|
+
data.value -= maxValue;
|
|
2367
|
+
}
|
|
2368
|
+
data.loops ??= minLoops;
|
|
2369
|
+
data.loops++;
|
|
2370
|
+
}
|
|
2371
|
+
break;
|
|
2372
|
+
case AnimationStatus.decreasing:
|
|
2373
|
+
if (data.value <= minValue) {
|
|
2374
|
+
if (changeDirection) {
|
|
2375
|
+
data.status = AnimationStatus.increasing;
|
|
2376
|
+
}
|
|
2377
|
+
else {
|
|
2378
|
+
data.value += maxValue;
|
|
2379
|
+
}
|
|
2380
|
+
data.loops ??= minLoops;
|
|
2381
|
+
data.loops++;
|
|
2382
|
+
}
|
|
2383
|
+
break;
|
|
2384
|
+
}
|
|
2385
|
+
checkDestroy(particle, destroyType, data.value, minValue, maxValue);
|
|
2386
|
+
if (!particle.destroyed) {
|
|
2387
|
+
data.value = clamp(data.value, minValue, maxValue);
|
|
3000
2388
|
}
|
|
2389
|
+
}
|
|
2390
|
+
|
|
2391
|
+
class OpacityAnimation extends RangedAnimationOptions {
|
|
2392
|
+
destroy = DestroyType.none;
|
|
3001
2393
|
load(data) {
|
|
3002
2394
|
super.load(data);
|
|
3003
2395
|
if (isNull(data)) {
|
|
3004
2396
|
return;
|
|
3005
2397
|
}
|
|
3006
|
-
|
|
3007
|
-
this.destroy = data.destroy;
|
|
3008
|
-
}
|
|
2398
|
+
loadProperty(this, "destroy", data.destroy);
|
|
3009
2399
|
}
|
|
3010
2400
|
}
|
|
3011
2401
|
|
|
3012
2402
|
class Opacity extends RangedAnimationValueWithRandom {
|
|
3013
|
-
animation;
|
|
3014
|
-
|
|
3015
|
-
super();
|
|
3016
|
-
this.animation = new OpacityAnimation();
|
|
3017
|
-
this.value = 1;
|
|
3018
|
-
}
|
|
2403
|
+
animation = new OpacityAnimation();
|
|
2404
|
+
value = 1;
|
|
3019
2405
|
load(data) {
|
|
3020
2406
|
if (isNull(data)) {
|
|
3021
2407
|
return;
|
|
@@ -3059,10 +2445,7 @@
|
|
|
3059
2445
|
(particle.opacity.loops ?? none) < (particle.opacity.maxLoops ?? none))));
|
|
3060
2446
|
}
|
|
3061
2447
|
loadOptions(options, ...sources) {
|
|
3062
|
-
options
|
|
3063
|
-
for (const source of sources) {
|
|
3064
|
-
options.opacity.load(source?.opacity);
|
|
3065
|
-
}
|
|
2448
|
+
loadOptionProperty(options, "opacity", Opacity, ...sources);
|
|
3066
2449
|
}
|
|
3067
2450
|
reset(particle) {
|
|
3068
2451
|
if (!particle.opacity) {
|
|
@@ -3080,7 +2463,7 @@
|
|
|
3080
2463
|
}
|
|
3081
2464
|
|
|
3082
2465
|
async function loadOpacityUpdater(engine) {
|
|
3083
|
-
engine.checkVersion("4.
|
|
2466
|
+
engine.checkVersion("4.2.0");
|
|
3084
2467
|
await engine.pluginManager.register(e => {
|
|
3085
2468
|
e.pluginManager.addParticleUpdater("opacity", container => {
|
|
3086
2469
|
return Promise.resolve(new OpacityUpdater(container));
|
|
@@ -3088,7 +2471,7 @@
|
|
|
3088
2471
|
});
|
|
3089
2472
|
}
|
|
3090
2473
|
|
|
3091
|
-
const
|
|
2474
|
+
const boundsMin = 0;
|
|
3092
2475
|
function bounceHorizontal(data) {
|
|
3093
2476
|
if ((data.outMode !== OutMode.bounce && data.outMode !== OutMode.split) ||
|
|
3094
2477
|
(data.direction !== OutModeDirection.left && data.direction !== OutModeDirection.right)) {
|
|
@@ -3103,8 +2486,8 @@
|
|
|
3103
2486
|
const velocity = data.particle.velocity.x;
|
|
3104
2487
|
let bounced = false;
|
|
3105
2488
|
if (data.outOfCanvas &&
|
|
3106
|
-
((data.direction === OutModeDirection.right && velocity > minVelocity
|
|
3107
|
-
(data.direction === OutModeDirection.left && velocity < minVelocity
|
|
2489
|
+
((data.direction === OutModeDirection.right && velocity > minVelocity) ||
|
|
2490
|
+
(data.direction === OutModeDirection.left && velocity < minVelocity))) {
|
|
3108
2491
|
const newVelocity = getRangeValue(data.particle.options.bounce.horizontal.value);
|
|
3109
2492
|
data.particle.velocity.x *= -newVelocity;
|
|
3110
2493
|
bounced = true;
|
|
@@ -3137,8 +2520,8 @@
|
|
|
3137
2520
|
const velocity = data.particle.velocity.y;
|
|
3138
2521
|
let bounced = false;
|
|
3139
2522
|
if (data.outOfCanvas &&
|
|
3140
|
-
((data.direction === OutModeDirection.bottom && velocity > minVelocity
|
|
3141
|
-
(data.direction === OutModeDirection.top && velocity < minVelocity
|
|
2523
|
+
((data.direction === OutModeDirection.bottom && velocity > minVelocity) ||
|
|
2524
|
+
(data.direction === OutModeDirection.top && velocity < minVelocity))) {
|
|
3142
2525
|
const newVelocity = getRangeValue(data.particle.options.bounce.vertical.value);
|
|
3143
2526
|
data.particle.velocity.y *= -newVelocity;
|
|
3144
2527
|
bounced = true;
|
|
@@ -3191,7 +2574,6 @@
|
|
|
3191
2574
|
}
|
|
3192
2575
|
}
|
|
3193
2576
|
|
|
3194
|
-
const minVelocity$3 = 0;
|
|
3195
2577
|
class DestroyOutMode {
|
|
3196
2578
|
modes;
|
|
3197
2579
|
constructor(_container) {
|
|
@@ -3210,10 +2592,10 @@
|
|
|
3210
2592
|
break;
|
|
3211
2593
|
case ParticleOutType.inside: {
|
|
3212
2594
|
const { dx, dy } = getDistances(particle.position, particle.moveCenter), { x: vx, y: vy } = particle.velocity;
|
|
3213
|
-
if ((vx < minVelocity
|
|
3214
|
-
(vy < minVelocity
|
|
3215
|
-
(vx >= minVelocity
|
|
3216
|
-
(vy >= minVelocity
|
|
2595
|
+
if ((vx < minVelocity && dx > particle.moveCenter.radius) ||
|
|
2596
|
+
(vy < minVelocity && dy > particle.moveCenter.radius) ||
|
|
2597
|
+
(vx >= minVelocity && dx < -particle.moveCenter.radius) ||
|
|
2598
|
+
(vy >= minVelocity && dy < -particle.moveCenter.radius)) {
|
|
3217
2599
|
return;
|
|
3218
2600
|
}
|
|
3219
2601
|
break;
|
|
@@ -3223,7 +2605,6 @@
|
|
|
3223
2605
|
}
|
|
3224
2606
|
}
|
|
3225
2607
|
|
|
3226
|
-
const minVelocity$2 = 0;
|
|
3227
2608
|
class NoneOutMode {
|
|
3228
2609
|
modes;
|
|
3229
2610
|
#container;
|
|
@@ -3243,10 +2624,10 @@
|
|
|
3243
2624
|
}
|
|
3244
2625
|
const gravityOptions = particle.options.move.gravity, container = this.#container, canvasSize = container.canvas.size, pRadius = particle.getRadius();
|
|
3245
2626
|
if (!gravityOptions.enable) {
|
|
3246
|
-
if ((particle.velocity.y > minVelocity
|
|
3247
|
-
(particle.velocity.y < minVelocity
|
|
3248
|
-
(particle.velocity.x > minVelocity
|
|
3249
|
-
(particle.velocity.x < minVelocity
|
|
2627
|
+
if ((particle.velocity.y > minVelocity && particle.position.y <= canvasSize.height + pRadius) ||
|
|
2628
|
+
(particle.velocity.y < minVelocity && particle.position.y >= -pRadius) ||
|
|
2629
|
+
(particle.velocity.x > minVelocity && particle.position.x <= canvasSize.width + pRadius) ||
|
|
2630
|
+
(particle.velocity.x < minVelocity && particle.position.x >= -pRadius)) {
|
|
3250
2631
|
return;
|
|
3251
2632
|
}
|
|
3252
2633
|
if (!isPointInside(particle.position, container.canvas.size, originPoint, pRadius, direction)) {
|
|
@@ -3265,7 +2646,7 @@
|
|
|
3265
2646
|
}
|
|
3266
2647
|
}
|
|
3267
2648
|
|
|
3268
|
-
const
|
|
2649
|
+
const updateVector = Vector.origin;
|
|
3269
2650
|
class OutOutMode {
|
|
3270
2651
|
modes;
|
|
3271
2652
|
#container;
|
|
@@ -3286,10 +2667,10 @@
|
|
|
3286
2667
|
updateVector.angle = particle.velocity.angle + Math.PI;
|
|
3287
2668
|
updateVector.addTo(particle.moveCenter);
|
|
3288
2669
|
const { dx, dy } = getDistances(particle.position, updateVector);
|
|
3289
|
-
if ((vx <= minVelocity
|
|
3290
|
-
(vy <= minVelocity
|
|
3291
|
-
(vx >= minVelocity
|
|
3292
|
-
(vy >= minVelocity
|
|
2670
|
+
if ((vx <= minVelocity && dx >= minDistance) ||
|
|
2671
|
+
(vy <= minVelocity && dy >= minDistance) ||
|
|
2672
|
+
(vx >= minVelocity && dx <= minDistance) ||
|
|
2673
|
+
(vy >= minVelocity && dy <= minDistance)) {
|
|
3293
2674
|
return;
|
|
3294
2675
|
}
|
|
3295
2676
|
particle.position.x = Math.floor(randomInRangeValue({
|
|
@@ -3413,21 +2794,21 @@
|
|
|
3413
2794
|
this.#updateOutMode(particle, delta, outModes.right ?? outModes.default, OutModeDirection.right);
|
|
3414
2795
|
this.#updateOutMode(particle, delta, outModes.top ?? outModes.default, OutModeDirection.top);
|
|
3415
2796
|
}
|
|
3416
|
-
#addUpdaterIfMissing
|
|
2797
|
+
#addUpdaterIfMissing(particle, outMode, getUpdater) {
|
|
3417
2798
|
const outModes = particle.options.move.outModes;
|
|
3418
2799
|
if (!this.updaters.has(outMode) && checkOutMode(outModes, outMode)) {
|
|
3419
2800
|
this.updaters.set(outMode, getUpdater(this.#container));
|
|
3420
2801
|
}
|
|
3421
|
-
}
|
|
3422
|
-
#updateOutMode
|
|
2802
|
+
}
|
|
2803
|
+
#updateOutMode(particle, delta, outMode, direction) {
|
|
3423
2804
|
for (const updater of this.updaters.values()) {
|
|
3424
2805
|
updater.update(particle, direction, delta, outMode);
|
|
3425
2806
|
}
|
|
3426
|
-
}
|
|
2807
|
+
}
|
|
3427
2808
|
}
|
|
3428
2809
|
|
|
3429
2810
|
async function loadOutModesUpdater(engine) {
|
|
3430
|
-
engine.checkVersion("4.
|
|
2811
|
+
engine.checkVersion("4.2.0");
|
|
3431
2812
|
await engine.pluginManager.register(e => {
|
|
3432
2813
|
e.pluginManager.addParticleUpdater("outModes", container => {
|
|
3433
2814
|
return Promise.resolve(new OutOfCanvasUpdater(container));
|
|
@@ -3498,7 +2879,7 @@
|
|
|
3498
2879
|
}
|
|
3499
2880
|
|
|
3500
2881
|
async function loadPaintUpdater(engine) {
|
|
3501
|
-
engine.checkVersion("4.
|
|
2882
|
+
engine.checkVersion("4.2.0");
|
|
3502
2883
|
await engine.pluginManager.register(e => {
|
|
3503
2884
|
e.pluginManager.addParticleUpdater("paint", container => {
|
|
3504
2885
|
return Promise.resolve(new PaintUpdater(e.pluginManager, container));
|
|
@@ -3553,37 +2934,26 @@
|
|
|
3553
2934
|
}
|
|
3554
2935
|
|
|
3555
2936
|
async function loadRgbColorPlugin(engine) {
|
|
3556
|
-
engine.checkVersion("4.
|
|
2937
|
+
engine.checkVersion("4.2.0");
|
|
3557
2938
|
await engine.pluginManager.register(e => {
|
|
3558
2939
|
e.pluginManager.addColorManager("rgb", new RgbColorManager());
|
|
3559
2940
|
});
|
|
3560
2941
|
}
|
|
3561
2942
|
|
|
3562
2943
|
class SizeAnimation extends RangedAnimationOptions {
|
|
3563
|
-
destroy;
|
|
3564
|
-
constructor() {
|
|
3565
|
-
super();
|
|
3566
|
-
this.destroy = DestroyType.none;
|
|
3567
|
-
this.speed = 5;
|
|
3568
|
-
}
|
|
2944
|
+
destroy = DestroyType.none;
|
|
3569
2945
|
load(data) {
|
|
3570
2946
|
super.load(data);
|
|
3571
2947
|
if (isNull(data)) {
|
|
3572
2948
|
return;
|
|
3573
2949
|
}
|
|
3574
|
-
|
|
3575
|
-
this.destroy = data.destroy;
|
|
3576
|
-
}
|
|
2950
|
+
loadProperty(this, "destroy", data.destroy);
|
|
3577
2951
|
}
|
|
3578
2952
|
}
|
|
3579
2953
|
|
|
3580
2954
|
class Size extends RangedAnimationValueWithRandom {
|
|
3581
|
-
animation;
|
|
3582
|
-
|
|
3583
|
-
super();
|
|
3584
|
-
this.animation = new SizeAnimation();
|
|
3585
|
-
this.value = 3;
|
|
3586
|
-
}
|
|
2955
|
+
animation = new SizeAnimation();
|
|
2956
|
+
value = 3;
|
|
3587
2957
|
load(data) {
|
|
3588
2958
|
super.load(data);
|
|
3589
2959
|
if (isNull(data)) {
|
|
@@ -3626,10 +2996,7 @@
|
|
|
3626
2996
|
(particle.size.loops ?? minLoops) < (particle.size.maxLoops ?? minLoops))));
|
|
3627
2997
|
}
|
|
3628
2998
|
loadOptions(options, ...sources) {
|
|
3629
|
-
options
|
|
3630
|
-
for (const source of sources) {
|
|
3631
|
-
options.size.load(source?.size);
|
|
3632
|
-
}
|
|
2999
|
+
loadOptionProperty(options, "size", Size, ...sources);
|
|
3633
3000
|
}
|
|
3634
3001
|
preInit(particle) {
|
|
3635
3002
|
const pxRatio = this.#container.retina.pixelRatio, options = particle.options, sizeOptions = options.size;
|
|
@@ -3652,7 +3019,7 @@
|
|
|
3652
3019
|
}
|
|
3653
3020
|
|
|
3654
3021
|
async function loadSizeUpdater(engine) {
|
|
3655
|
-
engine.checkVersion("4.
|
|
3022
|
+
engine.checkVersion("4.2.0");
|
|
3656
3023
|
await engine.pluginManager.register(e => {
|
|
3657
3024
|
e.pluginManager.addParticleUpdater("size", container => {
|
|
3658
3025
|
return Promise.resolve(new SizeUpdater(container));
|
|
@@ -3661,7 +3028,7 @@
|
|
|
3661
3028
|
}
|
|
3662
3029
|
|
|
3663
3030
|
async function loadBasic(engine) {
|
|
3664
|
-
engine.checkVersion("4.
|
|
3031
|
+
engine.checkVersion("4.2.0");
|
|
3665
3032
|
await engine.pluginManager.register(async (e) => {
|
|
3666
3033
|
await Promise.all([
|
|
3667
3034
|
loadBlendPlugin(e),
|
|
@@ -3712,78 +3079,46 @@
|
|
|
3712
3079
|
count;
|
|
3713
3080
|
delay;
|
|
3714
3081
|
duration;
|
|
3715
|
-
wait;
|
|
3716
|
-
constructor() {
|
|
3717
|
-
this.wait = false;
|
|
3718
|
-
}
|
|
3082
|
+
wait = false;
|
|
3719
3083
|
load(data) {
|
|
3720
3084
|
if (isNull(data)) {
|
|
3721
3085
|
return;
|
|
3722
3086
|
}
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
this.delay = setRangeValue(data.delay);
|
|
3728
|
-
}
|
|
3729
|
-
if (data.duration !== undefined) {
|
|
3730
|
-
this.duration = setRangeValue(data.duration);
|
|
3731
|
-
}
|
|
3732
|
-
if (data.wait !== undefined) {
|
|
3733
|
-
this.wait = data.wait;
|
|
3734
|
-
}
|
|
3087
|
+
loadProperty(this, "count", data.count);
|
|
3088
|
+
loadRangeProperty(this, "delay", data.delay);
|
|
3089
|
+
loadRangeProperty(this, "duration", data.duration);
|
|
3090
|
+
loadProperty(this, "wait", data.wait);
|
|
3735
3091
|
}
|
|
3736
3092
|
}
|
|
3737
3093
|
|
|
3738
3094
|
class EmitterRate {
|
|
3739
|
-
delay;
|
|
3740
|
-
quantity;
|
|
3741
|
-
constructor() {
|
|
3742
|
-
this.quantity = 1;
|
|
3743
|
-
this.delay = 0.1;
|
|
3744
|
-
}
|
|
3095
|
+
delay = 0.1;
|
|
3096
|
+
quantity = 1;
|
|
3745
3097
|
load(data) {
|
|
3746
3098
|
if (isNull(data)) {
|
|
3747
3099
|
return;
|
|
3748
3100
|
}
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
}
|
|
3752
|
-
if (data.delay !== undefined) {
|
|
3753
|
-
this.delay = setRangeValue(data.delay);
|
|
3754
|
-
}
|
|
3101
|
+
loadRangeProperty(this, "quantity", data.quantity);
|
|
3102
|
+
loadRangeProperty(this, "delay", data.delay);
|
|
3755
3103
|
}
|
|
3756
3104
|
}
|
|
3757
3105
|
|
|
3758
3106
|
class EmitterShapeReplace {
|
|
3759
|
-
color;
|
|
3760
|
-
opacity;
|
|
3761
|
-
constructor() {
|
|
3762
|
-
this.color = false;
|
|
3763
|
-
this.opacity = false;
|
|
3764
|
-
}
|
|
3107
|
+
color = false;
|
|
3108
|
+
opacity = false;
|
|
3765
3109
|
load(data) {
|
|
3766
3110
|
if (isNull(data)) {
|
|
3767
3111
|
return;
|
|
3768
3112
|
}
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
}
|
|
3772
|
-
if (data.opacity !== undefined) {
|
|
3773
|
-
this.opacity = data.opacity;
|
|
3774
|
-
}
|
|
3113
|
+
loadProperty(this, "color", data.color);
|
|
3114
|
+
loadProperty(this, "opacity", data.opacity);
|
|
3775
3115
|
}
|
|
3776
3116
|
}
|
|
3777
3117
|
|
|
3778
3118
|
class EmitterShape {
|
|
3779
|
-
options;
|
|
3780
|
-
replace;
|
|
3781
|
-
type;
|
|
3782
|
-
constructor() {
|
|
3783
|
-
this.options = {};
|
|
3784
|
-
this.replace = new EmitterShapeReplace();
|
|
3785
|
-
this.type = "square";
|
|
3786
|
-
}
|
|
3119
|
+
options = {};
|
|
3120
|
+
replace = new EmitterShapeReplace();
|
|
3121
|
+
type = "square";
|
|
3787
3122
|
load(data) {
|
|
3788
3123
|
if (isNull(data)) {
|
|
3789
3124
|
return;
|
|
@@ -3792,34 +3127,21 @@
|
|
|
3792
3127
|
this.options = deepExtend({}, data.options ?? {});
|
|
3793
3128
|
}
|
|
3794
3129
|
this.replace.load(data.replace);
|
|
3795
|
-
|
|
3796
|
-
this.type = data.type;
|
|
3797
|
-
}
|
|
3130
|
+
loadProperty(this, "type", data.type);
|
|
3798
3131
|
}
|
|
3799
3132
|
}
|
|
3800
3133
|
|
|
3801
3134
|
class EmitterSize {
|
|
3802
|
-
height;
|
|
3803
|
-
mode;
|
|
3804
|
-
width;
|
|
3805
|
-
constructor() {
|
|
3806
|
-
this.mode = PixelMode.percent;
|
|
3807
|
-
this.height = 0;
|
|
3808
|
-
this.width = 0;
|
|
3809
|
-
}
|
|
3135
|
+
height = 0;
|
|
3136
|
+
mode = PixelMode.percent;
|
|
3137
|
+
width = 0;
|
|
3810
3138
|
load(data) {
|
|
3811
3139
|
if (isNull(data)) {
|
|
3812
3140
|
return;
|
|
3813
3141
|
}
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
if (data.height !== undefined) {
|
|
3818
|
-
this.height = data.height;
|
|
3819
|
-
}
|
|
3820
|
-
if (data.width !== undefined) {
|
|
3821
|
-
this.width = data.width;
|
|
3822
|
-
}
|
|
3142
|
+
loadProperty(this, "mode", data.mode);
|
|
3143
|
+
loadProperty(this, "height", data.height);
|
|
3144
|
+
loadProperty(this, "width", data.width);
|
|
3823
3145
|
}
|
|
3824
3146
|
}
|
|
3825
3147
|
|
|
@@ -3842,50 +3164,35 @@
|
|
|
3842
3164
|
}
|
|
3843
3165
|
|
|
3844
3166
|
class Emitter {
|
|
3845
|
-
autoPlay;
|
|
3167
|
+
autoPlay = true;
|
|
3846
3168
|
direction;
|
|
3847
3169
|
domId;
|
|
3848
|
-
fill;
|
|
3849
|
-
life;
|
|
3170
|
+
fill = true;
|
|
3171
|
+
life = new EmitterLife();
|
|
3850
3172
|
name;
|
|
3851
3173
|
particles;
|
|
3852
3174
|
position;
|
|
3853
|
-
rate;
|
|
3854
|
-
shape;
|
|
3175
|
+
rate = new EmitterRate();
|
|
3176
|
+
shape = new EmitterShape();
|
|
3855
3177
|
size;
|
|
3856
|
-
spawn;
|
|
3178
|
+
spawn = new EmitterSpawn();
|
|
3857
3179
|
spawnFillColor;
|
|
3858
3180
|
spawnStrokeColor;
|
|
3859
|
-
startCount;
|
|
3860
|
-
constructor() {
|
|
3861
|
-
this.autoPlay = true;
|
|
3862
|
-
this.fill = true;
|
|
3863
|
-
this.life = new EmitterLife();
|
|
3864
|
-
this.rate = new EmitterRate();
|
|
3865
|
-
this.shape = new EmitterShape();
|
|
3866
|
-
this.spawn = new EmitterSpawn();
|
|
3867
|
-
this.startCount = 0;
|
|
3868
|
-
}
|
|
3181
|
+
startCount = 0;
|
|
3869
3182
|
load(data) {
|
|
3870
3183
|
if (isNull(data)) {
|
|
3871
3184
|
return;
|
|
3872
3185
|
}
|
|
3873
|
-
|
|
3874
|
-
this.autoPlay = data.autoPlay;
|
|
3875
|
-
}
|
|
3186
|
+
loadProperty(this, "autoPlay", data.autoPlay);
|
|
3876
3187
|
if (data.size !== undefined) {
|
|
3877
3188
|
this.size ??= new EmitterSize();
|
|
3878
3189
|
this.size.load(data.size);
|
|
3879
3190
|
}
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
this.domId = data.domId;
|
|
3884
|
-
if (data.fill !== undefined) {
|
|
3885
|
-
this.fill = data.fill;
|
|
3886
|
-
}
|
|
3191
|
+
loadProperty(this, "direction", data.direction);
|
|
3192
|
+
loadProperty(this, "domId", data.domId);
|
|
3193
|
+
loadProperty(this, "fill", data.fill);
|
|
3887
3194
|
this.life.load(data.life);
|
|
3888
|
-
this
|
|
3195
|
+
loadProperty(this, "name", data.name);
|
|
3889
3196
|
this.particles = executeOnSingleOrMultiple(data.particles, particles => {
|
|
3890
3197
|
return deepExtend({}, particles);
|
|
3891
3198
|
});
|
|
@@ -3909,9 +3216,7 @@
|
|
|
3909
3216
|
this.spawnStrokeColor ??= new AnimatableColor();
|
|
3910
3217
|
this.spawnStrokeColor.load(data.spawnStrokeColor);
|
|
3911
3218
|
}
|
|
3912
|
-
|
|
3913
|
-
this.startCount = data.startCount;
|
|
3914
|
-
}
|
|
3219
|
+
loadProperty(this, "startCount", data.startCount);
|
|
3915
3220
|
}
|
|
3916
3221
|
}
|
|
3917
3222
|
|
|
@@ -3976,7 +3281,7 @@
|
|
|
3976
3281
|
})(EmitterClickMode || (EmitterClickMode = {}));
|
|
3977
3282
|
|
|
3978
3283
|
async function loadEmittersPluginSimple(engine) {
|
|
3979
|
-
engine.checkVersion("4.
|
|
3284
|
+
engine.checkVersion("4.2.0");
|
|
3980
3285
|
await engine.pluginManager.register(async (e) => {
|
|
3981
3286
|
const instancesManager = await getEmittersInstancesManager(e);
|
|
3982
3287
|
await addEmittersShapesManager(e);
|
|
@@ -3985,39 +3290,25 @@
|
|
|
3985
3290
|
}
|
|
3986
3291
|
|
|
3987
3292
|
class MotionReduce {
|
|
3988
|
-
factor;
|
|
3989
|
-
value;
|
|
3990
|
-
constructor() {
|
|
3991
|
-
this.factor = 4;
|
|
3992
|
-
this.value = true;
|
|
3993
|
-
}
|
|
3293
|
+
factor = 4;
|
|
3294
|
+
value = true;
|
|
3994
3295
|
load(data) {
|
|
3995
3296
|
if (isNull(data)) {
|
|
3996
3297
|
return;
|
|
3997
3298
|
}
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
}
|
|
4001
|
-
if (data.value !== undefined) {
|
|
4002
|
-
this.value = data.value;
|
|
4003
|
-
}
|
|
3299
|
+
loadProperty(this, "factor", data.factor);
|
|
3300
|
+
loadProperty(this, "value", data.value);
|
|
4004
3301
|
}
|
|
4005
3302
|
}
|
|
4006
3303
|
|
|
4007
3304
|
class Motion {
|
|
4008
|
-
disable;
|
|
4009
|
-
reduce;
|
|
4010
|
-
constructor() {
|
|
4011
|
-
this.disable = true;
|
|
4012
|
-
this.reduce = new MotionReduce();
|
|
4013
|
-
}
|
|
3305
|
+
disable = true;
|
|
3306
|
+
reduce = new MotionReduce();
|
|
4014
3307
|
load(data) {
|
|
4015
3308
|
if (isNull(data)) {
|
|
4016
3309
|
return;
|
|
4017
3310
|
}
|
|
4018
|
-
|
|
4019
|
-
this.disable = data.disable;
|
|
4020
|
-
}
|
|
3311
|
+
loadProperty(this, "disable", data.disable);
|
|
4021
3312
|
this.reduce.load(data.reduce);
|
|
4022
3313
|
}
|
|
4023
3314
|
}
|
|
@@ -4044,7 +3335,7 @@
|
|
|
4044
3335
|
}
|
|
4045
3336
|
|
|
4046
3337
|
async function loadMotionPlugin(engine) {
|
|
4047
|
-
engine.checkVersion("4.
|
|
3338
|
+
engine.checkVersion("4.2.0");
|
|
4048
3339
|
await engine.pluginManager.register(e => {
|
|
4049
3340
|
e.pluginManager.addPlugin(new MotionPlugin());
|
|
4050
3341
|
});
|
|
@@ -4113,39 +3404,24 @@
|
|
|
4113
3404
|
}
|
|
4114
3405
|
|
|
4115
3406
|
class RollLight {
|
|
4116
|
-
enable;
|
|
4117
|
-
value;
|
|
4118
|
-
constructor() {
|
|
4119
|
-
this.enable = false;
|
|
4120
|
-
this.value = 0;
|
|
4121
|
-
}
|
|
3407
|
+
enable = false;
|
|
3408
|
+
value = 0;
|
|
4122
3409
|
load(data) {
|
|
4123
3410
|
if (isNull(data)) {
|
|
4124
3411
|
return;
|
|
4125
3412
|
}
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
}
|
|
4129
|
-
if (data.value !== undefined) {
|
|
4130
|
-
this.value = setRangeValue(data.value);
|
|
4131
|
-
}
|
|
3413
|
+
loadProperty(this, "enable", data.enable);
|
|
3414
|
+
loadRangeProperty(this, "value", data.value);
|
|
4132
3415
|
}
|
|
4133
3416
|
}
|
|
4134
3417
|
|
|
4135
3418
|
class Roll {
|
|
4136
3419
|
backColor;
|
|
4137
|
-
darken;
|
|
4138
|
-
enable;
|
|
4139
|
-
enlighten;
|
|
4140
|
-
mode;
|
|
4141
|
-
speed;
|
|
4142
|
-
constructor() {
|
|
4143
|
-
this.darken = new RollLight();
|
|
4144
|
-
this.enable = false;
|
|
4145
|
-
this.enlighten = new RollLight();
|
|
4146
|
-
this.mode = RollMode.vertical;
|
|
4147
|
-
this.speed = 25;
|
|
4148
|
-
}
|
|
3420
|
+
darken = new RollLight();
|
|
3421
|
+
enable = false;
|
|
3422
|
+
enlighten = new RollLight();
|
|
3423
|
+
mode = RollMode.vertical;
|
|
3424
|
+
speed = 25;
|
|
4149
3425
|
load(data) {
|
|
4150
3426
|
if (isNull(data)) {
|
|
4151
3427
|
return;
|
|
@@ -4154,16 +3430,10 @@
|
|
|
4154
3430
|
this.backColor = OptionsColor.create(this.backColor, data.backColor);
|
|
4155
3431
|
}
|
|
4156
3432
|
this.darken.load(data.darken);
|
|
4157
|
-
|
|
4158
|
-
this.enable = data.enable;
|
|
4159
|
-
}
|
|
3433
|
+
loadProperty(this, "enable", data.enable);
|
|
4160
3434
|
this.enlighten.load(data.enlighten);
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
}
|
|
4164
|
-
if (data.speed !== undefined) {
|
|
4165
|
-
this.speed = setRangeValue(data.speed);
|
|
4166
|
-
}
|
|
3435
|
+
loadProperty(this, "mode", data.mode);
|
|
3436
|
+
loadRangeProperty(this, "speed", data.speed);
|
|
4167
3437
|
}
|
|
4168
3438
|
}
|
|
4169
3439
|
|
|
@@ -4187,10 +3457,7 @@
|
|
|
4187
3457
|
return !particle.destroyed && !particle.spawning && !!roll?.enable;
|
|
4188
3458
|
}
|
|
4189
3459
|
loadOptions(options, ...sources) {
|
|
4190
|
-
options
|
|
4191
|
-
for (const source of sources) {
|
|
4192
|
-
options.roll.load(source?.roll);
|
|
4193
|
-
}
|
|
3460
|
+
loadOptionProperty(options, "roll", Roll, ...sources);
|
|
4194
3461
|
}
|
|
4195
3462
|
update(particle, delta) {
|
|
4196
3463
|
if (!this.isEnabled(particle)) {
|
|
@@ -4201,7 +3468,7 @@
|
|
|
4201
3468
|
}
|
|
4202
3469
|
|
|
4203
3470
|
async function loadRollUpdater(engine) {
|
|
4204
|
-
engine.checkVersion("4.
|
|
3471
|
+
engine.checkVersion("4.2.0");
|
|
4205
3472
|
await engine.pluginManager.register(e => {
|
|
4206
3473
|
e.pluginManager.addParticleUpdater("roll", () => {
|
|
4207
3474
|
return Promise.resolve(new RollUpdater(e.pluginManager));
|
|
@@ -4210,58 +3477,33 @@
|
|
|
4210
3477
|
}
|
|
4211
3478
|
|
|
4212
3479
|
class RotateAnimation {
|
|
4213
|
-
decay;
|
|
4214
|
-
enable;
|
|
4215
|
-
speed;
|
|
4216
|
-
sync;
|
|
4217
|
-
constructor() {
|
|
4218
|
-
this.enable = false;
|
|
4219
|
-
this.speed = 0;
|
|
4220
|
-
this.decay = 0;
|
|
4221
|
-
this.sync = false;
|
|
4222
|
-
}
|
|
3480
|
+
decay = 0;
|
|
3481
|
+
enable = false;
|
|
3482
|
+
speed = 0;
|
|
3483
|
+
sync = false;
|
|
4223
3484
|
load(data) {
|
|
4224
3485
|
if (isNull(data)) {
|
|
4225
3486
|
return;
|
|
4226
3487
|
}
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
this.speed = setRangeValue(data.speed);
|
|
4232
|
-
}
|
|
4233
|
-
if (data.decay !== undefined) {
|
|
4234
|
-
this.decay = setRangeValue(data.decay);
|
|
4235
|
-
}
|
|
4236
|
-
if (data.sync !== undefined) {
|
|
4237
|
-
this.sync = data.sync;
|
|
4238
|
-
}
|
|
3488
|
+
loadProperty(this, "enable", data.enable);
|
|
3489
|
+
loadRangeProperty(this, "speed", data.speed);
|
|
3490
|
+
loadRangeProperty(this, "decay", data.decay);
|
|
3491
|
+
loadProperty(this, "sync", data.sync);
|
|
4239
3492
|
}
|
|
4240
3493
|
}
|
|
4241
3494
|
|
|
4242
3495
|
class Rotate extends ValueWithRandom {
|
|
4243
|
-
animation;
|
|
4244
|
-
direction;
|
|
4245
|
-
path;
|
|
4246
|
-
constructor() {
|
|
4247
|
-
super();
|
|
4248
|
-
this.animation = new RotateAnimation();
|
|
4249
|
-
this.direction = RotateDirection.clockwise;
|
|
4250
|
-
this.path = false;
|
|
4251
|
-
this.value = 0;
|
|
4252
|
-
}
|
|
3496
|
+
animation = new RotateAnimation();
|
|
3497
|
+
direction = RotateDirection.clockwise;
|
|
3498
|
+
path = false;
|
|
4253
3499
|
load(data) {
|
|
4254
3500
|
if (isNull(data)) {
|
|
4255
3501
|
return;
|
|
4256
3502
|
}
|
|
4257
3503
|
super.load(data);
|
|
4258
|
-
|
|
4259
|
-
this.direction = data.direction;
|
|
4260
|
-
}
|
|
3504
|
+
loadProperty(this, "direction", data.direction);
|
|
4261
3505
|
this.animation.load(data.animation);
|
|
4262
|
-
|
|
4263
|
-
this.path = data.path;
|
|
4264
|
-
}
|
|
3506
|
+
loadProperty(this, "path", data.path);
|
|
4265
3507
|
}
|
|
4266
3508
|
}
|
|
4267
3509
|
|
|
@@ -4299,7 +3541,7 @@
|
|
|
4299
3541
|
}
|
|
4300
3542
|
const rotateAnimation = rotateOptions.animation;
|
|
4301
3543
|
if (rotateAnimation.enable) {
|
|
4302
|
-
particle.rotate.decay = identity$
|
|
3544
|
+
particle.rotate.decay = identity$1 - getRangeValue(rotateAnimation.decay);
|
|
4303
3545
|
particle.rotate.velocity =
|
|
4304
3546
|
(getRangeValue(rotateAnimation.speed) / doublePIDeg) * this.#container.retina.reduceFactor;
|
|
4305
3547
|
if (!rotateAnimation.sync) {
|
|
@@ -4316,10 +3558,7 @@
|
|
|
4316
3558
|
return !particle.destroyed && !particle.spawning && (!!rotate.value || rotate.animation.enable || rotate.path);
|
|
4317
3559
|
}
|
|
4318
3560
|
loadOptions(options, ...sources) {
|
|
4319
|
-
options
|
|
4320
|
-
for (const source of sources) {
|
|
4321
|
-
options.rotate.load(source?.rotate);
|
|
4322
|
-
}
|
|
3561
|
+
loadOptionProperty(options, "rotate", Rotate, ...sources);
|
|
4323
3562
|
}
|
|
4324
3563
|
update(particle, delta) {
|
|
4325
3564
|
if (!this.isEnabled(particle)) {
|
|
@@ -4335,7 +3574,7 @@
|
|
|
4335
3574
|
}
|
|
4336
3575
|
|
|
4337
3576
|
async function loadRotateUpdater(engine) {
|
|
4338
|
-
engine.checkVersion("4.
|
|
3577
|
+
engine.checkVersion("4.2.0");
|
|
4339
3578
|
await engine.pluginManager.register(e => {
|
|
4340
3579
|
e.pluginManager.addParticleUpdater("rotate", container => {
|
|
4341
3580
|
return Promise.resolve(new RotateUpdater(container));
|
|
@@ -4359,7 +3598,7 @@
|
|
|
4359
3598
|
}
|
|
4360
3599
|
|
|
4361
3600
|
async function loadSquareShape(engine) {
|
|
4362
|
-
engine.checkVersion("4.
|
|
3601
|
+
engine.checkVersion("4.2.0");
|
|
4363
3602
|
await engine.pluginManager.register(e => {
|
|
4364
3603
|
e.pluginManager.addShape(["edge", "square"], () => Promise.resolve(new SquareDrawer()));
|
|
4365
3604
|
});
|
|
@@ -4373,58 +3612,33 @@
|
|
|
4373
3612
|
})(TiltDirection || (TiltDirection = {}));
|
|
4374
3613
|
|
|
4375
3614
|
class TiltAnimation {
|
|
4376
|
-
decay;
|
|
4377
|
-
enable;
|
|
4378
|
-
speed;
|
|
4379
|
-
sync;
|
|
4380
|
-
constructor() {
|
|
4381
|
-
this.enable = false;
|
|
4382
|
-
this.speed = 0;
|
|
4383
|
-
this.decay = 0;
|
|
4384
|
-
this.sync = false;
|
|
4385
|
-
}
|
|
3615
|
+
decay = 0;
|
|
3616
|
+
enable = false;
|
|
3617
|
+
speed = 0;
|
|
3618
|
+
sync = false;
|
|
4386
3619
|
load(data) {
|
|
4387
3620
|
if (isNull(data)) {
|
|
4388
3621
|
return;
|
|
4389
3622
|
}
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
|
|
4394
|
-
this.speed = setRangeValue(data.speed);
|
|
4395
|
-
}
|
|
4396
|
-
if (data.decay !== undefined) {
|
|
4397
|
-
this.decay = setRangeValue(data.decay);
|
|
4398
|
-
}
|
|
4399
|
-
if (data.sync !== undefined) {
|
|
4400
|
-
this.sync = data.sync;
|
|
4401
|
-
}
|
|
3623
|
+
loadProperty(this, "enable", data.enable);
|
|
3624
|
+
loadRangeProperty(this, "speed", data.speed);
|
|
3625
|
+
loadRangeProperty(this, "decay", data.decay);
|
|
3626
|
+
loadProperty(this, "sync", data.sync);
|
|
4402
3627
|
}
|
|
4403
3628
|
}
|
|
4404
3629
|
|
|
4405
3630
|
class Tilt extends ValueWithRandom {
|
|
4406
|
-
animation;
|
|
4407
|
-
direction;
|
|
4408
|
-
enable;
|
|
4409
|
-
constructor() {
|
|
4410
|
-
super();
|
|
4411
|
-
this.animation = new TiltAnimation();
|
|
4412
|
-
this.direction = TiltDirection.clockwise;
|
|
4413
|
-
this.enable = false;
|
|
4414
|
-
this.value = 0;
|
|
4415
|
-
}
|
|
3631
|
+
animation = new TiltAnimation();
|
|
3632
|
+
direction = TiltDirection.clockwise;
|
|
3633
|
+
enable = false;
|
|
4416
3634
|
load(data) {
|
|
4417
3635
|
super.load(data);
|
|
4418
3636
|
if (isNull(data)) {
|
|
4419
3637
|
return;
|
|
4420
3638
|
}
|
|
4421
3639
|
this.animation.load(data.animation);
|
|
4422
|
-
|
|
4423
|
-
|
|
4424
|
-
}
|
|
4425
|
-
if (data.enable !== undefined) {
|
|
4426
|
-
this.enable = data.enable;
|
|
4427
|
-
}
|
|
3640
|
+
loadProperty(this, "direction", data.direction);
|
|
3641
|
+
loadProperty(this, "enable", data.enable);
|
|
4428
3642
|
}
|
|
4429
3643
|
}
|
|
4430
3644
|
|
|
@@ -4449,8 +3663,8 @@
|
|
|
4449
3663
|
particle.tilt = {
|
|
4450
3664
|
enable: tiltOptions.enable,
|
|
4451
3665
|
value: degToRad(getRangeValue(tiltOptions.value)),
|
|
4452
|
-
sinDirection: getRandom() >= half ? identity$
|
|
4453
|
-
cosDirection: getRandom() >= half ? identity$
|
|
3666
|
+
sinDirection: getRandom() >= half ? identity$1 : -identity$1,
|
|
3667
|
+
cosDirection: getRandom() >= half ? identity$1 : -identity$1,
|
|
4454
3668
|
min: 0,
|
|
4455
3669
|
max: doublePI,
|
|
4456
3670
|
};
|
|
@@ -4470,7 +3684,7 @@
|
|
|
4470
3684
|
}
|
|
4471
3685
|
const tiltAnimation = particle.options.tilt?.animation;
|
|
4472
3686
|
if (tiltAnimation?.enable) {
|
|
4473
|
-
particle.tilt.decay = identity$
|
|
3687
|
+
particle.tilt.decay = identity$1 - getRangeValue(tiltAnimation.decay);
|
|
4474
3688
|
particle.tilt.velocity = (getRangeValue(tiltAnimation.speed) / maxAngle$1) * this.#container.retina.reduceFactor;
|
|
4475
3689
|
if (!tiltAnimation.sync) {
|
|
4476
3690
|
particle.tilt.velocity *= getRandom();
|
|
@@ -4482,10 +3696,7 @@
|
|
|
4482
3696
|
return !particle.destroyed && !particle.spawning && !!tiltAnimation?.enable;
|
|
4483
3697
|
}
|
|
4484
3698
|
loadOptions(options, ...sources) {
|
|
4485
|
-
options
|
|
4486
|
-
for (const source of sources) {
|
|
4487
|
-
options.tilt.load(source?.tilt);
|
|
4488
|
-
}
|
|
3699
|
+
loadOptionProperty(options, "tilt", Tilt, ...sources);
|
|
4489
3700
|
}
|
|
4490
3701
|
update(particle, delta) {
|
|
4491
3702
|
if (!this.isEnabled(particle) || !particle.tilt) {
|
|
@@ -4496,7 +3707,7 @@
|
|
|
4496
3707
|
}
|
|
4497
3708
|
|
|
4498
3709
|
async function loadTiltUpdater(engine) {
|
|
4499
|
-
engine.checkVersion("4.
|
|
3710
|
+
engine.checkVersion("4.2.0");
|
|
4500
3711
|
await engine.pluginManager.register(e => {
|
|
4501
3712
|
e.pluginManager.addParticleUpdater("tilt", container => {
|
|
4502
3713
|
return Promise.resolve(new TiltUpdater(container));
|
|
@@ -4505,44 +3716,27 @@
|
|
|
4505
3716
|
}
|
|
4506
3717
|
|
|
4507
3718
|
class WobbleSpeed {
|
|
4508
|
-
angle;
|
|
4509
|
-
move;
|
|
4510
|
-
constructor() {
|
|
4511
|
-
this.angle = 50;
|
|
4512
|
-
this.move = 10;
|
|
4513
|
-
}
|
|
3719
|
+
angle = 50;
|
|
3720
|
+
move = 10;
|
|
4514
3721
|
load(data) {
|
|
4515
3722
|
if (isNull(data)) {
|
|
4516
3723
|
return;
|
|
4517
3724
|
}
|
|
4518
|
-
|
|
4519
|
-
|
|
4520
|
-
}
|
|
4521
|
-
if (data.move !== undefined) {
|
|
4522
|
-
this.move = setRangeValue(data.move);
|
|
4523
|
-
}
|
|
3725
|
+
loadRangeProperty(this, "angle", data.angle);
|
|
3726
|
+
loadRangeProperty(this, "move", data.move);
|
|
4524
3727
|
}
|
|
4525
3728
|
}
|
|
4526
3729
|
|
|
4527
3730
|
class Wobble {
|
|
4528
|
-
distance;
|
|
4529
|
-
enable;
|
|
4530
|
-
speed;
|
|
4531
|
-
constructor() {
|
|
4532
|
-
this.distance = 5;
|
|
4533
|
-
this.enable = false;
|
|
4534
|
-
this.speed = new WobbleSpeed();
|
|
4535
|
-
}
|
|
3731
|
+
distance = 5;
|
|
3732
|
+
enable = false;
|
|
3733
|
+
speed = new WobbleSpeed();
|
|
4536
3734
|
load(data) {
|
|
4537
3735
|
if (isNull(data)) {
|
|
4538
3736
|
return;
|
|
4539
3737
|
}
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
|
-
}
|
|
4543
|
-
if (data.enable !== undefined) {
|
|
4544
|
-
this.enable = data.enable;
|
|
4545
|
-
}
|
|
3738
|
+
loadRangeProperty(this, "distance", data.distance);
|
|
3739
|
+
loadProperty(this, "enable", data.enable);
|
|
4546
3740
|
if (data.speed !== undefined) {
|
|
4547
3741
|
if (isNumber(data.speed)) {
|
|
4548
3742
|
this.speed.load({ angle: data.speed });
|
|
@@ -4604,10 +3798,7 @@
|
|
|
4604
3798
|
return !particle.destroyed && !particle.spawning && !!particle.options.wobble?.enable;
|
|
4605
3799
|
}
|
|
4606
3800
|
loadOptions(options, ...sources) {
|
|
4607
|
-
options
|
|
4608
|
-
for (const source of sources) {
|
|
4609
|
-
options.wobble.load(source?.wobble);
|
|
4610
|
-
}
|
|
3801
|
+
loadOptionProperty(options, "wobble", Wobble, ...sources);
|
|
4611
3802
|
}
|
|
4612
3803
|
update(particle, delta) {
|
|
4613
3804
|
if (!this.isEnabled(particle)) {
|
|
@@ -4618,7 +3809,7 @@
|
|
|
4618
3809
|
}
|
|
4619
3810
|
|
|
4620
3811
|
async function loadWobbleUpdater(engine) {
|
|
4621
|
-
engine.checkVersion("4.
|
|
3812
|
+
engine.checkVersion("4.2.0");
|
|
4622
3813
|
await engine.pluginManager.register(e => {
|
|
4623
3814
|
e.pluginManager.addParticleUpdater("wobble", container => {
|
|
4624
3815
|
return Promise.resolve(new WobbleUpdater(container));
|
|
@@ -4834,7 +4025,7 @@
|
|
|
4834
4025
|
return;
|
|
4835
4026
|
}
|
|
4836
4027
|
this.draw(ctx => {
|
|
4837
|
-
|
|
4028
|
+
ctx.clearRect(originPoint.x, originPoint.y, this.#canvasManager.size.width, this.#canvasManager.size.height);
|
|
4838
4029
|
});
|
|
4839
4030
|
}
|
|
4840
4031
|
clear() {
|
|
@@ -4896,7 +4087,7 @@
|
|
|
4896
4087
|
plugin.drawParticleSetup?.(context, particle, delta);
|
|
4897
4088
|
}
|
|
4898
4089
|
this.#applyPreDrawUpdaters(context, particle, radius, opacity, colorStyles, transform);
|
|
4899
|
-
drawParticle({
|
|
4090
|
+
this.#drawParticle({
|
|
4900
4091
|
container,
|
|
4901
4092
|
context,
|
|
4902
4093
|
particle,
|
|
@@ -4915,7 +4106,7 @@
|
|
|
4915
4106
|
drawParticlePlugins(particle, delta) {
|
|
4916
4107
|
this.draw(ctx => {
|
|
4917
4108
|
for (const plugin of this.#drawParticlePlugins) {
|
|
4918
|
-
drawParticlePlugin(ctx, plugin, particle, delta);
|
|
4109
|
+
this.#drawParticlePlugin(ctx, plugin, particle, delta);
|
|
4919
4110
|
}
|
|
4920
4111
|
});
|
|
4921
4112
|
}
|
|
@@ -5015,12 +4206,19 @@
|
|
|
5015
4206
|
}
|
|
5016
4207
|
paintBase(baseColor) {
|
|
5017
4208
|
this.draw(ctx => {
|
|
5018
|
-
|
|
4209
|
+
ctx.fillStyle = baseColor ?? "rgba(0,0,0,0)";
|
|
4210
|
+
ctx.fillRect(originPoint.x, originPoint.y, this.#canvasManager.size.width, this.#canvasManager.size.height);
|
|
5019
4211
|
});
|
|
5020
4212
|
}
|
|
5021
4213
|
paintImage(image, opacity) {
|
|
5022
4214
|
this.draw(ctx => {
|
|
5023
|
-
|
|
4215
|
+
if (!image) {
|
|
4216
|
+
return;
|
|
4217
|
+
}
|
|
4218
|
+
const prevAlpha = ctx.globalAlpha;
|
|
4219
|
+
ctx.globalAlpha = opacity;
|
|
4220
|
+
ctx.drawImage(image, originPoint.x, originPoint.y, this.#canvasManager.size.width, this.#canvasManager.size.height);
|
|
4221
|
+
ctx.globalAlpha = prevAlpha;
|
|
5024
4222
|
});
|
|
5025
4223
|
}
|
|
5026
4224
|
setContext(context) {
|
|
@@ -5034,15 +4232,15 @@
|
|
|
5034
4232
|
}
|
|
5035
4233
|
stop() {
|
|
5036
4234
|
this.draw(ctx => {
|
|
5037
|
-
|
|
4235
|
+
ctx.clearRect(originPoint.x, originPoint.y, this.#canvasManager.size.width, this.#canvasManager.size.height);
|
|
5038
4236
|
});
|
|
5039
4237
|
}
|
|
5040
|
-
#applyPostDrawUpdaters
|
|
4238
|
+
#applyPostDrawUpdaters(particle) {
|
|
5041
4239
|
for (const updater of this.#postDrawUpdaters) {
|
|
5042
4240
|
updater.afterDraw?.(particle);
|
|
5043
4241
|
}
|
|
5044
|
-
}
|
|
5045
|
-
#applyPreDrawUpdaters
|
|
4242
|
+
}
|
|
4243
|
+
#applyPreDrawUpdaters(ctx, particle, radius, zOpacity, colorStyles, transform) {
|
|
5046
4244
|
for (const updater of this.#preDrawUpdaters) {
|
|
5047
4245
|
if (updater.getColorStyles) {
|
|
5048
4246
|
const { fill, stroke } = updater.getColorStyles(particle, ctx, radius, zOpacity);
|
|
@@ -5061,8 +4259,114 @@
|
|
|
5061
4259
|
}
|
|
5062
4260
|
updater.beforeDraw?.(particle);
|
|
5063
4261
|
}
|
|
5064
|
-
}
|
|
5065
|
-
#
|
|
4262
|
+
}
|
|
4263
|
+
#drawAfterEffect(drawer, data) {
|
|
4264
|
+
if (!drawer?.drawAfter) {
|
|
4265
|
+
return;
|
|
4266
|
+
}
|
|
4267
|
+
const { particle } = data;
|
|
4268
|
+
if (!particle.effect) {
|
|
4269
|
+
return;
|
|
4270
|
+
}
|
|
4271
|
+
drawer.drawAfter(data);
|
|
4272
|
+
}
|
|
4273
|
+
#drawBeforeEffect(drawer, data) {
|
|
4274
|
+
if (!drawer?.drawBefore) {
|
|
4275
|
+
return;
|
|
4276
|
+
}
|
|
4277
|
+
const { particle } = data;
|
|
4278
|
+
if (!particle.effect) {
|
|
4279
|
+
return;
|
|
4280
|
+
}
|
|
4281
|
+
drawer.drawBefore(data);
|
|
4282
|
+
}
|
|
4283
|
+
#drawParticle(data) {
|
|
4284
|
+
const { container, context, particle, delta, colorStyles, radius, opacity, transform } = data, { effectDrawers, shapeDrawers } = container, pos = particle.getPosition(), transformData = particle.getTransformData(transform), drawScale = defaultZoom, drawPosition = {
|
|
4285
|
+
x: pos.x,
|
|
4286
|
+
y: pos.y,
|
|
4287
|
+
};
|
|
4288
|
+
context.setTransform(transformData.a, transformData.b, transformData.c, transformData.d, pos.x, pos.y);
|
|
4289
|
+
if (colorStyles.fill) {
|
|
4290
|
+
context.fillStyle = colorStyles.fill;
|
|
4291
|
+
}
|
|
4292
|
+
const fillEnabled = !!particle.fillEnabled, strokeWidth = particle.strokeWidth ?? minStrokeWidth;
|
|
4293
|
+
context.lineWidth = strokeWidth;
|
|
4294
|
+
if (colorStyles.stroke) {
|
|
4295
|
+
context.strokeStyle = colorStyles.stroke;
|
|
4296
|
+
}
|
|
4297
|
+
const drawData = {
|
|
4298
|
+
context,
|
|
4299
|
+
particle,
|
|
4300
|
+
radius,
|
|
4301
|
+
drawRadius: radius * drawScale,
|
|
4302
|
+
opacity,
|
|
4303
|
+
delta,
|
|
4304
|
+
pixelRatio: container.retina.pixelRatio,
|
|
4305
|
+
fill: fillEnabled,
|
|
4306
|
+
stroke: strokeWidth > minStrokeWidth,
|
|
4307
|
+
transformData,
|
|
4308
|
+
position: { ...pos },
|
|
4309
|
+
drawPosition,
|
|
4310
|
+
drawScale,
|
|
4311
|
+
};
|
|
4312
|
+
for (const plugin of container.plugins) {
|
|
4313
|
+
plugin.drawParticleTransform?.(drawData);
|
|
4314
|
+
}
|
|
4315
|
+
const effect = particle.effect ? effectDrawers.get(particle.effect) : undefined, shape = particle.shape ? shapeDrawers.get(particle.shape) : undefined;
|
|
4316
|
+
this.#drawBeforeEffect(effect, drawData);
|
|
4317
|
+
this.#drawShapeBeforeDraw(shape, drawData);
|
|
4318
|
+
this.#drawShape(shape, drawData);
|
|
4319
|
+
this.#drawShapeAfterDraw(shape, drawData);
|
|
4320
|
+
this.#drawAfterEffect(effect, drawData);
|
|
4321
|
+
context.resetTransform();
|
|
4322
|
+
}
|
|
4323
|
+
#drawParticlePlugin(context, plugin, particle, delta) {
|
|
4324
|
+
if (!plugin.drawParticle) {
|
|
4325
|
+
return;
|
|
4326
|
+
}
|
|
4327
|
+
plugin.drawParticle(context, particle, delta);
|
|
4328
|
+
}
|
|
4329
|
+
#drawShape(drawer, data) {
|
|
4330
|
+
if (!drawer) {
|
|
4331
|
+
return;
|
|
4332
|
+
}
|
|
4333
|
+
const { context, fill, particle, stroke } = data;
|
|
4334
|
+
if (!particle.shape) {
|
|
4335
|
+
return;
|
|
4336
|
+
}
|
|
4337
|
+
context.beginPath();
|
|
4338
|
+
drawer.draw(data);
|
|
4339
|
+
if (particle.shapeClose) {
|
|
4340
|
+
context.closePath();
|
|
4341
|
+
}
|
|
4342
|
+
if (fill) {
|
|
4343
|
+
context.fill();
|
|
4344
|
+
}
|
|
4345
|
+
if (stroke) {
|
|
4346
|
+
context.stroke();
|
|
4347
|
+
}
|
|
4348
|
+
}
|
|
4349
|
+
#drawShapeAfterDraw(drawer, data) {
|
|
4350
|
+
if (!drawer?.afterDraw) {
|
|
4351
|
+
return;
|
|
4352
|
+
}
|
|
4353
|
+
const { particle } = data;
|
|
4354
|
+
if (!particle.shape) {
|
|
4355
|
+
return;
|
|
4356
|
+
}
|
|
4357
|
+
drawer.afterDraw(data);
|
|
4358
|
+
}
|
|
4359
|
+
#drawShapeBeforeDraw(drawer, data) {
|
|
4360
|
+
if (!drawer?.beforeDraw) {
|
|
4361
|
+
return;
|
|
4362
|
+
}
|
|
4363
|
+
const { particle } = data;
|
|
4364
|
+
if (!particle.shape) {
|
|
4365
|
+
return;
|
|
4366
|
+
}
|
|
4367
|
+
drawer.beforeDraw(data);
|
|
4368
|
+
}
|
|
4369
|
+
#getPluginParticleColors(particle) {
|
|
5066
4370
|
let fColor, sColor;
|
|
5067
4371
|
for (const plugin of this.#colorPlugins) {
|
|
5068
4372
|
if (!fColor && plugin.particleFillColor) {
|
|
@@ -5078,7 +4382,7 @@
|
|
|
5078
4382
|
this.#reusablePluginColors[fColorIndex] = fColor;
|
|
5079
4383
|
this.#reusablePluginColors[sColorIndex] = sColor;
|
|
5080
4384
|
return this.#reusablePluginColors;
|
|
5081
|
-
}
|
|
4385
|
+
}
|
|
5082
4386
|
}
|
|
5083
4387
|
|
|
5084
4388
|
const transferredCanvases = new WeakMap(), getTransferredCanvas = (canvas) => {
|
|
@@ -5210,6 +4514,7 @@
|
|
|
5210
4514
|
obs.observe(element, { attributes: true });
|
|
5211
4515
|
});
|
|
5212
4516
|
this.initPlugins();
|
|
4517
|
+
this.#initContext();
|
|
5213
4518
|
this.render.init();
|
|
5214
4519
|
}
|
|
5215
4520
|
initBackground() {
|
|
@@ -5219,7 +4524,7 @@
|
|
|
5219
4524
|
}
|
|
5220
4525
|
const elementStyle = element.style, color = rangeColorToRgb(this.#pluginManager, background.color);
|
|
5221
4526
|
if (color) {
|
|
5222
|
-
elementStyle.backgroundColor = getStyleFromRgb(color, container.hdr, background.opacity);
|
|
4527
|
+
elementStyle.backgroundColor = getStyleFromRgb(color, container.actualOptions.hdr, background.opacity);
|
|
5223
4528
|
}
|
|
5224
4529
|
else {
|
|
5225
4530
|
elementStyle.backgroundColor = "";
|
|
@@ -5241,7 +4546,7 @@
|
|
|
5241
4546
|
if (this.#generated && this.domElement) {
|
|
5242
4547
|
this.domElement.remove();
|
|
5243
4548
|
}
|
|
5244
|
-
const
|
|
4549
|
+
const domCanvas = isHtmlCanvasElement(canvas) ? canvas : undefined;
|
|
5245
4550
|
this.domElement = domCanvas;
|
|
5246
4551
|
this.#generated = domCanvas ? domCanvas.dataset[generatedAttribute] === "true" : false;
|
|
5247
4552
|
this.renderCanvas = domCanvas ? getTransferredCanvas(domCanvas) : canvas;
|
|
@@ -5262,26 +4567,6 @@
|
|
|
5262
4567
|
const pxRatio = this.#container.retina.pixelRatio, retinaSize = this.size;
|
|
5263
4568
|
renderCanvas.height = retinaSize.height = standardSize.height * pxRatio;
|
|
5264
4569
|
renderCanvas.width = retinaSize.width = standardSize.width * pxRatio;
|
|
5265
|
-
const canSupportHdrQuery = safeMatchMedia("(color-gamut: p3)");
|
|
5266
|
-
this.render.setContextSettings({
|
|
5267
|
-
alpha: true,
|
|
5268
|
-
colorSpace: canSupportHdrQuery?.matches && container.hdr ? "display-p3" : "srgb",
|
|
5269
|
-
desynchronized: true,
|
|
5270
|
-
willReadFrequently: false,
|
|
5271
|
-
});
|
|
5272
|
-
this.render.setContext(renderCanvas.getContext("2d", this.render.settings));
|
|
5273
|
-
this.#safeMutationObserver(obs => {
|
|
5274
|
-
obs.disconnect();
|
|
5275
|
-
});
|
|
5276
|
-
container.retina.init();
|
|
5277
|
-
this.initBackground();
|
|
5278
|
-
this.#safeMutationObserver(obs => {
|
|
5279
|
-
const element = this.domElement;
|
|
5280
|
-
if (!element || !(element instanceof Node)) {
|
|
5281
|
-
return;
|
|
5282
|
-
}
|
|
5283
|
-
obs.observe(element, { attributes: true });
|
|
5284
|
-
});
|
|
5285
4570
|
}
|
|
5286
4571
|
resize() {
|
|
5287
4572
|
const element = this.domElement;
|
|
@@ -5349,12 +4634,30 @@
|
|
|
5349
4634
|
await container.refresh();
|
|
5350
4635
|
}
|
|
5351
4636
|
}
|
|
5352
|
-
#applyResizePlugins
|
|
4637
|
+
#applyResizePlugins() {
|
|
5353
4638
|
for (const plugin of this.#resizePlugins) {
|
|
5354
4639
|
plugin.resize?.();
|
|
5355
4640
|
}
|
|
5356
|
-
}
|
|
5357
|
-
#
|
|
4641
|
+
}
|
|
4642
|
+
#initContext() {
|
|
4643
|
+
const container = this.#container, canSupportHdr = container.actualOptions.hdr &&
|
|
4644
|
+
safeMatchMedia("(color-gamut: p3)")?.matches &&
|
|
4645
|
+
safeMatchMedia("(dynamic-range: high)")?.matches;
|
|
4646
|
+
this.render.setContextSettings({
|
|
4647
|
+
alpha: true,
|
|
4648
|
+
desynchronized: true,
|
|
4649
|
+
willReadFrequently: false,
|
|
4650
|
+
...(canSupportHdr
|
|
4651
|
+
? { colorSpace: "display-p3", colorType: "float16" }
|
|
4652
|
+
: { colorSpace: "srgb" }),
|
|
4653
|
+
});
|
|
4654
|
+
const renderCanvas = this.renderCanvas;
|
|
4655
|
+
if (!renderCanvas) {
|
|
4656
|
+
return;
|
|
4657
|
+
}
|
|
4658
|
+
this.render.setContext(renderCanvas.getContext("2d", this.render.settings));
|
|
4659
|
+
}
|
|
4660
|
+
#initStyle() {
|
|
5358
4661
|
const element = this.domElement, options = this.#container.actualOptions;
|
|
5359
4662
|
if (!element) {
|
|
5360
4663
|
return;
|
|
@@ -5375,8 +4678,8 @@
|
|
|
5375
4678
|
}
|
|
5376
4679
|
element.style.setProperty(key, value, "important");
|
|
5377
4680
|
}
|
|
5378
|
-
}
|
|
5379
|
-
#repairStyle
|
|
4681
|
+
}
|
|
4682
|
+
#repairStyle() {
|
|
5380
4683
|
const element = this.domElement;
|
|
5381
4684
|
if (!element) {
|
|
5382
4685
|
return;
|
|
@@ -5395,27 +4698,27 @@
|
|
|
5395
4698
|
}
|
|
5396
4699
|
observer.observe(element, { attributes: true });
|
|
5397
4700
|
});
|
|
5398
|
-
}
|
|
5399
|
-
#resetOriginalStyle
|
|
4701
|
+
}
|
|
4702
|
+
#resetOriginalStyle() {
|
|
5400
4703
|
const element = this.domElement, originalStyle = this.#originalStyle;
|
|
5401
4704
|
if (!element || !originalStyle) {
|
|
5402
4705
|
return;
|
|
5403
4706
|
}
|
|
5404
4707
|
setStyle(element, originalStyle, true);
|
|
5405
|
-
}
|
|
5406
|
-
#safeMutationObserver
|
|
4708
|
+
}
|
|
4709
|
+
#safeMutationObserver(callback) {
|
|
5407
4710
|
if (!this.#mutationObserver) {
|
|
5408
4711
|
return;
|
|
5409
4712
|
}
|
|
5410
4713
|
callback(this.#mutationObserver);
|
|
5411
|
-
}
|
|
5412
|
-
#setFullScreenStyle
|
|
4714
|
+
}
|
|
4715
|
+
#setFullScreenStyle() {
|
|
5413
4716
|
const element = this.domElement;
|
|
5414
4717
|
if (!element) {
|
|
5415
4718
|
return;
|
|
5416
4719
|
}
|
|
5417
4720
|
setStyle(element, getFullScreenStyle(this.#container.actualOptions.fullScreen.zIndex), true);
|
|
5418
|
-
}
|
|
4721
|
+
}
|
|
5419
4722
|
}
|
|
5420
4723
|
|
|
5421
4724
|
class EventListeners {
|
|
@@ -5440,7 +4743,7 @@
|
|
|
5440
4743
|
removeListeners() {
|
|
5441
4744
|
this.#manageListeners(false);
|
|
5442
4745
|
}
|
|
5443
|
-
#handleVisibilityChange
|
|
4746
|
+
#handleVisibilityChange() {
|
|
5444
4747
|
const container = this.#container, options = container.actualOptions;
|
|
5445
4748
|
if (!options.pauseOnBlur) {
|
|
5446
4749
|
return;
|
|
@@ -5458,8 +4761,8 @@
|
|
|
5458
4761
|
container.draw(true);
|
|
5459
4762
|
}
|
|
5460
4763
|
}
|
|
5461
|
-
}
|
|
5462
|
-
#handleWindowResize
|
|
4764
|
+
}
|
|
4765
|
+
#handleWindowResize() {
|
|
5463
4766
|
if (this.#resizeTimeout) {
|
|
5464
4767
|
clearTimeout(this.#resizeTimeout);
|
|
5465
4768
|
this.#resizeTimeout = undefined;
|
|
@@ -5469,13 +4772,13 @@
|
|
|
5469
4772
|
await canvas.windowResize();
|
|
5470
4773
|
};
|
|
5471
4774
|
this.#resizeTimeout = setTimeout(() => void handleResize(), this.#container.actualOptions.resize.delay * millisecondsToSeconds);
|
|
5472
|
-
}
|
|
5473
|
-
#manageListeners
|
|
4775
|
+
}
|
|
4776
|
+
#manageListeners(add) {
|
|
5474
4777
|
const handlers = this.#handlers;
|
|
5475
4778
|
this.#manageResize(add);
|
|
5476
4779
|
manageListener(document, visibilityChangeEvent, handlers.visibilityChange, add, false);
|
|
5477
|
-
}
|
|
5478
|
-
#manageResize
|
|
4780
|
+
}
|
|
4781
|
+
#manageResize(add) {
|
|
5479
4782
|
const handlers = this.#handlers, container = this.#container, options = container.actualOptions;
|
|
5480
4783
|
if (!options.resize.enable) {
|
|
5481
4784
|
return;
|
|
@@ -5502,7 +4805,7 @@
|
|
|
5502
4805
|
});
|
|
5503
4806
|
this.#resizeObserver.observe(canvasEl);
|
|
5504
4807
|
}
|
|
5505
|
-
}
|
|
4808
|
+
}
|
|
5506
4809
|
}
|
|
5507
4810
|
|
|
5508
4811
|
function loadEffectData(effect, effectOptions, id, reduceDuplicates) {
|
|
@@ -5529,6 +4832,131 @@
|
|
|
5529
4832
|
data.setCb(data.radius);
|
|
5530
4833
|
}
|
|
5531
4834
|
}
|
|
4835
|
+
function normalizeAngle(angle, modulus) {
|
|
4836
|
+
const normalized = angle % modulus;
|
|
4837
|
+
return normalized < defaultAngle ? normalized + modulus : normalized;
|
|
4838
|
+
}
|
|
4839
|
+
function initParticleState(particle, id, group) {
|
|
4840
|
+
particle.id = id;
|
|
4841
|
+
particle.group = group;
|
|
4842
|
+
particle.justWarped = false;
|
|
4843
|
+
particle.effectClose = true;
|
|
4844
|
+
particle.shapeClose = true;
|
|
4845
|
+
particle.pathRotation = false;
|
|
4846
|
+
particle.lastPathTime = 0;
|
|
4847
|
+
particle.destroyed = false;
|
|
4848
|
+
particle.unbreakable = false;
|
|
4849
|
+
particle.isRotating = false;
|
|
4850
|
+
particle.rotation = 0;
|
|
4851
|
+
particle.misplaced = false;
|
|
4852
|
+
particle.retina = {
|
|
4853
|
+
maxDistance: {},
|
|
4854
|
+
maxSpeed: 0,
|
|
4855
|
+
moveDrift: 0,
|
|
4856
|
+
moveSpeed: 0,
|
|
4857
|
+
sizeAnimationSpeed: 0,
|
|
4858
|
+
};
|
|
4859
|
+
particle.size = {
|
|
4860
|
+
value: 1,
|
|
4861
|
+
max: 1,
|
|
4862
|
+
min: 1,
|
|
4863
|
+
enable: false,
|
|
4864
|
+
};
|
|
4865
|
+
particle.outType = ParticleOutType.normal;
|
|
4866
|
+
particle.ignoresResizeRatio = true;
|
|
4867
|
+
}
|
|
4868
|
+
function resolveParticleOptions(particle, container, pluginManager, overrideOptions) {
|
|
4869
|
+
const mainOptions = container.actualOptions, particlesOptions = loadParticlesOptions(pluginManager, container, mainOptions.particles), reduceDuplicates = particlesOptions.reduceDuplicates;
|
|
4870
|
+
particle.effect = itemFromSingleOrMultiple(particlesOptions.effect.type, particle.id, reduceDuplicates);
|
|
4871
|
+
particle.shape = itemFromSingleOrMultiple(particlesOptions.shape.type, particle.id, reduceDuplicates);
|
|
4872
|
+
const effectOptions = particlesOptions.effect, shapeOptions = particlesOptions.shape;
|
|
4873
|
+
if (overrideOptions) {
|
|
4874
|
+
if (overrideOptions.effect) {
|
|
4875
|
+
const overrideEffectType = overrideOptions.effect.type;
|
|
4876
|
+
if (overrideEffectType && overrideEffectType !== particle.effect) {
|
|
4877
|
+
const effect = itemFromSingleOrMultiple(overrideEffectType, particle.id, reduceDuplicates);
|
|
4878
|
+
if (effect) {
|
|
4879
|
+
particle.effect = effect;
|
|
4880
|
+
}
|
|
4881
|
+
}
|
|
4882
|
+
effectOptions.load(overrideOptions.effect);
|
|
4883
|
+
}
|
|
4884
|
+
if (overrideOptions.shape) {
|
|
4885
|
+
const overrideShapeType = overrideOptions.shape.type;
|
|
4886
|
+
if (overrideShapeType && overrideShapeType !== particle.shape) {
|
|
4887
|
+
const shape = itemFromSingleOrMultiple(overrideShapeType, particle.id, reduceDuplicates);
|
|
4888
|
+
if (shape) {
|
|
4889
|
+
particle.shape = shape;
|
|
4890
|
+
}
|
|
4891
|
+
}
|
|
4892
|
+
shapeOptions.load(overrideOptions.shape);
|
|
4893
|
+
}
|
|
4894
|
+
}
|
|
4895
|
+
if (particle.effect === randomColorValue) {
|
|
4896
|
+
const availableEffects = [...container.effectDrawers.keys()];
|
|
4897
|
+
particle.effect = availableEffects[Math.floor(getRandom() * availableEffects.length)];
|
|
4898
|
+
}
|
|
4899
|
+
if (particle.shape === randomColorValue) {
|
|
4900
|
+
const availableShapes = [...container.shapeDrawers.keys()];
|
|
4901
|
+
particle.shape = availableShapes[Math.floor(getRandom() * availableShapes.length)];
|
|
4902
|
+
}
|
|
4903
|
+
particle.effectData = particle.effect
|
|
4904
|
+
? loadEffectData(particle.effect, effectOptions, particle.id, reduceDuplicates)
|
|
4905
|
+
: undefined;
|
|
4906
|
+
particle.shapeData = particle.shape
|
|
4907
|
+
? loadShapeData(particle.shape, shapeOptions, particle.id, reduceDuplicates)
|
|
4908
|
+
: undefined;
|
|
4909
|
+
particlesOptions.load(overrideOptions);
|
|
4910
|
+
const effectData = particle.effectData, shapeData = particle.shapeData;
|
|
4911
|
+
if (effectData) {
|
|
4912
|
+
particlesOptions.load(effectData.particles);
|
|
4913
|
+
}
|
|
4914
|
+
if (shapeData) {
|
|
4915
|
+
particlesOptions.load(shapeData.particles);
|
|
4916
|
+
}
|
|
4917
|
+
particle.effectClose = effectData?.close ?? particlesOptions.effect.close;
|
|
4918
|
+
particle.shapeClose = shapeData?.close ?? particlesOptions.shape.close;
|
|
4919
|
+
return particlesOptions;
|
|
4920
|
+
}
|
|
4921
|
+
function initParticleDrawers(particle, container) {
|
|
4922
|
+
let effectDrawer, shapeDrawer;
|
|
4923
|
+
if (particle.effect) {
|
|
4924
|
+
effectDrawer = container.effectDrawers.get(particle.effect);
|
|
4925
|
+
}
|
|
4926
|
+
if (effectDrawer?.loadEffect) {
|
|
4927
|
+
effectDrawer.loadEffect(particle);
|
|
4928
|
+
}
|
|
4929
|
+
if (particle.shape) {
|
|
4930
|
+
shapeDrawer = container.shapeDrawers.get(particle.shape);
|
|
4931
|
+
}
|
|
4932
|
+
if (shapeDrawer?.loadShape) {
|
|
4933
|
+
shapeDrawer.loadShape(particle);
|
|
4934
|
+
}
|
|
4935
|
+
const sideCountFunc = shapeDrawer?.getSidesCount;
|
|
4936
|
+
if (sideCountFunc) {
|
|
4937
|
+
particle.sides = sideCountFunc(particle);
|
|
4938
|
+
}
|
|
4939
|
+
}
|
|
4940
|
+
function runUpdaterPreInit(updaters, particle) {
|
|
4941
|
+
for (const updater of updaters) {
|
|
4942
|
+
updater.preInit?.(particle);
|
|
4943
|
+
}
|
|
4944
|
+
}
|
|
4945
|
+
function runUpdaterInit(updaters, particle) {
|
|
4946
|
+
for (const updater of updaters) {
|
|
4947
|
+
updater.init(particle);
|
|
4948
|
+
}
|
|
4949
|
+
}
|
|
4950
|
+
function runDrawerInit(container, particle) {
|
|
4951
|
+
const shapeDrawer = particle.shape ? container.shapeDrawers.get(particle.shape) : undefined, effectDrawer = particle.effect ? container.effectDrawers.get(particle.effect) : undefined;
|
|
4952
|
+
effectDrawer?.particleInit?.(container, particle);
|
|
4953
|
+
shapeDrawer?.particleInit?.(container, particle);
|
|
4954
|
+
}
|
|
4955
|
+
function runParticleCreatedPlugins(container, particle) {
|
|
4956
|
+
for (const plugin of container.particleCreatedPlugins) {
|
|
4957
|
+
plugin.particleCreated?.(particle);
|
|
4958
|
+
}
|
|
4959
|
+
}
|
|
5532
4960
|
class Particle {
|
|
5533
4961
|
backColor;
|
|
5534
4962
|
bubble;
|
|
@@ -5654,88 +5082,20 @@
|
|
|
5654
5082
|
const rotateData = this.getRotateData(), rotating = this.isRotating;
|
|
5655
5083
|
this.#cachedTransform.a = rotateData.cos * (externalTransform.a ?? defaultTransform.a);
|
|
5656
5084
|
this.#cachedTransform.b = rotating
|
|
5657
|
-
? rotateData.sin * (externalTransform.b ?? identity$
|
|
5085
|
+
? rotateData.sin * (externalTransform.b ?? identity$1)
|
|
5658
5086
|
: (externalTransform.b ?? defaultTransform.b);
|
|
5659
5087
|
this.#cachedTransform.c = rotating
|
|
5660
|
-
? -rotateData.sin * (externalTransform.c ?? identity$
|
|
5088
|
+
? -rotateData.sin * (externalTransform.c ?? identity$1)
|
|
5661
5089
|
: (externalTransform.c ?? defaultTransform.c);
|
|
5662
5090
|
this.#cachedTransform.d = rotateData.cos * (externalTransform.d ?? defaultTransform.d);
|
|
5663
5091
|
return this.#cachedTransform;
|
|
5664
5092
|
}
|
|
5665
5093
|
init(id, position, overrideOptions, group) {
|
|
5666
5094
|
const container = this.#container;
|
|
5667
|
-
this
|
|
5668
|
-
this.
|
|
5669
|
-
this.justWarped = false;
|
|
5670
|
-
this.effectClose = true;
|
|
5671
|
-
this.shapeClose = true;
|
|
5672
|
-
this.pathRotation = false;
|
|
5673
|
-
this.lastPathTime = 0;
|
|
5674
|
-
this.destroyed = false;
|
|
5675
|
-
this.unbreakable = false;
|
|
5676
|
-
this.isRotating = false;
|
|
5677
|
-
this.rotation = 0;
|
|
5678
|
-
this.misplaced = false;
|
|
5679
|
-
this.retina = {
|
|
5680
|
-
maxDistance: {},
|
|
5681
|
-
maxSpeed: 0,
|
|
5682
|
-
moveDrift: 0,
|
|
5683
|
-
moveSpeed: 0,
|
|
5684
|
-
sizeAnimationSpeed: 0,
|
|
5685
|
-
};
|
|
5686
|
-
this.size = {
|
|
5687
|
-
value: 1,
|
|
5688
|
-
max: 1,
|
|
5689
|
-
min: 1,
|
|
5690
|
-
enable: false,
|
|
5691
|
-
};
|
|
5692
|
-
this.outType = ParticleOutType.normal;
|
|
5693
|
-
this.ignoresResizeRatio = true;
|
|
5694
|
-
const mainOptions = container.actualOptions, particlesOptions = loadParticlesOptions(this.#pluginManager, container, mainOptions.particles), reduceDuplicates = particlesOptions.reduceDuplicates, effectType = particlesOptions.effect.type, shapeType = particlesOptions.shape.type;
|
|
5695
|
-
this.effect = itemFromSingleOrMultiple(effectType, this.id, reduceDuplicates);
|
|
5696
|
-
this.shape = itemFromSingleOrMultiple(shapeType, this.id, reduceDuplicates);
|
|
5697
|
-
const effectOptions = particlesOptions.effect, shapeOptions = particlesOptions.shape;
|
|
5698
|
-
if (overrideOptions) {
|
|
5699
|
-
if (overrideOptions.effect?.type && overrideOptions.effect.type !== this.effect) {
|
|
5700
|
-
const overrideEffectType = overrideOptions.effect.type, effect = itemFromSingleOrMultiple(overrideEffectType, this.id, reduceDuplicates);
|
|
5701
|
-
if (effect) {
|
|
5702
|
-
this.effect = effect;
|
|
5703
|
-
effectOptions.load(overrideOptions.effect);
|
|
5704
|
-
}
|
|
5705
|
-
}
|
|
5706
|
-
if (overrideOptions.shape?.type && overrideOptions.shape.type !== this.shape) {
|
|
5707
|
-
const overrideShapeType = overrideOptions.shape.type, shape = itemFromSingleOrMultiple(overrideShapeType, this.id, reduceDuplicates);
|
|
5708
|
-
if (shape) {
|
|
5709
|
-
this.shape = shape;
|
|
5710
|
-
shapeOptions.load(overrideOptions.shape);
|
|
5711
|
-
}
|
|
5712
|
-
}
|
|
5713
|
-
}
|
|
5714
|
-
if (this.effect === randomColorValue) {
|
|
5715
|
-
const availableEffects = [...this.#container.effectDrawers.keys()];
|
|
5716
|
-
this.effect = availableEffects[Math.floor(getRandom() * availableEffects.length)];
|
|
5717
|
-
}
|
|
5718
|
-
if (this.shape === randomColorValue) {
|
|
5719
|
-
const availableShapes = [...this.#container.shapeDrawers.keys()];
|
|
5720
|
-
this.shape = availableShapes[Math.floor(getRandom() * availableShapes.length)];
|
|
5721
|
-
}
|
|
5722
|
-
this.effectData = this.effect ? loadEffectData(this.effect, effectOptions, this.id, reduceDuplicates) : undefined;
|
|
5723
|
-
this.shapeData = this.shape ? loadShapeData(this.shape, shapeOptions, this.id, reduceDuplicates) : undefined;
|
|
5724
|
-
particlesOptions.load(overrideOptions);
|
|
5725
|
-
const effectData = this.effectData, shapeData = this.shapeData;
|
|
5726
|
-
if (effectData) {
|
|
5727
|
-
particlesOptions.load(effectData.particles);
|
|
5728
|
-
}
|
|
5729
|
-
if (shapeData) {
|
|
5730
|
-
particlesOptions.load(shapeData.particles);
|
|
5731
|
-
}
|
|
5732
|
-
this.effectClose = effectData?.close ?? particlesOptions.effect.close;
|
|
5733
|
-
this.shapeClose = shapeData?.close ?? particlesOptions.shape.close;
|
|
5734
|
-
this.options = particlesOptions;
|
|
5095
|
+
initParticleState(this, id, group);
|
|
5096
|
+
this.options = resolveParticleOptions(this, container, this.#pluginManager, overrideOptions);
|
|
5735
5097
|
container.retina.initParticle(this);
|
|
5736
|
-
|
|
5737
|
-
updater.preInit?.(this);
|
|
5738
|
-
}
|
|
5098
|
+
runUpdaterPreInit(container.particleUpdaters, this);
|
|
5739
5099
|
this.bubble = {
|
|
5740
5100
|
inRange: false,
|
|
5741
5101
|
};
|
|
@@ -5748,32 +5108,11 @@
|
|
|
5748
5108
|
this.velocity = this.initialVelocity.copy();
|
|
5749
5109
|
this.zIndexFactor = this.position.z / container.zLayers;
|
|
5750
5110
|
this.sides = 24;
|
|
5751
|
-
|
|
5752
|
-
if (this.effect) {
|
|
5753
|
-
effectDrawer = container.effectDrawers.get(this.effect);
|
|
5754
|
-
}
|
|
5755
|
-
if (effectDrawer?.loadEffect) {
|
|
5756
|
-
effectDrawer.loadEffect(this);
|
|
5757
|
-
}
|
|
5758
|
-
if (this.shape) {
|
|
5759
|
-
shapeDrawer = container.shapeDrawers.get(this.shape);
|
|
5760
|
-
}
|
|
5761
|
-
if (shapeDrawer?.loadShape) {
|
|
5762
|
-
shapeDrawer.loadShape(this);
|
|
5763
|
-
}
|
|
5764
|
-
const sideCountFunc = shapeDrawer?.getSidesCount;
|
|
5765
|
-
if (sideCountFunc) {
|
|
5766
|
-
this.sides = sideCountFunc(this);
|
|
5767
|
-
}
|
|
5111
|
+
initParticleDrawers(this, container);
|
|
5768
5112
|
this.spawning = false;
|
|
5769
|
-
|
|
5770
|
-
|
|
5771
|
-
|
|
5772
|
-
effectDrawer?.particleInit?.(container, this);
|
|
5773
|
-
shapeDrawer?.particleInit?.(container, this);
|
|
5774
|
-
for (const plugin of container.particleCreatedPlugins) {
|
|
5775
|
-
plugin.particleCreated?.(this);
|
|
5776
|
-
}
|
|
5113
|
+
runUpdaterInit(container.particleUpdaters, this);
|
|
5114
|
+
runDrawerInit(container, this);
|
|
5115
|
+
runParticleCreatedPlugins(container, this);
|
|
5777
5116
|
}
|
|
5778
5117
|
isInsideCanvas(direction) {
|
|
5779
5118
|
return this.#getInsideCanvasResult({ direction }).inside;
|
|
@@ -5787,15 +5126,15 @@
|
|
|
5787
5126
|
}
|
|
5788
5127
|
const angle = this.roll.angle;
|
|
5789
5128
|
if (this.roll.horizontal && this.roll.vertical) {
|
|
5790
|
-
const
|
|
5129
|
+
const adjustedAngle = normalizeAngle(angle, doublePI);
|
|
5791
5130
|
return adjustedAngle >= Math.PI * half && adjustedAngle < Math.PI * triple * half;
|
|
5792
5131
|
}
|
|
5793
5132
|
if (this.roll.horizontal) {
|
|
5794
|
-
const
|
|
5133
|
+
const adjustedAngle = normalizeAngle(angle + Math.PI * half, doublePI);
|
|
5795
5134
|
return adjustedAngle >= Math.PI && adjustedAngle < Math.PI * double;
|
|
5796
5135
|
}
|
|
5797
5136
|
if (this.roll.vertical) {
|
|
5798
|
-
const
|
|
5137
|
+
const adjustedAngle = normalizeAngle(angle, doublePI);
|
|
5799
5138
|
return adjustedAngle >= Math.PI && adjustedAngle < Math.PI * double;
|
|
5800
5139
|
}
|
|
5801
5140
|
return false;
|
|
@@ -5808,10 +5147,10 @@
|
|
|
5808
5147
|
updater.reset?.(this);
|
|
5809
5148
|
}
|
|
5810
5149
|
}
|
|
5811
|
-
#calcPosition
|
|
5150
|
+
#calcPosition(position, zIndex) {
|
|
5812
5151
|
let tryCount = defaultRetryCount, posVec = position ? Vector3d.create(position.x, position.y, zIndex) : undefined;
|
|
5813
|
-
const container = this.#container, plugins = container.particlePositionPlugins, outModes = this.options.move.outModes, radius = this.getRadius(), canvasSize = container.canvas.size
|
|
5814
|
-
|
|
5152
|
+
const container = this.#container, plugins = container.particlePositionPlugins, outModes = this.options.move.outModes, radius = this.getRadius(), canvasSize = container.canvas.size;
|
|
5153
|
+
for (;;) {
|
|
5815
5154
|
for (const plugin of plugins) {
|
|
5816
5155
|
const pluginPos = plugin.particlePosition?.(posVec, this);
|
|
5817
5156
|
if (pluginPos) {
|
|
@@ -5839,9 +5178,8 @@
|
|
|
5839
5178
|
tryCount += tryCountIncrement;
|
|
5840
5179
|
posVec = undefined;
|
|
5841
5180
|
}
|
|
5842
|
-
|
|
5843
|
-
|
|
5844
|
-
#calculateVelocity = () => {
|
|
5181
|
+
}
|
|
5182
|
+
#calculateVelocity() {
|
|
5845
5183
|
const moveOptions = this.options.move, baseVelocity = getParticleBaseVelocity(this.direction), res = baseVelocity.copy();
|
|
5846
5184
|
if (moveOptions.direction === MoveDirection.inside || moveOptions.direction === MoveDirection.outside) {
|
|
5847
5185
|
return res;
|
|
@@ -5857,8 +5195,8 @@
|
|
|
5857
5195
|
res.length *= getRandom();
|
|
5858
5196
|
}
|
|
5859
5197
|
return res;
|
|
5860
|
-
}
|
|
5861
|
-
#fixHorizontal
|
|
5198
|
+
}
|
|
5199
|
+
#fixHorizontal(pos, radius, outMode) {
|
|
5862
5200
|
fixOutMode({
|
|
5863
5201
|
outMode,
|
|
5864
5202
|
checkModes: [OutMode.bounce],
|
|
@@ -5867,8 +5205,8 @@
|
|
|
5867
5205
|
setCb: (value) => (pos.x += value),
|
|
5868
5206
|
radius,
|
|
5869
5207
|
});
|
|
5870
|
-
}
|
|
5871
|
-
#fixVertical
|
|
5208
|
+
}
|
|
5209
|
+
#fixVertical(pos, radius, outMode) {
|
|
5872
5210
|
fixOutMode({
|
|
5873
5211
|
outMode,
|
|
5874
5212
|
checkModes: [OutMode.bounce],
|
|
@@ -5877,8 +5215,8 @@
|
|
|
5877
5215
|
setCb: (value) => (pos.y += value),
|
|
5878
5216
|
radius,
|
|
5879
5217
|
});
|
|
5880
|
-
}
|
|
5881
|
-
#getDefaultInsideCanvasResult
|
|
5218
|
+
}
|
|
5219
|
+
#getDefaultInsideCanvasResult(direction, outMode) {
|
|
5882
5220
|
const radius = this.getRadius(), canvasSize = this.#container.canvas.size, position = this.position, isBounce = outMode === OutMode.bounce;
|
|
5883
5221
|
if (direction === OutModeDirection.bottom) {
|
|
5884
5222
|
return {
|
|
@@ -5911,8 +5249,8 @@
|
|
|
5911
5249
|
position.x <= canvasSize.width + radius,
|
|
5912
5250
|
reason: "default",
|
|
5913
5251
|
};
|
|
5914
|
-
}
|
|
5915
|
-
#getInsideCanvasCallbackData
|
|
5252
|
+
}
|
|
5253
|
+
#getInsideCanvasCallbackData(direction, outMode) {
|
|
5916
5254
|
return {
|
|
5917
5255
|
canvasSize: this.#container.canvas.size,
|
|
5918
5256
|
direction,
|
|
@@ -5920,8 +5258,8 @@
|
|
|
5920
5258
|
particle: this,
|
|
5921
5259
|
radius: this.getRadius(),
|
|
5922
5260
|
};
|
|
5923
|
-
}
|
|
5924
|
-
#getInsideCanvasResult
|
|
5261
|
+
}
|
|
5262
|
+
#getInsideCanvasResult(data) {
|
|
5925
5263
|
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;
|
|
5926
5264
|
if (!shapeCheck && !effectCheck) {
|
|
5927
5265
|
return defaultResult;
|
|
@@ -5936,8 +5274,8 @@
|
|
|
5936
5274
|
};
|
|
5937
5275
|
}
|
|
5938
5276
|
return shapeResult ?? effectResult ?? defaultResult;
|
|
5939
|
-
}
|
|
5940
|
-
#getRollColor
|
|
5277
|
+
}
|
|
5278
|
+
#getRollColor(color) {
|
|
5941
5279
|
if (!color || !this.roll || (!this.backColor && !this.roll.alter)) {
|
|
5942
5280
|
return color;
|
|
5943
5281
|
}
|
|
@@ -5951,8 +5289,8 @@
|
|
|
5951
5289
|
return alterHsl(color, this.roll.alter.type, this.roll.alter.value);
|
|
5952
5290
|
}
|
|
5953
5291
|
return color;
|
|
5954
|
-
}
|
|
5955
|
-
#initPosition
|
|
5292
|
+
}
|
|
5293
|
+
#initPosition(position) {
|
|
5956
5294
|
const container = this.#container, zIndexValue = Math.floor(getRangeValue(this.options.zIndex.value)), initialPosition = this.#calcPosition(position, clamp(zIndexValue, minZ, container.zLayers));
|
|
5957
5295
|
if (!initialPosition) {
|
|
5958
5296
|
throw new Error("a valid position cannot be found for particle");
|
|
@@ -5975,8 +5313,8 @@
|
|
|
5975
5313
|
break;
|
|
5976
5314
|
}
|
|
5977
5315
|
this.offset = Vector.origin;
|
|
5978
|
-
}
|
|
5979
|
-
#normalizeInsideCanvasResult
|
|
5316
|
+
}
|
|
5317
|
+
#normalizeInsideCanvasResult(result, reason) {
|
|
5980
5318
|
if (typeof result === "boolean") {
|
|
5981
5319
|
return {
|
|
5982
5320
|
inside: result,
|
|
@@ -5988,7 +5326,7 @@
|
|
|
5988
5326
|
margin: result.margin,
|
|
5989
5327
|
reason: result.reason ?? reason,
|
|
5990
5328
|
};
|
|
5991
|
-
}
|
|
5329
|
+
}
|
|
5992
5330
|
}
|
|
5993
5331
|
|
|
5994
5332
|
class SpatialHashGrid {
|
|
@@ -6341,10 +5679,10 @@
|
|
|
6341
5679
|
}
|
|
6342
5680
|
this.#resizeFactor = undefined;
|
|
6343
5681
|
}
|
|
6344
|
-
#addToPool
|
|
5682
|
+
#addToPool(...particles) {
|
|
6345
5683
|
this.#pool.push(...particles);
|
|
6346
|
-
}
|
|
6347
|
-
#applyDensity
|
|
5684
|
+
}
|
|
5685
|
+
#applyDensity(options, pluginsCount, group, groupOptions) {
|
|
6348
5686
|
const numberOptions = options.number;
|
|
6349
5687
|
if (!numberOptions.density.enable) {
|
|
6350
5688
|
if (group === undefined) {
|
|
@@ -6368,36 +5706,19 @@
|
|
|
6368
5706
|
else if (particlesCount > particlesNumber) {
|
|
6369
5707
|
this.removeQuantity(particlesCount - particlesNumber, group);
|
|
6370
5708
|
}
|
|
6371
|
-
}
|
|
6372
|
-
#createBuckets
|
|
5709
|
+
}
|
|
5710
|
+
#createBuckets(zLayers) {
|
|
6373
5711
|
const bucketCount = Math.max(Math.floor(zLayers), one);
|
|
6374
5712
|
return Array.from({ length: bucketCount }, () => []);
|
|
6375
|
-
}
|
|
6376
|
-
#getBucketIndex
|
|
5713
|
+
}
|
|
5714
|
+
#getBucketIndex(zIndex) {
|
|
6377
5715
|
const maxBucketIndex = this.#zBuckets.length - one;
|
|
6378
5716
|
if (maxBucketIndex <= minIndex) {
|
|
6379
5717
|
return minIndex;
|
|
6380
5718
|
}
|
|
6381
5719
|
return Math.min(Math.max(Math.floor(zIndex), minIndex), maxBucketIndex);
|
|
6382
|
-
}
|
|
6383
|
-
#
|
|
6384
|
-
let start = minIndex, end = bucket.length;
|
|
6385
|
-
while (start < end) {
|
|
6386
|
-
const middle = Math.floor((start + end) / double), middleParticle = bucket[middle];
|
|
6387
|
-
if (!middleParticle) {
|
|
6388
|
-
end = middle;
|
|
6389
|
-
continue;
|
|
6390
|
-
}
|
|
6391
|
-
if (middleParticle.id < particleId) {
|
|
6392
|
-
start = middle + one;
|
|
6393
|
-
}
|
|
6394
|
-
else {
|
|
6395
|
-
end = middle;
|
|
6396
|
-
}
|
|
6397
|
-
}
|
|
6398
|
-
return start;
|
|
6399
|
-
};
|
|
6400
|
-
#initDensityFactor = densityOptions => {
|
|
5720
|
+
}
|
|
5721
|
+
#initDensityFactor(densityOptions) {
|
|
6401
5722
|
const container = this.#container;
|
|
6402
5723
|
if (!densityOptions.enable) {
|
|
6403
5724
|
return defaultDensityFactor;
|
|
@@ -6407,16 +5728,16 @@
|
|
|
6407
5728
|
return defaultDensityFactor;
|
|
6408
5729
|
}
|
|
6409
5730
|
return ((canvasSize.width * canvasSize.height) / (densityOptions.height * densityOptions.width * pxRatio ** squareExp));
|
|
6410
|
-
}
|
|
6411
|
-
#insertParticleIntoBucket
|
|
5731
|
+
}
|
|
5732
|
+
#insertParticleIntoBucket(particle) {
|
|
6412
5733
|
const bucketIndex = this.#getBucketIndex(particle.position.z), bucket = this.#zBuckets[bucketIndex];
|
|
6413
5734
|
if (!bucket) {
|
|
6414
5735
|
return;
|
|
6415
5736
|
}
|
|
6416
|
-
bucket.
|
|
5737
|
+
bucket.push(particle);
|
|
6417
5738
|
this.#particleBuckets.set(particle.id, bucketIndex);
|
|
6418
|
-
}
|
|
6419
|
-
#removeParticle
|
|
5739
|
+
}
|
|
5740
|
+
#removeParticle(index, group, override) {
|
|
6420
5741
|
const particle = this.#array[index];
|
|
6421
5742
|
if (!particle) {
|
|
6422
5743
|
return false;
|
|
@@ -6432,22 +5753,20 @@
|
|
|
6432
5753
|
});
|
|
6433
5754
|
this.#addToPool(particle);
|
|
6434
5755
|
return true;
|
|
6435
|
-
}
|
|
6436
|
-
#removeParticleFromBucket
|
|
5756
|
+
}
|
|
5757
|
+
#removeParticleFromBucket(particle) {
|
|
6437
5758
|
const bucketIndex = this.#particleBuckets.get(particle.id) ?? this.#getBucketIndex(particle.position.z), bucket = this.#zBuckets[bucketIndex];
|
|
6438
5759
|
if (!bucket) {
|
|
6439
5760
|
this.#particleBuckets.delete(particle.id);
|
|
6440
5761
|
return;
|
|
6441
5762
|
}
|
|
6442
|
-
const
|
|
6443
|
-
if (
|
|
6444
|
-
|
|
6445
|
-
return;
|
|
5763
|
+
const idx = bucket.findIndex(p => p.id === particle.id);
|
|
5764
|
+
if (idx >= minIndex) {
|
|
5765
|
+
bucket.splice(idx, deleteCount);
|
|
6446
5766
|
}
|
|
6447
|
-
bucket.splice(particleIndex, deleteCount);
|
|
6448
5767
|
this.#particleBuckets.delete(particle.id);
|
|
6449
|
-
}
|
|
6450
|
-
#resetBuckets
|
|
5768
|
+
}
|
|
5769
|
+
#resetBuckets(zLayers) {
|
|
6451
5770
|
const bucketCount = Math.max(Math.floor(zLayers), one);
|
|
6452
5771
|
if (this.#zBuckets.length !== bucketCount) {
|
|
6453
5772
|
this.#zBuckets = this.#createBuckets(bucketCount);
|
|
@@ -6456,8 +5775,8 @@
|
|
|
6456
5775
|
for (const bucket of this.#zBuckets) {
|
|
6457
5776
|
bucket.length = minIndex;
|
|
6458
5777
|
}
|
|
6459
|
-
}
|
|
6460
|
-
#updateParticleBucket
|
|
5778
|
+
}
|
|
5779
|
+
#updateParticleBucket(particle) {
|
|
6461
5780
|
const newBucketIndex = this.#getBucketIndex(particle.position.z), currentBucketIndex = this.#particleBuckets.get(particle.id);
|
|
6462
5781
|
if (currentBucketIndex === undefined) {
|
|
6463
5782
|
this.#insertParticleIntoBucket(particle);
|
|
@@ -6468,9 +5787,9 @@
|
|
|
6468
5787
|
}
|
|
6469
5788
|
const currentBucket = this.#zBuckets[currentBucketIndex];
|
|
6470
5789
|
if (currentBucket) {
|
|
6471
|
-
const
|
|
6472
|
-
if (
|
|
6473
|
-
currentBucket.splice(
|
|
5790
|
+
const idx = currentBucket.findIndex(p => p.id === particle.id);
|
|
5791
|
+
if (idx >= minIndex) {
|
|
5792
|
+
currentBucket.splice(idx, deleteCount);
|
|
6474
5793
|
}
|
|
6475
5794
|
}
|
|
6476
5795
|
const newBucket = this.#zBuckets[newBucketIndex];
|
|
@@ -6478,10 +5797,16 @@
|
|
|
6478
5797
|
this.#particleBuckets.set(particle.id, newBucketIndex);
|
|
6479
5798
|
return;
|
|
6480
5799
|
}
|
|
6481
|
-
newBucket.
|
|
5800
|
+
newBucket.push(particle);
|
|
5801
|
+
if (newBucket.length >= double) {
|
|
5802
|
+
const prev = newBucket[newBucket.length - double];
|
|
5803
|
+
if (prev && particle.id < prev.id) {
|
|
5804
|
+
newBucket.sort((a, b) => a.id - b.id);
|
|
5805
|
+
}
|
|
5806
|
+
}
|
|
6482
5807
|
this.#particleBuckets.set(particle.id, newBucketIndex);
|
|
6483
|
-
}
|
|
6484
|
-
#updateParticlesPhase1
|
|
5808
|
+
}
|
|
5809
|
+
#updateParticlesPhase1(delta) {
|
|
6485
5810
|
const particlesToDelete = new Set(), resizeFactor = this.#resizeFactor;
|
|
6486
5811
|
for (const particle of this.#array) {
|
|
6487
5812
|
if (resizeFactor && !particle.ignoresResizeRatio) {
|
|
@@ -6507,8 +5832,8 @@
|
|
|
6507
5832
|
this.grid.insert(particle);
|
|
6508
5833
|
}
|
|
6509
5834
|
return particlesToDelete;
|
|
6510
|
-
}
|
|
6511
|
-
#updateParticlesPhase2
|
|
5835
|
+
}
|
|
5836
|
+
#updateParticlesPhase2(delta, particlesToDelete) {
|
|
6512
5837
|
for (const particle of this.#array) {
|
|
6513
5838
|
if (particle.destroyed) {
|
|
6514
5839
|
particlesToDelete.add(particle);
|
|
@@ -6524,7 +5849,7 @@
|
|
|
6524
5849
|
}
|
|
6525
5850
|
this.#updateParticleBucket(particle);
|
|
6526
5851
|
}
|
|
6527
|
-
}
|
|
5852
|
+
}
|
|
6528
5853
|
}
|
|
6529
5854
|
|
|
6530
5855
|
class Retina {
|
|
@@ -6886,7 +6211,7 @@
|
|
|
6886
6211
|
}
|
|
6887
6212
|
return refresh;
|
|
6888
6213
|
}
|
|
6889
|
-
#nextFrame
|
|
6214
|
+
#nextFrame(timestamp) {
|
|
6890
6215
|
try {
|
|
6891
6216
|
if (!this.#smooth &&
|
|
6892
6217
|
this.#lastFrameTime !== undefined &&
|
|
@@ -6914,7 +6239,7 @@
|
|
|
6914
6239
|
catch (e) {
|
|
6915
6240
|
getLogger().error("error in animation loop", e);
|
|
6916
6241
|
}
|
|
6917
|
-
}
|
|
6242
|
+
}
|
|
6918
6243
|
}
|
|
6919
6244
|
|
|
6920
6245
|
var Container$1 = /*#__PURE__*/Object.freeze({
|
|
@@ -6960,7 +6285,7 @@
|
|
|
6960
6285
|
BlendPluginInstance: BlendPluginInstance
|
|
6961
6286
|
});
|
|
6962
6287
|
|
|
6963
|
-
const
|
|
6288
|
+
const moveSpeedFactor = 60, minSpinRadius = 0, spinFactor = 0.01, defaultPathDelay = 0, noDecay = 1;
|
|
6964
6289
|
function applyDistance(particle) {
|
|
6965
6290
|
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;
|
|
6966
6291
|
if (!hDistance && !vDistance) {
|
|
@@ -7352,7 +6677,7 @@
|
|
|
7352
6677
|
mediaQuery.addEventListener("change", handleChange);
|
|
7353
6678
|
await Promise.resolve();
|
|
7354
6679
|
}
|
|
7355
|
-
#handleMotionChange
|
|
6680
|
+
#handleMotionChange(mediaQuery) {
|
|
7356
6681
|
const container = this.#container, motion = container.actualOptions.motion;
|
|
7357
6682
|
if (!motion) {
|
|
7358
6683
|
return;
|
|
@@ -7368,7 +6693,7 @@
|
|
|
7368
6693
|
else {
|
|
7369
6694
|
container.retina.reduceFactor = defaultReduce;
|
|
7370
6695
|
}
|
|
7371
|
-
}
|
|
6696
|
+
}
|
|
7372
6697
|
}
|
|
7373
6698
|
|
|
7374
6699
|
var MotionPluginInstance$1 = /*#__PURE__*/Object.freeze({
|
|
@@ -7461,7 +6786,13 @@
|
|
|
7461
6786
|
this.#paused = !this.options.autoPlay;
|
|
7462
6787
|
this.#particlesOptions = particlesOptions;
|
|
7463
6788
|
this.#size = this.#calcSize();
|
|
7464
|
-
this.size =
|
|
6789
|
+
this.size =
|
|
6790
|
+
this.#size.mode === PixelMode.percent
|
|
6791
|
+
? {
|
|
6792
|
+
width: (this.#size.width / percentDenominator) * this.#container.canvas.size.width,
|
|
6793
|
+
height: (this.#size.height / percentDenominator) * this.#container.canvas.size.height,
|
|
6794
|
+
}
|
|
6795
|
+
: { width: this.#size.width, height: this.#size.height };
|
|
7465
6796
|
this.#lifeCount = this.options.life.count ?? defaultLifeCount;
|
|
7466
6797
|
this.#immortal = this.#lifeCount <= minLifeCount;
|
|
7467
6798
|
if (this.options.domId) {
|
|
@@ -7532,7 +6863,13 @@
|
|
|
7532
6863
|
? initialPosition
|
|
7533
6864
|
: this.#calcPosition();
|
|
7534
6865
|
this.#size = this.#calcSize();
|
|
7535
|
-
this.size =
|
|
6866
|
+
this.size =
|
|
6867
|
+
this.#size.mode === PixelMode.percent
|
|
6868
|
+
? {
|
|
6869
|
+
width: (this.#size.width / percentDenominator) * container.canvas.size.width,
|
|
6870
|
+
height: (this.#size.height / percentDenominator) * container.canvas.size.height,
|
|
6871
|
+
}
|
|
6872
|
+
: { width: this.#size.width, height: this.#size.height };
|
|
7536
6873
|
this.#shape?.resize(this.position, this.size);
|
|
7537
6874
|
}
|
|
7538
6875
|
update(delta) {
|
|
@@ -7632,7 +6969,7 @@
|
|
|
7632
6969
|
return size;
|
|
7633
6970
|
})());
|
|
7634
6971
|
}
|
|
7635
|
-
#destroy
|
|
6972
|
+
#destroy() {
|
|
7636
6973
|
this.#mutationObserver?.disconnect();
|
|
7637
6974
|
this.#mutationObserver = undefined;
|
|
7638
6975
|
this.#resizeObserver?.disconnect();
|
|
@@ -7641,7 +6978,7 @@
|
|
|
7641
6978
|
this.#container.dispatchEvent("emitterDestroyed", {
|
|
7642
6979
|
emitter: this,
|
|
7643
6980
|
});
|
|
7644
|
-
}
|
|
6981
|
+
}
|
|
7645
6982
|
#emit() {
|
|
7646
6983
|
if (this.#paused) {
|
|
7647
6984
|
return;
|
|
@@ -7701,7 +7038,7 @@
|
|
|
7701
7038
|
}
|
|
7702
7039
|
}
|
|
7703
7040
|
}
|
|
7704
|
-
#prepareToDie
|
|
7041
|
+
#prepareToDie() {
|
|
7705
7042
|
if (this.#paused) {
|
|
7706
7043
|
return;
|
|
7707
7044
|
}
|
|
@@ -7709,8 +7046,8 @@
|
|
|
7709
7046
|
if ((this.#lifeCount > minLifeCount || this.#immortal) && duration !== undefined && duration > minDuration) {
|
|
7710
7047
|
this.#duration = duration * millisecondsToSeconds;
|
|
7711
7048
|
}
|
|
7712
|
-
}
|
|
7713
|
-
#setColorAnimation
|
|
7049
|
+
}
|
|
7050
|
+
#setColorAnimation(animation, initValue, maxValue, factor = defaultColorAnimationFactor) {
|
|
7714
7051
|
const container = this.#container;
|
|
7715
7052
|
if (!animation.enable) {
|
|
7716
7053
|
return initValue;
|
|
@@ -7719,7 +7056,7 @@
|
|
|
7719
7056
|
? (delay * millisecondsToSeconds) / container.retina.reduceFactor
|
|
7720
7057
|
: Infinity, colorSpeed = getRangeValue(animation.speed);
|
|
7721
7058
|
return (initValue + (colorSpeed * container.fpsLimit) / emitFactor + colorOffset * factor) % maxValue;
|
|
7722
|
-
}
|
|
7059
|
+
}
|
|
7723
7060
|
}
|
|
7724
7061
|
|
|
7725
7062
|
var EmitterInstance$1 = /*#__PURE__*/Object.freeze({
|