@tsparticles/ribbons 4.1.3 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -4
- package/browser/RibbonsOptions.js +32 -50
- package/browser/ribbons.js +2 -2
- package/browser/ribbons.lazy.js +2 -2
- package/browser/utils.js +2 -2
- package/cjs/RibbonsOptions.js +32 -50
- package/cjs/ribbons.js +2 -2
- package/cjs/ribbons.lazy.js +2 -2
- package/cjs/utils.js +2 -2
- package/esm/RibbonsOptions.js +32 -50
- package/esm/ribbons.js +2 -2
- package/esm/ribbons.lazy.js +2 -2
- package/esm/utils.js +2 -2
- package/package.json +38 -9
- package/report.html +1 -1
- package/tsparticles.ribbons.bundle.js +1065 -1718
- package/tsparticles.ribbons.bundle.min.js +1 -1
- package/tsparticles.ribbons.js +36 -54
- package/tsparticles.ribbons.min.js +1 -1
- package/types/IRibbonsOptions.d.ts +1 -3
- package/types/RibbonsOptions.d.ts +3 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
(function(g){g.__tsParticlesInternals=g.__tsParticlesInternals||{};g.__tsParticlesInternals.bundles=g.__tsParticlesInternals.bundles||{};g.__tsParticlesInternals.effects=g.__tsParticlesInternals.effects||{};g.__tsParticlesInternals.engine=g.__tsParticlesInternals.engine||{};g.__tsParticlesInternals.interactions=g.__tsParticlesInternals.interactions||{};g.__tsParticlesInternals.palettes=g.__tsParticlesInternals.palettes||{};g.__tsParticlesInternals.paths=g.__tsParticlesInternals.paths||{};g.__tsParticlesInternals.plugins=g.__tsParticlesInternals.plugins||{};g.__tsParticlesInternals.plugins=g.__tsParticlesInternals.plugins||{};g.__tsParticlesInternals.plugins.emittersShapes=g.__tsParticlesInternals.plugins.emittersShapes||{};g.__tsParticlesInternals.presets=g.__tsParticlesInternals.presets||{};g.__tsParticlesInternals.shapes=g.__tsParticlesInternals.shapes||{};g.__tsParticlesInternals.updaters=g.__tsParticlesInternals.updaters||{};g.__tsParticlesInternals.utils=g.__tsParticlesInternals.utils||{};g.__tsParticlesInternals.canvas=g.__tsParticlesInternals.canvas||{};g.__tsParticlesInternals.canvas=g.__tsParticlesInternals.canvas||{};g.__tsParticlesInternals.canvas.utils=g.__tsParticlesInternals.canvas.utils||{};g.__tsParticlesInternals.path=g.__tsParticlesInternals.path||{};g.__tsParticlesInternals.path=g.__tsParticlesInternals.path||{};g.__tsParticlesInternals.path.utils=g.__tsParticlesInternals.path.utils||{};var __tsProxyFactory=typeof Proxy!=="undefined"?function(obj){return new Proxy(obj,{get:function(target,key){if(!(key in target)){target[key]={};}return target[key];}});}:function(obj){return obj;};g.__tsParticlesInternals.bundles=__tsProxyFactory(g.__tsParticlesInternals.bundles);g.__tsParticlesInternals.effects=__tsProxyFactory(g.__tsParticlesInternals.effects);g.__tsParticlesInternals.interactions=__tsProxyFactory(g.__tsParticlesInternals.interactions);g.__tsParticlesInternals.palettes=__tsProxyFactory(g.__tsParticlesInternals.palettes);g.__tsParticlesInternals.paths=__tsProxyFactory(g.__tsParticlesInternals.paths);g.__tsParticlesInternals.plugins=__tsProxyFactory(g.__tsParticlesInternals.plugins);g.__tsParticlesInternals.plugins.emittersShapes=__tsProxyFactory(g.__tsParticlesInternals.plugins.emittersShapes);g.__tsParticlesInternals.presets=__tsProxyFactory(g.__tsParticlesInternals.presets);g.__tsParticlesInternals.shapes=__tsProxyFactory(g.__tsParticlesInternals.shapes);g.__tsParticlesInternals.updaters=__tsProxyFactory(g.__tsParticlesInternals.updaters);g.__tsParticlesInternals.utils=__tsProxyFactory(g.__tsParticlesInternals.utils);g.__tsParticlesInternals.canvas=__tsProxyFactory(g.__tsParticlesInternals.canvas);g.__tsParticlesInternals.path=__tsProxyFactory(g.__tsParticlesInternals.path);g.tsparticlesInternalExports=g.tsparticlesInternalExports||{};})(typeof globalThis!=="undefined"?globalThis:typeof window!=="undefined"?window:this);
|
|
2
|
-
/* tsParticles v4.
|
|
2
|
+
/* tsParticles v4.2.0 */
|
|
3
3
|
(function (global, factory) {
|
|
4
4
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
5
5
|
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
b: 0,
|
|
16
16
|
c: 0,
|
|
17
17
|
d: 1,
|
|
18
|
-
}, randomColorValue = "random", midColorValue = "mid", double = 2, doublePI = Math.PI * double, defaultFps = 60, defaultAlpha$1 = 1, generatedTrue = "true", generatedFalse = "false", canvasTag = "canvas", defaultRetryCount = 0, squareExp = 2, spatialHashGridCellSize = 100, defaultRemoveQuantity = 1, defaultRatio = 1, defaultReduceFactor = 1, inverseFactorNumerator = 1, rgbMax = 255, hMax = 360, sMax = 100, lMax = 100, hMin = 0, sMin = 0, hPhase = 60, empty = 0, quarter = 0.25, threeQuarter = half$1 + quarter, minVelocity$
|
|
18
|
+
}, randomColorValue = "random", midColorValue = "mid", double = 2, doublePI = Math.PI * double, defaultFps = 60, defaultAlpha$1 = 1, generatedTrue = "true", generatedFalse = "false", canvasTag = "canvas", defaultRetryCount = 0, squareExp = 2, spatialHashGridCellSize = 100, defaultRemoveQuantity = 1, defaultRatio = 1, defaultReduceFactor = 1, inverseFactorNumerator = 1, rgbMax = 255, hMax = 360, sMax = 100, lMax = 100, hMin = 0, sMin = 0, hPhase = 60, empty = 0, quarter = 0.25, threeQuarter = half$1 + quarter, minVelocity = 0, minDistance = 0, minRadius$2 = 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, lengthOffset = 1, defaultDensityFactor = 1, deleteCount = 1, defaultAngle$1 = 0, identity$2 = 1, minStrokeWidth = 0, lFactor = 1, lMin = 0, maxNits = 400, triple = 3, sextuple = 6, sNormalizedOffset = 1, phaseNumerator = 1, defaultRgbMin = 0, defaultVelocity = 0, defaultLoops = 0, defaultTime = 0, defaultZoom = 1;
|
|
19
19
|
|
|
20
20
|
exports.MoveDirection = void 0;
|
|
21
21
|
(function (MoveDirection) {
|
|
@@ -82,11 +82,6 @@
|
|
|
82
82
|
div(n) {
|
|
83
83
|
return Vector3d.create(this.x / n, this.y / n, this.z / n);
|
|
84
84
|
}
|
|
85
|
-
divTo(n) {
|
|
86
|
-
this.x /= n;
|
|
87
|
-
this.y /= n;
|
|
88
|
-
this.z /= n;
|
|
89
|
-
}
|
|
90
85
|
getLengthSq() {
|
|
91
86
|
return this.x ** squareExp + this.y ** squareExp;
|
|
92
87
|
}
|
|
@@ -176,6 +171,9 @@
|
|
|
176
171
|
function setRandom(rnd = Math.random) {
|
|
177
172
|
_random = rnd;
|
|
178
173
|
}
|
|
174
|
+
function getRandomFn() {
|
|
175
|
+
return _random;
|
|
176
|
+
}
|
|
179
177
|
function getRandom() {
|
|
180
178
|
const min = 0, max = 1;
|
|
181
179
|
return clamp(_random(), min, max - Number.EPSILON);
|
|
@@ -311,13 +309,6 @@
|
|
|
311
309
|
y: position?.y ?? getRandom() * size.height,
|
|
312
310
|
};
|
|
313
311
|
}
|
|
314
|
-
function calcExactPositionOrRandomFromSizeRanged(data) {
|
|
315
|
-
const position = {
|
|
316
|
-
x: data.position?.x !== undefined ? getRangeValue(data.position.x) : undefined,
|
|
317
|
-
y: data.position?.y !== undefined ? getRangeValue(data.position.y) : undefined,
|
|
318
|
-
};
|
|
319
|
-
return calcExactPositionOrRandomFromSize({ size: data.size, position });
|
|
320
|
-
}
|
|
321
312
|
function parseAlpha(input) {
|
|
322
313
|
const defaultAlpha = 1;
|
|
323
314
|
if (!input) {
|
|
@@ -326,27 +317,6 @@
|
|
|
326
317
|
return input.endsWith("%") ? parseFloat(input) / percentDenominator : parseFloat(input);
|
|
327
318
|
}
|
|
328
319
|
|
|
329
|
-
exports.AnimationMode = void 0;
|
|
330
|
-
(function (AnimationMode) {
|
|
331
|
-
AnimationMode["auto"] = "auto";
|
|
332
|
-
AnimationMode["increase"] = "increase";
|
|
333
|
-
AnimationMode["decrease"] = "decrease";
|
|
334
|
-
AnimationMode["random"] = "random";
|
|
335
|
-
})(exports.AnimationMode || (exports.AnimationMode = {}));
|
|
336
|
-
|
|
337
|
-
exports.AnimationStatus = void 0;
|
|
338
|
-
(function (AnimationStatus) {
|
|
339
|
-
AnimationStatus["increasing"] = "increasing";
|
|
340
|
-
AnimationStatus["decreasing"] = "decreasing";
|
|
341
|
-
})(exports.AnimationStatus || (exports.AnimationStatus = {}));
|
|
342
|
-
|
|
343
|
-
exports.DestroyType = void 0;
|
|
344
|
-
(function (DestroyType) {
|
|
345
|
-
DestroyType["none"] = "none";
|
|
346
|
-
DestroyType["max"] = "max";
|
|
347
|
-
DestroyType["min"] = "min";
|
|
348
|
-
})(exports.DestroyType || (exports.DestroyType = {}));
|
|
349
|
-
|
|
350
320
|
exports.OutModeDirection = void 0;
|
|
351
321
|
(function (OutModeDirection) {
|
|
352
322
|
OutModeDirection["bottom"] = "bottom";
|
|
@@ -361,80 +331,7 @@
|
|
|
361
331
|
PixelMode["percent"] = "percent";
|
|
362
332
|
})(exports.PixelMode || (exports.PixelMode = {}));
|
|
363
333
|
|
|
364
|
-
|
|
365
|
-
(function (StartValueType) {
|
|
366
|
-
StartValueType["max"] = "max";
|
|
367
|
-
StartValueType["min"] = "min";
|
|
368
|
-
StartValueType["random"] = "random";
|
|
369
|
-
})(exports.StartValueType || (exports.StartValueType = {}));
|
|
370
|
-
|
|
371
|
-
const minRadius$1 = 0, minMemoizeSize = 0;
|
|
372
|
-
function memoize(fn, options) {
|
|
373
|
-
const cache = new Map(), maxSize = options?.maxSize, ttlMs = options?.ttlMs, keyFn = options?.keyFn, stableStringify = (obj, seen = new WeakSet()) => {
|
|
374
|
-
if (obj === null) {
|
|
375
|
-
return "null";
|
|
376
|
-
}
|
|
377
|
-
const t = typeof obj;
|
|
378
|
-
if (t === "undefined") {
|
|
379
|
-
return "undefined";
|
|
380
|
-
}
|
|
381
|
-
if (t === "number" || t === "boolean" || t === "string") {
|
|
382
|
-
return JSON.stringify(obj);
|
|
383
|
-
}
|
|
384
|
-
if (t === "function") {
|
|
385
|
-
try {
|
|
386
|
-
const fn = obj;
|
|
387
|
-
return fn.toString();
|
|
388
|
-
}
|
|
389
|
-
catch {
|
|
390
|
-
return '"[Function]"';
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
if (t === "symbol") {
|
|
394
|
-
try {
|
|
395
|
-
return obj.toString();
|
|
396
|
-
}
|
|
397
|
-
catch {
|
|
398
|
-
return '"[Symbol]"';
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
if (Array.isArray(obj)) {
|
|
402
|
-
return `[${obj.map(i => stableStringify(i, seen)).join(",")}]`;
|
|
403
|
-
}
|
|
404
|
-
if (seen.has(obj)) {
|
|
405
|
-
return '"[Circular]"';
|
|
406
|
-
}
|
|
407
|
-
seen.add(obj);
|
|
408
|
-
const keys = Object.keys(obj).sort();
|
|
409
|
-
return `{${keys.map(k => `${JSON.stringify(k)}:${stableStringify(obj[k], seen)}`).join(",")}}`;
|
|
410
|
-
}, defaultKeyer = (args) => stableStringify(args), makeKey = (args) => (keyFn ? keyFn(args) : defaultKeyer(args)), ensureBounds = () => {
|
|
411
|
-
if (typeof maxSize === "number" && maxSize >= minMemoizeSize) {
|
|
412
|
-
while (cache.size > maxSize) {
|
|
413
|
-
const firstKey = cache.keys().next().value;
|
|
414
|
-
if (firstKey === undefined)
|
|
415
|
-
break;
|
|
416
|
-
cache.delete(firstKey);
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
};
|
|
420
|
-
return (...args) => {
|
|
421
|
-
const key = makeKey(args), now = Date.now(), entry = cache.get(key);
|
|
422
|
-
if (entry !== undefined) {
|
|
423
|
-
if (ttlMs && now - entry.ts > ttlMs) {
|
|
424
|
-
cache.delete(key);
|
|
425
|
-
}
|
|
426
|
-
else {
|
|
427
|
-
cache.delete(key);
|
|
428
|
-
cache.set(key, { value: entry.value, ts: entry.ts });
|
|
429
|
-
return entry.value;
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
const result = fn(...args);
|
|
433
|
-
cache.set(key, { value: result, ts: now });
|
|
434
|
-
ensureBounds();
|
|
435
|
-
return result;
|
|
436
|
-
};
|
|
437
|
-
}
|
|
334
|
+
const minRadius$1 = 0;
|
|
438
335
|
function hasMatchMedia() {
|
|
439
336
|
return typeof matchMedia !== "undefined";
|
|
440
337
|
}
|
|
@@ -447,12 +344,6 @@
|
|
|
447
344
|
}
|
|
448
345
|
return matchMedia(query);
|
|
449
346
|
}
|
|
450
|
-
function safeIntersectionObserver(callback) {
|
|
451
|
-
if (typeof IntersectionObserver === "undefined") {
|
|
452
|
-
return;
|
|
453
|
-
}
|
|
454
|
-
return new IntersectionObserver(callback);
|
|
455
|
-
}
|
|
456
347
|
function safeMutationObserver(callback) {
|
|
457
348
|
if (typeof MutationObserver === "undefined") {
|
|
458
349
|
return;
|
|
@@ -462,11 +353,8 @@
|
|
|
462
353
|
function isInArray(value, array) {
|
|
463
354
|
return value === array || (isArray(array) && array.includes(value));
|
|
464
355
|
}
|
|
465
|
-
function arrayRandomIndex(array) {
|
|
466
|
-
return Math.floor(getRandom() * array.length);
|
|
467
|
-
}
|
|
468
356
|
function itemFromArray(array, index, useIndex = true) {
|
|
469
|
-
return array[index !== undefined && useIndex ? index % array.length :
|
|
357
|
+
return array[index !== undefined && useIndex ? index % array.length : Math.floor(getRandom() * array.length)];
|
|
470
358
|
}
|
|
471
359
|
function isPointInside(point, size, offset, radius, direction) {
|
|
472
360
|
return areBoundsInside(calculateBounds(point, radius ?? minRadius$1), size, offset, direction);
|
|
@@ -570,63 +458,6 @@
|
|
|
570
458
|
function itemFromSingleOrMultiple(obj, index, useIndex) {
|
|
571
459
|
return isArray(obj) ? itemFromArray(obj, index, useIndex) : obj;
|
|
572
460
|
}
|
|
573
|
-
function findItemFromSingleOrMultiple(obj, callback) {
|
|
574
|
-
if (isArray(obj)) {
|
|
575
|
-
return obj.find((t, index) => callback(t, index));
|
|
576
|
-
}
|
|
577
|
-
const defaultIndex = 0;
|
|
578
|
-
return callback(obj, defaultIndex) ? obj : undefined;
|
|
579
|
-
}
|
|
580
|
-
function initParticleNumericAnimationValue(options, pxRatio) {
|
|
581
|
-
const valueRange = options.value, animationOptions = options.animation, res = {
|
|
582
|
-
delayTime: getRangeValue(animationOptions.delay) * millisecondsToSeconds$1,
|
|
583
|
-
enable: animationOptions.enable,
|
|
584
|
-
value: getRangeValue(options.value) * pxRatio,
|
|
585
|
-
max: getRangeMax(valueRange) * pxRatio,
|
|
586
|
-
min: getRangeMin(valueRange) * pxRatio,
|
|
587
|
-
loops: 0,
|
|
588
|
-
maxLoops: getRangeValue(animationOptions.count),
|
|
589
|
-
time: 0,
|
|
590
|
-
}, decayOffset = 1;
|
|
591
|
-
if (animationOptions.enable) {
|
|
592
|
-
res.decay = decayOffset - getRangeValue(animationOptions.decay);
|
|
593
|
-
switch (animationOptions.mode) {
|
|
594
|
-
case exports.AnimationMode.increase:
|
|
595
|
-
res.status = exports.AnimationStatus.increasing;
|
|
596
|
-
break;
|
|
597
|
-
case exports.AnimationMode.decrease:
|
|
598
|
-
res.status = exports.AnimationStatus.decreasing;
|
|
599
|
-
break;
|
|
600
|
-
case exports.AnimationMode.random:
|
|
601
|
-
res.status = getRandom() >= half$1 ? exports.AnimationStatus.increasing : exports.AnimationStatus.decreasing;
|
|
602
|
-
break;
|
|
603
|
-
}
|
|
604
|
-
const autoStatus = animationOptions.mode === exports.AnimationMode.auto;
|
|
605
|
-
switch (animationOptions.startValue) {
|
|
606
|
-
case exports.StartValueType.min:
|
|
607
|
-
res.value = res.min;
|
|
608
|
-
if (autoStatus) {
|
|
609
|
-
res.status = exports.AnimationStatus.increasing;
|
|
610
|
-
}
|
|
611
|
-
break;
|
|
612
|
-
case exports.StartValueType.max:
|
|
613
|
-
res.value = res.max;
|
|
614
|
-
if (autoStatus) {
|
|
615
|
-
res.status = exports.AnimationStatus.decreasing;
|
|
616
|
-
}
|
|
617
|
-
break;
|
|
618
|
-
case exports.StartValueType.random:
|
|
619
|
-
default:
|
|
620
|
-
res.value = randomInRangeValue(res);
|
|
621
|
-
if (autoStatus) {
|
|
622
|
-
res.status = getRandom() >= half$1 ? exports.AnimationStatus.increasing : exports.AnimationStatus.decreasing;
|
|
623
|
-
}
|
|
624
|
-
break;
|
|
625
|
-
}
|
|
626
|
-
}
|
|
627
|
-
res.initialValue = res.value;
|
|
628
|
-
return res;
|
|
629
|
-
}
|
|
630
461
|
function getPositionOrSize(positionOrSize, canvasSize) {
|
|
631
462
|
const isPercent = positionOrSize.mode === exports.PixelMode.percent;
|
|
632
463
|
if (!isPercent) {
|
|
@@ -650,80 +481,6 @@
|
|
|
650
481
|
function getPosition(position, canvasSize) {
|
|
651
482
|
return getPositionOrSize(position, canvasSize);
|
|
652
483
|
}
|
|
653
|
-
function getSize(size, canvasSize) {
|
|
654
|
-
return getPositionOrSize(size, canvasSize);
|
|
655
|
-
}
|
|
656
|
-
function checkDestroy(particle, destroyType, value, minValue, maxValue) {
|
|
657
|
-
switch (destroyType) {
|
|
658
|
-
case exports.DestroyType.max:
|
|
659
|
-
if (value >= maxValue) {
|
|
660
|
-
particle.destroy();
|
|
661
|
-
}
|
|
662
|
-
break;
|
|
663
|
-
case exports.DestroyType.min:
|
|
664
|
-
if (value <= minValue) {
|
|
665
|
-
particle.destroy();
|
|
666
|
-
}
|
|
667
|
-
break;
|
|
668
|
-
}
|
|
669
|
-
}
|
|
670
|
-
function updateAnimation(particle, data, changeDirection, destroyType, delta) {
|
|
671
|
-
const minLoops = 0, minDelay = 0, identity = 1, minVelocity = 0, minDecay = 1;
|
|
672
|
-
if (particle.destroyed ||
|
|
673
|
-
!data.enable ||
|
|
674
|
-
((data.maxLoops ?? minLoops) > minLoops && (data.loops ?? minLoops) > (data.maxLoops ?? minLoops))) {
|
|
675
|
-
return;
|
|
676
|
-
}
|
|
677
|
-
const velocity = (data.velocity ?? minVelocity) * delta.factor, minValue = data.min, maxValue = data.max, decay = data.decay ?? minDecay;
|
|
678
|
-
data.time ??= 0;
|
|
679
|
-
if ((data.delayTime ?? minDelay) > minDelay && data.time < (data.delayTime ?? minDelay)) {
|
|
680
|
-
data.time += delta.value;
|
|
681
|
-
}
|
|
682
|
-
if ((data.delayTime ?? minDelay) > minDelay && data.time < (data.delayTime ?? minDelay)) {
|
|
683
|
-
return;
|
|
684
|
-
}
|
|
685
|
-
switch (data.status) {
|
|
686
|
-
case exports.AnimationStatus.increasing:
|
|
687
|
-
data.value += velocity;
|
|
688
|
-
break;
|
|
689
|
-
case exports.AnimationStatus.decreasing:
|
|
690
|
-
data.value -= velocity;
|
|
691
|
-
break;
|
|
692
|
-
}
|
|
693
|
-
if (data.velocity && decay !== identity) {
|
|
694
|
-
data.velocity *= decay;
|
|
695
|
-
}
|
|
696
|
-
switch (data.status) {
|
|
697
|
-
case exports.AnimationStatus.increasing:
|
|
698
|
-
if (data.value >= maxValue) {
|
|
699
|
-
if (changeDirection) {
|
|
700
|
-
data.status = exports.AnimationStatus.decreasing;
|
|
701
|
-
}
|
|
702
|
-
else {
|
|
703
|
-
data.value -= maxValue;
|
|
704
|
-
}
|
|
705
|
-
data.loops ??= minLoops;
|
|
706
|
-
data.loops++;
|
|
707
|
-
}
|
|
708
|
-
break;
|
|
709
|
-
case exports.AnimationStatus.decreasing:
|
|
710
|
-
if (data.value <= minValue) {
|
|
711
|
-
if (changeDirection) {
|
|
712
|
-
data.status = exports.AnimationStatus.increasing;
|
|
713
|
-
}
|
|
714
|
-
else {
|
|
715
|
-
data.value += maxValue;
|
|
716
|
-
}
|
|
717
|
-
data.loops ??= minLoops;
|
|
718
|
-
data.loops++;
|
|
719
|
-
}
|
|
720
|
-
break;
|
|
721
|
-
}
|
|
722
|
-
checkDestroy(particle, destroyType, data.value, minValue, maxValue);
|
|
723
|
-
if (!particle.destroyed) {
|
|
724
|
-
data.value = clamp(data.value, minValue, maxValue);
|
|
725
|
-
}
|
|
726
|
-
}
|
|
727
484
|
function cloneStyle(style) {
|
|
728
485
|
const clonedStyle = safeDocument().createElement("div").style;
|
|
729
486
|
for (const key in style) {
|
|
@@ -745,30 +502,34 @@
|
|
|
745
502
|
}
|
|
746
503
|
return clonedStyle;
|
|
747
504
|
}
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
505
|
+
let _cachedZIndex, _cachedStyle;
|
|
506
|
+
function getFullScreenStyle(zIndex) {
|
|
507
|
+
if (_cachedZIndex !== zIndex || !_cachedStyle) {
|
|
508
|
+
_cachedZIndex = zIndex;
|
|
509
|
+
const fullScreenStyle = safeDocument().createElement("div").style, radix = 10, style = {
|
|
510
|
+
width: "100%",
|
|
511
|
+
height: "100%",
|
|
512
|
+
margin: "0",
|
|
513
|
+
padding: "0",
|
|
514
|
+
borderWidth: "0",
|
|
515
|
+
position: "fixed",
|
|
516
|
+
zIndex: zIndex.toString(radix),
|
|
517
|
+
"z-index": zIndex.toString(radix),
|
|
518
|
+
top: "0",
|
|
519
|
+
left: "0",
|
|
520
|
+
"pointer-events": "none",
|
|
521
|
+
};
|
|
522
|
+
for (const key in style) {
|
|
523
|
+
const value = style[key];
|
|
524
|
+
if (value === undefined) {
|
|
525
|
+
continue;
|
|
526
|
+
}
|
|
527
|
+
fullScreenStyle.setProperty(key, value);
|
|
766
528
|
}
|
|
767
|
-
fullScreenStyle
|
|
529
|
+
_cachedStyle = fullScreenStyle;
|
|
768
530
|
}
|
|
769
|
-
return
|
|
531
|
+
return _cachedStyle;
|
|
770
532
|
}
|
|
771
|
-
const getFullScreenStyle = memoize(computeFullScreenStyle);
|
|
772
533
|
function manageListener(element, event, handler, add, options) {
|
|
773
534
|
if (add) {
|
|
774
535
|
let addOptions = { passive: true };
|
|
@@ -1118,7 +879,7 @@
|
|
|
1118
879
|
return this.#domArray;
|
|
1119
880
|
}
|
|
1120
881
|
get version() {
|
|
1121
|
-
return "4.
|
|
882
|
+
return "4.2.0";
|
|
1122
883
|
}
|
|
1123
884
|
addEventListener(type, listener) {
|
|
1124
885
|
this.#eventDispatcher.addEventListener(type, listener);
|
|
@@ -1288,6 +1049,14 @@
|
|
|
1288
1049
|
RotateDirection["random"] = "random";
|
|
1289
1050
|
})(exports.RotateDirection || (exports.RotateDirection = {}));
|
|
1290
1051
|
|
|
1052
|
+
exports.AnimationMode = void 0;
|
|
1053
|
+
(function (AnimationMode) {
|
|
1054
|
+
AnimationMode["auto"] = "auto";
|
|
1055
|
+
AnimationMode["increase"] = "increase";
|
|
1056
|
+
AnimationMode["decrease"] = "decrease";
|
|
1057
|
+
AnimationMode["random"] = "random";
|
|
1058
|
+
})(exports.AnimationMode || (exports.AnimationMode = {}));
|
|
1059
|
+
|
|
1291
1060
|
exports.LimitMode = void 0;
|
|
1292
1061
|
(function (LimitMode) {
|
|
1293
1062
|
LimitMode["delete"] = "delete";
|
|
@@ -1309,6 +1078,13 @@
|
|
|
1309
1078
|
AlterType["enlighten"] = "enlighten";
|
|
1310
1079
|
})(exports.AlterType || (exports.AlterType = {}));
|
|
1311
1080
|
|
|
1081
|
+
exports.DestroyType = void 0;
|
|
1082
|
+
(function (DestroyType) {
|
|
1083
|
+
DestroyType["none"] = "none";
|
|
1084
|
+
DestroyType["max"] = "max";
|
|
1085
|
+
DestroyType["min"] = "min";
|
|
1086
|
+
})(exports.DestroyType || (exports.DestroyType = {}));
|
|
1087
|
+
|
|
1312
1088
|
exports.GradientType = void 0;
|
|
1313
1089
|
(function (GradientType) {
|
|
1314
1090
|
GradientType["linear"] = "linear";
|
|
@@ -1323,160 +1099,126 @@
|
|
|
1323
1099
|
ParticleOutType["outside"] = "outside";
|
|
1324
1100
|
})(exports.ParticleOutType || (exports.ParticleOutType = {}));
|
|
1325
1101
|
|
|
1326
|
-
exports.
|
|
1327
|
-
(function (
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
EasingType["easeInSine"] = "ease-in-sine";
|
|
1341
|
-
EasingType["easeInSmoothstep"] = "ease-in-smoothstep";
|
|
1342
|
-
EasingType["easeOutBack"] = "ease-out-back";
|
|
1343
|
-
EasingType["easeOutBounce"] = "ease-out-bounce";
|
|
1344
|
-
EasingType["easeOutCirc"] = "ease-out-circ";
|
|
1345
|
-
EasingType["easeOutCubic"] = "ease-out-cubic";
|
|
1346
|
-
EasingType["easeOutElastic"] = "ease-out-elastic";
|
|
1347
|
-
EasingType["easeOutExpo"] = "ease-out-expo";
|
|
1348
|
-
EasingType["easeOutGaussian"] = "ease-out-gaussian";
|
|
1349
|
-
EasingType["easeOutLinear"] = "ease-out-linear";
|
|
1350
|
-
EasingType["easeOutQuad"] = "ease-out-quad";
|
|
1351
|
-
EasingType["easeOutQuart"] = "ease-out-quart";
|
|
1352
|
-
EasingType["easeOutQuint"] = "ease-out-quint";
|
|
1353
|
-
EasingType["easeOutSigmoid"] = "ease-out-sigmoid";
|
|
1354
|
-
EasingType["easeOutSine"] = "ease-out-sine";
|
|
1355
|
-
EasingType["easeOutSmoothstep"] = "ease-out-smoothstep";
|
|
1356
|
-
EasingType["easeInOutBack"] = "ease-in-out-back";
|
|
1357
|
-
EasingType["easeInOutBounce"] = "ease-in-out-bounce";
|
|
1358
|
-
EasingType["easeInOutCirc"] = "ease-in-out-circ";
|
|
1359
|
-
EasingType["easeInOutCubic"] = "ease-in-out-cubic";
|
|
1360
|
-
EasingType["easeInOutElastic"] = "ease-in-out-elastic";
|
|
1361
|
-
EasingType["easeInOutExpo"] = "ease-in-out-expo";
|
|
1362
|
-
EasingType["easeInOutGaussian"] = "ease-in-out-gaussian";
|
|
1363
|
-
EasingType["easeInOutLinear"] = "ease-in-out-linear";
|
|
1364
|
-
EasingType["easeInOutQuad"] = "ease-in-out-quad";
|
|
1365
|
-
EasingType["easeInOutQuart"] = "ease-in-out-quart";
|
|
1366
|
-
EasingType["easeInOutQuint"] = "ease-in-out-quint";
|
|
1367
|
-
EasingType["easeInOutSigmoid"] = "ease-in-out-sigmoid";
|
|
1368
|
-
EasingType["easeInOutSine"] = "ease-in-out-sine";
|
|
1369
|
-
EasingType["easeInOutSmoothstep"] = "ease-in-out-smoothstep";
|
|
1370
|
-
})(exports.EasingType || (exports.EasingType = {}));
|
|
1371
|
-
|
|
1372
|
-
class AnimationOptions {
|
|
1373
|
-
count;
|
|
1374
|
-
decay;
|
|
1375
|
-
delay;
|
|
1376
|
-
enable;
|
|
1377
|
-
speed;
|
|
1378
|
-
sync;
|
|
1379
|
-
constructor() {
|
|
1380
|
-
this.count = 0;
|
|
1381
|
-
this.enable = false;
|
|
1382
|
-
this.speed = 1;
|
|
1383
|
-
this.decay = 0;
|
|
1384
|
-
this.delay = 0;
|
|
1385
|
-
this.sync = false;
|
|
1386
|
-
}
|
|
1102
|
+
exports.StartValueType = void 0;
|
|
1103
|
+
(function (StartValueType) {
|
|
1104
|
+
StartValueType["max"] = "max";
|
|
1105
|
+
StartValueType["min"] = "min";
|
|
1106
|
+
StartValueType["random"] = "random";
|
|
1107
|
+
})(exports.StartValueType || (exports.StartValueType = {}));
|
|
1108
|
+
|
|
1109
|
+
exports.AnimationStatus = void 0;
|
|
1110
|
+
(function (AnimationStatus) {
|
|
1111
|
+
AnimationStatus["increasing"] = "increasing";
|
|
1112
|
+
AnimationStatus["decreasing"] = "decreasing";
|
|
1113
|
+
})(exports.AnimationStatus || (exports.AnimationStatus = {}));
|
|
1114
|
+
|
|
1115
|
+
class OptionLoader {
|
|
1387
1116
|
load(data) {
|
|
1388
1117
|
if (isNull(data)) {
|
|
1389
1118
|
return;
|
|
1390
1119
|
}
|
|
1391
|
-
|
|
1392
|
-
this.count = setRangeValue(data.count);
|
|
1393
|
-
}
|
|
1394
|
-
if (data.enable !== undefined) {
|
|
1395
|
-
this.enable = data.enable;
|
|
1396
|
-
}
|
|
1397
|
-
if (data.speed !== undefined) {
|
|
1398
|
-
this.speed = setRangeValue(data.speed);
|
|
1399
|
-
}
|
|
1400
|
-
if (data.decay !== undefined) {
|
|
1401
|
-
this.decay = setRangeValue(data.decay);
|
|
1402
|
-
}
|
|
1403
|
-
if (data.delay !== undefined) {
|
|
1404
|
-
this.delay = setRangeValue(data.delay);
|
|
1405
|
-
}
|
|
1406
|
-
if (data.sync !== undefined) {
|
|
1407
|
-
this.sync = data.sync;
|
|
1408
|
-
}
|
|
1120
|
+
this.doLoad(data);
|
|
1409
1121
|
}
|
|
1410
1122
|
}
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
constructor() {
|
|
1415
|
-
super();
|
|
1416
|
-
this.mode = exports.AnimationMode.auto;
|
|
1417
|
-
this.startValue = exports.StartValueType.random;
|
|
1418
|
-
}
|
|
1419
|
-
load(data) {
|
|
1420
|
-
super.load(data);
|
|
1421
|
-
if (isNull(data)) {
|
|
1422
|
-
return;
|
|
1423
|
-
}
|
|
1424
|
-
if (data.mode !== undefined) {
|
|
1425
|
-
this.mode = data.mode;
|
|
1426
|
-
}
|
|
1427
|
-
if (data.startValue !== undefined) {
|
|
1428
|
-
this.startValue = data.startValue;
|
|
1429
|
-
}
|
|
1123
|
+
function loadOptions(options, ...sourceOptionsArr) {
|
|
1124
|
+
for (const sourceOptions of sourceOptionsArr) {
|
|
1125
|
+
options.load(sourceOptions);
|
|
1430
1126
|
}
|
|
1431
1127
|
}
|
|
1432
1128
|
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
offset;
|
|
1437
|
-
constructor(min, max) {
|
|
1438
|
-
super();
|
|
1439
|
-
this.min = min;
|
|
1440
|
-
this.max = max;
|
|
1441
|
-
this.offset = 0;
|
|
1442
|
-
this.sync = true;
|
|
1129
|
+
function loadProperty(obj, key, value) {
|
|
1130
|
+
if (value !== undefined) {
|
|
1131
|
+
obj[key] = value;
|
|
1443
1132
|
}
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1133
|
+
}
|
|
1134
|
+
function loadRangeProperty(obj, key, value) {
|
|
1135
|
+
if (value !== undefined) {
|
|
1136
|
+
obj[key] = setRangeValue(value);
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
function loadNestedProperty(obj, key, value) {
|
|
1140
|
+
if (value !== undefined) {
|
|
1141
|
+
obj[key].load(value);
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
1144
|
+
function loadLazyProperty(obj, key, value, factory) {
|
|
1145
|
+
if (value !== undefined) {
|
|
1146
|
+
const objRecord = obj;
|
|
1147
|
+
objRecord[key] ??= factory();
|
|
1148
|
+
objRecord[key].load(value);
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1151
|
+
function loadExtendProperty(obj, key, value) {
|
|
1152
|
+
if (value !== undefined) {
|
|
1153
|
+
obj[key] = deepExtend(obj[key] ?? {}, value);
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
function loadOptionProperty(obj, key, optionClass, ...sources) {
|
|
1157
|
+
const objRecord = obj;
|
|
1158
|
+
objRecord[key] ??= new optionClass();
|
|
1159
|
+
const target = objRecord[key];
|
|
1160
|
+
for (const source of sources) {
|
|
1161
|
+
target.load(source?.[key]);
|
|
1162
|
+
}
|
|
1163
|
+
}
|
|
1164
|
+
|
|
1165
|
+
class AnimationOptions extends OptionLoader {
|
|
1166
|
+
count = 0;
|
|
1167
|
+
decay = 0;
|
|
1168
|
+
delay = 0;
|
|
1169
|
+
enable = false;
|
|
1170
|
+
speed = 1;
|
|
1171
|
+
sync = false;
|
|
1172
|
+
doLoad(data) {
|
|
1173
|
+
loadRangeProperty(this, "count", data.count);
|
|
1174
|
+
loadProperty(this, "enable", data.enable);
|
|
1175
|
+
loadRangeProperty(this, "speed", data.speed);
|
|
1176
|
+
loadRangeProperty(this, "decay", data.decay);
|
|
1177
|
+
loadRangeProperty(this, "delay", data.delay);
|
|
1178
|
+
loadProperty(this, "sync", data.sync);
|
|
1179
|
+
}
|
|
1180
|
+
}
|
|
1181
|
+
class RangedAnimationOptions extends AnimationOptions {
|
|
1182
|
+
mode = exports.AnimationMode.auto;
|
|
1183
|
+
startValue = exports.StartValueType.random;
|
|
1184
|
+
doLoad(data) {
|
|
1185
|
+
super.doLoad(data);
|
|
1186
|
+
loadProperty(this, "mode", data.mode);
|
|
1187
|
+
loadProperty(this, "startValue", data.startValue);
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
|
|
1191
|
+
class ColorAnimation extends AnimationOptions {
|
|
1192
|
+
max;
|
|
1193
|
+
min;
|
|
1194
|
+
offset = 0;
|
|
1195
|
+
sync = true;
|
|
1196
|
+
constructor(min, max) {
|
|
1197
|
+
super();
|
|
1198
|
+
this.min = min;
|
|
1199
|
+
this.max = max;
|
|
1200
|
+
}
|
|
1201
|
+
doLoad(data) {
|
|
1202
|
+
super.doLoad(data);
|
|
1203
|
+
loadProperty(this, "max", data.max);
|
|
1204
|
+
loadProperty(this, "min", data.min);
|
|
1205
|
+
loadRangeProperty(this, "offset", data.offset);
|
|
1458
1206
|
}
|
|
1459
1207
|
}
|
|
1460
1208
|
|
|
1461
|
-
class HslAnimation {
|
|
1209
|
+
class HslAnimation extends OptionLoader {
|
|
1462
1210
|
h = new ColorAnimation(hMin, hMax);
|
|
1463
1211
|
l = new ColorAnimation(lMin, lMax);
|
|
1464
1212
|
s = new ColorAnimation(sMin, sMax);
|
|
1465
|
-
|
|
1466
|
-
if (isNull(data)) {
|
|
1467
|
-
return;
|
|
1468
|
-
}
|
|
1213
|
+
doLoad(data) {
|
|
1469
1214
|
this.h.load(data.h);
|
|
1470
1215
|
this.s.load(data.s);
|
|
1471
1216
|
this.l.load(data.l);
|
|
1472
1217
|
}
|
|
1473
1218
|
}
|
|
1474
1219
|
|
|
1475
|
-
class OptionsColor {
|
|
1476
|
-
value;
|
|
1477
|
-
constructor() {
|
|
1478
|
-
this.value = "";
|
|
1479
|
-
}
|
|
1220
|
+
class OptionsColor extends OptionLoader {
|
|
1221
|
+
value = "";
|
|
1480
1222
|
static create(source, data) {
|
|
1481
1223
|
const color = new OptionsColor();
|
|
1482
1224
|
color.load(source);
|
|
@@ -1490,10 +1232,7 @@
|
|
|
1490
1232
|
}
|
|
1491
1233
|
return color;
|
|
1492
1234
|
}
|
|
1493
|
-
|
|
1494
|
-
if (isNull(data)) {
|
|
1495
|
-
return;
|
|
1496
|
-
}
|
|
1235
|
+
doLoad(data) {
|
|
1497
1236
|
if (!isNull(data.value)) {
|
|
1498
1237
|
this.value = data.value;
|
|
1499
1238
|
}
|
|
@@ -1501,11 +1240,7 @@
|
|
|
1501
1240
|
}
|
|
1502
1241
|
|
|
1503
1242
|
class AnimatableColor extends OptionsColor {
|
|
1504
|
-
animation;
|
|
1505
|
-
constructor() {
|
|
1506
|
-
super();
|
|
1507
|
-
this.animation = new HslAnimation();
|
|
1508
|
-
}
|
|
1243
|
+
animation = new HslAnimation();
|
|
1509
1244
|
static create(source, data) {
|
|
1510
1245
|
const color = new AnimatableColor();
|
|
1511
1246
|
color.load(source);
|
|
@@ -1519,11 +1254,8 @@
|
|
|
1519
1254
|
}
|
|
1520
1255
|
return color;
|
|
1521
1256
|
}
|
|
1522
|
-
|
|
1523
|
-
super.
|
|
1524
|
-
if (isNull(data)) {
|
|
1525
|
-
return;
|
|
1526
|
-
}
|
|
1257
|
+
doLoad(data) {
|
|
1258
|
+
super.doLoad(data);
|
|
1527
1259
|
const colorAnimation = data.animation;
|
|
1528
1260
|
if (colorAnimation !== undefined) {
|
|
1529
1261
|
if (colorAnimation.enable === undefined) {
|
|
@@ -1536,100 +1268,53 @@
|
|
|
1536
1268
|
}
|
|
1537
1269
|
}
|
|
1538
1270
|
|
|
1539
|
-
class Background {
|
|
1271
|
+
class Background extends OptionLoader {
|
|
1540
1272
|
color;
|
|
1541
|
-
image;
|
|
1542
|
-
opacity;
|
|
1543
|
-
position;
|
|
1544
|
-
repeat;
|
|
1545
|
-
size;
|
|
1273
|
+
image = "";
|
|
1274
|
+
opacity = 1;
|
|
1275
|
+
position = "";
|
|
1276
|
+
repeat = "";
|
|
1277
|
+
size = "";
|
|
1546
1278
|
constructor() {
|
|
1279
|
+
super();
|
|
1547
1280
|
this.color = new OptionsColor();
|
|
1548
1281
|
this.color.value = "";
|
|
1549
|
-
this.image = "";
|
|
1550
|
-
this.position = "";
|
|
1551
|
-
this.repeat = "";
|
|
1552
|
-
this.size = "";
|
|
1553
|
-
this.opacity = 1;
|
|
1554
1282
|
}
|
|
1555
|
-
|
|
1556
|
-
if (isNull(data)) {
|
|
1557
|
-
return;
|
|
1558
|
-
}
|
|
1283
|
+
doLoad(data) {
|
|
1559
1284
|
if (data.color !== undefined) {
|
|
1560
1285
|
this.color = OptionsColor.create(this.color, data.color);
|
|
1561
1286
|
}
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
}
|
|
1568
|
-
if (data.repeat !== undefined) {
|
|
1569
|
-
this.repeat = data.repeat;
|
|
1570
|
-
}
|
|
1571
|
-
if (data.size !== undefined) {
|
|
1572
|
-
this.size = data.size;
|
|
1573
|
-
}
|
|
1574
|
-
if (data.opacity !== undefined) {
|
|
1575
|
-
this.opacity = data.opacity;
|
|
1576
|
-
}
|
|
1287
|
+
loadProperty(this, "image", data.image);
|
|
1288
|
+
loadProperty(this, "position", data.position);
|
|
1289
|
+
loadProperty(this, "repeat", data.repeat);
|
|
1290
|
+
loadProperty(this, "size", data.size);
|
|
1291
|
+
loadProperty(this, "opacity", data.opacity);
|
|
1577
1292
|
}
|
|
1578
1293
|
}
|
|
1579
1294
|
|
|
1580
|
-
class FullScreen {
|
|
1581
|
-
enable;
|
|
1582
|
-
zIndex;
|
|
1583
|
-
|
|
1584
|
-
this.enable
|
|
1585
|
-
this.zIndex
|
|
1586
|
-
}
|
|
1587
|
-
load(data) {
|
|
1588
|
-
if (isNull(data)) {
|
|
1589
|
-
return;
|
|
1590
|
-
}
|
|
1591
|
-
if (data.enable !== undefined) {
|
|
1592
|
-
this.enable = data.enable;
|
|
1593
|
-
}
|
|
1594
|
-
if (data.zIndex !== undefined) {
|
|
1595
|
-
this.zIndex = data.zIndex;
|
|
1596
|
-
}
|
|
1295
|
+
class FullScreen extends OptionLoader {
|
|
1296
|
+
enable = true;
|
|
1297
|
+
zIndex = 0;
|
|
1298
|
+
doLoad(data) {
|
|
1299
|
+
loadProperty(this, "enable", data.enable);
|
|
1300
|
+
loadProperty(this, "zIndex", data.zIndex);
|
|
1597
1301
|
}
|
|
1598
1302
|
}
|
|
1599
1303
|
|
|
1600
|
-
class ResizeEvent {
|
|
1601
|
-
delay;
|
|
1602
|
-
enable;
|
|
1603
|
-
|
|
1604
|
-
this
|
|
1605
|
-
this.enable
|
|
1606
|
-
}
|
|
1607
|
-
load(data) {
|
|
1608
|
-
if (isNull(data)) {
|
|
1609
|
-
return;
|
|
1610
|
-
}
|
|
1611
|
-
if (data.delay !== undefined) {
|
|
1612
|
-
this.delay = data.delay;
|
|
1613
|
-
}
|
|
1614
|
-
if (data.enable !== undefined) {
|
|
1615
|
-
this.enable = data.enable;
|
|
1616
|
-
}
|
|
1304
|
+
class ResizeEvent extends OptionLoader {
|
|
1305
|
+
delay = 0.5;
|
|
1306
|
+
enable = true;
|
|
1307
|
+
doLoad(data) {
|
|
1308
|
+
loadProperty(this, "delay", data.delay);
|
|
1309
|
+
loadProperty(this, "enable", data.enable);
|
|
1617
1310
|
}
|
|
1618
1311
|
}
|
|
1619
1312
|
|
|
1620
|
-
class Effect {
|
|
1621
|
-
close;
|
|
1622
|
-
options;
|
|
1623
|
-
type;
|
|
1624
|
-
|
|
1625
|
-
this.close = true;
|
|
1626
|
-
this.options = {};
|
|
1627
|
-
this.type = [];
|
|
1628
|
-
}
|
|
1629
|
-
load(data) {
|
|
1630
|
-
if (isNull(data)) {
|
|
1631
|
-
return;
|
|
1632
|
-
}
|
|
1313
|
+
class Effect extends OptionLoader {
|
|
1314
|
+
close = true;
|
|
1315
|
+
options = {};
|
|
1316
|
+
type = [];
|
|
1317
|
+
doLoad(data) {
|
|
1633
1318
|
const options = data.options;
|
|
1634
1319
|
if (options !== undefined) {
|
|
1635
1320
|
for (const effect in options) {
|
|
@@ -1639,128 +1324,62 @@
|
|
|
1639
1324
|
}
|
|
1640
1325
|
}
|
|
1641
1326
|
}
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
}
|
|
1645
|
-
if (data.type !== undefined) {
|
|
1646
|
-
this.type = data.type;
|
|
1647
|
-
}
|
|
1327
|
+
loadProperty(this, "close", data.close);
|
|
1328
|
+
loadProperty(this, "type", data.type);
|
|
1648
1329
|
}
|
|
1649
1330
|
}
|
|
1650
1331
|
|
|
1651
|
-
class Fill {
|
|
1332
|
+
class Fill extends OptionLoader {
|
|
1652
1333
|
color;
|
|
1653
|
-
enable;
|
|
1654
|
-
opacity;
|
|
1655
|
-
|
|
1656
|
-
this.enable = true;
|
|
1657
|
-
this.opacity = 1;
|
|
1658
|
-
}
|
|
1659
|
-
load(data) {
|
|
1660
|
-
if (isNull(data)) {
|
|
1661
|
-
return;
|
|
1662
|
-
}
|
|
1334
|
+
enable = true;
|
|
1335
|
+
opacity = 1;
|
|
1336
|
+
doLoad(data) {
|
|
1663
1337
|
if (data.color !== undefined) {
|
|
1664
1338
|
this.color = AnimatableColor.create(this.color, data.color);
|
|
1665
1339
|
}
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
}
|
|
1669
|
-
if (data.opacity !== undefined) {
|
|
1670
|
-
this.opacity = setRangeValue(data.opacity);
|
|
1671
|
-
}
|
|
1340
|
+
loadProperty(this, "enable", data.enable);
|
|
1341
|
+
loadRangeProperty(this, "opacity", data.opacity);
|
|
1672
1342
|
}
|
|
1673
1343
|
}
|
|
1674
1344
|
|
|
1675
|
-
class MoveAngle {
|
|
1676
|
-
offset;
|
|
1677
|
-
value;
|
|
1678
|
-
|
|
1679
|
-
this.offset
|
|
1680
|
-
this.value
|
|
1681
|
-
}
|
|
1682
|
-
load(data) {
|
|
1683
|
-
if (isNull(data)) {
|
|
1684
|
-
return;
|
|
1685
|
-
}
|
|
1686
|
-
if (data.offset !== undefined) {
|
|
1687
|
-
this.offset = setRangeValue(data.offset);
|
|
1688
|
-
}
|
|
1689
|
-
if (data.value !== undefined) {
|
|
1690
|
-
this.value = setRangeValue(data.value);
|
|
1691
|
-
}
|
|
1345
|
+
class MoveAngle extends OptionLoader {
|
|
1346
|
+
offset = 0;
|
|
1347
|
+
value = 90;
|
|
1348
|
+
doLoad(data) {
|
|
1349
|
+
loadRangeProperty(this, "offset", data.offset);
|
|
1350
|
+
loadRangeProperty(this, "value", data.value);
|
|
1692
1351
|
}
|
|
1693
1352
|
}
|
|
1694
1353
|
|
|
1695
|
-
class MoveCenter {
|
|
1696
|
-
mode;
|
|
1697
|
-
radius;
|
|
1698
|
-
x;
|
|
1699
|
-
y;
|
|
1700
|
-
|
|
1701
|
-
this.x
|
|
1702
|
-
this.y
|
|
1703
|
-
this
|
|
1704
|
-
this.radius
|
|
1705
|
-
}
|
|
1706
|
-
load(data) {
|
|
1707
|
-
if (isNull(data)) {
|
|
1708
|
-
return;
|
|
1709
|
-
}
|
|
1710
|
-
if (data.x !== undefined) {
|
|
1711
|
-
this.x = data.x;
|
|
1712
|
-
}
|
|
1713
|
-
if (data.y !== undefined) {
|
|
1714
|
-
this.y = data.y;
|
|
1715
|
-
}
|
|
1716
|
-
if (data.mode !== undefined) {
|
|
1717
|
-
this.mode = data.mode;
|
|
1718
|
-
}
|
|
1719
|
-
if (data.radius !== undefined) {
|
|
1720
|
-
this.radius = data.radius;
|
|
1721
|
-
}
|
|
1354
|
+
class MoveCenter extends OptionLoader {
|
|
1355
|
+
mode = exports.PixelMode.percent;
|
|
1356
|
+
radius = 0;
|
|
1357
|
+
x = 50;
|
|
1358
|
+
y = 50;
|
|
1359
|
+
doLoad(data) {
|
|
1360
|
+
loadProperty(this, "x", data.x);
|
|
1361
|
+
loadProperty(this, "y", data.y);
|
|
1362
|
+
loadProperty(this, "mode", data.mode);
|
|
1363
|
+
loadProperty(this, "radius", data.radius);
|
|
1722
1364
|
}
|
|
1723
1365
|
}
|
|
1724
1366
|
|
|
1725
|
-
class MoveGravity {
|
|
1726
|
-
acceleration;
|
|
1727
|
-
enable;
|
|
1728
|
-
inverse;
|
|
1729
|
-
maxSpeed;
|
|
1730
|
-
|
|
1731
|
-
this
|
|
1732
|
-
this.enable
|
|
1733
|
-
this.inverse
|
|
1734
|
-
this.maxSpeed
|
|
1735
|
-
}
|
|
1736
|
-
load(data) {
|
|
1737
|
-
if (isNull(data)) {
|
|
1738
|
-
return;
|
|
1739
|
-
}
|
|
1740
|
-
if (data.acceleration !== undefined) {
|
|
1741
|
-
this.acceleration = setRangeValue(data.acceleration);
|
|
1742
|
-
}
|
|
1743
|
-
if (data.enable !== undefined) {
|
|
1744
|
-
this.enable = data.enable;
|
|
1745
|
-
}
|
|
1746
|
-
if (data.inverse !== undefined) {
|
|
1747
|
-
this.inverse = data.inverse;
|
|
1748
|
-
}
|
|
1749
|
-
if (data.maxSpeed !== undefined) {
|
|
1750
|
-
this.maxSpeed = setRangeValue(data.maxSpeed);
|
|
1751
|
-
}
|
|
1367
|
+
class MoveGravity extends OptionLoader {
|
|
1368
|
+
acceleration = 9.81;
|
|
1369
|
+
enable = false;
|
|
1370
|
+
inverse = false;
|
|
1371
|
+
maxSpeed = 50;
|
|
1372
|
+
doLoad(data) {
|
|
1373
|
+
loadRangeProperty(this, "acceleration", data.acceleration);
|
|
1374
|
+
loadProperty(this, "enable", data.enable);
|
|
1375
|
+
loadProperty(this, "inverse", data.inverse);
|
|
1376
|
+
loadRangeProperty(this, "maxSpeed", data.maxSpeed);
|
|
1752
1377
|
}
|
|
1753
1378
|
}
|
|
1754
1379
|
|
|
1755
|
-
class ValueWithRandom {
|
|
1756
|
-
value;
|
|
1757
|
-
|
|
1758
|
-
this.value = 0;
|
|
1759
|
-
}
|
|
1760
|
-
load(data) {
|
|
1761
|
-
if (isNull(data)) {
|
|
1762
|
-
return;
|
|
1763
|
-
}
|
|
1380
|
+
class ValueWithRandom extends OptionLoader {
|
|
1381
|
+
value = 0;
|
|
1382
|
+
doLoad(data) {
|
|
1764
1383
|
if (!isNull(data.value)) {
|
|
1765
1384
|
this.value = setRangeValue(data.value);
|
|
1766
1385
|
}
|
|
@@ -1768,51 +1387,25 @@
|
|
|
1768
1387
|
}
|
|
1769
1388
|
class AnimationValueWithRandom extends ValueWithRandom {
|
|
1770
1389
|
animation = new AnimationOptions();
|
|
1771
|
-
|
|
1772
|
-
super.
|
|
1773
|
-
|
|
1774
|
-
return;
|
|
1775
|
-
}
|
|
1776
|
-
const animation = data.animation;
|
|
1777
|
-
if (animation !== undefined) {
|
|
1778
|
-
this.animation.load(animation);
|
|
1779
|
-
}
|
|
1390
|
+
doLoad(data) {
|
|
1391
|
+
super.doLoad(data);
|
|
1392
|
+
loadNestedProperty(this, "animation", data.animation);
|
|
1780
1393
|
}
|
|
1781
1394
|
}
|
|
1782
1395
|
class RangedAnimationValueWithRandom extends AnimationValueWithRandom {
|
|
1783
|
-
animation;
|
|
1784
|
-
constructor() {
|
|
1785
|
-
super();
|
|
1786
|
-
this.animation = new RangedAnimationOptions();
|
|
1787
|
-
}
|
|
1788
|
-
load(data) {
|
|
1789
|
-
super.load(data);
|
|
1790
|
-
}
|
|
1396
|
+
animation = new RangedAnimationOptions();
|
|
1791
1397
|
}
|
|
1792
1398
|
|
|
1793
|
-
class MovePath {
|
|
1794
|
-
clamp;
|
|
1795
|
-
delay;
|
|
1796
|
-
enable;
|
|
1399
|
+
class MovePath extends OptionLoader {
|
|
1400
|
+
clamp = true;
|
|
1401
|
+
delay = new ValueWithRandom();
|
|
1402
|
+
enable = false;
|
|
1797
1403
|
generator;
|
|
1798
|
-
options;
|
|
1799
|
-
|
|
1800
|
-
this.clamp
|
|
1801
|
-
this.delay = new ValueWithRandom();
|
|
1802
|
-
this.enable = false;
|
|
1803
|
-
this.options = {};
|
|
1804
|
-
}
|
|
1805
|
-
load(data) {
|
|
1806
|
-
if (isNull(data)) {
|
|
1807
|
-
return;
|
|
1808
|
-
}
|
|
1809
|
-
if (data.clamp !== undefined) {
|
|
1810
|
-
this.clamp = data.clamp;
|
|
1811
|
-
}
|
|
1404
|
+
options = {};
|
|
1405
|
+
doLoad(data) {
|
|
1406
|
+
loadProperty(this, "clamp", data.clamp);
|
|
1812
1407
|
this.delay.load(data.delay);
|
|
1813
|
-
|
|
1814
|
-
this.enable = data.enable;
|
|
1815
|
-
}
|
|
1408
|
+
loadProperty(this, "enable", data.enable);
|
|
1816
1409
|
this.generator = data.generator;
|
|
1817
1410
|
if (data.options) {
|
|
1818
1411
|
this.options = deepExtend(this.options, data.options);
|
|
@@ -1820,19 +1413,13 @@
|
|
|
1820
1413
|
}
|
|
1821
1414
|
}
|
|
1822
1415
|
|
|
1823
|
-
class OutModes {
|
|
1416
|
+
class OutModes extends OptionLoader {
|
|
1824
1417
|
bottom;
|
|
1825
|
-
default;
|
|
1418
|
+
default = exports.OutMode.out;
|
|
1826
1419
|
left;
|
|
1827
1420
|
right;
|
|
1828
1421
|
top;
|
|
1829
|
-
|
|
1830
|
-
this.default = exports.OutMode.out;
|
|
1831
|
-
}
|
|
1832
|
-
load(data) {
|
|
1833
|
-
if (isNull(data)) {
|
|
1834
|
-
return;
|
|
1835
|
-
}
|
|
1422
|
+
doLoad(data) {
|
|
1836
1423
|
if (data.default !== undefined) {
|
|
1837
1424
|
this.default = data.default;
|
|
1838
1425
|
}
|
|
@@ -1843,79 +1430,42 @@
|
|
|
1843
1430
|
}
|
|
1844
1431
|
}
|
|
1845
1432
|
|
|
1846
|
-
class Spin {
|
|
1847
|
-
acceleration;
|
|
1848
|
-
enable;
|
|
1433
|
+
class Spin extends OptionLoader {
|
|
1434
|
+
acceleration = 0;
|
|
1435
|
+
enable = false;
|
|
1849
1436
|
position;
|
|
1850
|
-
|
|
1851
|
-
this.acceleration
|
|
1852
|
-
this.enable
|
|
1853
|
-
}
|
|
1854
|
-
load(data) {
|
|
1855
|
-
if (isNull(data)) {
|
|
1856
|
-
return;
|
|
1857
|
-
}
|
|
1858
|
-
if (data.acceleration !== undefined) {
|
|
1859
|
-
this.acceleration = setRangeValue(data.acceleration);
|
|
1860
|
-
}
|
|
1861
|
-
if (data.enable !== undefined) {
|
|
1862
|
-
this.enable = data.enable;
|
|
1863
|
-
}
|
|
1437
|
+
doLoad(data) {
|
|
1438
|
+
loadRangeProperty(this, "acceleration", data.acceleration);
|
|
1439
|
+
loadProperty(this, "enable", data.enable);
|
|
1864
1440
|
if (data.position) {
|
|
1865
1441
|
this.position = deepExtend({}, data.position);
|
|
1866
1442
|
}
|
|
1867
1443
|
}
|
|
1868
1444
|
}
|
|
1869
1445
|
|
|
1870
|
-
class Move {
|
|
1871
|
-
angle;
|
|
1872
|
-
center;
|
|
1873
|
-
decay;
|
|
1874
|
-
direction;
|
|
1875
|
-
distance;
|
|
1876
|
-
drift;
|
|
1877
|
-
enable;
|
|
1878
|
-
gravity;
|
|
1879
|
-
outModes;
|
|
1880
|
-
path;
|
|
1881
|
-
random;
|
|
1882
|
-
size;
|
|
1883
|
-
speed;
|
|
1884
|
-
spin;
|
|
1885
|
-
straight;
|
|
1886
|
-
vibrate;
|
|
1887
|
-
warp;
|
|
1888
|
-
|
|
1889
|
-
this.angle = new MoveAngle();
|
|
1890
|
-
this.center = new MoveCenter();
|
|
1891
|
-
this.decay = 0;
|
|
1892
|
-
this.distance = {};
|
|
1893
|
-
this.direction = exports.MoveDirection.none;
|
|
1894
|
-
this.drift = 0;
|
|
1895
|
-
this.enable = false;
|
|
1896
|
-
this.gravity = new MoveGravity();
|
|
1897
|
-
this.path = new MovePath();
|
|
1898
|
-
this.outModes = new OutModes();
|
|
1899
|
-
this.random = false;
|
|
1900
|
-
this.size = false;
|
|
1901
|
-
this.speed = 2;
|
|
1902
|
-
this.spin = new Spin();
|
|
1903
|
-
this.straight = false;
|
|
1904
|
-
this.vibrate = false;
|
|
1905
|
-
this.warp = false;
|
|
1906
|
-
}
|
|
1907
|
-
load(data) {
|
|
1908
|
-
if (isNull(data)) {
|
|
1909
|
-
return;
|
|
1910
|
-
}
|
|
1446
|
+
class Move extends OptionLoader {
|
|
1447
|
+
angle = new MoveAngle();
|
|
1448
|
+
center = new MoveCenter();
|
|
1449
|
+
decay = 0;
|
|
1450
|
+
direction = exports.MoveDirection.none;
|
|
1451
|
+
distance = {};
|
|
1452
|
+
drift = 0;
|
|
1453
|
+
enable = false;
|
|
1454
|
+
gravity = new MoveGravity();
|
|
1455
|
+
outModes = new OutModes();
|
|
1456
|
+
path = new MovePath();
|
|
1457
|
+
random = false;
|
|
1458
|
+
size = false;
|
|
1459
|
+
speed = 2;
|
|
1460
|
+
spin = new Spin();
|
|
1461
|
+
straight = false;
|
|
1462
|
+
vibrate = false;
|
|
1463
|
+
warp = false;
|
|
1464
|
+
doLoad(data) {
|
|
1911
1465
|
this.angle.load(isNumber(data.angle) ? { value: data.angle } : data.angle);
|
|
1912
1466
|
this.center.load(data.center);
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
}
|
|
1916
|
-
if (data.direction !== undefined) {
|
|
1917
|
-
this.direction = data.direction;
|
|
1918
|
-
}
|
|
1467
|
+
loadRangeProperty(this, "decay", data.decay);
|
|
1468
|
+
loadProperty(this, "direction", data.direction);
|
|
1919
1469
|
if (data.distance !== undefined) {
|
|
1920
1470
|
this.distance = isNumber(data.distance)
|
|
1921
1471
|
? {
|
|
@@ -1924,12 +1474,8 @@
|
|
|
1924
1474
|
}
|
|
1925
1475
|
: { ...data.distance };
|
|
1926
1476
|
}
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
}
|
|
1930
|
-
if (data.enable !== undefined) {
|
|
1931
|
-
this.enable = data.enable;
|
|
1932
|
-
}
|
|
1477
|
+
loadRangeProperty(this, "drift", data.drift);
|
|
1478
|
+
loadProperty(this, "enable", data.enable);
|
|
1933
1479
|
this.gravity.load(data.gravity);
|
|
1934
1480
|
const outModes = data.outModes;
|
|
1935
1481
|
if (outModes !== undefined) {
|
|
@@ -1943,177 +1489,91 @@
|
|
|
1943
1489
|
}
|
|
1944
1490
|
}
|
|
1945
1491
|
this.path.load(data.path);
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
if (data.size !== undefined) {
|
|
1950
|
-
this.size = data.size;
|
|
1951
|
-
}
|
|
1952
|
-
if (data.speed !== undefined) {
|
|
1953
|
-
this.speed = setRangeValue(data.speed);
|
|
1954
|
-
}
|
|
1492
|
+
loadProperty(this, "random", data.random);
|
|
1493
|
+
loadProperty(this, "size", data.size);
|
|
1494
|
+
loadRangeProperty(this, "speed", data.speed);
|
|
1955
1495
|
this.spin.load(data.spin);
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
if (data.vibrate !== undefined) {
|
|
1960
|
-
this.vibrate = data.vibrate;
|
|
1961
|
-
}
|
|
1962
|
-
if (data.warp !== undefined) {
|
|
1963
|
-
this.warp = data.warp;
|
|
1964
|
-
}
|
|
1496
|
+
loadProperty(this, "straight", data.straight);
|
|
1497
|
+
loadProperty(this, "vibrate", data.vibrate);
|
|
1498
|
+
loadProperty(this, "warp", data.warp);
|
|
1965
1499
|
}
|
|
1966
1500
|
}
|
|
1967
1501
|
|
|
1968
|
-
class Stroke {
|
|
1502
|
+
class Stroke extends OptionLoader {
|
|
1969
1503
|
color;
|
|
1970
1504
|
opacity;
|
|
1971
|
-
width;
|
|
1972
|
-
|
|
1973
|
-
this.width = 0;
|
|
1974
|
-
}
|
|
1975
|
-
load(data) {
|
|
1976
|
-
if (isNull(data)) {
|
|
1977
|
-
return;
|
|
1978
|
-
}
|
|
1505
|
+
width = 0;
|
|
1506
|
+
doLoad(data) {
|
|
1979
1507
|
if (data.color !== undefined) {
|
|
1980
1508
|
this.color = AnimatableColor.create(this.color, data.color);
|
|
1981
1509
|
}
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
}
|
|
1985
|
-
if (data.opacity !== undefined) {
|
|
1986
|
-
this.opacity = setRangeValue(data.opacity);
|
|
1987
|
-
}
|
|
1510
|
+
loadRangeProperty(this, "width", data.width);
|
|
1511
|
+
loadRangeProperty(this, "opacity", data.opacity);
|
|
1988
1512
|
}
|
|
1989
1513
|
}
|
|
1990
1514
|
|
|
1991
|
-
class Paint {
|
|
1515
|
+
class Paint extends OptionLoader {
|
|
1992
1516
|
color;
|
|
1993
1517
|
fill;
|
|
1994
1518
|
stroke;
|
|
1995
|
-
|
|
1996
|
-
if (isNull(data)) {
|
|
1997
|
-
return;
|
|
1998
|
-
}
|
|
1519
|
+
doLoad(data) {
|
|
1999
1520
|
if (data.color !== undefined) {
|
|
2000
1521
|
this.color = AnimatableColor.create(this.color, data.color);
|
|
2001
1522
|
}
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
this.fill.load(data.fill);
|
|
2005
|
-
}
|
|
2006
|
-
if (data.stroke !== undefined) {
|
|
2007
|
-
this.stroke ??= new Stroke();
|
|
2008
|
-
this.stroke.load(data.stroke);
|
|
2009
|
-
}
|
|
1523
|
+
loadLazyProperty(this, "fill", data.fill, () => new Fill());
|
|
1524
|
+
loadLazyProperty(this, "stroke", data.stroke, () => new Stroke());
|
|
2010
1525
|
}
|
|
2011
1526
|
}
|
|
2012
1527
|
|
|
2013
1528
|
class ParticlesBounceFactor extends ValueWithRandom {
|
|
2014
|
-
|
|
2015
|
-
super();
|
|
2016
|
-
this.value = 1;
|
|
2017
|
-
}
|
|
1529
|
+
value = 1;
|
|
2018
1530
|
}
|
|
2019
1531
|
|
|
2020
|
-
class ParticlesBounce {
|
|
2021
|
-
horizontal;
|
|
2022
|
-
vertical;
|
|
2023
|
-
|
|
2024
|
-
this.horizontal = new ParticlesBounceFactor();
|
|
2025
|
-
this.vertical = new ParticlesBounceFactor();
|
|
2026
|
-
}
|
|
2027
|
-
load(data) {
|
|
2028
|
-
if (isNull(data)) {
|
|
2029
|
-
return;
|
|
2030
|
-
}
|
|
1532
|
+
class ParticlesBounce extends OptionLoader {
|
|
1533
|
+
horizontal = new ParticlesBounceFactor();
|
|
1534
|
+
vertical = new ParticlesBounceFactor();
|
|
1535
|
+
doLoad(data) {
|
|
2031
1536
|
this.horizontal.load(data.horizontal);
|
|
2032
1537
|
this.vertical.load(data.vertical);
|
|
2033
1538
|
}
|
|
2034
1539
|
}
|
|
2035
1540
|
|
|
2036
|
-
class ParticlesDensity {
|
|
2037
|
-
enable;
|
|
2038
|
-
height;
|
|
2039
|
-
width;
|
|
2040
|
-
|
|
2041
|
-
this.enable
|
|
2042
|
-
this.width
|
|
2043
|
-
this.height
|
|
2044
|
-
}
|
|
2045
|
-
load(data) {
|
|
2046
|
-
if (isNull(data)) {
|
|
2047
|
-
return;
|
|
2048
|
-
}
|
|
2049
|
-
if (data.enable !== undefined) {
|
|
2050
|
-
this.enable = data.enable;
|
|
2051
|
-
}
|
|
2052
|
-
const width = data.width;
|
|
2053
|
-
if (width !== undefined) {
|
|
2054
|
-
this.width = width;
|
|
2055
|
-
}
|
|
2056
|
-
const height = data.height;
|
|
2057
|
-
if (height !== undefined) {
|
|
2058
|
-
this.height = height;
|
|
2059
|
-
}
|
|
1541
|
+
class ParticlesDensity extends OptionLoader {
|
|
1542
|
+
enable = false;
|
|
1543
|
+
height = 1080;
|
|
1544
|
+
width = 1920;
|
|
1545
|
+
doLoad(data) {
|
|
1546
|
+
loadProperty(this, "enable", data.enable);
|
|
1547
|
+
loadProperty(this, "width", data.width);
|
|
1548
|
+
loadProperty(this, "height", data.height);
|
|
2060
1549
|
}
|
|
2061
1550
|
}
|
|
2062
1551
|
|
|
2063
|
-
class ParticlesNumberLimit {
|
|
2064
|
-
mode;
|
|
2065
|
-
value;
|
|
2066
|
-
|
|
2067
|
-
this
|
|
2068
|
-
this.value
|
|
2069
|
-
}
|
|
2070
|
-
load(data) {
|
|
2071
|
-
if (isNull(data)) {
|
|
2072
|
-
return;
|
|
2073
|
-
}
|
|
2074
|
-
if (data.mode !== undefined) {
|
|
2075
|
-
this.mode = data.mode;
|
|
2076
|
-
}
|
|
2077
|
-
if (data.value !== undefined) {
|
|
2078
|
-
this.value = data.value;
|
|
2079
|
-
}
|
|
1552
|
+
class ParticlesNumberLimit extends OptionLoader {
|
|
1553
|
+
mode = exports.LimitMode.delete;
|
|
1554
|
+
value = 0;
|
|
1555
|
+
doLoad(data) {
|
|
1556
|
+
loadProperty(this, "mode", data.mode);
|
|
1557
|
+
loadProperty(this, "value", data.value);
|
|
2080
1558
|
}
|
|
2081
1559
|
}
|
|
2082
1560
|
|
|
2083
|
-
class ParticlesNumber {
|
|
2084
|
-
density;
|
|
2085
|
-
limit;
|
|
2086
|
-
value;
|
|
2087
|
-
|
|
2088
|
-
this.density = new ParticlesDensity();
|
|
2089
|
-
this.limit = new ParticlesNumberLimit();
|
|
2090
|
-
this.value = 0;
|
|
2091
|
-
}
|
|
2092
|
-
load(data) {
|
|
2093
|
-
if (isNull(data)) {
|
|
2094
|
-
return;
|
|
2095
|
-
}
|
|
1561
|
+
class ParticlesNumber extends OptionLoader {
|
|
1562
|
+
density = new ParticlesDensity();
|
|
1563
|
+
limit = new ParticlesNumberLimit();
|
|
1564
|
+
value = 0;
|
|
1565
|
+
doLoad(data) {
|
|
2096
1566
|
this.density.load(data.density);
|
|
2097
1567
|
this.limit.load(data.limit);
|
|
2098
|
-
|
|
2099
|
-
this.value = data.value;
|
|
2100
|
-
}
|
|
1568
|
+
loadProperty(this, "value", data.value);
|
|
2101
1569
|
}
|
|
2102
1570
|
}
|
|
2103
1571
|
|
|
2104
|
-
class Shape {
|
|
2105
|
-
close;
|
|
2106
|
-
options;
|
|
2107
|
-
type;
|
|
2108
|
-
|
|
2109
|
-
this.close = true;
|
|
2110
|
-
this.options = {};
|
|
2111
|
-
this.type = "circle";
|
|
2112
|
-
}
|
|
2113
|
-
load(data) {
|
|
2114
|
-
if (isNull(data)) {
|
|
2115
|
-
return;
|
|
2116
|
-
}
|
|
1572
|
+
class Shape extends OptionLoader {
|
|
1573
|
+
close = true;
|
|
1574
|
+
options = {};
|
|
1575
|
+
type = "circle";
|
|
1576
|
+
doLoad(data) {
|
|
2117
1577
|
const options = data.options;
|
|
2118
1578
|
if (options !== undefined) {
|
|
2119
1579
|
for (const shape in options) {
|
|
@@ -2123,76 +1583,47 @@
|
|
|
2123
1583
|
}
|
|
2124
1584
|
}
|
|
2125
1585
|
}
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
}
|
|
2129
|
-
if (data.type !== undefined) {
|
|
2130
|
-
this.type = data.type;
|
|
2131
|
-
}
|
|
1586
|
+
loadProperty(this, "close", data.close);
|
|
1587
|
+
loadProperty(this, "type", data.type);
|
|
2132
1588
|
}
|
|
2133
1589
|
}
|
|
2134
1590
|
|
|
2135
1591
|
class ZIndex extends ValueWithRandom {
|
|
2136
|
-
opacityRate;
|
|
2137
|
-
sizeRate;
|
|
2138
|
-
velocityRate;
|
|
2139
|
-
|
|
2140
|
-
super();
|
|
2141
|
-
this.opacityRate
|
|
2142
|
-
this.sizeRate
|
|
2143
|
-
this.velocityRate
|
|
2144
|
-
}
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
if (data.sizeRate !== undefined) {
|
|
2154
|
-
this.sizeRate = data.sizeRate;
|
|
2155
|
-
}
|
|
2156
|
-
if (data.velocityRate !== undefined) {
|
|
2157
|
-
this.velocityRate = data.velocityRate;
|
|
2158
|
-
}
|
|
2159
|
-
}
|
|
2160
|
-
}
|
|
2161
|
-
|
|
2162
|
-
class ParticlesOptions {
|
|
2163
|
-
bounce;
|
|
2164
|
-
effect;
|
|
2165
|
-
groups;
|
|
2166
|
-
move;
|
|
2167
|
-
number;
|
|
1592
|
+
opacityRate = 1;
|
|
1593
|
+
sizeRate = 1;
|
|
1594
|
+
velocityRate = 1;
|
|
1595
|
+
doLoad(data) {
|
|
1596
|
+
super.doLoad(data);
|
|
1597
|
+
loadProperty(this, "opacityRate", data.opacityRate);
|
|
1598
|
+
loadProperty(this, "sizeRate", data.sizeRate);
|
|
1599
|
+
loadProperty(this, "velocityRate", data.velocityRate);
|
|
1600
|
+
}
|
|
1601
|
+
}
|
|
1602
|
+
|
|
1603
|
+
class ParticlesOptions extends OptionLoader {
|
|
1604
|
+
bounce = new ParticlesBounce();
|
|
1605
|
+
effect = new Effect();
|
|
1606
|
+
groups = {};
|
|
1607
|
+
move = new Move();
|
|
1608
|
+
number = new ParticlesNumber();
|
|
2168
1609
|
paint;
|
|
2169
1610
|
palette;
|
|
2170
|
-
reduceDuplicates;
|
|
2171
|
-
shape;
|
|
2172
|
-
zIndex;
|
|
1611
|
+
reduceDuplicates = false;
|
|
1612
|
+
shape = new Shape();
|
|
1613
|
+
zIndex = new ZIndex();
|
|
2173
1614
|
#container;
|
|
2174
1615
|
#pluginManager;
|
|
2175
1616
|
constructor(pluginManager, container) {
|
|
1617
|
+
super();
|
|
2176
1618
|
this.#pluginManager = pluginManager;
|
|
2177
1619
|
this.#container = container;
|
|
2178
|
-
this.bounce = new ParticlesBounce();
|
|
2179
|
-
this.effect = new Effect();
|
|
2180
|
-
this.groups = {};
|
|
2181
|
-
this.move = new Move();
|
|
2182
|
-
this.number = new ParticlesNumber();
|
|
2183
1620
|
this.paint = new Paint();
|
|
2184
1621
|
this.paint.color = new AnimatableColor();
|
|
2185
1622
|
this.paint.color.value = "#fff";
|
|
2186
1623
|
this.paint.fill = new Fill();
|
|
2187
1624
|
this.paint.fill.enable = true;
|
|
2188
|
-
this.reduceDuplicates = false;
|
|
2189
|
-
this.shape = new Shape();
|
|
2190
|
-
this.zIndex = new ZIndex();
|
|
2191
1625
|
}
|
|
2192
|
-
|
|
2193
|
-
if (isNull(data)) {
|
|
2194
|
-
return;
|
|
2195
|
-
}
|
|
1626
|
+
doLoad(data) {
|
|
2196
1627
|
if (data.palette) {
|
|
2197
1628
|
this.palette = data.palette;
|
|
2198
1629
|
this.#importPalette(this.palette);
|
|
@@ -2250,7 +1681,7 @@
|
|
|
2250
1681
|
}
|
|
2251
1682
|
}
|
|
2252
1683
|
}
|
|
2253
|
-
#importPalette
|
|
1684
|
+
#importPalette(palette) {
|
|
2254
1685
|
const paletteData = this.#pluginManager.getPalette(palette);
|
|
2255
1686
|
if (!paletteData) {
|
|
2256
1687
|
return;
|
|
@@ -2294,69 +1725,49 @@
|
|
|
2294
1725
|
mode: paletteData.blendMode,
|
|
2295
1726
|
},
|
|
2296
1727
|
});
|
|
2297
|
-
};
|
|
2298
|
-
}
|
|
2299
|
-
|
|
2300
|
-
function loadOptions(options, ...sourceOptionsArr) {
|
|
2301
|
-
for (const sourceOptions of sourceOptionsArr) {
|
|
2302
|
-
options.load(sourceOptions);
|
|
2303
1728
|
}
|
|
2304
1729
|
}
|
|
1730
|
+
|
|
2305
1731
|
function loadParticlesOptions(pluginManager, container, ...sourceOptionsArr) {
|
|
2306
1732
|
const options = new ParticlesOptions(pluginManager, container);
|
|
2307
1733
|
loadOptions(options, ...sourceOptionsArr);
|
|
2308
1734
|
return options;
|
|
2309
1735
|
}
|
|
2310
1736
|
|
|
2311
|
-
class Options {
|
|
2312
|
-
autoPlay;
|
|
1737
|
+
class Options extends OptionLoader {
|
|
1738
|
+
autoPlay = true;
|
|
2313
1739
|
background;
|
|
2314
|
-
clear;
|
|
2315
|
-
defaultThemes;
|
|
2316
|
-
delay;
|
|
2317
|
-
detectRetina;
|
|
2318
|
-
duration;
|
|
2319
|
-
fpsLimit;
|
|
1740
|
+
clear = true;
|
|
1741
|
+
defaultThemes = {};
|
|
1742
|
+
delay = 0;
|
|
1743
|
+
detectRetina = true;
|
|
1744
|
+
duration = 0;
|
|
1745
|
+
fpsLimit = 120;
|
|
2320
1746
|
fullScreen;
|
|
2321
|
-
hdr;
|
|
1747
|
+
hdr = true;
|
|
2322
1748
|
key;
|
|
2323
1749
|
name;
|
|
2324
1750
|
palette;
|
|
2325
1751
|
particles;
|
|
2326
|
-
pauseOnBlur;
|
|
2327
|
-
pauseOnOutsideViewport;
|
|
1752
|
+
pauseOnBlur = true;
|
|
1753
|
+
pauseOnOutsideViewport = true;
|
|
2328
1754
|
preset;
|
|
2329
1755
|
resize;
|
|
2330
|
-
smooth;
|
|
2331
|
-
style;
|
|
2332
|
-
zLayers;
|
|
1756
|
+
smooth = false;
|
|
1757
|
+
style = {};
|
|
1758
|
+
zLayers = 100;
|
|
2333
1759
|
#container;
|
|
2334
1760
|
#pluginManager;
|
|
2335
1761
|
constructor(pluginManager, container) {
|
|
1762
|
+
super();
|
|
2336
1763
|
this.#pluginManager = pluginManager;
|
|
2337
1764
|
this.#container = container;
|
|
2338
|
-
this.autoPlay = true;
|
|
2339
1765
|
this.background = new Background();
|
|
2340
|
-
this.clear = true;
|
|
2341
|
-
this.defaultThemes = {};
|
|
2342
|
-
this.delay = 0;
|
|
2343
1766
|
this.fullScreen = new FullScreen();
|
|
2344
|
-
this.detectRetina = true;
|
|
2345
|
-
this.duration = 0;
|
|
2346
|
-
this.fpsLimit = 120;
|
|
2347
|
-
this.hdr = true;
|
|
2348
1767
|
this.particles = loadParticlesOptions(this.#pluginManager, this.#container);
|
|
2349
|
-
this.pauseOnBlur = true;
|
|
2350
|
-
this.pauseOnOutsideViewport = true;
|
|
2351
1768
|
this.resize = new ResizeEvent();
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
this.zLayers = 100;
|
|
2355
|
-
}
|
|
2356
|
-
load(data) {
|
|
2357
|
-
if (isNull(data)) {
|
|
2358
|
-
return;
|
|
2359
|
-
}
|
|
1769
|
+
}
|
|
1770
|
+
doLoad(data) {
|
|
2360
1771
|
if (data.preset !== undefined) {
|
|
2361
1772
|
this.preset = data.preset;
|
|
2362
1773
|
executeOnSingleOrMultiple(this.preset, preset => {
|
|
@@ -2367,44 +1778,18 @@
|
|
|
2367
1778
|
this.palette = data.palette;
|
|
2368
1779
|
this.#importPalette(this.palette);
|
|
2369
1780
|
}
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
if (data.delay !== undefined) {
|
|
2383
|
-
this.delay = setRangeValue(data.delay);
|
|
2384
|
-
}
|
|
2385
|
-
const detectRetina = data.detectRetina;
|
|
2386
|
-
if (detectRetina !== undefined) {
|
|
2387
|
-
this.detectRetina = detectRetina;
|
|
2388
|
-
}
|
|
2389
|
-
if (data.duration !== undefined) {
|
|
2390
|
-
this.duration = setRangeValue(data.duration);
|
|
2391
|
-
}
|
|
2392
|
-
const fpsLimit = data.fpsLimit;
|
|
2393
|
-
if (fpsLimit !== undefined) {
|
|
2394
|
-
this.fpsLimit = fpsLimit;
|
|
2395
|
-
}
|
|
2396
|
-
if (data.hdr !== undefined) {
|
|
2397
|
-
this.hdr = data.hdr;
|
|
2398
|
-
}
|
|
2399
|
-
if (data.pauseOnBlur !== undefined) {
|
|
2400
|
-
this.pauseOnBlur = data.pauseOnBlur;
|
|
2401
|
-
}
|
|
2402
|
-
if (data.pauseOnOutsideViewport !== undefined) {
|
|
2403
|
-
this.pauseOnOutsideViewport = data.pauseOnOutsideViewport;
|
|
2404
|
-
}
|
|
2405
|
-
if (data.zLayers !== undefined) {
|
|
2406
|
-
this.zLayers = data.zLayers;
|
|
2407
|
-
}
|
|
1781
|
+
loadProperty(this, "autoPlay", data.autoPlay);
|
|
1782
|
+
loadProperty(this, "clear", data.clear);
|
|
1783
|
+
loadProperty(this, "key", data.key);
|
|
1784
|
+
loadProperty(this, "name", data.name);
|
|
1785
|
+
loadRangeProperty(this, "delay", data.delay);
|
|
1786
|
+
loadProperty(this, "detectRetina", data.detectRetina);
|
|
1787
|
+
loadRangeProperty(this, "duration", data.duration);
|
|
1788
|
+
loadProperty(this, "fpsLimit", data.fpsLimit);
|
|
1789
|
+
loadProperty(this, "hdr", data.hdr);
|
|
1790
|
+
loadProperty(this, "pauseOnBlur", data.pauseOnBlur);
|
|
1791
|
+
loadProperty(this, "pauseOnOutsideViewport", data.pauseOnOutsideViewport);
|
|
1792
|
+
loadProperty(this, "zLayers", data.zLayers);
|
|
2408
1793
|
this.background.load(data.background);
|
|
2409
1794
|
const fullScreen = data.fullScreen;
|
|
2410
1795
|
if (isBoolean(fullScreen)) {
|
|
@@ -2416,14 +1801,12 @@
|
|
|
2416
1801
|
this.particles.load(data.particles);
|
|
2417
1802
|
this.resize.load(data.resize);
|
|
2418
1803
|
this.style = deepExtend(this.style, data.style);
|
|
2419
|
-
|
|
2420
|
-
this.smooth = data.smooth;
|
|
2421
|
-
}
|
|
1804
|
+
loadProperty(this, "smooth", data.smooth);
|
|
2422
1805
|
this.#pluginManager.plugins.forEach(plugin => {
|
|
2423
1806
|
plugin.loadOptions(this.#container, this, data);
|
|
2424
1807
|
});
|
|
2425
1808
|
}
|
|
2426
|
-
#importPalette
|
|
1809
|
+
#importPalette(palette) {
|
|
2427
1810
|
const paletteData = this.#pluginManager.getPalette(palette);
|
|
2428
1811
|
if (!paletteData) {
|
|
2429
1812
|
return;
|
|
@@ -2440,143 +1823,19 @@
|
|
|
2440
1823
|
palette,
|
|
2441
1824
|
},
|
|
2442
1825
|
});
|
|
2443
|
-
};
|
|
2444
|
-
#importPreset = preset => {
|
|
2445
|
-
this.load(this.#pluginManager.getPreset(preset));
|
|
2446
|
-
};
|
|
2447
|
-
}
|
|
2448
|
-
|
|
2449
|
-
function paintBase(context, dimension, baseColor) {
|
|
2450
|
-
context.fillStyle = baseColor ?? "rgba(0,0,0,0)";
|
|
2451
|
-
context.fillRect(originPoint.x, originPoint.y, dimension.width, dimension.height);
|
|
2452
|
-
}
|
|
2453
|
-
function paintImage(context, dimension, image, opacity) {
|
|
2454
|
-
if (!image) {
|
|
2455
|
-
return;
|
|
2456
|
-
}
|
|
2457
|
-
const prevAlpha = context.globalAlpha;
|
|
2458
|
-
context.globalAlpha = opacity;
|
|
2459
|
-
context.drawImage(image, originPoint.x, originPoint.y, dimension.width, dimension.height);
|
|
2460
|
-
context.globalAlpha = prevAlpha;
|
|
2461
|
-
}
|
|
2462
|
-
function clear(context, dimension) {
|
|
2463
|
-
context.clearRect(originPoint.x, originPoint.y, dimension.width, dimension.height);
|
|
2464
|
-
}
|
|
2465
|
-
function drawParticle(data) {
|
|
2466
|
-
const { container, context, particle, delta, colorStyles, radius, opacity, transform } = data, { effectDrawers, shapeDrawers } = container, pos = particle.getPosition(), transformData = particle.getTransformData(transform), drawScale = defaultZoom, drawPosition = {
|
|
2467
|
-
x: pos.x,
|
|
2468
|
-
y: pos.y,
|
|
2469
|
-
};
|
|
2470
|
-
context.setTransform(transformData.a, transformData.b, transformData.c, transformData.d, pos.x, pos.y);
|
|
2471
|
-
if (colorStyles.fill) {
|
|
2472
|
-
context.fillStyle = colorStyles.fill;
|
|
2473
|
-
}
|
|
2474
|
-
const fillEnabled = !!particle.fillEnabled, strokeWidth = particle.strokeWidth ?? minStrokeWidth;
|
|
2475
|
-
context.lineWidth = strokeWidth;
|
|
2476
|
-
if (colorStyles.stroke) {
|
|
2477
|
-
context.strokeStyle = colorStyles.stroke;
|
|
2478
|
-
}
|
|
2479
|
-
const drawData = {
|
|
2480
|
-
context,
|
|
2481
|
-
particle,
|
|
2482
|
-
radius,
|
|
2483
|
-
drawRadius: radius * drawScale,
|
|
2484
|
-
opacity,
|
|
2485
|
-
delta,
|
|
2486
|
-
pixelRatio: container.retina.pixelRatio,
|
|
2487
|
-
fill: fillEnabled,
|
|
2488
|
-
stroke: strokeWidth > minStrokeWidth,
|
|
2489
|
-
transformData,
|
|
2490
|
-
position: { ...pos },
|
|
2491
|
-
drawPosition,
|
|
2492
|
-
drawScale,
|
|
2493
|
-
};
|
|
2494
|
-
for (const plugin of container.plugins) {
|
|
2495
|
-
plugin.drawParticleTransform?.(drawData);
|
|
2496
|
-
}
|
|
2497
|
-
const effect = particle.effect ? effectDrawers.get(particle.effect) : undefined, shape = particle.shape ? shapeDrawers.get(particle.shape) : undefined;
|
|
2498
|
-
drawBeforeEffect(effect, drawData);
|
|
2499
|
-
drawShapeBeforeDraw(shape, drawData);
|
|
2500
|
-
drawShape(shape, drawData);
|
|
2501
|
-
drawShapeAfterDraw(shape, drawData);
|
|
2502
|
-
drawAfterEffect(effect, drawData);
|
|
2503
|
-
context.resetTransform();
|
|
2504
|
-
}
|
|
2505
|
-
function drawAfterEffect(drawer, data) {
|
|
2506
|
-
if (!drawer?.drawAfter) {
|
|
2507
|
-
return;
|
|
2508
|
-
}
|
|
2509
|
-
const { particle } = data;
|
|
2510
|
-
if (!particle.effect) {
|
|
2511
|
-
return;
|
|
2512
|
-
}
|
|
2513
|
-
drawer.drawAfter(data);
|
|
2514
|
-
}
|
|
2515
|
-
function drawBeforeEffect(drawer, data) {
|
|
2516
|
-
if (!drawer?.drawBefore) {
|
|
2517
|
-
return;
|
|
2518
|
-
}
|
|
2519
|
-
const { particle } = data;
|
|
2520
|
-
if (!particle.effect) {
|
|
2521
|
-
return;
|
|
2522
|
-
}
|
|
2523
|
-
drawer.drawBefore(data);
|
|
2524
|
-
}
|
|
2525
|
-
function drawShape(drawer, data) {
|
|
2526
|
-
if (!drawer) {
|
|
2527
|
-
return;
|
|
2528
|
-
}
|
|
2529
|
-
const { context, fill, particle, stroke } = data;
|
|
2530
|
-
if (!particle.shape) {
|
|
2531
|
-
return;
|
|
2532
|
-
}
|
|
2533
|
-
context.beginPath();
|
|
2534
|
-
drawer.draw(data);
|
|
2535
|
-
if (particle.shapeClose) {
|
|
2536
|
-
context.closePath();
|
|
2537
|
-
}
|
|
2538
|
-
if (fill) {
|
|
2539
|
-
context.fill();
|
|
2540
|
-
}
|
|
2541
|
-
if (stroke) {
|
|
2542
|
-
context.stroke();
|
|
2543
|
-
}
|
|
2544
|
-
}
|
|
2545
|
-
function drawShapeAfterDraw(drawer, data) {
|
|
2546
|
-
if (!drawer?.afterDraw) {
|
|
2547
|
-
return;
|
|
2548
|
-
}
|
|
2549
|
-
const { particle } = data;
|
|
2550
|
-
if (!particle.shape) {
|
|
2551
|
-
return;
|
|
2552
|
-
}
|
|
2553
|
-
drawer.afterDraw(data);
|
|
2554
|
-
}
|
|
2555
|
-
function drawShapeBeforeDraw(drawer, data) {
|
|
2556
|
-
if (!drawer?.beforeDraw) {
|
|
2557
|
-
return;
|
|
2558
|
-
}
|
|
2559
|
-
const { particle } = data;
|
|
2560
|
-
if (!particle.shape) {
|
|
2561
|
-
return;
|
|
2562
1826
|
}
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
function drawParticlePlugin(context, plugin, particle, delta) {
|
|
2566
|
-
if (!plugin.drawParticle) {
|
|
2567
|
-
return;
|
|
1827
|
+
#importPreset(preset) {
|
|
1828
|
+
this.load(this.#pluginManager.getPreset(preset));
|
|
2568
1829
|
}
|
|
2569
|
-
plugin.drawParticle(context, particle, delta);
|
|
2570
1830
|
}
|
|
2571
1831
|
|
|
2572
|
-
const styleCache = new Map(),
|
|
1832
|
+
const styleCache = new Map(), maxStyleCacheSize = 2000, rgbFixedPrecision = 2, hslFixedPrecision = 2, sdrReferenceWhiteNits = 203;
|
|
2573
1833
|
function getCachedStyle(key, generator) {
|
|
2574
1834
|
let cached = styleCache.get(key);
|
|
2575
1835
|
if (!cached) {
|
|
2576
1836
|
cached = generator();
|
|
2577
|
-
if (styleCache.size
|
|
2578
|
-
|
|
2579
|
-
keysToDelete.forEach(k => styleCache.delete(k));
|
|
1837
|
+
if (styleCache.size > maxStyleCacheSize) {
|
|
1838
|
+
styleCache.clear();
|
|
2580
1839
|
}
|
|
2581
1840
|
styleCache.set(key, cached);
|
|
2582
1841
|
}
|
|
@@ -2643,10 +1902,6 @@
|
|
|
2643
1902
|
}
|
|
2644
1903
|
return undefined;
|
|
2645
1904
|
}
|
|
2646
|
-
function colorToHsl(pluginManager, color, index, useIndex = true) {
|
|
2647
|
-
const rgb = colorToRgb(pluginManager, color, index, useIndex);
|
|
2648
|
-
return rgb ? rgbToHsl(rgb) : undefined;
|
|
2649
|
-
}
|
|
2650
1905
|
function rangeColorToHsl(pluginManager, color, index, useIndex = true) {
|
|
2651
1906
|
const rgb = rangeColorToRgb(pluginManager, color, index, useIndex);
|
|
2652
1907
|
return rgb ? rgbToHsl(rgb) : undefined;
|
|
@@ -2686,34 +1941,35 @@
|
|
|
2686
1941
|
function stringToRgb(pluginManager, input) {
|
|
2687
1942
|
return stringToRgba(pluginManager, input);
|
|
2688
1943
|
}
|
|
1944
|
+
function hslChannel(temp1, temp2, temp3) {
|
|
1945
|
+
const temp3Min = 0, temp3Max = 1;
|
|
1946
|
+
if (temp3 < temp3Min) {
|
|
1947
|
+
temp3++;
|
|
1948
|
+
}
|
|
1949
|
+
if (temp3 > temp3Max) {
|
|
1950
|
+
temp3--;
|
|
1951
|
+
}
|
|
1952
|
+
if (temp3 * sextuple < temp3Max) {
|
|
1953
|
+
return temp1 + (temp2 - temp1) * sextuple * temp3;
|
|
1954
|
+
}
|
|
1955
|
+
if (temp3 * double < temp3Max) {
|
|
1956
|
+
return temp2;
|
|
1957
|
+
}
|
|
1958
|
+
if (temp3 * triple < temp3Max * double) {
|
|
1959
|
+
const temp3Offset = double / triple;
|
|
1960
|
+
return temp1 + (temp2 - temp1) * (temp3Offset - temp3) * sextuple;
|
|
1961
|
+
}
|
|
1962
|
+
return temp1;
|
|
1963
|
+
}
|
|
2689
1964
|
function hslToRgb(hsl) {
|
|
2690
1965
|
const h = ((hsl.h % hMax) + hMax) % hMax, s = Math.max(sMin, Math.min(sMax, hsl.s)), l = Math.max(lMin, Math.min(lMax, hsl.l)), hNormalized = h / hMax, sNormalized = s / sMax, lNormalized = l / lMax;
|
|
2691
1966
|
if (s === sMin) {
|
|
2692
1967
|
const grayscaleValue = Math.round(lNormalized * rgbMax);
|
|
2693
1968
|
return { r: grayscaleValue, g: grayscaleValue, b: grayscaleValue };
|
|
2694
1969
|
}
|
|
2695
|
-
const
|
|
2696
|
-
const temp3Min = 0, temp3Max = 1;
|
|
2697
|
-
if (temp3 < temp3Min) {
|
|
2698
|
-
temp3++;
|
|
2699
|
-
}
|
|
2700
|
-
if (temp3 > temp3Max) {
|
|
2701
|
-
temp3--;
|
|
2702
|
-
}
|
|
2703
|
-
if (temp3 * sextuple < temp3Max) {
|
|
2704
|
-
return temp1 + (temp2 - temp1) * sextuple * temp3;
|
|
2705
|
-
}
|
|
2706
|
-
if (temp3 * double < temp3Max) {
|
|
2707
|
-
return temp2;
|
|
2708
|
-
}
|
|
2709
|
-
if (temp3 * triple < temp3Max * double) {
|
|
2710
|
-
const temp3Offset = double / triple;
|
|
2711
|
-
return temp1 + (temp2 - temp1) * (temp3Offset - temp3) * sextuple;
|
|
2712
|
-
}
|
|
2713
|
-
return temp1;
|
|
2714
|
-
}, temp1 = lNormalized < half$1
|
|
1970
|
+
const temp1 = lNormalized < half$1
|
|
2715
1971
|
? lNormalized * (sNormalizedOffset + sNormalized)
|
|
2716
|
-
: lNormalized + sNormalized - lNormalized * sNormalized, temp2 = double * lNormalized - temp1, phaseThird = phaseNumerator / triple, red = Math.min(rgbMax, rgbMax *
|
|
1972
|
+
: lNormalized + sNormalized - lNormalized * sNormalized, temp2 = double * lNormalized - temp1, phaseThird = phaseNumerator / triple, red = Math.min(rgbMax, rgbMax * hslChannel(temp2, temp1, hNormalized + phaseThird)), green = Math.min(rgbMax, rgbMax * hslChannel(temp2, temp1, hNormalized)), blue = Math.min(rgbMax, rgbMax * hslChannel(temp2, temp1, hNormalized - phaseThird));
|
|
2717
1973
|
return { r: Math.round(red), g: Math.round(green), b: Math.round(blue) };
|
|
2718
1974
|
}
|
|
2719
1975
|
function hslaToRgba(hsla) {
|
|
@@ -2726,7 +1982,7 @@
|
|
|
2726
1982
|
};
|
|
2727
1983
|
}
|
|
2728
1984
|
function getRandomRgbColor(min) {
|
|
2729
|
-
const fixedMin = min ?? defaultRgbMin, fixedMax = rgbMax + identity$
|
|
1985
|
+
const fixedMin = min ?? defaultRgbMin, fixedMax = rgbMax + identity$2, getRgbInRangeValue = () => Math.floor(getRandomInRange(fixedMin, fixedMax));
|
|
2730
1986
|
return {
|
|
2731
1987
|
b: getRgbInRangeValue(),
|
|
2732
1988
|
g: getRgbInRangeValue(),
|
|
@@ -2737,21 +1993,18 @@
|
|
|
2737
1993
|
const op = opacity ?? defaultOpacity$1, key = `rgb-${color.r.toFixed(rgbFixedPrecision)}-${color.g.toFixed(rgbFixedPrecision)}-${color.b.toFixed(rgbFixedPrecision)}-${hdr ? "hdr" : "sdr"}-${op.toString()}`;
|
|
2738
1994
|
return getCachedStyle(key, () => (hdr ? getHdrStyleFromRgb(color, opacity) : getSdrStyleFromRgb(color, opacity)));
|
|
2739
1995
|
}
|
|
2740
|
-
function getHdrStyleFromRgb(color, opacity) {
|
|
2741
|
-
|
|
1996
|
+
function getHdrStyleFromRgb(color, opacity, peakNits = maxNits) {
|
|
1997
|
+
const headroom = peakNits / sdrReferenceWhiteNits;
|
|
1998
|
+
return `color(display-p3 ${((color.r / rgbMax) * headroom).toString()} ${((color.g / rgbMax) * headroom).toString()} ${((color.b / rgbMax) * headroom).toString()} / ${(opacity ?? defaultOpacity$1).toString()})`;
|
|
2742
1999
|
}
|
|
2743
2000
|
function getSdrStyleFromRgb(color, opacity) {
|
|
2744
2001
|
return `rgba(${color.r.toString()}, ${color.g.toString()}, ${color.b.toString()}, ${(opacity ?? defaultOpacity$1).toString()})`;
|
|
2745
2002
|
}
|
|
2746
2003
|
function getStyleFromHsl(color, hdr, opacity) {
|
|
2747
2004
|
const op = opacity ?? defaultOpacity$1, key = `hsl-${color.h.toFixed(hslFixedPrecision)}-${color.s.toFixed(hslFixedPrecision)}-${color.l.toFixed(hslFixedPrecision)}-${hdr ? "hdr" : "sdr"}-${op.toString()}`;
|
|
2748
|
-
return getCachedStyle(key, () =>
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
return getHdrStyleFromRgb(hslToRgb(color), opacity);
|
|
2752
|
-
}
|
|
2753
|
-
function getSdrStyleFromHsl(color, opacity) {
|
|
2754
|
-
return `hsla(${color.h.toString()}, ${color.s.toString()}%, ${color.l.toString()}%, ${(opacity ?? defaultOpacity$1).toString()})`;
|
|
2005
|
+
return getCachedStyle(key, () => hdr
|
|
2006
|
+
? getStyleFromRgb(hslToRgb(color), true, opacity)
|
|
2007
|
+
: `hsla(${color.h.toString()}, ${color.s.toString()}%, ${color.l.toString()}%, ${op.toString()})`);
|
|
2755
2008
|
}
|
|
2756
2009
|
function colorMix(color1, color2, size1, size2) {
|
|
2757
2010
|
let rgb1 = color1, rgb2 = color2;
|
|
@@ -2930,22 +2183,14 @@
|
|
|
2930
2183
|
const tsParticles = initEngine();
|
|
2931
2184
|
|
|
2932
2185
|
class Blend {
|
|
2933
|
-
enable;
|
|
2934
|
-
mode;
|
|
2935
|
-
constructor() {
|
|
2936
|
-
this.mode = "destination-out";
|
|
2937
|
-
this.enable = false;
|
|
2938
|
-
}
|
|
2186
|
+
enable = false;
|
|
2187
|
+
mode = "destination-out";
|
|
2939
2188
|
load(data) {
|
|
2940
2189
|
if (isNull(data)) {
|
|
2941
2190
|
return;
|
|
2942
2191
|
}
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
}
|
|
2946
|
-
if (data.enable !== undefined) {
|
|
2947
|
-
this.enable = data.enable;
|
|
2948
|
-
}
|
|
2192
|
+
loadProperty(this, "mode", data.mode);
|
|
2193
|
+
loadProperty(this, "enable", data.enable);
|
|
2949
2194
|
}
|
|
2950
2195
|
}
|
|
2951
2196
|
|
|
@@ -2975,7 +2220,7 @@
|
|
|
2975
2220
|
}
|
|
2976
2221
|
|
|
2977
2222
|
async function loadBlendPlugin(engine) {
|
|
2978
|
-
engine.checkVersion("4.
|
|
2223
|
+
engine.checkVersion("4.2.0");
|
|
2979
2224
|
await engine.pluginManager.register(e => {
|
|
2980
2225
|
e.pluginManager.addPlugin(new BlendPlugin());
|
|
2981
2226
|
});
|
|
@@ -3012,7 +2257,7 @@
|
|
|
3012
2257
|
}
|
|
3013
2258
|
|
|
3014
2259
|
async function loadCircleShape(engine) {
|
|
3015
|
-
engine.checkVersion("4.
|
|
2260
|
+
engine.checkVersion("4.2.0");
|
|
3016
2261
|
await engine.pluginManager.register(e => {
|
|
3017
2262
|
e.pluginManager.addShape(["circle"], () => {
|
|
3018
2263
|
return Promise.resolve(new CircleDrawer());
|
|
@@ -3060,7 +2305,7 @@
|
|
|
3060
2305
|
}
|
|
3061
2306
|
|
|
3062
2307
|
async function loadHexColorPlugin(engine) {
|
|
3063
|
-
engine.checkVersion("4.
|
|
2308
|
+
engine.checkVersion("4.2.0");
|
|
3064
2309
|
await engine.pluginManager.register(e => {
|
|
3065
2310
|
e.pluginManager.addColorManager("hex", new HexColorManager());
|
|
3066
2311
|
});
|
|
@@ -3113,7 +2358,7 @@
|
|
|
3113
2358
|
}
|
|
3114
2359
|
|
|
3115
2360
|
async function loadHslColorPlugin(engine) {
|
|
3116
|
-
engine.checkVersion("4.
|
|
2361
|
+
engine.checkVersion("4.2.0");
|
|
3117
2362
|
await engine.pluginManager.register(e => {
|
|
3118
2363
|
e.pluginManager.addColorManager("hsl", new HslColorManager());
|
|
3119
2364
|
});
|
|
@@ -3137,7 +2382,7 @@
|
|
|
3137
2382
|
}
|
|
3138
2383
|
|
|
3139
2384
|
async function loadMovePlugin(engine) {
|
|
3140
|
-
engine.checkVersion("4.
|
|
2385
|
+
engine.checkVersion("4.2.0");
|
|
3141
2386
|
await engine.pluginManager.register(e => {
|
|
3142
2387
|
const moveEngine = e, movePluginManager = moveEngine.pluginManager;
|
|
3143
2388
|
movePluginManager.initializers.pathGenerators ??= new Map();
|
|
@@ -3155,31 +2400,137 @@
|
|
|
3155
2400
|
});
|
|
3156
2401
|
}
|
|
3157
2402
|
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
2403
|
+
function checkDestroy(particle, destroyType, value, minValue, maxValue) {
|
|
2404
|
+
switch (destroyType) {
|
|
2405
|
+
case exports.DestroyType.max:
|
|
2406
|
+
if (value >= maxValue) {
|
|
2407
|
+
particle.destroy();
|
|
2408
|
+
}
|
|
2409
|
+
break;
|
|
2410
|
+
case exports.DestroyType.min:
|
|
2411
|
+
if (value <= minValue) {
|
|
2412
|
+
particle.destroy();
|
|
2413
|
+
}
|
|
2414
|
+
break;
|
|
2415
|
+
}
|
|
2416
|
+
}
|
|
2417
|
+
function initParticleNumericAnimationValue(options, pxRatio) {
|
|
2418
|
+
const valueRange = options.value, animationOptions = options.animation, res = {
|
|
2419
|
+
delayTime: getRangeValue(animationOptions.delay) * millisecondsToSeconds$1,
|
|
2420
|
+
enable: animationOptions.enable,
|
|
2421
|
+
value: getRangeValue(options.value) * pxRatio,
|
|
2422
|
+
max: getRangeMax(valueRange) * pxRatio,
|
|
2423
|
+
min: getRangeMin(valueRange) * pxRatio,
|
|
2424
|
+
loops: 0,
|
|
2425
|
+
maxLoops: getRangeValue(animationOptions.count),
|
|
2426
|
+
time: 0,
|
|
2427
|
+
}, decayOffset = 1;
|
|
2428
|
+
if (animationOptions.enable) {
|
|
2429
|
+
res.decay = decayOffset - getRangeValue(animationOptions.decay);
|
|
2430
|
+
switch (animationOptions.mode) {
|
|
2431
|
+
case exports.AnimationMode.increase:
|
|
2432
|
+
res.status = exports.AnimationStatus.increasing;
|
|
2433
|
+
break;
|
|
2434
|
+
case exports.AnimationMode.decrease:
|
|
2435
|
+
res.status = exports.AnimationStatus.decreasing;
|
|
2436
|
+
break;
|
|
2437
|
+
case exports.AnimationMode.random:
|
|
2438
|
+
res.status = getRandom() >= half$1 ? exports.AnimationStatus.increasing : exports.AnimationStatus.decreasing;
|
|
2439
|
+
break;
|
|
2440
|
+
}
|
|
2441
|
+
const autoStatus = animationOptions.mode === exports.AnimationMode.auto;
|
|
2442
|
+
switch (animationOptions.startValue) {
|
|
2443
|
+
case exports.StartValueType.min:
|
|
2444
|
+
res.value = res.min;
|
|
2445
|
+
if (autoStatus) {
|
|
2446
|
+
res.status = exports.AnimationStatus.increasing;
|
|
2447
|
+
}
|
|
2448
|
+
break;
|
|
2449
|
+
case exports.StartValueType.max:
|
|
2450
|
+
res.value = res.max;
|
|
2451
|
+
if (autoStatus) {
|
|
2452
|
+
res.status = exports.AnimationStatus.decreasing;
|
|
2453
|
+
}
|
|
2454
|
+
break;
|
|
2455
|
+
case exports.StartValueType.random:
|
|
2456
|
+
default:
|
|
2457
|
+
res.value = randomInRangeValue(res);
|
|
2458
|
+
if (autoStatus) {
|
|
2459
|
+
res.status = getRandom() >= half$1 ? exports.AnimationStatus.increasing : exports.AnimationStatus.decreasing;
|
|
2460
|
+
}
|
|
2461
|
+
break;
|
|
2462
|
+
}
|
|
2463
|
+
}
|
|
2464
|
+
res.initialValue = res.value;
|
|
2465
|
+
return res;
|
|
2466
|
+
}
|
|
2467
|
+
function updateAnimation(particle, data, changeDirection, destroyType, delta) {
|
|
2468
|
+
const minLoops = 0, minDelay = 0, identity = 1, minVelocity = 0, minDecay = 1;
|
|
2469
|
+
if (particle.destroyed ||
|
|
2470
|
+
!data.enable ||
|
|
2471
|
+
((data.maxLoops ?? minLoops) > minLoops && (data.loops ?? minLoops) > (data.maxLoops ?? minLoops))) {
|
|
2472
|
+
return;
|
|
2473
|
+
}
|
|
2474
|
+
const velocity = (data.velocity ?? minVelocity) * delta.factor, minValue = data.min, maxValue = data.max, decay = data.decay ?? minDecay;
|
|
2475
|
+
data.time ??= 0;
|
|
2476
|
+
const delayTime = data.delayTime ?? minDelay;
|
|
2477
|
+
if (delayTime > minDelay && data.time < delayTime) {
|
|
2478
|
+
data.time += delta.value;
|
|
2479
|
+
if (data.time < delayTime) {
|
|
2480
|
+
return;
|
|
2481
|
+
}
|
|
2482
|
+
}
|
|
2483
|
+
switch (data.status) {
|
|
2484
|
+
case exports.AnimationStatus.increasing:
|
|
2485
|
+
data.value += velocity;
|
|
2486
|
+
break;
|
|
2487
|
+
case exports.AnimationStatus.decreasing:
|
|
2488
|
+
data.value -= velocity;
|
|
2489
|
+
break;
|
|
2490
|
+
}
|
|
2491
|
+
if (data.velocity && decay !== identity) {
|
|
2492
|
+
data.velocity *= decay;
|
|
2493
|
+
}
|
|
2494
|
+
switch (data.status) {
|
|
2495
|
+
case exports.AnimationStatus.increasing:
|
|
2496
|
+
if (data.value >= maxValue) {
|
|
2497
|
+
{
|
|
2498
|
+
data.status = exports.AnimationStatus.decreasing;
|
|
2499
|
+
}
|
|
2500
|
+
data.loops ??= minLoops;
|
|
2501
|
+
data.loops++;
|
|
2502
|
+
}
|
|
2503
|
+
break;
|
|
2504
|
+
case exports.AnimationStatus.decreasing:
|
|
2505
|
+
if (data.value <= minValue) {
|
|
2506
|
+
{
|
|
2507
|
+
data.status = exports.AnimationStatus.increasing;
|
|
2508
|
+
}
|
|
2509
|
+
data.loops ??= minLoops;
|
|
2510
|
+
data.loops++;
|
|
2511
|
+
}
|
|
2512
|
+
break;
|
|
2513
|
+
}
|
|
2514
|
+
checkDestroy(particle, destroyType, data.value, minValue, maxValue);
|
|
2515
|
+
if (!particle.destroyed) {
|
|
2516
|
+
data.value = clamp(data.value, minValue, maxValue);
|
|
3164
2517
|
}
|
|
2518
|
+
}
|
|
2519
|
+
|
|
2520
|
+
class OpacityAnimation extends RangedAnimationOptions {
|
|
2521
|
+
destroy = exports.DestroyType.none;
|
|
3165
2522
|
load(data) {
|
|
3166
2523
|
super.load(data);
|
|
3167
2524
|
if (isNull(data)) {
|
|
3168
2525
|
return;
|
|
3169
2526
|
}
|
|
3170
|
-
|
|
3171
|
-
this.destroy = data.destroy;
|
|
3172
|
-
}
|
|
2527
|
+
loadProperty(this, "destroy", data.destroy);
|
|
3173
2528
|
}
|
|
3174
2529
|
}
|
|
3175
2530
|
|
|
3176
2531
|
class Opacity extends RangedAnimationValueWithRandom {
|
|
3177
|
-
animation;
|
|
3178
|
-
|
|
3179
|
-
super();
|
|
3180
|
-
this.animation = new OpacityAnimation();
|
|
3181
|
-
this.value = 1;
|
|
3182
|
-
}
|
|
2532
|
+
animation = new OpacityAnimation();
|
|
2533
|
+
value = 1;
|
|
3183
2534
|
load(data) {
|
|
3184
2535
|
if (isNull(data)) {
|
|
3185
2536
|
return;
|
|
@@ -3223,10 +2574,7 @@
|
|
|
3223
2574
|
(particle.opacity.loops ?? none) < (particle.opacity.maxLoops ?? none))));
|
|
3224
2575
|
}
|
|
3225
2576
|
loadOptions(options, ...sources) {
|
|
3226
|
-
options
|
|
3227
|
-
for (const source of sources) {
|
|
3228
|
-
options.opacity.load(source?.opacity);
|
|
3229
|
-
}
|
|
2577
|
+
loadOptionProperty(options, "opacity", Opacity, ...sources);
|
|
3230
2578
|
}
|
|
3231
2579
|
reset(particle) {
|
|
3232
2580
|
if (!particle.opacity) {
|
|
@@ -3244,7 +2592,7 @@
|
|
|
3244
2592
|
}
|
|
3245
2593
|
|
|
3246
2594
|
async function loadOpacityUpdater(engine) {
|
|
3247
|
-
engine.checkVersion("4.
|
|
2595
|
+
engine.checkVersion("4.2.0");
|
|
3248
2596
|
await engine.pluginManager.register(e => {
|
|
3249
2597
|
e.pluginManager.addParticleUpdater("opacity", container => {
|
|
3250
2598
|
return Promise.resolve(new OpacityUpdater(container));
|
|
@@ -3252,7 +2600,7 @@
|
|
|
3252
2600
|
});
|
|
3253
2601
|
}
|
|
3254
2602
|
|
|
3255
|
-
const
|
|
2603
|
+
const boundsMin = 0;
|
|
3256
2604
|
function bounceHorizontal(data) {
|
|
3257
2605
|
if ((data.outMode !== exports.OutMode.bounce && data.outMode !== exports.OutMode.split) ||
|
|
3258
2606
|
(data.direction !== exports.OutModeDirection.left && data.direction !== exports.OutModeDirection.right)) {
|
|
@@ -3267,8 +2615,8 @@
|
|
|
3267
2615
|
const velocity = data.particle.velocity.x;
|
|
3268
2616
|
let bounced = false;
|
|
3269
2617
|
if (data.outOfCanvas &&
|
|
3270
|
-
((data.direction === exports.OutModeDirection.right && velocity > minVelocity
|
|
3271
|
-
(data.direction === exports.OutModeDirection.left && velocity < minVelocity
|
|
2618
|
+
((data.direction === exports.OutModeDirection.right && velocity > minVelocity) ||
|
|
2619
|
+
(data.direction === exports.OutModeDirection.left && velocity < minVelocity))) {
|
|
3272
2620
|
const newVelocity = getRangeValue(data.particle.options.bounce.horizontal.value);
|
|
3273
2621
|
data.particle.velocity.x *= -newVelocity;
|
|
3274
2622
|
bounced = true;
|
|
@@ -3301,8 +2649,8 @@
|
|
|
3301
2649
|
const velocity = data.particle.velocity.y;
|
|
3302
2650
|
let bounced = false;
|
|
3303
2651
|
if (data.outOfCanvas &&
|
|
3304
|
-
((data.direction === exports.OutModeDirection.bottom && velocity > minVelocity
|
|
3305
|
-
(data.direction === exports.OutModeDirection.top && velocity < minVelocity
|
|
2652
|
+
((data.direction === exports.OutModeDirection.bottom && velocity > minVelocity) ||
|
|
2653
|
+
(data.direction === exports.OutModeDirection.top && velocity < minVelocity))) {
|
|
3306
2654
|
const newVelocity = getRangeValue(data.particle.options.bounce.vertical.value);
|
|
3307
2655
|
data.particle.velocity.y *= -newVelocity;
|
|
3308
2656
|
bounced = true;
|
|
@@ -3355,7 +2703,6 @@
|
|
|
3355
2703
|
}
|
|
3356
2704
|
}
|
|
3357
2705
|
|
|
3358
|
-
const minVelocity$3 = 0;
|
|
3359
2706
|
class DestroyOutMode {
|
|
3360
2707
|
modes;
|
|
3361
2708
|
constructor(_container) {
|
|
@@ -3374,10 +2721,10 @@
|
|
|
3374
2721
|
break;
|
|
3375
2722
|
case exports.ParticleOutType.inside: {
|
|
3376
2723
|
const { dx, dy } = getDistances(particle.position, particle.moveCenter), { x: vx, y: vy } = particle.velocity;
|
|
3377
|
-
if ((vx < minVelocity
|
|
3378
|
-
(vy < minVelocity
|
|
3379
|
-
(vx >= minVelocity
|
|
3380
|
-
(vy >= minVelocity
|
|
2724
|
+
if ((vx < minVelocity && dx > particle.moveCenter.radius) ||
|
|
2725
|
+
(vy < minVelocity && dy > particle.moveCenter.radius) ||
|
|
2726
|
+
(vx >= minVelocity && dx < -particle.moveCenter.radius) ||
|
|
2727
|
+
(vy >= minVelocity && dy < -particle.moveCenter.radius)) {
|
|
3381
2728
|
return;
|
|
3382
2729
|
}
|
|
3383
2730
|
break;
|
|
@@ -3387,7 +2734,6 @@
|
|
|
3387
2734
|
}
|
|
3388
2735
|
}
|
|
3389
2736
|
|
|
3390
|
-
const minVelocity$2 = 0;
|
|
3391
2737
|
class NoneOutMode {
|
|
3392
2738
|
modes;
|
|
3393
2739
|
#container;
|
|
@@ -3407,10 +2753,10 @@
|
|
|
3407
2753
|
}
|
|
3408
2754
|
const gravityOptions = particle.options.move.gravity, container = this.#container, canvasSize = container.canvas.size, pRadius = particle.getRadius();
|
|
3409
2755
|
if (!gravityOptions.enable) {
|
|
3410
|
-
if ((particle.velocity.y > minVelocity
|
|
3411
|
-
(particle.velocity.y < minVelocity
|
|
3412
|
-
(particle.velocity.x > minVelocity
|
|
3413
|
-
(particle.velocity.x < minVelocity
|
|
2756
|
+
if ((particle.velocity.y > minVelocity && particle.position.y <= canvasSize.height + pRadius) ||
|
|
2757
|
+
(particle.velocity.y < minVelocity && particle.position.y >= -pRadius) ||
|
|
2758
|
+
(particle.velocity.x > minVelocity && particle.position.x <= canvasSize.width + pRadius) ||
|
|
2759
|
+
(particle.velocity.x < minVelocity && particle.position.x >= -pRadius)) {
|
|
3414
2760
|
return;
|
|
3415
2761
|
}
|
|
3416
2762
|
if (!isPointInside(particle.position, container.canvas.size, originPoint, pRadius, direction)) {
|
|
@@ -3429,7 +2775,7 @@
|
|
|
3429
2775
|
}
|
|
3430
2776
|
}
|
|
3431
2777
|
|
|
3432
|
-
const
|
|
2778
|
+
const updateVector = Vector.origin;
|
|
3433
2779
|
class OutOutMode {
|
|
3434
2780
|
modes;
|
|
3435
2781
|
#container;
|
|
@@ -3450,10 +2796,10 @@
|
|
|
3450
2796
|
updateVector.angle = particle.velocity.angle + Math.PI;
|
|
3451
2797
|
updateVector.addTo(particle.moveCenter);
|
|
3452
2798
|
const { dx, dy } = getDistances(particle.position, updateVector);
|
|
3453
|
-
if ((vx <= minVelocity
|
|
3454
|
-
(vy <= minVelocity
|
|
3455
|
-
(vx >= minVelocity
|
|
3456
|
-
(vy >= minVelocity
|
|
2799
|
+
if ((vx <= minVelocity && dx >= minDistance) ||
|
|
2800
|
+
(vy <= minVelocity && dy >= minDistance) ||
|
|
2801
|
+
(vx >= minVelocity && dx <= minDistance) ||
|
|
2802
|
+
(vy >= minVelocity && dy <= minDistance)) {
|
|
3457
2803
|
return;
|
|
3458
2804
|
}
|
|
3459
2805
|
particle.position.x = Math.floor(randomInRangeValue({
|
|
@@ -3577,21 +2923,21 @@
|
|
|
3577
2923
|
this.#updateOutMode(particle, delta, outModes.right ?? outModes.default, exports.OutModeDirection.right);
|
|
3578
2924
|
this.#updateOutMode(particle, delta, outModes.top ?? outModes.default, exports.OutModeDirection.top);
|
|
3579
2925
|
}
|
|
3580
|
-
#addUpdaterIfMissing
|
|
2926
|
+
#addUpdaterIfMissing(particle, outMode, getUpdater) {
|
|
3581
2927
|
const outModes = particle.options.move.outModes;
|
|
3582
2928
|
if (!this.updaters.has(outMode) && checkOutMode(outModes, outMode)) {
|
|
3583
2929
|
this.updaters.set(outMode, getUpdater(this.#container));
|
|
3584
2930
|
}
|
|
3585
|
-
}
|
|
3586
|
-
#updateOutMode
|
|
2931
|
+
}
|
|
2932
|
+
#updateOutMode(particle, delta, outMode, direction) {
|
|
3587
2933
|
for (const updater of this.updaters.values()) {
|
|
3588
2934
|
updater.update(particle, direction, delta, outMode);
|
|
3589
2935
|
}
|
|
3590
|
-
}
|
|
2936
|
+
}
|
|
3591
2937
|
}
|
|
3592
2938
|
|
|
3593
2939
|
async function loadOutModesUpdater(engine) {
|
|
3594
|
-
engine.checkVersion("4.
|
|
2940
|
+
engine.checkVersion("4.2.0");
|
|
3595
2941
|
await engine.pluginManager.register(e => {
|
|
3596
2942
|
e.pluginManager.addParticleUpdater("outModes", container => {
|
|
3597
2943
|
return Promise.resolve(new OutOfCanvasUpdater(container));
|
|
@@ -3662,7 +3008,7 @@
|
|
|
3662
3008
|
}
|
|
3663
3009
|
|
|
3664
3010
|
async function loadPaintUpdater(engine) {
|
|
3665
|
-
engine.checkVersion("4.
|
|
3011
|
+
engine.checkVersion("4.2.0");
|
|
3666
3012
|
await engine.pluginManager.register(e => {
|
|
3667
3013
|
e.pluginManager.addParticleUpdater("paint", container => {
|
|
3668
3014
|
return Promise.resolve(new PaintUpdater(e.pluginManager, container));
|
|
@@ -3717,37 +3063,26 @@
|
|
|
3717
3063
|
}
|
|
3718
3064
|
|
|
3719
3065
|
async function loadRgbColorPlugin(engine) {
|
|
3720
|
-
engine.checkVersion("4.
|
|
3066
|
+
engine.checkVersion("4.2.0");
|
|
3721
3067
|
await engine.pluginManager.register(e => {
|
|
3722
3068
|
e.pluginManager.addColorManager("rgb", new RgbColorManager());
|
|
3723
3069
|
});
|
|
3724
3070
|
}
|
|
3725
3071
|
|
|
3726
3072
|
class SizeAnimation extends RangedAnimationOptions {
|
|
3727
|
-
destroy;
|
|
3728
|
-
constructor() {
|
|
3729
|
-
super();
|
|
3730
|
-
this.destroy = exports.DestroyType.none;
|
|
3731
|
-
this.speed = 5;
|
|
3732
|
-
}
|
|
3073
|
+
destroy = exports.DestroyType.none;
|
|
3733
3074
|
load(data) {
|
|
3734
3075
|
super.load(data);
|
|
3735
3076
|
if (isNull(data)) {
|
|
3736
3077
|
return;
|
|
3737
3078
|
}
|
|
3738
|
-
|
|
3739
|
-
this.destroy = data.destroy;
|
|
3740
|
-
}
|
|
3079
|
+
loadProperty(this, "destroy", data.destroy);
|
|
3741
3080
|
}
|
|
3742
3081
|
}
|
|
3743
3082
|
|
|
3744
3083
|
class Size extends RangedAnimationValueWithRandom {
|
|
3745
|
-
animation;
|
|
3746
|
-
|
|
3747
|
-
super();
|
|
3748
|
-
this.animation = new SizeAnimation();
|
|
3749
|
-
this.value = 3;
|
|
3750
|
-
}
|
|
3084
|
+
animation = new SizeAnimation();
|
|
3085
|
+
value = 3;
|
|
3751
3086
|
load(data) {
|
|
3752
3087
|
super.load(data);
|
|
3753
3088
|
if (isNull(data)) {
|
|
@@ -3790,10 +3125,7 @@
|
|
|
3790
3125
|
(particle.size.loops ?? minLoops) < (particle.size.maxLoops ?? minLoops))));
|
|
3791
3126
|
}
|
|
3792
3127
|
loadOptions(options, ...sources) {
|
|
3793
|
-
options
|
|
3794
|
-
for (const source of sources) {
|
|
3795
|
-
options.size.load(source?.size);
|
|
3796
|
-
}
|
|
3128
|
+
loadOptionProperty(options, "size", Size, ...sources);
|
|
3797
3129
|
}
|
|
3798
3130
|
preInit(particle) {
|
|
3799
3131
|
const pxRatio = this.#container.retina.pixelRatio, options = particle.options, sizeOptions = options.size;
|
|
@@ -3816,7 +3148,7 @@
|
|
|
3816
3148
|
}
|
|
3817
3149
|
|
|
3818
3150
|
async function loadSizeUpdater(engine) {
|
|
3819
|
-
engine.checkVersion("4.
|
|
3151
|
+
engine.checkVersion("4.2.0");
|
|
3820
3152
|
await engine.pluginManager.register(e => {
|
|
3821
3153
|
e.pluginManager.addParticleUpdater("size", container => {
|
|
3822
3154
|
return Promise.resolve(new SizeUpdater(container));
|
|
@@ -3825,7 +3157,7 @@
|
|
|
3825
3157
|
}
|
|
3826
3158
|
|
|
3827
3159
|
async function loadBasic(engine) {
|
|
3828
|
-
engine.checkVersion("4.
|
|
3160
|
+
engine.checkVersion("4.2.0");
|
|
3829
3161
|
await engine.pluginManager.register(async (e) => {
|
|
3830
3162
|
await Promise.all([
|
|
3831
3163
|
loadBlendPlugin(e),
|
|
@@ -3846,78 +3178,46 @@
|
|
|
3846
3178
|
count;
|
|
3847
3179
|
delay;
|
|
3848
3180
|
duration;
|
|
3849
|
-
wait;
|
|
3850
|
-
constructor() {
|
|
3851
|
-
this.wait = false;
|
|
3852
|
-
}
|
|
3181
|
+
wait = false;
|
|
3853
3182
|
load(data) {
|
|
3854
3183
|
if (isNull(data)) {
|
|
3855
3184
|
return;
|
|
3856
3185
|
}
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
this.delay = setRangeValue(data.delay);
|
|
3862
|
-
}
|
|
3863
|
-
if (data.duration !== undefined) {
|
|
3864
|
-
this.duration = setRangeValue(data.duration);
|
|
3865
|
-
}
|
|
3866
|
-
if (data.wait !== undefined) {
|
|
3867
|
-
this.wait = data.wait;
|
|
3868
|
-
}
|
|
3186
|
+
loadProperty(this, "count", data.count);
|
|
3187
|
+
loadRangeProperty(this, "delay", data.delay);
|
|
3188
|
+
loadRangeProperty(this, "duration", data.duration);
|
|
3189
|
+
loadProperty(this, "wait", data.wait);
|
|
3869
3190
|
}
|
|
3870
3191
|
}
|
|
3871
3192
|
|
|
3872
3193
|
class EmitterRate {
|
|
3873
|
-
delay;
|
|
3874
|
-
quantity;
|
|
3875
|
-
constructor() {
|
|
3876
|
-
this.quantity = 1;
|
|
3877
|
-
this.delay = 0.1;
|
|
3878
|
-
}
|
|
3194
|
+
delay = 0.1;
|
|
3195
|
+
quantity = 1;
|
|
3879
3196
|
load(data) {
|
|
3880
3197
|
if (isNull(data)) {
|
|
3881
3198
|
return;
|
|
3882
3199
|
}
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
}
|
|
3886
|
-
if (data.delay !== undefined) {
|
|
3887
|
-
this.delay = setRangeValue(data.delay);
|
|
3888
|
-
}
|
|
3200
|
+
loadRangeProperty(this, "quantity", data.quantity);
|
|
3201
|
+
loadRangeProperty(this, "delay", data.delay);
|
|
3889
3202
|
}
|
|
3890
3203
|
}
|
|
3891
3204
|
|
|
3892
3205
|
class EmitterShapeReplace {
|
|
3893
|
-
color;
|
|
3894
|
-
opacity;
|
|
3895
|
-
constructor() {
|
|
3896
|
-
this.color = false;
|
|
3897
|
-
this.opacity = false;
|
|
3898
|
-
}
|
|
3206
|
+
color = false;
|
|
3207
|
+
opacity = false;
|
|
3899
3208
|
load(data) {
|
|
3900
3209
|
if (isNull(data)) {
|
|
3901
3210
|
return;
|
|
3902
3211
|
}
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
}
|
|
3906
|
-
if (data.opacity !== undefined) {
|
|
3907
|
-
this.opacity = data.opacity;
|
|
3908
|
-
}
|
|
3212
|
+
loadProperty(this, "color", data.color);
|
|
3213
|
+
loadProperty(this, "opacity", data.opacity);
|
|
3909
3214
|
}
|
|
3910
3215
|
}
|
|
3911
3216
|
|
|
3912
3217
|
class EmitterShape {
|
|
3913
|
-
options;
|
|
3914
|
-
replace;
|
|
3915
|
-
type;
|
|
3916
|
-
constructor() {
|
|
3917
|
-
this.options = {};
|
|
3918
|
-
this.replace = new EmitterShapeReplace();
|
|
3919
|
-
this.type = "square";
|
|
3920
|
-
}
|
|
3218
|
+
options = {};
|
|
3219
|
+
replace = new EmitterShapeReplace();
|
|
3220
|
+
type = "square";
|
|
3921
3221
|
load(data) {
|
|
3922
3222
|
if (isNull(data)) {
|
|
3923
3223
|
return;
|
|
@@ -3926,34 +3226,21 @@
|
|
|
3926
3226
|
this.options = deepExtend({}, data.options ?? {});
|
|
3927
3227
|
}
|
|
3928
3228
|
this.replace.load(data.replace);
|
|
3929
|
-
|
|
3930
|
-
this.type = data.type;
|
|
3931
|
-
}
|
|
3229
|
+
loadProperty(this, "type", data.type);
|
|
3932
3230
|
}
|
|
3933
3231
|
}
|
|
3934
3232
|
|
|
3935
3233
|
class EmitterSize {
|
|
3936
|
-
height;
|
|
3937
|
-
mode;
|
|
3938
|
-
width;
|
|
3939
|
-
constructor() {
|
|
3940
|
-
this.mode = exports.PixelMode.percent;
|
|
3941
|
-
this.height = 0;
|
|
3942
|
-
this.width = 0;
|
|
3943
|
-
}
|
|
3234
|
+
height = 0;
|
|
3235
|
+
mode = exports.PixelMode.percent;
|
|
3236
|
+
width = 0;
|
|
3944
3237
|
load(data) {
|
|
3945
3238
|
if (isNull(data)) {
|
|
3946
3239
|
return;
|
|
3947
3240
|
}
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
if (data.height !== undefined) {
|
|
3952
|
-
this.height = data.height;
|
|
3953
|
-
}
|
|
3954
|
-
if (data.width !== undefined) {
|
|
3955
|
-
this.width = data.width;
|
|
3956
|
-
}
|
|
3241
|
+
loadProperty(this, "mode", data.mode);
|
|
3242
|
+
loadProperty(this, "height", data.height);
|
|
3243
|
+
loadProperty(this, "width", data.width);
|
|
3957
3244
|
}
|
|
3958
3245
|
}
|
|
3959
3246
|
|
|
@@ -3976,50 +3263,35 @@
|
|
|
3976
3263
|
}
|
|
3977
3264
|
|
|
3978
3265
|
class Emitter {
|
|
3979
|
-
autoPlay;
|
|
3266
|
+
autoPlay = true;
|
|
3980
3267
|
direction;
|
|
3981
3268
|
domId;
|
|
3982
|
-
fill;
|
|
3983
|
-
life;
|
|
3269
|
+
fill = true;
|
|
3270
|
+
life = new EmitterLife();
|
|
3984
3271
|
name;
|
|
3985
3272
|
particles;
|
|
3986
3273
|
position;
|
|
3987
|
-
rate;
|
|
3988
|
-
shape;
|
|
3274
|
+
rate = new EmitterRate();
|
|
3275
|
+
shape = new EmitterShape();
|
|
3989
3276
|
size;
|
|
3990
|
-
spawn;
|
|
3277
|
+
spawn = new EmitterSpawn();
|
|
3991
3278
|
spawnFillColor;
|
|
3992
3279
|
spawnStrokeColor;
|
|
3993
|
-
startCount;
|
|
3994
|
-
constructor() {
|
|
3995
|
-
this.autoPlay = true;
|
|
3996
|
-
this.fill = true;
|
|
3997
|
-
this.life = new EmitterLife();
|
|
3998
|
-
this.rate = new EmitterRate();
|
|
3999
|
-
this.shape = new EmitterShape();
|
|
4000
|
-
this.spawn = new EmitterSpawn();
|
|
4001
|
-
this.startCount = 0;
|
|
4002
|
-
}
|
|
3280
|
+
startCount = 0;
|
|
4003
3281
|
load(data) {
|
|
4004
3282
|
if (isNull(data)) {
|
|
4005
3283
|
return;
|
|
4006
3284
|
}
|
|
4007
|
-
|
|
4008
|
-
this.autoPlay = data.autoPlay;
|
|
4009
|
-
}
|
|
3285
|
+
loadProperty(this, "autoPlay", data.autoPlay);
|
|
4010
3286
|
if (data.size !== undefined) {
|
|
4011
3287
|
this.size ??= new EmitterSize();
|
|
4012
3288
|
this.size.load(data.size);
|
|
4013
3289
|
}
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
this.domId = data.domId;
|
|
4018
|
-
if (data.fill !== undefined) {
|
|
4019
|
-
this.fill = data.fill;
|
|
4020
|
-
}
|
|
3290
|
+
loadProperty(this, "direction", data.direction);
|
|
3291
|
+
loadProperty(this, "domId", data.domId);
|
|
3292
|
+
loadProperty(this, "fill", data.fill);
|
|
4021
3293
|
this.life.load(data.life);
|
|
4022
|
-
this
|
|
3294
|
+
loadProperty(this, "name", data.name);
|
|
4023
3295
|
this.particles = executeOnSingleOrMultiple(data.particles, particles => {
|
|
4024
3296
|
return deepExtend({}, particles);
|
|
4025
3297
|
});
|
|
@@ -4043,9 +3315,7 @@
|
|
|
4043
3315
|
this.spawnStrokeColor ??= new AnimatableColor();
|
|
4044
3316
|
this.spawnStrokeColor.load(data.spawnStrokeColor);
|
|
4045
3317
|
}
|
|
4046
|
-
|
|
4047
|
-
this.startCount = data.startCount;
|
|
4048
|
-
}
|
|
3318
|
+
loadProperty(this, "startCount", data.startCount);
|
|
4049
3319
|
}
|
|
4050
3320
|
}
|
|
4051
3321
|
|
|
@@ -4127,7 +3397,7 @@
|
|
|
4127
3397
|
})(EmitterClickMode || (EmitterClickMode = {}));
|
|
4128
3398
|
|
|
4129
3399
|
async function loadEmittersPluginSimple(engine) {
|
|
4130
|
-
engine.checkVersion("4.
|
|
3400
|
+
engine.checkVersion("4.2.0");
|
|
4131
3401
|
await engine.pluginManager.register(async (e) => {
|
|
4132
3402
|
const instancesManager = await getEmittersInstancesManager(e);
|
|
4133
3403
|
await addEmittersShapesManager(e);
|
|
@@ -4215,7 +3485,7 @@
|
|
|
4215
3485
|
}
|
|
4216
3486
|
|
|
4217
3487
|
async function loadEmittersShapeSquare(engine) {
|
|
4218
|
-
engine.checkVersion("4.
|
|
3488
|
+
engine.checkVersion("4.2.0");
|
|
4219
3489
|
await engine.pluginManager.register((e) => {
|
|
4220
3490
|
ensureEmittersPluginLoaded(e);
|
|
4221
3491
|
e.pluginManager.addEmitterShapeGenerator?.("square", new EmittersSquareShapeGenerator());
|
|
@@ -4223,55 +3493,36 @@
|
|
|
4223
3493
|
}
|
|
4224
3494
|
|
|
4225
3495
|
class LifeDelay extends ValueWithRandom {
|
|
4226
|
-
sync;
|
|
4227
|
-
constructor() {
|
|
4228
|
-
super();
|
|
4229
|
-
this.sync = false;
|
|
4230
|
-
}
|
|
3496
|
+
sync = false;
|
|
4231
3497
|
load(data) {
|
|
4232
3498
|
if (isNull(data)) {
|
|
4233
3499
|
return;
|
|
4234
3500
|
}
|
|
4235
3501
|
super.load(data);
|
|
4236
|
-
|
|
4237
|
-
this.sync = data.sync;
|
|
4238
|
-
}
|
|
3502
|
+
loadProperty(this, "sync", data.sync);
|
|
4239
3503
|
}
|
|
4240
3504
|
}
|
|
4241
3505
|
|
|
4242
3506
|
class LifeDuration extends ValueWithRandom {
|
|
4243
|
-
sync;
|
|
4244
|
-
constructor() {
|
|
4245
|
-
super();
|
|
4246
|
-
this.sync = false;
|
|
4247
|
-
}
|
|
3507
|
+
sync = false;
|
|
4248
3508
|
load(data) {
|
|
4249
3509
|
if (isNull(data)) {
|
|
4250
3510
|
return;
|
|
4251
3511
|
}
|
|
4252
3512
|
super.load(data);
|
|
4253
|
-
|
|
4254
|
-
this.sync = data.sync;
|
|
4255
|
-
}
|
|
3513
|
+
loadProperty(this, "sync", data.sync);
|
|
4256
3514
|
}
|
|
4257
3515
|
}
|
|
4258
3516
|
|
|
4259
3517
|
class Life {
|
|
4260
|
-
count;
|
|
4261
|
-
delay;
|
|
4262
|
-
duration;
|
|
4263
|
-
constructor() {
|
|
4264
|
-
this.count = 0;
|
|
4265
|
-
this.delay = new LifeDelay();
|
|
4266
|
-
this.duration = new LifeDuration();
|
|
4267
|
-
}
|
|
3518
|
+
count = 0;
|
|
3519
|
+
delay = new LifeDelay();
|
|
3520
|
+
duration = new LifeDuration();
|
|
4268
3521
|
load(data) {
|
|
4269
3522
|
if (isNull(data)) {
|
|
4270
3523
|
return;
|
|
4271
3524
|
}
|
|
4272
|
-
|
|
4273
|
-
this.count = data.count;
|
|
4274
|
-
}
|
|
3525
|
+
loadProperty(this, "count", data.count);
|
|
4275
3526
|
this.delay.load(data.delay);
|
|
4276
3527
|
this.duration.load(data.duration);
|
|
4277
3528
|
}
|
|
@@ -4330,7 +3581,7 @@
|
|
|
4330
3581
|
}
|
|
4331
3582
|
}
|
|
4332
3583
|
|
|
4333
|
-
const noTime = 0, identity$
|
|
3584
|
+
const noTime = 0, identity$1 = 1, infiniteValue = -1;
|
|
4334
3585
|
class LifeUpdater {
|
|
4335
3586
|
#container;
|
|
4336
3587
|
constructor(container) {
|
|
@@ -4341,7 +3592,7 @@
|
|
|
4341
3592
|
if (!lifeOptions) {
|
|
4342
3593
|
return;
|
|
4343
3594
|
}
|
|
4344
|
-
const delayFactor = lifeOptions.delay.sync ? identity$
|
|
3595
|
+
const delayFactor = lifeOptions.delay.sync ? identity$1 : getRandom(), durationFactor = lifeOptions.duration.sync ? identity$1 : getRandom();
|
|
4345
3596
|
particle.life = {
|
|
4346
3597
|
delay: container.retina.reduceFactor
|
|
4347
3598
|
? ((getRangeValue(lifeOptions.delay.value) * delayFactor) / container.retina.reduceFactor) *
|
|
@@ -4367,10 +3618,7 @@
|
|
|
4367
3618
|
return !particle.destroyed;
|
|
4368
3619
|
}
|
|
4369
3620
|
loadOptions(options, ...sources) {
|
|
4370
|
-
options
|
|
4371
|
-
for (const source of sources) {
|
|
4372
|
-
options.life.load(source?.life);
|
|
4373
|
-
}
|
|
3621
|
+
loadOptionProperty(options, "life", Life, ...sources);
|
|
4374
3622
|
}
|
|
4375
3623
|
update(particle, delta) {
|
|
4376
3624
|
if (!this.isEnabled(particle) || !particle.life) {
|
|
@@ -4381,7 +3629,7 @@
|
|
|
4381
3629
|
}
|
|
4382
3630
|
|
|
4383
3631
|
async function loadLifeUpdater(engine) {
|
|
4384
|
-
engine.checkVersion("4.
|
|
3632
|
+
engine.checkVersion("4.2.0");
|
|
4385
3633
|
await engine.pluginManager.register(e => {
|
|
4386
3634
|
e.pluginManager.addParticleUpdater("life", container => {
|
|
4387
3635
|
return Promise.resolve(new LifeUpdater(container));
|
|
@@ -4390,39 +3638,25 @@
|
|
|
4390
3638
|
}
|
|
4391
3639
|
|
|
4392
3640
|
class MotionReduce {
|
|
4393
|
-
factor;
|
|
4394
|
-
value;
|
|
4395
|
-
constructor() {
|
|
4396
|
-
this.factor = 4;
|
|
4397
|
-
this.value = true;
|
|
4398
|
-
}
|
|
3641
|
+
factor = 4;
|
|
3642
|
+
value = true;
|
|
4399
3643
|
load(data) {
|
|
4400
3644
|
if (isNull(data)) {
|
|
4401
3645
|
return;
|
|
4402
3646
|
}
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
}
|
|
4406
|
-
if (data.value !== undefined) {
|
|
4407
|
-
this.value = data.value;
|
|
4408
|
-
}
|
|
3647
|
+
loadProperty(this, "factor", data.factor);
|
|
3648
|
+
loadProperty(this, "value", data.value);
|
|
4409
3649
|
}
|
|
4410
3650
|
}
|
|
4411
3651
|
|
|
4412
3652
|
class Motion {
|
|
4413
|
-
disable;
|
|
4414
|
-
reduce;
|
|
4415
|
-
constructor() {
|
|
4416
|
-
this.disable = true;
|
|
4417
|
-
this.reduce = new MotionReduce();
|
|
4418
|
-
}
|
|
3653
|
+
disable = true;
|
|
3654
|
+
reduce = new MotionReduce();
|
|
4419
3655
|
load(data) {
|
|
4420
3656
|
if (isNull(data)) {
|
|
4421
3657
|
return;
|
|
4422
3658
|
}
|
|
4423
|
-
|
|
4424
|
-
this.disable = data.disable;
|
|
4425
|
-
}
|
|
3659
|
+
loadProperty(this, "disable", data.disable);
|
|
4426
3660
|
this.reduce.load(data.reduce);
|
|
4427
3661
|
}
|
|
4428
3662
|
}
|
|
@@ -4449,7 +3683,7 @@
|
|
|
4449
3683
|
}
|
|
4450
3684
|
|
|
4451
3685
|
async function loadMotionPlugin(engine) {
|
|
4452
|
-
engine.checkVersion("4.
|
|
3686
|
+
engine.checkVersion("4.2.0");
|
|
4453
3687
|
await engine.pluginManager.register(e => {
|
|
4454
3688
|
e.pluginManager.addPlugin(new MotionPlugin());
|
|
4455
3689
|
});
|
|
@@ -4847,39 +4081,30 @@
|
|
|
4847
4081
|
}
|
|
4848
4082
|
|
|
4849
4083
|
async function loadRibbonShape(engine) {
|
|
4850
|
-
engine.checkVersion("4.
|
|
4084
|
+
engine.checkVersion("4.2.0");
|
|
4851
4085
|
await engine.pluginManager.register(e => {
|
|
4852
4086
|
e.pluginManager.addShape(["ribbon"], (container) => Promise.resolve(new RibbonDrawer(container)));
|
|
4853
4087
|
});
|
|
4854
4088
|
}
|
|
4855
4089
|
|
|
4856
4090
|
class RibbonsOptions {
|
|
4857
|
-
angle;
|
|
4858
4091
|
colors;
|
|
4859
4092
|
count;
|
|
4860
4093
|
disableForReducedMotion;
|
|
4861
|
-
drift;
|
|
4862
4094
|
emitterSize;
|
|
4863
|
-
|
|
4095
|
+
positionX;
|
|
4864
4096
|
ribbonOptions;
|
|
4865
4097
|
scalar;
|
|
4866
|
-
spread;
|
|
4867
4098
|
ticks;
|
|
4868
4099
|
zIndex;
|
|
4869
4100
|
constructor() {
|
|
4870
|
-
this.angle = 90;
|
|
4871
4101
|
this.count = 5;
|
|
4872
|
-
this.spread = 0;
|
|
4873
|
-
this.drift = 0;
|
|
4874
4102
|
this.emitterSize = {
|
|
4875
4103
|
width: 100,
|
|
4876
4104
|
height: 0,
|
|
4877
4105
|
};
|
|
4106
|
+
this.positionX = 50;
|
|
4878
4107
|
this.ticks = 200;
|
|
4879
|
-
this.position = {
|
|
4880
|
-
x: 50,
|
|
4881
|
-
y: 0,
|
|
4882
|
-
};
|
|
4883
4108
|
this.colors = ["#FF0055", "#00D1FF", "#FFD23F", "#61FF7E", "#B284FF"];
|
|
4884
4109
|
this.ribbonOptions = {
|
|
4885
4110
|
angle: 45,
|
|
@@ -4910,13 +4135,12 @@
|
|
|
4910
4135
|
}
|
|
4911
4136
|
get origin() {
|
|
4912
4137
|
return {
|
|
4913
|
-
x: this.
|
|
4914
|
-
y:
|
|
4138
|
+
x: this.positionX / percentDenominator,
|
|
4139
|
+
y: 0,
|
|
4915
4140
|
};
|
|
4916
4141
|
}
|
|
4917
4142
|
set origin(value) {
|
|
4918
|
-
this.
|
|
4919
|
-
this.position.y = value.y * percentDenominator;
|
|
4143
|
+
this.positionX = value.x * percentDenominator;
|
|
4920
4144
|
}
|
|
4921
4145
|
get particleCount() {
|
|
4922
4146
|
return this.count;
|
|
@@ -4924,26 +4148,24 @@
|
|
|
4924
4148
|
set particleCount(value) {
|
|
4925
4149
|
this.count = value;
|
|
4926
4150
|
}
|
|
4151
|
+
get position() {
|
|
4152
|
+
return {
|
|
4153
|
+
x: this.positionX,
|
|
4154
|
+
y: 0,
|
|
4155
|
+
};
|
|
4156
|
+
}
|
|
4157
|
+
set position(value) {
|
|
4158
|
+
this.positionX = value.x;
|
|
4159
|
+
}
|
|
4927
4160
|
load(data) {
|
|
4928
4161
|
if (isNull(data)) {
|
|
4929
4162
|
return;
|
|
4930
4163
|
}
|
|
4931
|
-
if (data.angle !== undefined) {
|
|
4932
|
-
this.angle = data.angle;
|
|
4933
|
-
}
|
|
4934
4164
|
const count = data.count ?? data.particleCount;
|
|
4935
4165
|
if (count !== undefined) {
|
|
4936
4166
|
this.count = count;
|
|
4937
4167
|
}
|
|
4938
|
-
|
|
4939
|
-
this.spread = data.spread;
|
|
4940
|
-
}
|
|
4941
|
-
if (data.drift !== undefined) {
|
|
4942
|
-
this.drift = data.drift;
|
|
4943
|
-
}
|
|
4944
|
-
if (data.ticks !== undefined) {
|
|
4945
|
-
this.ticks = data.ticks;
|
|
4946
|
-
}
|
|
4168
|
+
loadProperty(this, "ticks", data.ticks);
|
|
4947
4169
|
if (data.emitterSize) {
|
|
4948
4170
|
if (data.emitterSize.width !== undefined) {
|
|
4949
4171
|
this.emitterSize.width = data.emitterSize.width;
|
|
@@ -4952,20 +4174,20 @@
|
|
|
4952
4174
|
this.emitterSize.height = data.emitterSize.height;
|
|
4953
4175
|
}
|
|
4954
4176
|
}
|
|
4955
|
-
|
|
4956
|
-
if (
|
|
4957
|
-
|
|
4958
|
-
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
if (position) {
|
|
4964
|
-
if (position.x !== undefined) {
|
|
4965
|
-
this.position.x = position.x;
|
|
4177
|
+
loadProperty(this, "positionX", data.positionX);
|
|
4178
|
+
if (data.positionX === undefined) {
|
|
4179
|
+
const origin = data.origin;
|
|
4180
|
+
if (origin && !data.position) {
|
|
4181
|
+
data.position = {
|
|
4182
|
+
x: origin.x === undefined ? undefined : origin.x * percentDenominator,
|
|
4183
|
+
y: 0,
|
|
4184
|
+
};
|
|
4966
4185
|
}
|
|
4967
|
-
|
|
4968
|
-
|
|
4186
|
+
const position = data.position;
|
|
4187
|
+
if (position) {
|
|
4188
|
+
if (position.x !== undefined) {
|
|
4189
|
+
this.positionX = position.x;
|
|
4190
|
+
}
|
|
4969
4191
|
}
|
|
4970
4192
|
}
|
|
4971
4193
|
if (data.colors !== undefined) {
|
|
@@ -4979,15 +4201,9 @@
|
|
|
4979
4201
|
if (data.ribbonOptions !== undefined) {
|
|
4980
4202
|
this.ribbonOptions = deepExtend({}, data.ribbonOptions);
|
|
4981
4203
|
}
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
if (data.zIndex !== undefined) {
|
|
4986
|
-
this.zIndex = data.zIndex;
|
|
4987
|
-
}
|
|
4988
|
-
if (data.disableForReducedMotion !== undefined) {
|
|
4989
|
-
this.disableForReducedMotion = data.disableForReducedMotion;
|
|
4990
|
-
}
|
|
4204
|
+
loadProperty(this, "scalar", data.scalar);
|
|
4205
|
+
loadProperty(this, "zIndex", data.zIndex);
|
|
4206
|
+
loadProperty(this, "disableForReducedMotion", data.disableForReducedMotion);
|
|
4991
4207
|
}
|
|
4992
4208
|
}
|
|
4993
4209
|
|
|
@@ -4996,7 +4212,7 @@
|
|
|
4996
4212
|
await container.addEmitter?.({
|
|
4997
4213
|
startCount: actualOptions.count,
|
|
4998
4214
|
position: {
|
|
4999
|
-
x: actualOptions.
|
|
4215
|
+
x: actualOptions.positionX,
|
|
5000
4216
|
y: emitterTop,
|
|
5001
4217
|
},
|
|
5002
4218
|
shape: {
|
|
@@ -5136,7 +4352,7 @@
|
|
|
5136
4352
|
name: "ribbons",
|
|
5137
4353
|
startCount: actualOptions.count,
|
|
5138
4354
|
position: {
|
|
5139
|
-
x: actualOptions.
|
|
4355
|
+
x: actualOptions.positionX,
|
|
5140
4356
|
y: emitterTop,
|
|
5141
4357
|
},
|
|
5142
4358
|
shape: {
|
|
@@ -5188,7 +4404,7 @@
|
|
|
5188
4404
|
|
|
5189
4405
|
let initPromise = null;
|
|
5190
4406
|
async function doInitPlugins(engine) {
|
|
5191
|
-
engine.checkVersion("4.
|
|
4407
|
+
engine.checkVersion("4.2.0");
|
|
5192
4408
|
await engine.pluginManager.register(async (e) => {
|
|
5193
4409
|
const emittersRegister = async (engine) => {
|
|
5194
4410
|
await loadEmittersPluginSimple(engine);
|
|
@@ -5255,7 +4471,7 @@
|
|
|
5255
4471
|
ribbons.init = async () => {
|
|
5256
4472
|
await initPlugins(tsParticles);
|
|
5257
4473
|
};
|
|
5258
|
-
ribbons.version = "4.
|
|
4474
|
+
ribbons.version = "4.2.0";
|
|
5259
4475
|
globalThis.ribbons = ribbons;
|
|
5260
4476
|
|
|
5261
4477
|
const globalObject = globalThis;
|
|
@@ -5316,7 +4532,7 @@
|
|
|
5316
4532
|
return;
|
|
5317
4533
|
}
|
|
5318
4534
|
this.draw(ctx => {
|
|
5319
|
-
|
|
4535
|
+
ctx.clearRect(originPoint.x, originPoint.y, this.#canvasManager.size.width, this.#canvasManager.size.height);
|
|
5320
4536
|
});
|
|
5321
4537
|
}
|
|
5322
4538
|
clear() {
|
|
@@ -5378,7 +4594,7 @@
|
|
|
5378
4594
|
plugin.drawParticleSetup?.(context, particle, delta);
|
|
5379
4595
|
}
|
|
5380
4596
|
this.#applyPreDrawUpdaters(context, particle, radius, opacity, colorStyles, transform);
|
|
5381
|
-
drawParticle({
|
|
4597
|
+
this.#drawParticle({
|
|
5382
4598
|
container,
|
|
5383
4599
|
context,
|
|
5384
4600
|
particle,
|
|
@@ -5397,7 +4613,7 @@
|
|
|
5397
4613
|
drawParticlePlugins(particle, delta) {
|
|
5398
4614
|
this.draw(ctx => {
|
|
5399
4615
|
for (const plugin of this.#drawParticlePlugins) {
|
|
5400
|
-
drawParticlePlugin(ctx, plugin, particle, delta);
|
|
4616
|
+
this.#drawParticlePlugin(ctx, plugin, particle, delta);
|
|
5401
4617
|
}
|
|
5402
4618
|
});
|
|
5403
4619
|
}
|
|
@@ -5497,12 +4713,19 @@
|
|
|
5497
4713
|
}
|
|
5498
4714
|
paintBase(baseColor) {
|
|
5499
4715
|
this.draw(ctx => {
|
|
5500
|
-
|
|
4716
|
+
ctx.fillStyle = baseColor ?? "rgba(0,0,0,0)";
|
|
4717
|
+
ctx.fillRect(originPoint.x, originPoint.y, this.#canvasManager.size.width, this.#canvasManager.size.height);
|
|
5501
4718
|
});
|
|
5502
4719
|
}
|
|
5503
4720
|
paintImage(image, opacity) {
|
|
5504
4721
|
this.draw(ctx => {
|
|
5505
|
-
|
|
4722
|
+
if (!image) {
|
|
4723
|
+
return;
|
|
4724
|
+
}
|
|
4725
|
+
const prevAlpha = ctx.globalAlpha;
|
|
4726
|
+
ctx.globalAlpha = opacity;
|
|
4727
|
+
ctx.drawImage(image, originPoint.x, originPoint.y, this.#canvasManager.size.width, this.#canvasManager.size.height);
|
|
4728
|
+
ctx.globalAlpha = prevAlpha;
|
|
5506
4729
|
});
|
|
5507
4730
|
}
|
|
5508
4731
|
setContext(context) {
|
|
@@ -5516,15 +4739,15 @@
|
|
|
5516
4739
|
}
|
|
5517
4740
|
stop() {
|
|
5518
4741
|
this.draw(ctx => {
|
|
5519
|
-
|
|
4742
|
+
ctx.clearRect(originPoint.x, originPoint.y, this.#canvasManager.size.width, this.#canvasManager.size.height);
|
|
5520
4743
|
});
|
|
5521
4744
|
}
|
|
5522
|
-
#applyPostDrawUpdaters
|
|
4745
|
+
#applyPostDrawUpdaters(particle) {
|
|
5523
4746
|
for (const updater of this.#postDrawUpdaters) {
|
|
5524
4747
|
updater.afterDraw?.(particle);
|
|
5525
4748
|
}
|
|
5526
|
-
}
|
|
5527
|
-
#applyPreDrawUpdaters
|
|
4749
|
+
}
|
|
4750
|
+
#applyPreDrawUpdaters(ctx, particle, radius, zOpacity, colorStyles, transform) {
|
|
5528
4751
|
for (const updater of this.#preDrawUpdaters) {
|
|
5529
4752
|
if (updater.getColorStyles) {
|
|
5530
4753
|
const { fill, stroke } = updater.getColorStyles(particle, ctx, radius, zOpacity);
|
|
@@ -5543,8 +4766,114 @@
|
|
|
5543
4766
|
}
|
|
5544
4767
|
updater.beforeDraw?.(particle);
|
|
5545
4768
|
}
|
|
5546
|
-
}
|
|
5547
|
-
#
|
|
4769
|
+
}
|
|
4770
|
+
#drawAfterEffect(drawer, data) {
|
|
4771
|
+
if (!drawer?.drawAfter) {
|
|
4772
|
+
return;
|
|
4773
|
+
}
|
|
4774
|
+
const { particle } = data;
|
|
4775
|
+
if (!particle.effect) {
|
|
4776
|
+
return;
|
|
4777
|
+
}
|
|
4778
|
+
drawer.drawAfter(data);
|
|
4779
|
+
}
|
|
4780
|
+
#drawBeforeEffect(drawer, data) {
|
|
4781
|
+
if (!drawer?.drawBefore) {
|
|
4782
|
+
return;
|
|
4783
|
+
}
|
|
4784
|
+
const { particle } = data;
|
|
4785
|
+
if (!particle.effect) {
|
|
4786
|
+
return;
|
|
4787
|
+
}
|
|
4788
|
+
drawer.drawBefore(data);
|
|
4789
|
+
}
|
|
4790
|
+
#drawParticle(data) {
|
|
4791
|
+
const { container, context, particle, delta, colorStyles, radius, opacity, transform } = data, { effectDrawers, shapeDrawers } = container, pos = particle.getPosition(), transformData = particle.getTransformData(transform), drawScale = defaultZoom, drawPosition = {
|
|
4792
|
+
x: pos.x,
|
|
4793
|
+
y: pos.y,
|
|
4794
|
+
};
|
|
4795
|
+
context.setTransform(transformData.a, transformData.b, transformData.c, transformData.d, pos.x, pos.y);
|
|
4796
|
+
if (colorStyles.fill) {
|
|
4797
|
+
context.fillStyle = colorStyles.fill;
|
|
4798
|
+
}
|
|
4799
|
+
const fillEnabled = !!particle.fillEnabled, strokeWidth = particle.strokeWidth ?? minStrokeWidth;
|
|
4800
|
+
context.lineWidth = strokeWidth;
|
|
4801
|
+
if (colorStyles.stroke) {
|
|
4802
|
+
context.strokeStyle = colorStyles.stroke;
|
|
4803
|
+
}
|
|
4804
|
+
const drawData = {
|
|
4805
|
+
context,
|
|
4806
|
+
particle,
|
|
4807
|
+
radius,
|
|
4808
|
+
drawRadius: radius * drawScale,
|
|
4809
|
+
opacity,
|
|
4810
|
+
delta,
|
|
4811
|
+
pixelRatio: container.retina.pixelRatio,
|
|
4812
|
+
fill: fillEnabled,
|
|
4813
|
+
stroke: strokeWidth > minStrokeWidth,
|
|
4814
|
+
transformData,
|
|
4815
|
+
position: { ...pos },
|
|
4816
|
+
drawPosition,
|
|
4817
|
+
drawScale,
|
|
4818
|
+
};
|
|
4819
|
+
for (const plugin of container.plugins) {
|
|
4820
|
+
plugin.drawParticleTransform?.(drawData);
|
|
4821
|
+
}
|
|
4822
|
+
const effect = particle.effect ? effectDrawers.get(particle.effect) : undefined, shape = particle.shape ? shapeDrawers.get(particle.shape) : undefined;
|
|
4823
|
+
this.#drawBeforeEffect(effect, drawData);
|
|
4824
|
+
this.#drawShapeBeforeDraw(shape, drawData);
|
|
4825
|
+
this.#drawShape(shape, drawData);
|
|
4826
|
+
this.#drawShapeAfterDraw(shape, drawData);
|
|
4827
|
+
this.#drawAfterEffect(effect, drawData);
|
|
4828
|
+
context.resetTransform();
|
|
4829
|
+
}
|
|
4830
|
+
#drawParticlePlugin(context, plugin, particle, delta) {
|
|
4831
|
+
if (!plugin.drawParticle) {
|
|
4832
|
+
return;
|
|
4833
|
+
}
|
|
4834
|
+
plugin.drawParticle(context, particle, delta);
|
|
4835
|
+
}
|
|
4836
|
+
#drawShape(drawer, data) {
|
|
4837
|
+
if (!drawer) {
|
|
4838
|
+
return;
|
|
4839
|
+
}
|
|
4840
|
+
const { context, fill, particle, stroke } = data;
|
|
4841
|
+
if (!particle.shape) {
|
|
4842
|
+
return;
|
|
4843
|
+
}
|
|
4844
|
+
context.beginPath();
|
|
4845
|
+
drawer.draw(data);
|
|
4846
|
+
if (particle.shapeClose) {
|
|
4847
|
+
context.closePath();
|
|
4848
|
+
}
|
|
4849
|
+
if (fill) {
|
|
4850
|
+
context.fill();
|
|
4851
|
+
}
|
|
4852
|
+
if (stroke) {
|
|
4853
|
+
context.stroke();
|
|
4854
|
+
}
|
|
4855
|
+
}
|
|
4856
|
+
#drawShapeAfterDraw(drawer, data) {
|
|
4857
|
+
if (!drawer?.afterDraw) {
|
|
4858
|
+
return;
|
|
4859
|
+
}
|
|
4860
|
+
const { particle } = data;
|
|
4861
|
+
if (!particle.shape) {
|
|
4862
|
+
return;
|
|
4863
|
+
}
|
|
4864
|
+
drawer.afterDraw(data);
|
|
4865
|
+
}
|
|
4866
|
+
#drawShapeBeforeDraw(drawer, data) {
|
|
4867
|
+
if (!drawer?.beforeDraw) {
|
|
4868
|
+
return;
|
|
4869
|
+
}
|
|
4870
|
+
const { particle } = data;
|
|
4871
|
+
if (!particle.shape) {
|
|
4872
|
+
return;
|
|
4873
|
+
}
|
|
4874
|
+
drawer.beforeDraw(data);
|
|
4875
|
+
}
|
|
4876
|
+
#getPluginParticleColors(particle) {
|
|
5548
4877
|
let fColor, sColor;
|
|
5549
4878
|
for (const plugin of this.#colorPlugins) {
|
|
5550
4879
|
if (!fColor && plugin.particleFillColor) {
|
|
@@ -5560,7 +4889,7 @@
|
|
|
5560
4889
|
this.#reusablePluginColors[fColorIndex] = fColor;
|
|
5561
4890
|
this.#reusablePluginColors[sColorIndex] = sColor;
|
|
5562
4891
|
return this.#reusablePluginColors;
|
|
5563
|
-
}
|
|
4892
|
+
}
|
|
5564
4893
|
}
|
|
5565
4894
|
|
|
5566
4895
|
const transferredCanvases = new WeakMap(), getTransferredCanvas = (canvas) => {
|
|
@@ -5692,6 +5021,7 @@
|
|
|
5692
5021
|
obs.observe(element, { attributes: true });
|
|
5693
5022
|
});
|
|
5694
5023
|
this.initPlugins();
|
|
5024
|
+
this.#initContext();
|
|
5695
5025
|
this.render.init();
|
|
5696
5026
|
}
|
|
5697
5027
|
initBackground() {
|
|
@@ -5701,7 +5031,7 @@
|
|
|
5701
5031
|
}
|
|
5702
5032
|
const elementStyle = element.style, color = rangeColorToRgb(this.#pluginManager, background.color);
|
|
5703
5033
|
if (color) {
|
|
5704
|
-
elementStyle.backgroundColor = getStyleFromRgb(color, container.hdr, background.opacity);
|
|
5034
|
+
elementStyle.backgroundColor = getStyleFromRgb(color, container.actualOptions.hdr, background.opacity);
|
|
5705
5035
|
}
|
|
5706
5036
|
else {
|
|
5707
5037
|
elementStyle.backgroundColor = "";
|
|
@@ -5723,7 +5053,7 @@
|
|
|
5723
5053
|
if (this.#generated && this.domElement) {
|
|
5724
5054
|
this.domElement.remove();
|
|
5725
5055
|
}
|
|
5726
|
-
const
|
|
5056
|
+
const domCanvas = isHtmlCanvasElement(canvas) ? canvas : undefined;
|
|
5727
5057
|
this.domElement = domCanvas;
|
|
5728
5058
|
this.#generated = domCanvas ? domCanvas.dataset[generatedAttribute] === "true" : false;
|
|
5729
5059
|
this.renderCanvas = domCanvas ? getTransferredCanvas(domCanvas) : canvas;
|
|
@@ -5744,26 +5074,6 @@
|
|
|
5744
5074
|
const pxRatio = this.#container.retina.pixelRatio, retinaSize = this.size;
|
|
5745
5075
|
renderCanvas.height = retinaSize.height = standardSize.height * pxRatio;
|
|
5746
5076
|
renderCanvas.width = retinaSize.width = standardSize.width * pxRatio;
|
|
5747
|
-
const canSupportHdrQuery = safeMatchMedia("(color-gamut: p3)");
|
|
5748
|
-
this.render.setContextSettings({
|
|
5749
|
-
alpha: true,
|
|
5750
|
-
colorSpace: canSupportHdrQuery?.matches && container.hdr ? "display-p3" : "srgb",
|
|
5751
|
-
desynchronized: true,
|
|
5752
|
-
willReadFrequently: false,
|
|
5753
|
-
});
|
|
5754
|
-
this.render.setContext(renderCanvas.getContext("2d", this.render.settings));
|
|
5755
|
-
this.#safeMutationObserver(obs => {
|
|
5756
|
-
obs.disconnect();
|
|
5757
|
-
});
|
|
5758
|
-
container.retina.init();
|
|
5759
|
-
this.initBackground();
|
|
5760
|
-
this.#safeMutationObserver(obs => {
|
|
5761
|
-
const element = this.domElement;
|
|
5762
|
-
if (!element || !(element instanceof Node)) {
|
|
5763
|
-
return;
|
|
5764
|
-
}
|
|
5765
|
-
obs.observe(element, { attributes: true });
|
|
5766
|
-
});
|
|
5767
5077
|
}
|
|
5768
5078
|
resize() {
|
|
5769
5079
|
const element = this.domElement;
|
|
@@ -5831,12 +5141,30 @@
|
|
|
5831
5141
|
await container.refresh();
|
|
5832
5142
|
}
|
|
5833
5143
|
}
|
|
5834
|
-
#applyResizePlugins
|
|
5144
|
+
#applyResizePlugins() {
|
|
5835
5145
|
for (const plugin of this.#resizePlugins) {
|
|
5836
5146
|
plugin.resize?.();
|
|
5837
5147
|
}
|
|
5838
|
-
}
|
|
5839
|
-
#
|
|
5148
|
+
}
|
|
5149
|
+
#initContext() {
|
|
5150
|
+
const container = this.#container, canSupportHdr = container.actualOptions.hdr &&
|
|
5151
|
+
safeMatchMedia("(color-gamut: p3)")?.matches &&
|
|
5152
|
+
safeMatchMedia("(dynamic-range: high)")?.matches;
|
|
5153
|
+
this.render.setContextSettings({
|
|
5154
|
+
alpha: true,
|
|
5155
|
+
desynchronized: true,
|
|
5156
|
+
willReadFrequently: false,
|
|
5157
|
+
...(canSupportHdr
|
|
5158
|
+
? { colorSpace: "display-p3", colorType: "float16" }
|
|
5159
|
+
: { colorSpace: "srgb" }),
|
|
5160
|
+
});
|
|
5161
|
+
const renderCanvas = this.renderCanvas;
|
|
5162
|
+
if (!renderCanvas) {
|
|
5163
|
+
return;
|
|
5164
|
+
}
|
|
5165
|
+
this.render.setContext(renderCanvas.getContext("2d", this.render.settings));
|
|
5166
|
+
}
|
|
5167
|
+
#initStyle() {
|
|
5840
5168
|
const element = this.domElement, options = this.#container.actualOptions;
|
|
5841
5169
|
if (!element) {
|
|
5842
5170
|
return;
|
|
@@ -5857,8 +5185,8 @@
|
|
|
5857
5185
|
}
|
|
5858
5186
|
element.style.setProperty(key, value, "important");
|
|
5859
5187
|
}
|
|
5860
|
-
}
|
|
5861
|
-
#repairStyle
|
|
5188
|
+
}
|
|
5189
|
+
#repairStyle() {
|
|
5862
5190
|
const element = this.domElement;
|
|
5863
5191
|
if (!element) {
|
|
5864
5192
|
return;
|
|
@@ -5877,27 +5205,27 @@
|
|
|
5877
5205
|
}
|
|
5878
5206
|
observer.observe(element, { attributes: true });
|
|
5879
5207
|
});
|
|
5880
|
-
}
|
|
5881
|
-
#resetOriginalStyle
|
|
5208
|
+
}
|
|
5209
|
+
#resetOriginalStyle() {
|
|
5882
5210
|
const element = this.domElement, originalStyle = this.#originalStyle;
|
|
5883
5211
|
if (!element || !originalStyle) {
|
|
5884
5212
|
return;
|
|
5885
5213
|
}
|
|
5886
5214
|
setStyle(element, originalStyle, true);
|
|
5887
|
-
}
|
|
5888
|
-
#safeMutationObserver
|
|
5215
|
+
}
|
|
5216
|
+
#safeMutationObserver(callback) {
|
|
5889
5217
|
if (!this.#mutationObserver) {
|
|
5890
5218
|
return;
|
|
5891
5219
|
}
|
|
5892
5220
|
callback(this.#mutationObserver);
|
|
5893
|
-
}
|
|
5894
|
-
#setFullScreenStyle
|
|
5221
|
+
}
|
|
5222
|
+
#setFullScreenStyle() {
|
|
5895
5223
|
const element = this.domElement;
|
|
5896
5224
|
if (!element) {
|
|
5897
5225
|
return;
|
|
5898
5226
|
}
|
|
5899
5227
|
setStyle(element, getFullScreenStyle(this.#container.actualOptions.fullScreen.zIndex), true);
|
|
5900
|
-
}
|
|
5228
|
+
}
|
|
5901
5229
|
}
|
|
5902
5230
|
|
|
5903
5231
|
class EventListeners {
|
|
@@ -5922,7 +5250,7 @@
|
|
|
5922
5250
|
removeListeners() {
|
|
5923
5251
|
this.#manageListeners(false);
|
|
5924
5252
|
}
|
|
5925
|
-
#handleVisibilityChange
|
|
5253
|
+
#handleVisibilityChange() {
|
|
5926
5254
|
const container = this.#container, options = container.actualOptions;
|
|
5927
5255
|
if (!options.pauseOnBlur) {
|
|
5928
5256
|
return;
|
|
@@ -5940,8 +5268,8 @@
|
|
|
5940
5268
|
container.draw(true);
|
|
5941
5269
|
}
|
|
5942
5270
|
}
|
|
5943
|
-
}
|
|
5944
|
-
#handleWindowResize
|
|
5271
|
+
}
|
|
5272
|
+
#handleWindowResize() {
|
|
5945
5273
|
if (this.#resizeTimeout) {
|
|
5946
5274
|
clearTimeout(this.#resizeTimeout);
|
|
5947
5275
|
this.#resizeTimeout = undefined;
|
|
@@ -5951,13 +5279,13 @@
|
|
|
5951
5279
|
await canvas.windowResize();
|
|
5952
5280
|
};
|
|
5953
5281
|
this.#resizeTimeout = setTimeout(() => void handleResize(), this.#container.actualOptions.resize.delay * millisecondsToSeconds$1);
|
|
5954
|
-
}
|
|
5955
|
-
#manageListeners
|
|
5282
|
+
}
|
|
5283
|
+
#manageListeners(add) {
|
|
5956
5284
|
const handlers = this.#handlers;
|
|
5957
5285
|
this.#manageResize(add);
|
|
5958
5286
|
manageListener(document, visibilityChangeEvent, handlers.visibilityChange, add, false);
|
|
5959
|
-
}
|
|
5960
|
-
#manageResize
|
|
5287
|
+
}
|
|
5288
|
+
#manageResize(add) {
|
|
5961
5289
|
const handlers = this.#handlers, container = this.#container, options = container.actualOptions;
|
|
5962
5290
|
if (!options.resize.enable) {
|
|
5963
5291
|
return;
|
|
@@ -5984,7 +5312,7 @@
|
|
|
5984
5312
|
});
|
|
5985
5313
|
this.#resizeObserver.observe(canvasEl);
|
|
5986
5314
|
}
|
|
5987
|
-
}
|
|
5315
|
+
}
|
|
5988
5316
|
}
|
|
5989
5317
|
|
|
5990
5318
|
function loadEffectData(effect, effectOptions, id, reduceDuplicates) {
|
|
@@ -6011,6 +5339,131 @@
|
|
|
6011
5339
|
data.setCb(data.radius);
|
|
6012
5340
|
}
|
|
6013
5341
|
}
|
|
5342
|
+
function normalizeAngle(angle, modulus) {
|
|
5343
|
+
const normalized = angle % modulus;
|
|
5344
|
+
return normalized < defaultAngle$1 ? normalized + modulus : normalized;
|
|
5345
|
+
}
|
|
5346
|
+
function initParticleState(particle, id, group) {
|
|
5347
|
+
particle.id = id;
|
|
5348
|
+
particle.group = group;
|
|
5349
|
+
particle.justWarped = false;
|
|
5350
|
+
particle.effectClose = true;
|
|
5351
|
+
particle.shapeClose = true;
|
|
5352
|
+
particle.pathRotation = false;
|
|
5353
|
+
particle.lastPathTime = 0;
|
|
5354
|
+
particle.destroyed = false;
|
|
5355
|
+
particle.unbreakable = false;
|
|
5356
|
+
particle.isRotating = false;
|
|
5357
|
+
particle.rotation = 0;
|
|
5358
|
+
particle.misplaced = false;
|
|
5359
|
+
particle.retina = {
|
|
5360
|
+
maxDistance: {},
|
|
5361
|
+
maxSpeed: 0,
|
|
5362
|
+
moveDrift: 0,
|
|
5363
|
+
moveSpeed: 0,
|
|
5364
|
+
sizeAnimationSpeed: 0,
|
|
5365
|
+
};
|
|
5366
|
+
particle.size = {
|
|
5367
|
+
value: 1,
|
|
5368
|
+
max: 1,
|
|
5369
|
+
min: 1,
|
|
5370
|
+
enable: false,
|
|
5371
|
+
};
|
|
5372
|
+
particle.outType = exports.ParticleOutType.normal;
|
|
5373
|
+
particle.ignoresResizeRatio = true;
|
|
5374
|
+
}
|
|
5375
|
+
function resolveParticleOptions(particle, container, pluginManager, overrideOptions) {
|
|
5376
|
+
const mainOptions = container.actualOptions, particlesOptions = loadParticlesOptions(pluginManager, container, mainOptions.particles), reduceDuplicates = particlesOptions.reduceDuplicates;
|
|
5377
|
+
particle.effect = itemFromSingleOrMultiple(particlesOptions.effect.type, particle.id, reduceDuplicates);
|
|
5378
|
+
particle.shape = itemFromSingleOrMultiple(particlesOptions.shape.type, particle.id, reduceDuplicates);
|
|
5379
|
+
const effectOptions = particlesOptions.effect, shapeOptions = particlesOptions.shape;
|
|
5380
|
+
if (overrideOptions) {
|
|
5381
|
+
if (overrideOptions.effect) {
|
|
5382
|
+
const overrideEffectType = overrideOptions.effect.type;
|
|
5383
|
+
if (overrideEffectType && overrideEffectType !== particle.effect) {
|
|
5384
|
+
const effect = itemFromSingleOrMultiple(overrideEffectType, particle.id, reduceDuplicates);
|
|
5385
|
+
if (effect) {
|
|
5386
|
+
particle.effect = effect;
|
|
5387
|
+
}
|
|
5388
|
+
}
|
|
5389
|
+
effectOptions.load(overrideOptions.effect);
|
|
5390
|
+
}
|
|
5391
|
+
if (overrideOptions.shape) {
|
|
5392
|
+
const overrideShapeType = overrideOptions.shape.type;
|
|
5393
|
+
if (overrideShapeType && overrideShapeType !== particle.shape) {
|
|
5394
|
+
const shape = itemFromSingleOrMultiple(overrideShapeType, particle.id, reduceDuplicates);
|
|
5395
|
+
if (shape) {
|
|
5396
|
+
particle.shape = shape;
|
|
5397
|
+
}
|
|
5398
|
+
}
|
|
5399
|
+
shapeOptions.load(overrideOptions.shape);
|
|
5400
|
+
}
|
|
5401
|
+
}
|
|
5402
|
+
if (particle.effect === randomColorValue) {
|
|
5403
|
+
const availableEffects = [...container.effectDrawers.keys()];
|
|
5404
|
+
particle.effect = availableEffects[Math.floor(getRandom() * availableEffects.length)];
|
|
5405
|
+
}
|
|
5406
|
+
if (particle.shape === randomColorValue) {
|
|
5407
|
+
const availableShapes = [...container.shapeDrawers.keys()];
|
|
5408
|
+
particle.shape = availableShapes[Math.floor(getRandom() * availableShapes.length)];
|
|
5409
|
+
}
|
|
5410
|
+
particle.effectData = particle.effect
|
|
5411
|
+
? loadEffectData(particle.effect, effectOptions, particle.id, reduceDuplicates)
|
|
5412
|
+
: undefined;
|
|
5413
|
+
particle.shapeData = particle.shape
|
|
5414
|
+
? loadShapeData(particle.shape, shapeOptions, particle.id, reduceDuplicates)
|
|
5415
|
+
: undefined;
|
|
5416
|
+
particlesOptions.load(overrideOptions);
|
|
5417
|
+
const effectData = particle.effectData, shapeData = particle.shapeData;
|
|
5418
|
+
if (effectData) {
|
|
5419
|
+
particlesOptions.load(effectData.particles);
|
|
5420
|
+
}
|
|
5421
|
+
if (shapeData) {
|
|
5422
|
+
particlesOptions.load(shapeData.particles);
|
|
5423
|
+
}
|
|
5424
|
+
particle.effectClose = effectData?.close ?? particlesOptions.effect.close;
|
|
5425
|
+
particle.shapeClose = shapeData?.close ?? particlesOptions.shape.close;
|
|
5426
|
+
return particlesOptions;
|
|
5427
|
+
}
|
|
5428
|
+
function initParticleDrawers(particle, container) {
|
|
5429
|
+
let effectDrawer, shapeDrawer;
|
|
5430
|
+
if (particle.effect) {
|
|
5431
|
+
effectDrawer = container.effectDrawers.get(particle.effect);
|
|
5432
|
+
}
|
|
5433
|
+
if (effectDrawer?.loadEffect) {
|
|
5434
|
+
effectDrawer.loadEffect(particle);
|
|
5435
|
+
}
|
|
5436
|
+
if (particle.shape) {
|
|
5437
|
+
shapeDrawer = container.shapeDrawers.get(particle.shape);
|
|
5438
|
+
}
|
|
5439
|
+
if (shapeDrawer?.loadShape) {
|
|
5440
|
+
shapeDrawer.loadShape(particle);
|
|
5441
|
+
}
|
|
5442
|
+
const sideCountFunc = shapeDrawer?.getSidesCount;
|
|
5443
|
+
if (sideCountFunc) {
|
|
5444
|
+
particle.sides = sideCountFunc(particle);
|
|
5445
|
+
}
|
|
5446
|
+
}
|
|
5447
|
+
function runUpdaterPreInit(updaters, particle) {
|
|
5448
|
+
for (const updater of updaters) {
|
|
5449
|
+
updater.preInit?.(particle);
|
|
5450
|
+
}
|
|
5451
|
+
}
|
|
5452
|
+
function runUpdaterInit(updaters, particle) {
|
|
5453
|
+
for (const updater of updaters) {
|
|
5454
|
+
updater.init(particle);
|
|
5455
|
+
}
|
|
5456
|
+
}
|
|
5457
|
+
function runDrawerInit(container, particle) {
|
|
5458
|
+
const shapeDrawer = particle.shape ? container.shapeDrawers.get(particle.shape) : undefined, effectDrawer = particle.effect ? container.effectDrawers.get(particle.effect) : undefined;
|
|
5459
|
+
effectDrawer?.particleInit?.(container, particle);
|
|
5460
|
+
shapeDrawer?.particleInit?.(container, particle);
|
|
5461
|
+
}
|
|
5462
|
+
function runParticleCreatedPlugins(container, particle) {
|
|
5463
|
+
for (const plugin of container.particleCreatedPlugins) {
|
|
5464
|
+
plugin.particleCreated?.(particle);
|
|
5465
|
+
}
|
|
5466
|
+
}
|
|
6014
5467
|
class Particle {
|
|
6015
5468
|
backColor;
|
|
6016
5469
|
bubble;
|
|
@@ -6136,94 +5589,20 @@
|
|
|
6136
5589
|
const rotateData = this.getRotateData(), rotating = this.isRotating;
|
|
6137
5590
|
this.#cachedTransform.a = rotateData.cos * (externalTransform.a ?? defaultTransform.a);
|
|
6138
5591
|
this.#cachedTransform.b = rotating
|
|
6139
|
-
? rotateData.sin * (externalTransform.b ?? identity$
|
|
5592
|
+
? rotateData.sin * (externalTransform.b ?? identity$2)
|
|
6140
5593
|
: (externalTransform.b ?? defaultTransform.b);
|
|
6141
5594
|
this.#cachedTransform.c = rotating
|
|
6142
|
-
? -rotateData.sin * (externalTransform.c ?? identity$
|
|
5595
|
+
? -rotateData.sin * (externalTransform.c ?? identity$2)
|
|
6143
5596
|
: (externalTransform.c ?? defaultTransform.c);
|
|
6144
5597
|
this.#cachedTransform.d = rotateData.cos * (externalTransform.d ?? defaultTransform.d);
|
|
6145
5598
|
return this.#cachedTransform;
|
|
6146
5599
|
}
|
|
6147
5600
|
init(id, position, overrideOptions, group) {
|
|
6148
5601
|
const container = this.#container;
|
|
6149
|
-
this
|
|
6150
|
-
this.
|
|
6151
|
-
this.justWarped = false;
|
|
6152
|
-
this.effectClose = true;
|
|
6153
|
-
this.shapeClose = true;
|
|
6154
|
-
this.pathRotation = false;
|
|
6155
|
-
this.lastPathTime = 0;
|
|
6156
|
-
this.destroyed = false;
|
|
6157
|
-
this.unbreakable = false;
|
|
6158
|
-
this.isRotating = false;
|
|
6159
|
-
this.rotation = 0;
|
|
6160
|
-
this.misplaced = false;
|
|
6161
|
-
this.retina = {
|
|
6162
|
-
maxDistance: {},
|
|
6163
|
-
maxSpeed: 0,
|
|
6164
|
-
moveDrift: 0,
|
|
6165
|
-
moveSpeed: 0,
|
|
6166
|
-
sizeAnimationSpeed: 0,
|
|
6167
|
-
};
|
|
6168
|
-
this.size = {
|
|
6169
|
-
value: 1,
|
|
6170
|
-
max: 1,
|
|
6171
|
-
min: 1,
|
|
6172
|
-
enable: false,
|
|
6173
|
-
};
|
|
6174
|
-
this.outType = exports.ParticleOutType.normal;
|
|
6175
|
-
this.ignoresResizeRatio = true;
|
|
6176
|
-
const mainOptions = container.actualOptions, particlesOptions = loadParticlesOptions(this.#pluginManager, container, mainOptions.particles), reduceDuplicates = particlesOptions.reduceDuplicates, effectType = particlesOptions.effect.type, shapeType = particlesOptions.shape.type;
|
|
6177
|
-
this.effect = itemFromSingleOrMultiple(effectType, this.id, reduceDuplicates);
|
|
6178
|
-
this.shape = itemFromSingleOrMultiple(shapeType, this.id, reduceDuplicates);
|
|
6179
|
-
const effectOptions = particlesOptions.effect, shapeOptions = particlesOptions.shape;
|
|
6180
|
-
if (overrideOptions) {
|
|
6181
|
-
if (overrideOptions.effect) {
|
|
6182
|
-
const overrideEffectType = overrideOptions.effect.type;
|
|
6183
|
-
if (overrideEffectType && overrideEffectType !== this.effect) {
|
|
6184
|
-
const effect = itemFromSingleOrMultiple(overrideEffectType, this.id, reduceDuplicates);
|
|
6185
|
-
if (effect) {
|
|
6186
|
-
this.effect = effect;
|
|
6187
|
-
}
|
|
6188
|
-
}
|
|
6189
|
-
effectOptions.load(overrideOptions.effect);
|
|
6190
|
-
}
|
|
6191
|
-
if (overrideOptions.shape) {
|
|
6192
|
-
const overrideShapeType = overrideOptions.shape.type;
|
|
6193
|
-
if (overrideShapeType && overrideShapeType !== this.shape) {
|
|
6194
|
-
const shape = itemFromSingleOrMultiple(overrideShapeType, this.id, reduceDuplicates);
|
|
6195
|
-
if (shape) {
|
|
6196
|
-
this.shape = shape;
|
|
6197
|
-
}
|
|
6198
|
-
}
|
|
6199
|
-
shapeOptions.load(overrideOptions.shape);
|
|
6200
|
-
}
|
|
6201
|
-
}
|
|
6202
|
-
if (this.effect === randomColorValue) {
|
|
6203
|
-
const availableEffects = [...this.#container.effectDrawers.keys()];
|
|
6204
|
-
this.effect = availableEffects[Math.floor(getRandom() * availableEffects.length)];
|
|
6205
|
-
}
|
|
6206
|
-
if (this.shape === randomColorValue) {
|
|
6207
|
-
const availableShapes = [...this.#container.shapeDrawers.keys()];
|
|
6208
|
-
this.shape = availableShapes[Math.floor(getRandom() * availableShapes.length)];
|
|
6209
|
-
}
|
|
6210
|
-
this.effectData = this.effect ? loadEffectData(this.effect, effectOptions, this.id, reduceDuplicates) : undefined;
|
|
6211
|
-
this.shapeData = this.shape ? loadShapeData(this.shape, shapeOptions, this.id, reduceDuplicates) : undefined;
|
|
6212
|
-
particlesOptions.load(overrideOptions);
|
|
6213
|
-
const effectData = this.effectData, shapeData = this.shapeData;
|
|
6214
|
-
if (effectData) {
|
|
6215
|
-
particlesOptions.load(effectData.particles);
|
|
6216
|
-
}
|
|
6217
|
-
if (shapeData) {
|
|
6218
|
-
particlesOptions.load(shapeData.particles);
|
|
6219
|
-
}
|
|
6220
|
-
this.effectClose = effectData?.close ?? particlesOptions.effect.close;
|
|
6221
|
-
this.shapeClose = shapeData?.close ?? particlesOptions.shape.close;
|
|
6222
|
-
this.options = particlesOptions;
|
|
5602
|
+
initParticleState(this, id, group);
|
|
5603
|
+
this.options = resolveParticleOptions(this, container, this.#pluginManager, overrideOptions);
|
|
6223
5604
|
container.retina.initParticle(this);
|
|
6224
|
-
|
|
6225
|
-
updater.preInit?.(this);
|
|
6226
|
-
}
|
|
5605
|
+
runUpdaterPreInit(container.particleUpdaters, this);
|
|
6227
5606
|
this.bubble = {
|
|
6228
5607
|
inRange: false,
|
|
6229
5608
|
};
|
|
@@ -6236,32 +5615,11 @@
|
|
|
6236
5615
|
this.velocity = this.initialVelocity.copy();
|
|
6237
5616
|
this.zIndexFactor = this.position.z / container.zLayers;
|
|
6238
5617
|
this.sides = 24;
|
|
6239
|
-
|
|
6240
|
-
if (this.effect) {
|
|
6241
|
-
effectDrawer = container.effectDrawers.get(this.effect);
|
|
6242
|
-
}
|
|
6243
|
-
if (effectDrawer?.loadEffect) {
|
|
6244
|
-
effectDrawer.loadEffect(this);
|
|
6245
|
-
}
|
|
6246
|
-
if (this.shape) {
|
|
6247
|
-
shapeDrawer = container.shapeDrawers.get(this.shape);
|
|
6248
|
-
}
|
|
6249
|
-
if (shapeDrawer?.loadShape) {
|
|
6250
|
-
shapeDrawer.loadShape(this);
|
|
6251
|
-
}
|
|
6252
|
-
const sideCountFunc = shapeDrawer?.getSidesCount;
|
|
6253
|
-
if (sideCountFunc) {
|
|
6254
|
-
this.sides = sideCountFunc(this);
|
|
6255
|
-
}
|
|
5618
|
+
initParticleDrawers(this, container);
|
|
6256
5619
|
this.spawning = false;
|
|
6257
|
-
|
|
6258
|
-
|
|
6259
|
-
|
|
6260
|
-
effectDrawer?.particleInit?.(container, this);
|
|
6261
|
-
shapeDrawer?.particleInit?.(container, this);
|
|
6262
|
-
for (const plugin of container.particleCreatedPlugins) {
|
|
6263
|
-
plugin.particleCreated?.(this);
|
|
6264
|
-
}
|
|
5620
|
+
runUpdaterInit(container.particleUpdaters, this);
|
|
5621
|
+
runDrawerInit(container, this);
|
|
5622
|
+
runParticleCreatedPlugins(container, this);
|
|
6265
5623
|
}
|
|
6266
5624
|
isInsideCanvas(direction) {
|
|
6267
5625
|
return this.#getInsideCanvasResult({ direction }).inside;
|
|
@@ -6275,15 +5633,15 @@
|
|
|
6275
5633
|
}
|
|
6276
5634
|
const angle = this.roll.angle;
|
|
6277
5635
|
if (this.roll.horizontal && this.roll.vertical) {
|
|
6278
|
-
const
|
|
5636
|
+
const adjustedAngle = normalizeAngle(angle, doublePI);
|
|
6279
5637
|
return adjustedAngle >= Math.PI * half$1 && adjustedAngle < Math.PI * triple * half$1;
|
|
6280
5638
|
}
|
|
6281
5639
|
if (this.roll.horizontal) {
|
|
6282
|
-
const
|
|
5640
|
+
const adjustedAngle = normalizeAngle(angle + Math.PI * half$1, doublePI);
|
|
6283
5641
|
return adjustedAngle >= Math.PI && adjustedAngle < Math.PI * double;
|
|
6284
5642
|
}
|
|
6285
5643
|
if (this.roll.vertical) {
|
|
6286
|
-
const
|
|
5644
|
+
const adjustedAngle = normalizeAngle(angle, doublePI);
|
|
6287
5645
|
return adjustedAngle >= Math.PI && adjustedAngle < Math.PI * double;
|
|
6288
5646
|
}
|
|
6289
5647
|
return false;
|
|
@@ -6296,10 +5654,10 @@
|
|
|
6296
5654
|
updater.reset?.(this);
|
|
6297
5655
|
}
|
|
6298
5656
|
}
|
|
6299
|
-
#calcPosition
|
|
5657
|
+
#calcPosition(position, zIndex) {
|
|
6300
5658
|
let tryCount = defaultRetryCount, posVec = position ? Vector3d.create(position.x, position.y, zIndex) : undefined;
|
|
6301
|
-
const container = this.#container, plugins = container.particlePositionPlugins, outModes = this.options.move.outModes, radius = this.getRadius(), canvasSize = container.canvas.size
|
|
6302
|
-
|
|
5659
|
+
const container = this.#container, plugins = container.particlePositionPlugins, outModes = this.options.move.outModes, radius = this.getRadius(), canvasSize = container.canvas.size;
|
|
5660
|
+
for (;;) {
|
|
6303
5661
|
for (const plugin of plugins) {
|
|
6304
5662
|
const pluginPos = plugin.particlePosition?.(posVec, this);
|
|
6305
5663
|
if (pluginPos) {
|
|
@@ -6327,9 +5685,8 @@
|
|
|
6327
5685
|
tryCount += tryCountIncrement;
|
|
6328
5686
|
posVec = undefined;
|
|
6329
5687
|
}
|
|
6330
|
-
|
|
6331
|
-
|
|
6332
|
-
#calculateVelocity = () => {
|
|
5688
|
+
}
|
|
5689
|
+
#calculateVelocity() {
|
|
6333
5690
|
const moveOptions = this.options.move, baseVelocity = getParticleBaseVelocity(this.direction), res = baseVelocity.copy();
|
|
6334
5691
|
if (moveOptions.direction === exports.MoveDirection.inside || moveOptions.direction === exports.MoveDirection.outside) {
|
|
6335
5692
|
return res;
|
|
@@ -6345,8 +5702,8 @@
|
|
|
6345
5702
|
res.length *= getRandom();
|
|
6346
5703
|
}
|
|
6347
5704
|
return res;
|
|
6348
|
-
}
|
|
6349
|
-
#fixHorizontal
|
|
5705
|
+
}
|
|
5706
|
+
#fixHorizontal(pos, radius, outMode) {
|
|
6350
5707
|
fixOutMode({
|
|
6351
5708
|
outMode,
|
|
6352
5709
|
checkModes: [exports.OutMode.bounce],
|
|
@@ -6355,8 +5712,8 @@
|
|
|
6355
5712
|
setCb: (value) => (pos.x += value),
|
|
6356
5713
|
radius,
|
|
6357
5714
|
});
|
|
6358
|
-
}
|
|
6359
|
-
#fixVertical
|
|
5715
|
+
}
|
|
5716
|
+
#fixVertical(pos, radius, outMode) {
|
|
6360
5717
|
fixOutMode({
|
|
6361
5718
|
outMode,
|
|
6362
5719
|
checkModes: [exports.OutMode.bounce],
|
|
@@ -6365,8 +5722,8 @@
|
|
|
6365
5722
|
setCb: (value) => (pos.y += value),
|
|
6366
5723
|
radius,
|
|
6367
5724
|
});
|
|
6368
|
-
}
|
|
6369
|
-
#getDefaultInsideCanvasResult
|
|
5725
|
+
}
|
|
5726
|
+
#getDefaultInsideCanvasResult(direction, outMode) {
|
|
6370
5727
|
const radius = this.getRadius(), canvasSize = this.#container.canvas.size, position = this.position, isBounce = outMode === exports.OutMode.bounce;
|
|
6371
5728
|
if (direction === exports.OutModeDirection.bottom) {
|
|
6372
5729
|
return {
|
|
@@ -6399,8 +5756,8 @@
|
|
|
6399
5756
|
position.x <= canvasSize.width + radius,
|
|
6400
5757
|
reason: "default",
|
|
6401
5758
|
};
|
|
6402
|
-
}
|
|
6403
|
-
#getInsideCanvasCallbackData
|
|
5759
|
+
}
|
|
5760
|
+
#getInsideCanvasCallbackData(direction, outMode) {
|
|
6404
5761
|
return {
|
|
6405
5762
|
canvasSize: this.#container.canvas.size,
|
|
6406
5763
|
direction,
|
|
@@ -6408,8 +5765,8 @@
|
|
|
6408
5765
|
particle: this,
|
|
6409
5766
|
radius: this.getRadius(),
|
|
6410
5767
|
};
|
|
6411
|
-
}
|
|
6412
|
-
#getInsideCanvasResult
|
|
5768
|
+
}
|
|
5769
|
+
#getInsideCanvasResult(data) {
|
|
6413
5770
|
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;
|
|
6414
5771
|
if (!shapeCheck && !effectCheck) {
|
|
6415
5772
|
return defaultResult;
|
|
@@ -6424,8 +5781,8 @@
|
|
|
6424
5781
|
};
|
|
6425
5782
|
}
|
|
6426
5783
|
return shapeResult ?? effectResult ?? defaultResult;
|
|
6427
|
-
}
|
|
6428
|
-
#getRollColor
|
|
5784
|
+
}
|
|
5785
|
+
#getRollColor(color) {
|
|
6429
5786
|
if (!color || !this.roll || (!this.backColor && !this.roll.alter)) {
|
|
6430
5787
|
return color;
|
|
6431
5788
|
}
|
|
@@ -6439,8 +5796,8 @@
|
|
|
6439
5796
|
return alterHsl(color, this.roll.alter.type, this.roll.alter.value);
|
|
6440
5797
|
}
|
|
6441
5798
|
return color;
|
|
6442
|
-
}
|
|
6443
|
-
#initPosition
|
|
5799
|
+
}
|
|
5800
|
+
#initPosition(position) {
|
|
6444
5801
|
const container = this.#container, zIndexValue = Math.floor(getRangeValue(this.options.zIndex.value)), initialPosition = this.#calcPosition(position, clamp(zIndexValue, minZ, container.zLayers));
|
|
6445
5802
|
if (!initialPosition) {
|
|
6446
5803
|
throw new Error("a valid position cannot be found for particle");
|
|
@@ -6463,8 +5820,8 @@
|
|
|
6463
5820
|
break;
|
|
6464
5821
|
}
|
|
6465
5822
|
this.offset = Vector.origin;
|
|
6466
|
-
}
|
|
6467
|
-
#normalizeInsideCanvasResult
|
|
5823
|
+
}
|
|
5824
|
+
#normalizeInsideCanvasResult(result, reason) {
|
|
6468
5825
|
if (typeof result === "boolean") {
|
|
6469
5826
|
return {
|
|
6470
5827
|
inside: result,
|
|
@@ -6476,7 +5833,7 @@
|
|
|
6476
5833
|
margin: result.margin,
|
|
6477
5834
|
reason: result.reason ?? reason,
|
|
6478
5835
|
};
|
|
6479
|
-
}
|
|
5836
|
+
}
|
|
6480
5837
|
}
|
|
6481
5838
|
|
|
6482
5839
|
class SpatialHashGrid {
|
|
@@ -6829,10 +6186,10 @@
|
|
|
6829
6186
|
}
|
|
6830
6187
|
this.#resizeFactor = undefined;
|
|
6831
6188
|
}
|
|
6832
|
-
#addToPool
|
|
6189
|
+
#addToPool(...particles) {
|
|
6833
6190
|
this.#pool.push(...particles);
|
|
6834
|
-
}
|
|
6835
|
-
#applyDensity
|
|
6191
|
+
}
|
|
6192
|
+
#applyDensity(options, pluginsCount, group, groupOptions) {
|
|
6836
6193
|
const numberOptions = options.number;
|
|
6837
6194
|
if (!numberOptions.density.enable) {
|
|
6838
6195
|
if (group === undefined) {
|
|
@@ -6856,36 +6213,19 @@
|
|
|
6856
6213
|
else if (particlesCount > particlesNumber) {
|
|
6857
6214
|
this.removeQuantity(particlesCount - particlesNumber, group);
|
|
6858
6215
|
}
|
|
6859
|
-
}
|
|
6860
|
-
#createBuckets
|
|
6216
|
+
}
|
|
6217
|
+
#createBuckets(zLayers) {
|
|
6861
6218
|
const bucketCount = Math.max(Math.floor(zLayers), one);
|
|
6862
6219
|
return Array.from({ length: bucketCount }, () => []);
|
|
6863
|
-
}
|
|
6864
|
-
#getBucketIndex
|
|
6220
|
+
}
|
|
6221
|
+
#getBucketIndex(zIndex) {
|
|
6865
6222
|
const maxBucketIndex = this.#zBuckets.length - one;
|
|
6866
6223
|
if (maxBucketIndex <= minIndex) {
|
|
6867
6224
|
return minIndex;
|
|
6868
6225
|
}
|
|
6869
6226
|
return Math.min(Math.max(Math.floor(zIndex), minIndex), maxBucketIndex);
|
|
6870
|
-
}
|
|
6871
|
-
#
|
|
6872
|
-
let start = minIndex, end = bucket.length;
|
|
6873
|
-
while (start < end) {
|
|
6874
|
-
const middle = Math.floor((start + end) / double), middleParticle = bucket[middle];
|
|
6875
|
-
if (!middleParticle) {
|
|
6876
|
-
end = middle;
|
|
6877
|
-
continue;
|
|
6878
|
-
}
|
|
6879
|
-
if (middleParticle.id < particleId) {
|
|
6880
|
-
start = middle + one;
|
|
6881
|
-
}
|
|
6882
|
-
else {
|
|
6883
|
-
end = middle;
|
|
6884
|
-
}
|
|
6885
|
-
}
|
|
6886
|
-
return start;
|
|
6887
|
-
};
|
|
6888
|
-
#initDensityFactor = densityOptions => {
|
|
6227
|
+
}
|
|
6228
|
+
#initDensityFactor(densityOptions) {
|
|
6889
6229
|
const container = this.#container;
|
|
6890
6230
|
if (!densityOptions.enable) {
|
|
6891
6231
|
return defaultDensityFactor;
|
|
@@ -6895,16 +6235,16 @@
|
|
|
6895
6235
|
return defaultDensityFactor;
|
|
6896
6236
|
}
|
|
6897
6237
|
return ((canvasSize.width * canvasSize.height) / (densityOptions.height * densityOptions.width * pxRatio ** squareExp));
|
|
6898
|
-
}
|
|
6899
|
-
#insertParticleIntoBucket
|
|
6238
|
+
}
|
|
6239
|
+
#insertParticleIntoBucket(particle) {
|
|
6900
6240
|
const bucketIndex = this.#getBucketIndex(particle.position.z), bucket = this.#zBuckets[bucketIndex];
|
|
6901
6241
|
if (!bucket) {
|
|
6902
6242
|
return;
|
|
6903
6243
|
}
|
|
6904
|
-
bucket.
|
|
6244
|
+
bucket.push(particle);
|
|
6905
6245
|
this.#particleBuckets.set(particle.id, bucketIndex);
|
|
6906
|
-
}
|
|
6907
|
-
#removeParticle
|
|
6246
|
+
}
|
|
6247
|
+
#removeParticle(index, group, override) {
|
|
6908
6248
|
const particle = this.#array[index];
|
|
6909
6249
|
if (!particle) {
|
|
6910
6250
|
return false;
|
|
@@ -6920,22 +6260,20 @@
|
|
|
6920
6260
|
});
|
|
6921
6261
|
this.#addToPool(particle);
|
|
6922
6262
|
return true;
|
|
6923
|
-
}
|
|
6924
|
-
#removeParticleFromBucket
|
|
6263
|
+
}
|
|
6264
|
+
#removeParticleFromBucket(particle) {
|
|
6925
6265
|
const bucketIndex = this.#particleBuckets.get(particle.id) ?? this.#getBucketIndex(particle.position.z), bucket = this.#zBuckets[bucketIndex];
|
|
6926
6266
|
if (!bucket) {
|
|
6927
6267
|
this.#particleBuckets.delete(particle.id);
|
|
6928
6268
|
return;
|
|
6929
6269
|
}
|
|
6930
|
-
const
|
|
6931
|
-
if (
|
|
6932
|
-
|
|
6933
|
-
return;
|
|
6270
|
+
const idx = bucket.findIndex(p => p.id === particle.id);
|
|
6271
|
+
if (idx >= minIndex) {
|
|
6272
|
+
bucket.splice(idx, deleteCount);
|
|
6934
6273
|
}
|
|
6935
|
-
bucket.splice(particleIndex, deleteCount);
|
|
6936
6274
|
this.#particleBuckets.delete(particle.id);
|
|
6937
|
-
}
|
|
6938
|
-
#resetBuckets
|
|
6275
|
+
}
|
|
6276
|
+
#resetBuckets(zLayers) {
|
|
6939
6277
|
const bucketCount = Math.max(Math.floor(zLayers), one);
|
|
6940
6278
|
if (this.#zBuckets.length !== bucketCount) {
|
|
6941
6279
|
this.#zBuckets = this.#createBuckets(bucketCount);
|
|
@@ -6944,8 +6282,8 @@
|
|
|
6944
6282
|
for (const bucket of this.#zBuckets) {
|
|
6945
6283
|
bucket.length = minIndex;
|
|
6946
6284
|
}
|
|
6947
|
-
}
|
|
6948
|
-
#updateParticleBucket
|
|
6285
|
+
}
|
|
6286
|
+
#updateParticleBucket(particle) {
|
|
6949
6287
|
const newBucketIndex = this.#getBucketIndex(particle.position.z), currentBucketIndex = this.#particleBuckets.get(particle.id);
|
|
6950
6288
|
if (currentBucketIndex === undefined) {
|
|
6951
6289
|
this.#insertParticleIntoBucket(particle);
|
|
@@ -6956,9 +6294,9 @@
|
|
|
6956
6294
|
}
|
|
6957
6295
|
const currentBucket = this.#zBuckets[currentBucketIndex];
|
|
6958
6296
|
if (currentBucket) {
|
|
6959
|
-
const
|
|
6960
|
-
if (
|
|
6961
|
-
currentBucket.splice(
|
|
6297
|
+
const idx = currentBucket.findIndex(p => p.id === particle.id);
|
|
6298
|
+
if (idx >= minIndex) {
|
|
6299
|
+
currentBucket.splice(idx, deleteCount);
|
|
6962
6300
|
}
|
|
6963
6301
|
}
|
|
6964
6302
|
const newBucket = this.#zBuckets[newBucketIndex];
|
|
@@ -6966,10 +6304,16 @@
|
|
|
6966
6304
|
this.#particleBuckets.set(particle.id, newBucketIndex);
|
|
6967
6305
|
return;
|
|
6968
6306
|
}
|
|
6969
|
-
newBucket.
|
|
6307
|
+
newBucket.push(particle);
|
|
6308
|
+
if (newBucket.length >= double) {
|
|
6309
|
+
const prev = newBucket[newBucket.length - double];
|
|
6310
|
+
if (prev && particle.id < prev.id) {
|
|
6311
|
+
newBucket.sort((a, b) => a.id - b.id);
|
|
6312
|
+
}
|
|
6313
|
+
}
|
|
6970
6314
|
this.#particleBuckets.set(particle.id, newBucketIndex);
|
|
6971
|
-
}
|
|
6972
|
-
#updateParticlesPhase1
|
|
6315
|
+
}
|
|
6316
|
+
#updateParticlesPhase1(delta) {
|
|
6973
6317
|
const particlesToDelete = new Set(), resizeFactor = this.#resizeFactor;
|
|
6974
6318
|
for (const particle of this.#array) {
|
|
6975
6319
|
if (resizeFactor && !particle.ignoresResizeRatio) {
|
|
@@ -6995,8 +6339,8 @@
|
|
|
6995
6339
|
this.grid.insert(particle);
|
|
6996
6340
|
}
|
|
6997
6341
|
return particlesToDelete;
|
|
6998
|
-
}
|
|
6999
|
-
#updateParticlesPhase2
|
|
6342
|
+
}
|
|
6343
|
+
#updateParticlesPhase2(delta, particlesToDelete) {
|
|
7000
6344
|
for (const particle of this.#array) {
|
|
7001
6345
|
if (particle.destroyed) {
|
|
7002
6346
|
particlesToDelete.add(particle);
|
|
@@ -7012,7 +6356,7 @@
|
|
|
7012
6356
|
}
|
|
7013
6357
|
this.#updateParticleBucket(particle);
|
|
7014
6358
|
}
|
|
7015
|
-
}
|
|
6359
|
+
}
|
|
7016
6360
|
}
|
|
7017
6361
|
|
|
7018
6362
|
class Retina {
|
|
@@ -7374,7 +6718,7 @@
|
|
|
7374
6718
|
}
|
|
7375
6719
|
return refresh;
|
|
7376
6720
|
}
|
|
7377
|
-
#nextFrame
|
|
6721
|
+
#nextFrame(timestamp) {
|
|
7378
6722
|
try {
|
|
7379
6723
|
if (!this.#smooth &&
|
|
7380
6724
|
this.#lastFrameTime !== undefined &&
|
|
@@ -7402,7 +6746,7 @@
|
|
|
7402
6746
|
catch (e) {
|
|
7403
6747
|
getLogger().error("error in animation loop", e);
|
|
7404
6748
|
}
|
|
7405
|
-
}
|
|
6749
|
+
}
|
|
7406
6750
|
}
|
|
7407
6751
|
|
|
7408
6752
|
var Container$1 = /*#__PURE__*/Object.freeze({
|
|
@@ -7448,7 +6792,7 @@
|
|
|
7448
6792
|
BlendPluginInstance: BlendPluginInstance
|
|
7449
6793
|
});
|
|
7450
6794
|
|
|
7451
|
-
const
|
|
6795
|
+
const moveSpeedFactor = 60, minSpinRadius = 0, spinFactor = 0.01, defaultPathDelay = 0, noDecay = 1;
|
|
7452
6796
|
function applyDistance(particle) {
|
|
7453
6797
|
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;
|
|
7454
6798
|
if (!hDistance && !vDistance) {
|
|
@@ -7481,7 +6825,7 @@
|
|
|
7481
6825
|
}
|
|
7482
6826
|
function move(particle, moveOptions, moveSpeed, maxSpeed, moveDrift, reduceFactor, delta) {
|
|
7483
6827
|
applyPath(particle, delta);
|
|
7484
|
-
const gravityOptions = particle.gravity, gravityFactor = gravityOptions?.enable && gravityOptions.inverse ? -identity$
|
|
6828
|
+
const gravityOptions = particle.gravity, gravityFactor = gravityOptions?.enable && gravityOptions.inverse ? -identity$2 : identity$2;
|
|
7485
6829
|
if (moveDrift && moveSpeed) {
|
|
7486
6830
|
particle.velocity.x += (moveDrift * delta.factor) / (moveSpeedFactor * moveSpeed);
|
|
7487
6831
|
}
|
|
@@ -7501,7 +6845,7 @@
|
|
|
7501
6845
|
particle.velocity.y = velocity.y / moveSpeed;
|
|
7502
6846
|
}
|
|
7503
6847
|
}
|
|
7504
|
-
const zIndexOptions = particle.options.zIndex, zVelocityFactor = (identity$
|
|
6848
|
+
const zIndexOptions = particle.options.zIndex, zVelocityFactor = (identity$2 - particle.zIndexFactor) ** zIndexOptions.velocityRate;
|
|
7505
6849
|
velocity.multTo(zVelocityFactor);
|
|
7506
6850
|
velocity.multTo(reduceFactor);
|
|
7507
6851
|
const { position } = particle;
|
|
@@ -7527,13 +6871,13 @@
|
|
|
7527
6871
|
const maxCanvasSize = Math.max(container.canvas.size.width, container.canvas.size.height), halfMaxSize = maxCanvasSize * half$1;
|
|
7528
6872
|
if (particle.spin.radius > halfMaxSize) {
|
|
7529
6873
|
particle.spin.radius = halfMaxSize;
|
|
7530
|
-
particle.spin.acceleration *= -identity$
|
|
6874
|
+
particle.spin.acceleration *= -identity$2;
|
|
7531
6875
|
}
|
|
7532
6876
|
else if (particle.spin.radius < minSpinRadius) {
|
|
7533
6877
|
particle.spin.radius = minSpinRadius;
|
|
7534
|
-
particle.spin.acceleration *= -identity$
|
|
6878
|
+
particle.spin.acceleration *= -identity$2;
|
|
7535
6879
|
}
|
|
7536
|
-
particle.spin.angle += moveSpeed * spinFactor * (identity$
|
|
6880
|
+
particle.spin.angle += moveSpeed * spinFactor * (identity$2 - particle.spin.radius / maxCanvasSize);
|
|
7537
6881
|
}
|
|
7538
6882
|
function applyPath(particle, delta) {
|
|
7539
6883
|
const particlesOptions = particle.options, pathOptions = particlesOptions.move.path, pathEnabled = pathOptions.enable;
|
|
@@ -7550,13 +6894,13 @@
|
|
|
7550
6894
|
particle.velocity.addTo(path);
|
|
7551
6895
|
}
|
|
7552
6896
|
if (pathOptions.clamp) {
|
|
7553
|
-
particle.velocity.x = clamp(particle.velocity.x, -identity$
|
|
7554
|
-
particle.velocity.y = clamp(particle.velocity.y, -identity$
|
|
6897
|
+
particle.velocity.x = clamp(particle.velocity.x, -identity$2, identity$2);
|
|
6898
|
+
particle.velocity.y = clamp(particle.velocity.y, -identity$2, identity$2);
|
|
7555
6899
|
}
|
|
7556
6900
|
particle.lastPathTime -= pathDelay;
|
|
7557
6901
|
}
|
|
7558
6902
|
function getProximitySpeedFactor(particle) {
|
|
7559
|
-
return particle.slow.inRange ? particle.slow.factor : identity$
|
|
6903
|
+
return particle.slow.inRange ? particle.slow.factor : identity$2;
|
|
7560
6904
|
}
|
|
7561
6905
|
function initSpin(container, particle) {
|
|
7562
6906
|
const options = particle.options, spinOptions = options.move.spin;
|
|
@@ -7840,7 +7184,7 @@
|
|
|
7840
7184
|
mediaQuery.addEventListener("change", handleChange);
|
|
7841
7185
|
await Promise.resolve();
|
|
7842
7186
|
}
|
|
7843
|
-
#handleMotionChange
|
|
7187
|
+
#handleMotionChange(mediaQuery) {
|
|
7844
7188
|
const container = this.#container, motion = container.actualOptions.motion;
|
|
7845
7189
|
if (!motion) {
|
|
7846
7190
|
return;
|
|
@@ -7856,7 +7200,7 @@
|
|
|
7856
7200
|
else {
|
|
7857
7201
|
container.retina.reduceFactor = defaultReduce;
|
|
7858
7202
|
}
|
|
7859
|
-
}
|
|
7203
|
+
}
|
|
7860
7204
|
}
|
|
7861
7205
|
|
|
7862
7206
|
var MotionPluginInstance$1 = /*#__PURE__*/Object.freeze({
|
|
@@ -7949,7 +7293,13 @@
|
|
|
7949
7293
|
this.#paused = !this.options.autoPlay;
|
|
7950
7294
|
this.#particlesOptions = particlesOptions;
|
|
7951
7295
|
this.#size = this.#calcSize();
|
|
7952
|
-
this.size =
|
|
7296
|
+
this.size =
|
|
7297
|
+
this.#size.mode === exports.PixelMode.percent
|
|
7298
|
+
? {
|
|
7299
|
+
width: (this.#size.width / percentDenominator) * this.#container.canvas.size.width,
|
|
7300
|
+
height: (this.#size.height / percentDenominator) * this.#container.canvas.size.height,
|
|
7301
|
+
}
|
|
7302
|
+
: { width: this.#size.width, height: this.#size.height };
|
|
7953
7303
|
this.#lifeCount = this.options.life.count ?? defaultLifeCount;
|
|
7954
7304
|
this.#immortal = this.#lifeCount <= minLifeCount;
|
|
7955
7305
|
if (this.options.domId) {
|
|
@@ -8020,7 +7370,13 @@
|
|
|
8020
7370
|
? initialPosition
|
|
8021
7371
|
: this.#calcPosition();
|
|
8022
7372
|
this.#size = this.#calcSize();
|
|
8023
|
-
this.size =
|
|
7373
|
+
this.size =
|
|
7374
|
+
this.#size.mode === exports.PixelMode.percent
|
|
7375
|
+
? {
|
|
7376
|
+
width: (this.#size.width / percentDenominator) * container.canvas.size.width,
|
|
7377
|
+
height: (this.#size.height / percentDenominator) * container.canvas.size.height,
|
|
7378
|
+
}
|
|
7379
|
+
: { width: this.#size.width, height: this.#size.height };
|
|
8024
7380
|
this.#shape?.resize(this.position, this.size);
|
|
8025
7381
|
}
|
|
8026
7382
|
update(delta) {
|
|
@@ -8120,7 +7476,7 @@
|
|
|
8120
7476
|
return size;
|
|
8121
7477
|
})());
|
|
8122
7478
|
}
|
|
8123
|
-
#destroy
|
|
7479
|
+
#destroy() {
|
|
8124
7480
|
this.#mutationObserver?.disconnect();
|
|
8125
7481
|
this.#mutationObserver = undefined;
|
|
8126
7482
|
this.#resizeObserver?.disconnect();
|
|
@@ -8129,7 +7485,7 @@
|
|
|
8129
7485
|
this.#container.dispatchEvent("emitterDestroyed", {
|
|
8130
7486
|
emitter: this,
|
|
8131
7487
|
});
|
|
8132
|
-
}
|
|
7488
|
+
}
|
|
8133
7489
|
#emit() {
|
|
8134
7490
|
if (this.#paused) {
|
|
8135
7491
|
return;
|
|
@@ -8189,7 +7545,7 @@
|
|
|
8189
7545
|
}
|
|
8190
7546
|
}
|
|
8191
7547
|
}
|
|
8192
|
-
#prepareToDie
|
|
7548
|
+
#prepareToDie() {
|
|
8193
7549
|
if (this.#paused) {
|
|
8194
7550
|
return;
|
|
8195
7551
|
}
|
|
@@ -8197,8 +7553,8 @@
|
|
|
8197
7553
|
if ((this.#lifeCount > minLifeCount || this.#immortal) && duration !== undefined && duration > minDuration) {
|
|
8198
7554
|
this.#duration = duration * millisecondsToSeconds$1;
|
|
8199
7555
|
}
|
|
8200
|
-
}
|
|
8201
|
-
#setColorAnimation
|
|
7556
|
+
}
|
|
7557
|
+
#setColorAnimation(animation, initValue, maxValue, factor = defaultColorAnimationFactor) {
|
|
8202
7558
|
const container = this.#container;
|
|
8203
7559
|
if (!animation.enable) {
|
|
8204
7560
|
return initValue;
|
|
@@ -8207,7 +7563,7 @@
|
|
|
8207
7563
|
? (delay * millisecondsToSeconds$1) / container.retina.reduceFactor
|
|
8208
7564
|
: Infinity, colorSpeed = getRangeValue(animation.speed);
|
|
8209
7565
|
return (initValue + (colorSpeed * container.fpsLimit) / emitFactor + colorOffset * factor) % maxValue;
|
|
8210
|
-
}
|
|
7566
|
+
}
|
|
8211
7567
|
}
|
|
8212
7568
|
|
|
8213
7569
|
var EmitterInstance$1 = /*#__PURE__*/Object.freeze({
|
|
@@ -8230,6 +7586,7 @@
|
|
|
8230
7586
|
exports.MoveCenter = MoveCenter;
|
|
8231
7587
|
exports.MoveGravity = MoveGravity;
|
|
8232
7588
|
exports.MovePath = MovePath;
|
|
7589
|
+
exports.OptionLoader = OptionLoader;
|
|
8233
7590
|
exports.Options = Options;
|
|
8234
7591
|
exports.OptionsColor = OptionsColor;
|
|
8235
7592
|
exports.OutModes = OutModes;
|
|
@@ -8254,9 +7611,7 @@
|
|
|
8254
7611
|
exports.alterHsl = alterHsl;
|
|
8255
7612
|
exports.animate = animate;
|
|
8256
7613
|
exports.areBoundsInside = areBoundsInside;
|
|
8257
|
-
exports.arrayRandomIndex = arrayRandomIndex;
|
|
8258
7614
|
exports.calcExactPositionOrRandomFromSize = calcExactPositionOrRandomFromSize;
|
|
8259
|
-
exports.calcExactPositionOrRandomFromSizeRanged = calcExactPositionOrRandomFromSizeRanged;
|
|
8260
7615
|
exports.calcPositionFromSize = calcPositionFromSize;
|
|
8261
7616
|
exports.calcPositionOrRandomFromSize = calcPositionOrRandomFromSize;
|
|
8262
7617
|
exports.calcPositionOrRandomFromSizeRanged = calcPositionOrRandomFromSizeRanged;
|
|
@@ -8268,11 +7623,9 @@
|
|
|
8268
7623
|
exports.circleBounce = circleBounce;
|
|
8269
7624
|
exports.circleBounceDataFromParticle = circleBounceDataFromParticle;
|
|
8270
7625
|
exports.clamp = clamp;
|
|
8271
|
-
exports.clear = clear;
|
|
8272
7626
|
exports.cloneStyle = cloneStyle;
|
|
8273
7627
|
exports.collisionVelocity = collisionVelocity;
|
|
8274
7628
|
exports.colorMix = colorMix;
|
|
8275
|
-
exports.colorToHsl = colorToHsl;
|
|
8276
7629
|
exports.colorToRgb = colorToRgb;
|
|
8277
7630
|
exports.countOffset = countOffset;
|
|
8278
7631
|
exports.decayOffset = decayOffset;
|
|
@@ -8299,16 +7652,8 @@
|
|
|
8299
7652
|
exports.deleteCount = deleteCount;
|
|
8300
7653
|
exports.double = double;
|
|
8301
7654
|
exports.doublePI = doublePI;
|
|
8302
|
-
exports.drawAfterEffect = drawAfterEffect;
|
|
8303
|
-
exports.drawBeforeEffect = drawBeforeEffect;
|
|
8304
|
-
exports.drawParticle = drawParticle;
|
|
8305
|
-
exports.drawParticlePlugin = drawParticlePlugin;
|
|
8306
|
-
exports.drawShape = drawShape;
|
|
8307
|
-
exports.drawShapeAfterDraw = drawShapeAfterDraw;
|
|
8308
|
-
exports.drawShapeBeforeDraw = drawShapeBeforeDraw;
|
|
8309
7655
|
exports.empty = empty;
|
|
8310
7656
|
exports.executeOnSingleOrMultiple = executeOnSingleOrMultiple;
|
|
8311
|
-
exports.findItemFromSingleOrMultiple = findItemFromSingleOrMultiple;
|
|
8312
7657
|
exports.generatedAttribute = generatedAttribute;
|
|
8313
7658
|
exports.generatedFalse = generatedFalse;
|
|
8314
7659
|
exports.generatedTrue = generatedTrue;
|
|
@@ -8327,23 +7672,21 @@
|
|
|
8327
7672
|
exports.getParticleDirectionAngle = getParticleDirectionAngle;
|
|
8328
7673
|
exports.getPosition = getPosition;
|
|
8329
7674
|
exports.getRandom = getRandom;
|
|
7675
|
+
exports.getRandomFn = getRandomFn;
|
|
8330
7676
|
exports.getRandomInRange = getRandomInRange;
|
|
8331
7677
|
exports.getRandomRgbColor = getRandomRgbColor;
|
|
8332
7678
|
exports.getRangeMax = getRangeMax;
|
|
8333
7679
|
exports.getRangeMin = getRangeMin;
|
|
8334
7680
|
exports.getRangeValue = getRangeValue;
|
|
8335
|
-
exports.getSize = getSize;
|
|
8336
7681
|
exports.getStyleFromHsl = getStyleFromHsl;
|
|
8337
7682
|
exports.getStyleFromRgb = getStyleFromRgb;
|
|
8338
7683
|
exports.hMax = hMax;
|
|
8339
7684
|
exports.hMin = hMin;
|
|
8340
7685
|
exports.hPhase = hPhase;
|
|
8341
7686
|
exports.half = half$1;
|
|
8342
|
-
exports.hasMatchMedia = hasMatchMedia;
|
|
8343
7687
|
exports.hslToRgb = hslToRgb;
|
|
8344
7688
|
exports.hslaToRgba = hslaToRgba;
|
|
8345
|
-
exports.identity = identity$
|
|
8346
|
-
exports.initParticleNumericAnimationValue = initParticleNumericAnimationValue;
|
|
7689
|
+
exports.identity = identity$2;
|
|
8347
7690
|
exports.inverseFactorNumerator = inverseFactorNumerator;
|
|
8348
7691
|
exports.isArray = isArray;
|
|
8349
7692
|
exports.isBoolean = isBoolean;
|
|
@@ -8360,28 +7703,34 @@
|
|
|
8360
7703
|
exports.lMax = lMax;
|
|
8361
7704
|
exports.lMin = lMin;
|
|
8362
7705
|
exports.lengthOffset = lengthOffset;
|
|
7706
|
+
exports.loadExtendProperty = loadExtendProperty;
|
|
7707
|
+
exports.loadLazyProperty = loadLazyProperty;
|
|
8363
7708
|
exports.loadMinIndex = loadMinIndex;
|
|
7709
|
+
exports.loadNestedProperty = loadNestedProperty;
|
|
7710
|
+
exports.loadOptionProperty = loadOptionProperty;
|
|
8364
7711
|
exports.loadOptions = loadOptions;
|
|
8365
7712
|
exports.loadParticlesOptions = loadParticlesOptions;
|
|
7713
|
+
exports.loadProperty = loadProperty;
|
|
8366
7714
|
exports.loadRandomFactor = loadRandomFactor;
|
|
7715
|
+
exports.loadRangeProperty = loadRangeProperty;
|
|
8367
7716
|
exports.manageListener = manageListener;
|
|
8368
|
-
exports.
|
|
7717
|
+
exports.maxNits = maxNits;
|
|
8369
7718
|
exports.midColorValue = midColorValue;
|
|
8370
7719
|
exports.millisecondsToSeconds = millisecondsToSeconds$1;
|
|
8371
7720
|
exports.minCount = minCount;
|
|
7721
|
+
exports.minDistance = minDistance;
|
|
8372
7722
|
exports.minFpsLimit = minFpsLimit;
|
|
8373
7723
|
exports.minIndex = minIndex;
|
|
8374
7724
|
exports.minLimit = minLimit;
|
|
7725
|
+
exports.minRadius = minRadius$2;
|
|
8375
7726
|
exports.minStrokeWidth = minStrokeWidth;
|
|
8376
|
-
exports.minVelocity = minVelocity
|
|
7727
|
+
exports.minVelocity = minVelocity;
|
|
8377
7728
|
exports.minZ = minZ;
|
|
8378
7729
|
exports.minimumSize = minimumSize;
|
|
8379
7730
|
exports.mix = mix;
|
|
8380
7731
|
exports.none = none;
|
|
8381
7732
|
exports.one = one;
|
|
8382
7733
|
exports.originPoint = originPoint;
|
|
8383
|
-
exports.paintBase = paintBase;
|
|
8384
|
-
exports.paintImage = paintImage;
|
|
8385
7734
|
exports.parseAlpha = parseAlpha;
|
|
8386
7735
|
exports.percentDenominator = percentDenominator;
|
|
8387
7736
|
exports.phaseNumerator = phaseNumerator;
|
|
@@ -8400,7 +7749,6 @@
|
|
|
8400
7749
|
exports.sMin = sMin;
|
|
8401
7750
|
exports.sNormalizedOffset = sNormalizedOffset;
|
|
8402
7751
|
exports.safeDocument = safeDocument;
|
|
8403
|
-
exports.safeIntersectionObserver = safeIntersectionObserver;
|
|
8404
7752
|
exports.safeMatchMedia = safeMatchMedia;
|
|
8405
7753
|
exports.safeMutationObserver = safeMutationObserver;
|
|
8406
7754
|
exports.setAnimationFunctions = setAnimationFunctions;
|
|
@@ -8416,14 +7764,13 @@
|
|
|
8416
7764
|
exports.triple = triple;
|
|
8417
7765
|
exports.tryCountIncrement = tryCountIncrement;
|
|
8418
7766
|
exports.tsParticles = tsParticles;
|
|
8419
|
-
exports.updateAnimation = updateAnimation;
|
|
8420
7767
|
exports.updateColor = updateColor;
|
|
8421
7768
|
exports.updateColorValue = updateColorValue;
|
|
8422
7769
|
exports.visibilityChangeEvent = visibilityChangeEvent;
|
|
8423
7770
|
exports.zIndexFactorOffset = zIndexFactorOffset;
|
|
8424
7771
|
|
|
8425
7772
|
}));
|
|
8426
|
-
Object.assign(globalThis.window || globalThis, { loadMinIndex: (globalThis.__tsParticlesInternals.bundles.ribbons || {}).loadMinIndex, loadOptions: (globalThis.__tsParticlesInternals.bundles.ribbons || {}).loadOptions, loadParticlesOptions: (globalThis.__tsParticlesInternals.bundles.ribbons || {}).loadParticlesOptions, loadRandomFactor: (globalThis.__tsParticlesInternals.bundles.ribbons || {}).loadRandomFactor, tsParticles: (globalThis.__tsParticlesInternals.bundles.ribbons || {}).tsParticles });
|
|
7773
|
+
Object.assign(globalThis.window || globalThis, { loadExtendProperty: (globalThis.__tsParticlesInternals.bundles.ribbons || {}).loadExtendProperty, loadLazyProperty: (globalThis.__tsParticlesInternals.bundles.ribbons || {}).loadLazyProperty, loadMinIndex: (globalThis.__tsParticlesInternals.bundles.ribbons || {}).loadMinIndex, loadNestedProperty: (globalThis.__tsParticlesInternals.bundles.ribbons || {}).loadNestedProperty, loadOptionProperty: (globalThis.__tsParticlesInternals.bundles.ribbons || {}).loadOptionProperty, loadOptions: (globalThis.__tsParticlesInternals.bundles.ribbons || {}).loadOptions, loadParticlesOptions: (globalThis.__tsParticlesInternals.bundles.ribbons || {}).loadParticlesOptions, loadProperty: (globalThis.__tsParticlesInternals.bundles.ribbons || {}).loadProperty, loadRandomFactor: (globalThis.__tsParticlesInternals.bundles.ribbons || {}).loadRandomFactor, loadRangeProperty: (globalThis.__tsParticlesInternals.bundles.ribbons || {}).loadRangeProperty, tsParticles: (globalThis.__tsParticlesInternals.bundles.ribbons || {}).tsParticles });
|
|
8427
7774
|
globalThis.__tsParticlesInternals = globalThis.__tsParticlesInternals || {};
|
|
8428
7775
|
if (!globalThis.__tsParticlesInternals.engine || !globalThis.__tsParticlesInternals.engine.tsParticles) {
|
|
8429
7776
|
globalThis.__tsParticlesInternals.engine = globalThis.__tsParticlesInternals.bundles.ribbons || {};
|