@tsparticles/ribbons 4.1.2 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -8
- 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 +1073 -1729
- 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]);
|
|
1458
1162
|
}
|
|
1459
1163
|
}
|
|
1460
1164
|
|
|
1461
|
-
class
|
|
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);
|
|
1206
|
+
}
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
class HslAnimation extends OptionLoader {
|
|
1462
1210
|
h = new ColorAnimation(hMin, hMax);
|
|
1463
1211
|
l = new ColorAnimation(lMin, lMax);
|
|
1464
1212
|
s = new ColorAnimation(sMin, sMax);
|
|
1465
|
-
|
|
1466
|
-
if (isNull(data)) {
|
|
1467
|
-
return;
|
|
1468
|
-
}
|
|
1213
|
+
doLoad(data) {
|
|
1469
1214
|
this.h.load(data.h);
|
|
1470
1215
|
this.s.load(data.s);
|
|
1471
1216
|
this.l.load(data.l);
|
|
1472
1217
|
}
|
|
1473
1218
|
}
|
|
1474
1219
|
|
|
1475
|
-
class OptionsColor {
|
|
1476
|
-
value;
|
|
1477
|
-
constructor() {
|
|
1478
|
-
this.value = "";
|
|
1479
|
-
}
|
|
1220
|
+
class OptionsColor extends OptionLoader {
|
|
1221
|
+
value = "";
|
|
1480
1222
|
static create(source, data) {
|
|
1481
1223
|
const color = new OptionsColor();
|
|
1482
1224
|
color.load(source);
|
|
@@ -1490,10 +1232,7 @@
|
|
|
1490
1232
|
}
|
|
1491
1233
|
return color;
|
|
1492
1234
|
}
|
|
1493
|
-
|
|
1494
|
-
if (isNull(data)) {
|
|
1495
|
-
return;
|
|
1496
|
-
}
|
|
1235
|
+
doLoad(data) {
|
|
1497
1236
|
if (!isNull(data.value)) {
|
|
1498
1237
|
this.value = data.value;
|
|
1499
1238
|
}
|
|
@@ -1501,11 +1240,7 @@
|
|
|
1501
1240
|
}
|
|
1502
1241
|
|
|
1503
1242
|
class AnimatableColor extends OptionsColor {
|
|
1504
|
-
animation;
|
|
1505
|
-
constructor() {
|
|
1506
|
-
super();
|
|
1507
|
-
this.animation = new HslAnimation();
|
|
1508
|
-
}
|
|
1243
|
+
animation = new HslAnimation();
|
|
1509
1244
|
static create(source, data) {
|
|
1510
1245
|
const color = new AnimatableColor();
|
|
1511
1246
|
color.load(source);
|
|
@@ -1519,11 +1254,8 @@
|
|
|
1519
1254
|
}
|
|
1520
1255
|
return color;
|
|
1521
1256
|
}
|
|
1522
|
-
|
|
1523
|
-
super.
|
|
1524
|
-
if (isNull(data)) {
|
|
1525
|
-
return;
|
|
1526
|
-
}
|
|
1257
|
+
doLoad(data) {
|
|
1258
|
+
super.doLoad(data);
|
|
1527
1259
|
const colorAnimation = data.animation;
|
|
1528
1260
|
if (colorAnimation !== undefined) {
|
|
1529
1261
|
if (colorAnimation.enable === undefined) {
|
|
@@ -1536,100 +1268,53 @@
|
|
|
1536
1268
|
}
|
|
1537
1269
|
}
|
|
1538
1270
|
|
|
1539
|
-
class Background {
|
|
1271
|
+
class Background extends OptionLoader {
|
|
1540
1272
|
color;
|
|
1541
|
-
image;
|
|
1542
|
-
opacity;
|
|
1543
|
-
position;
|
|
1544
|
-
repeat;
|
|
1545
|
-
size;
|
|
1273
|
+
image = "";
|
|
1274
|
+
opacity = 1;
|
|
1275
|
+
position = "";
|
|
1276
|
+
repeat = "";
|
|
1277
|
+
size = "";
|
|
1546
1278
|
constructor() {
|
|
1279
|
+
super();
|
|
1547
1280
|
this.color = new OptionsColor();
|
|
1548
1281
|
this.color.value = "";
|
|
1549
|
-
this.image = "";
|
|
1550
|
-
this.position = "";
|
|
1551
|
-
this.repeat = "";
|
|
1552
|
-
this.size = "";
|
|
1553
|
-
this.opacity = 1;
|
|
1554
1282
|
}
|
|
1555
|
-
|
|
1556
|
-
if (isNull(data)) {
|
|
1557
|
-
return;
|
|
1558
|
-
}
|
|
1283
|
+
doLoad(data) {
|
|
1559
1284
|
if (data.color !== undefined) {
|
|
1560
1285
|
this.color = OptionsColor.create(this.color, data.color);
|
|
1561
1286
|
}
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
}
|
|
1568
|
-
if (data.repeat !== undefined) {
|
|
1569
|
-
this.repeat = data.repeat;
|
|
1570
|
-
}
|
|
1571
|
-
if (data.size !== undefined) {
|
|
1572
|
-
this.size = data.size;
|
|
1573
|
-
}
|
|
1574
|
-
if (data.opacity !== undefined) {
|
|
1575
|
-
this.opacity = data.opacity;
|
|
1576
|
-
}
|
|
1287
|
+
loadProperty(this, "image", data.image);
|
|
1288
|
+
loadProperty(this, "position", data.position);
|
|
1289
|
+
loadProperty(this, "repeat", data.repeat);
|
|
1290
|
+
loadProperty(this, "size", data.size);
|
|
1291
|
+
loadProperty(this, "opacity", data.opacity);
|
|
1577
1292
|
}
|
|
1578
1293
|
}
|
|
1579
1294
|
|
|
1580
|
-
class FullScreen {
|
|
1581
|
-
enable;
|
|
1582
|
-
zIndex;
|
|
1583
|
-
|
|
1584
|
-
this.enable
|
|
1585
|
-
this.zIndex
|
|
1586
|
-
}
|
|
1587
|
-
load(data) {
|
|
1588
|
-
if (isNull(data)) {
|
|
1589
|
-
return;
|
|
1590
|
-
}
|
|
1591
|
-
if (data.enable !== undefined) {
|
|
1592
|
-
this.enable = data.enable;
|
|
1593
|
-
}
|
|
1594
|
-
if (data.zIndex !== undefined) {
|
|
1595
|
-
this.zIndex = data.zIndex;
|
|
1596
|
-
}
|
|
1295
|
+
class FullScreen extends OptionLoader {
|
|
1296
|
+
enable = true;
|
|
1297
|
+
zIndex = 0;
|
|
1298
|
+
doLoad(data) {
|
|
1299
|
+
loadProperty(this, "enable", data.enable);
|
|
1300
|
+
loadProperty(this, "zIndex", data.zIndex);
|
|
1597
1301
|
}
|
|
1598
1302
|
}
|
|
1599
1303
|
|
|
1600
|
-
class ResizeEvent {
|
|
1601
|
-
delay;
|
|
1602
|
-
enable;
|
|
1603
|
-
|
|
1604
|
-
this
|
|
1605
|
-
this.enable
|
|
1606
|
-
}
|
|
1607
|
-
load(data) {
|
|
1608
|
-
if (isNull(data)) {
|
|
1609
|
-
return;
|
|
1610
|
-
}
|
|
1611
|
-
if (data.delay !== undefined) {
|
|
1612
|
-
this.delay = data.delay;
|
|
1613
|
-
}
|
|
1614
|
-
if (data.enable !== undefined) {
|
|
1615
|
-
this.enable = data.enable;
|
|
1616
|
-
}
|
|
1304
|
+
class ResizeEvent extends OptionLoader {
|
|
1305
|
+
delay = 0.5;
|
|
1306
|
+
enable = true;
|
|
1307
|
+
doLoad(data) {
|
|
1308
|
+
loadProperty(this, "delay", data.delay);
|
|
1309
|
+
loadProperty(this, "enable", data.enable);
|
|
1617
1310
|
}
|
|
1618
1311
|
}
|
|
1619
1312
|
|
|
1620
|
-
class Effect {
|
|
1621
|
-
close;
|
|
1622
|
-
options;
|
|
1623
|
-
type;
|
|
1624
|
-
|
|
1625
|
-
this.close = true;
|
|
1626
|
-
this.options = {};
|
|
1627
|
-
this.type = [];
|
|
1628
|
-
}
|
|
1629
|
-
load(data) {
|
|
1630
|
-
if (isNull(data)) {
|
|
1631
|
-
return;
|
|
1632
|
-
}
|
|
1313
|
+
class Effect extends OptionLoader {
|
|
1314
|
+
close = true;
|
|
1315
|
+
options = {};
|
|
1316
|
+
type = [];
|
|
1317
|
+
doLoad(data) {
|
|
1633
1318
|
const options = data.options;
|
|
1634
1319
|
if (options !== undefined) {
|
|
1635
1320
|
for (const effect in options) {
|
|
@@ -1639,128 +1324,62 @@
|
|
|
1639
1324
|
}
|
|
1640
1325
|
}
|
|
1641
1326
|
}
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
}
|
|
1645
|
-
if (data.type !== undefined) {
|
|
1646
|
-
this.type = data.type;
|
|
1647
|
-
}
|
|
1327
|
+
loadProperty(this, "close", data.close);
|
|
1328
|
+
loadProperty(this, "type", data.type);
|
|
1648
1329
|
}
|
|
1649
1330
|
}
|
|
1650
1331
|
|
|
1651
|
-
class Fill {
|
|
1332
|
+
class Fill extends OptionLoader {
|
|
1652
1333
|
color;
|
|
1653
|
-
enable;
|
|
1654
|
-
opacity;
|
|
1655
|
-
|
|
1656
|
-
this.enable = true;
|
|
1657
|
-
this.opacity = 1;
|
|
1658
|
-
}
|
|
1659
|
-
load(data) {
|
|
1660
|
-
if (isNull(data)) {
|
|
1661
|
-
return;
|
|
1662
|
-
}
|
|
1334
|
+
enable = true;
|
|
1335
|
+
opacity = 1;
|
|
1336
|
+
doLoad(data) {
|
|
1663
1337
|
if (data.color !== undefined) {
|
|
1664
1338
|
this.color = AnimatableColor.create(this.color, data.color);
|
|
1665
1339
|
}
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
}
|
|
1669
|
-
if (data.opacity !== undefined) {
|
|
1670
|
-
this.opacity = setRangeValue(data.opacity);
|
|
1671
|
-
}
|
|
1340
|
+
loadProperty(this, "enable", data.enable);
|
|
1341
|
+
loadRangeProperty(this, "opacity", data.opacity);
|
|
1672
1342
|
}
|
|
1673
1343
|
}
|
|
1674
1344
|
|
|
1675
|
-
class MoveAngle {
|
|
1676
|
-
offset;
|
|
1677
|
-
value;
|
|
1678
|
-
|
|
1679
|
-
this.offset
|
|
1680
|
-
this.value
|
|
1681
|
-
}
|
|
1682
|
-
load(data) {
|
|
1683
|
-
if (isNull(data)) {
|
|
1684
|
-
return;
|
|
1685
|
-
}
|
|
1686
|
-
if (data.offset !== undefined) {
|
|
1687
|
-
this.offset = setRangeValue(data.offset);
|
|
1688
|
-
}
|
|
1689
|
-
if (data.value !== undefined) {
|
|
1690
|
-
this.value = setRangeValue(data.value);
|
|
1691
|
-
}
|
|
1345
|
+
class MoveAngle extends OptionLoader {
|
|
1346
|
+
offset = 0;
|
|
1347
|
+
value = 90;
|
|
1348
|
+
doLoad(data) {
|
|
1349
|
+
loadRangeProperty(this, "offset", data.offset);
|
|
1350
|
+
loadRangeProperty(this, "value", data.value);
|
|
1692
1351
|
}
|
|
1693
1352
|
}
|
|
1694
1353
|
|
|
1695
|
-
class MoveCenter {
|
|
1696
|
-
mode;
|
|
1697
|
-
radius;
|
|
1698
|
-
x;
|
|
1699
|
-
y;
|
|
1700
|
-
|
|
1701
|
-
this.x
|
|
1702
|
-
this.y
|
|
1703
|
-
this
|
|
1704
|
-
this.radius
|
|
1705
|
-
}
|
|
1706
|
-
load(data) {
|
|
1707
|
-
if (isNull(data)) {
|
|
1708
|
-
return;
|
|
1709
|
-
}
|
|
1710
|
-
if (data.x !== undefined) {
|
|
1711
|
-
this.x = data.x;
|
|
1712
|
-
}
|
|
1713
|
-
if (data.y !== undefined) {
|
|
1714
|
-
this.y = data.y;
|
|
1715
|
-
}
|
|
1716
|
-
if (data.mode !== undefined) {
|
|
1717
|
-
this.mode = data.mode;
|
|
1718
|
-
}
|
|
1719
|
-
if (data.radius !== undefined) {
|
|
1720
|
-
this.radius = data.radius;
|
|
1721
|
-
}
|
|
1354
|
+
class MoveCenter extends OptionLoader {
|
|
1355
|
+
mode = exports.PixelMode.percent;
|
|
1356
|
+
radius = 0;
|
|
1357
|
+
x = 50;
|
|
1358
|
+
y = 50;
|
|
1359
|
+
doLoad(data) {
|
|
1360
|
+
loadProperty(this, "x", data.x);
|
|
1361
|
+
loadProperty(this, "y", data.y);
|
|
1362
|
+
loadProperty(this, "mode", data.mode);
|
|
1363
|
+
loadProperty(this, "radius", data.radius);
|
|
1722
1364
|
}
|
|
1723
1365
|
}
|
|
1724
1366
|
|
|
1725
|
-
class MoveGravity {
|
|
1726
|
-
acceleration;
|
|
1727
|
-
enable;
|
|
1728
|
-
inverse;
|
|
1729
|
-
maxSpeed;
|
|
1730
|
-
|
|
1731
|
-
this
|
|
1732
|
-
this.enable
|
|
1733
|
-
this.inverse
|
|
1734
|
-
this.maxSpeed
|
|
1735
|
-
}
|
|
1736
|
-
load(data) {
|
|
1737
|
-
if (isNull(data)) {
|
|
1738
|
-
return;
|
|
1739
|
-
}
|
|
1740
|
-
if (data.acceleration !== undefined) {
|
|
1741
|
-
this.acceleration = setRangeValue(data.acceleration);
|
|
1742
|
-
}
|
|
1743
|
-
if (data.enable !== undefined) {
|
|
1744
|
-
this.enable = data.enable;
|
|
1745
|
-
}
|
|
1746
|
-
if (data.inverse !== undefined) {
|
|
1747
|
-
this.inverse = data.inverse;
|
|
1748
|
-
}
|
|
1749
|
-
if (data.maxSpeed !== undefined) {
|
|
1750
|
-
this.maxSpeed = setRangeValue(data.maxSpeed);
|
|
1751
|
-
}
|
|
1367
|
+
class MoveGravity extends OptionLoader {
|
|
1368
|
+
acceleration = 9.81;
|
|
1369
|
+
enable = false;
|
|
1370
|
+
inverse = false;
|
|
1371
|
+
maxSpeed = 50;
|
|
1372
|
+
doLoad(data) {
|
|
1373
|
+
loadRangeProperty(this, "acceleration", data.acceleration);
|
|
1374
|
+
loadProperty(this, "enable", data.enable);
|
|
1375
|
+
loadProperty(this, "inverse", data.inverse);
|
|
1376
|
+
loadRangeProperty(this, "maxSpeed", data.maxSpeed);
|
|
1752
1377
|
}
|
|
1753
1378
|
}
|
|
1754
1379
|
|
|
1755
|
-
class ValueWithRandom {
|
|
1756
|
-
value;
|
|
1757
|
-
|
|
1758
|
-
this.value = 0;
|
|
1759
|
-
}
|
|
1760
|
-
load(data) {
|
|
1761
|
-
if (isNull(data)) {
|
|
1762
|
-
return;
|
|
1763
|
-
}
|
|
1380
|
+
class ValueWithRandom extends OptionLoader {
|
|
1381
|
+
value = 0;
|
|
1382
|
+
doLoad(data) {
|
|
1764
1383
|
if (!isNull(data.value)) {
|
|
1765
1384
|
this.value = setRangeValue(data.value);
|
|
1766
1385
|
}
|
|
@@ -1768,51 +1387,25 @@
|
|
|
1768
1387
|
}
|
|
1769
1388
|
class AnimationValueWithRandom extends ValueWithRandom {
|
|
1770
1389
|
animation = new AnimationOptions();
|
|
1771
|
-
|
|
1772
|
-
super.
|
|
1773
|
-
|
|
1774
|
-
return;
|
|
1775
|
-
}
|
|
1776
|
-
const animation = data.animation;
|
|
1777
|
-
if (animation !== undefined) {
|
|
1778
|
-
this.animation.load(animation);
|
|
1779
|
-
}
|
|
1390
|
+
doLoad(data) {
|
|
1391
|
+
super.doLoad(data);
|
|
1392
|
+
loadNestedProperty(this, "animation", data.animation);
|
|
1780
1393
|
}
|
|
1781
1394
|
}
|
|
1782
1395
|
class RangedAnimationValueWithRandom extends AnimationValueWithRandom {
|
|
1783
|
-
animation;
|
|
1784
|
-
constructor() {
|
|
1785
|
-
super();
|
|
1786
|
-
this.animation = new RangedAnimationOptions();
|
|
1787
|
-
}
|
|
1788
|
-
load(data) {
|
|
1789
|
-
super.load(data);
|
|
1790
|
-
}
|
|
1396
|
+
animation = new RangedAnimationOptions();
|
|
1791
1397
|
}
|
|
1792
1398
|
|
|
1793
|
-
class MovePath {
|
|
1794
|
-
clamp;
|
|
1795
|
-
delay;
|
|
1796
|
-
enable;
|
|
1399
|
+
class MovePath extends OptionLoader {
|
|
1400
|
+
clamp = true;
|
|
1401
|
+
delay = new ValueWithRandom();
|
|
1402
|
+
enable = false;
|
|
1797
1403
|
generator;
|
|
1798
|
-
options;
|
|
1799
|
-
|
|
1800
|
-
this.clamp
|
|
1801
|
-
this.delay = new ValueWithRandom();
|
|
1802
|
-
this.enable = false;
|
|
1803
|
-
this.options = {};
|
|
1804
|
-
}
|
|
1805
|
-
load(data) {
|
|
1806
|
-
if (isNull(data)) {
|
|
1807
|
-
return;
|
|
1808
|
-
}
|
|
1809
|
-
if (data.clamp !== undefined) {
|
|
1810
|
-
this.clamp = data.clamp;
|
|
1811
|
-
}
|
|
1404
|
+
options = {};
|
|
1405
|
+
doLoad(data) {
|
|
1406
|
+
loadProperty(this, "clamp", data.clamp);
|
|
1812
1407
|
this.delay.load(data.delay);
|
|
1813
|
-
|
|
1814
|
-
this.enable = data.enable;
|
|
1815
|
-
}
|
|
1408
|
+
loadProperty(this, "enable", data.enable);
|
|
1816
1409
|
this.generator = data.generator;
|
|
1817
1410
|
if (data.options) {
|
|
1818
1411
|
this.options = deepExtend(this.options, data.options);
|
|
@@ -1820,19 +1413,13 @@
|
|
|
1820
1413
|
}
|
|
1821
1414
|
}
|
|
1822
1415
|
|
|
1823
|
-
class OutModes {
|
|
1416
|
+
class OutModes extends OptionLoader {
|
|
1824
1417
|
bottom;
|
|
1825
|
-
default;
|
|
1418
|
+
default = exports.OutMode.out;
|
|
1826
1419
|
left;
|
|
1827
1420
|
right;
|
|
1828
1421
|
top;
|
|
1829
|
-
|
|
1830
|
-
this.default = exports.OutMode.out;
|
|
1831
|
-
}
|
|
1832
|
-
load(data) {
|
|
1833
|
-
if (isNull(data)) {
|
|
1834
|
-
return;
|
|
1835
|
-
}
|
|
1422
|
+
doLoad(data) {
|
|
1836
1423
|
if (data.default !== undefined) {
|
|
1837
1424
|
this.default = data.default;
|
|
1838
1425
|
}
|
|
@@ -1843,79 +1430,42 @@
|
|
|
1843
1430
|
}
|
|
1844
1431
|
}
|
|
1845
1432
|
|
|
1846
|
-
class Spin {
|
|
1847
|
-
acceleration;
|
|
1848
|
-
enable;
|
|
1433
|
+
class Spin extends OptionLoader {
|
|
1434
|
+
acceleration = 0;
|
|
1435
|
+
enable = false;
|
|
1849
1436
|
position;
|
|
1850
|
-
|
|
1851
|
-
this.acceleration
|
|
1852
|
-
this.enable
|
|
1853
|
-
}
|
|
1854
|
-
load(data) {
|
|
1855
|
-
if (isNull(data)) {
|
|
1856
|
-
return;
|
|
1857
|
-
}
|
|
1858
|
-
if (data.acceleration !== undefined) {
|
|
1859
|
-
this.acceleration = setRangeValue(data.acceleration);
|
|
1860
|
-
}
|
|
1861
|
-
if (data.enable !== undefined) {
|
|
1862
|
-
this.enable = data.enable;
|
|
1863
|
-
}
|
|
1437
|
+
doLoad(data) {
|
|
1438
|
+
loadRangeProperty(this, "acceleration", data.acceleration);
|
|
1439
|
+
loadProperty(this, "enable", data.enable);
|
|
1864
1440
|
if (data.position) {
|
|
1865
1441
|
this.position = deepExtend({}, data.position);
|
|
1866
1442
|
}
|
|
1867
1443
|
}
|
|
1868
1444
|
}
|
|
1869
1445
|
|
|
1870
|
-
class Move {
|
|
1871
|
-
angle;
|
|
1872
|
-
center;
|
|
1873
|
-
decay;
|
|
1874
|
-
direction;
|
|
1875
|
-
distance;
|
|
1876
|
-
drift;
|
|
1877
|
-
enable;
|
|
1878
|
-
gravity;
|
|
1879
|
-
outModes;
|
|
1880
|
-
path;
|
|
1881
|
-
random;
|
|
1882
|
-
size;
|
|
1883
|
-
speed;
|
|
1884
|
-
spin;
|
|
1885
|
-
straight;
|
|
1886
|
-
vibrate;
|
|
1887
|
-
warp;
|
|
1888
|
-
|
|
1889
|
-
this.angle = new MoveAngle();
|
|
1890
|
-
this.center = new MoveCenter();
|
|
1891
|
-
this.decay = 0;
|
|
1892
|
-
this.distance = {};
|
|
1893
|
-
this.direction = exports.MoveDirection.none;
|
|
1894
|
-
this.drift = 0;
|
|
1895
|
-
this.enable = false;
|
|
1896
|
-
this.gravity = new MoveGravity();
|
|
1897
|
-
this.path = new MovePath();
|
|
1898
|
-
this.outModes = new OutModes();
|
|
1899
|
-
this.random = false;
|
|
1900
|
-
this.size = false;
|
|
1901
|
-
this.speed = 2;
|
|
1902
|
-
this.spin = new Spin();
|
|
1903
|
-
this.straight = false;
|
|
1904
|
-
this.vibrate = false;
|
|
1905
|
-
this.warp = false;
|
|
1906
|
-
}
|
|
1907
|
-
load(data) {
|
|
1908
|
-
if (isNull(data)) {
|
|
1909
|
-
return;
|
|
1910
|
-
}
|
|
1446
|
+
class Move extends OptionLoader {
|
|
1447
|
+
angle = new MoveAngle();
|
|
1448
|
+
center = new MoveCenter();
|
|
1449
|
+
decay = 0;
|
|
1450
|
+
direction = exports.MoveDirection.none;
|
|
1451
|
+
distance = {};
|
|
1452
|
+
drift = 0;
|
|
1453
|
+
enable = false;
|
|
1454
|
+
gravity = new MoveGravity();
|
|
1455
|
+
outModes = new OutModes();
|
|
1456
|
+
path = new MovePath();
|
|
1457
|
+
random = false;
|
|
1458
|
+
size = false;
|
|
1459
|
+
speed = 2;
|
|
1460
|
+
spin = new Spin();
|
|
1461
|
+
straight = false;
|
|
1462
|
+
vibrate = false;
|
|
1463
|
+
warp = false;
|
|
1464
|
+
doLoad(data) {
|
|
1911
1465
|
this.angle.load(isNumber(data.angle) ? { value: data.angle } : data.angle);
|
|
1912
1466
|
this.center.load(data.center);
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
}
|
|
1916
|
-
if (data.direction !== undefined) {
|
|
1917
|
-
this.direction = data.direction;
|
|
1918
|
-
}
|
|
1467
|
+
loadRangeProperty(this, "decay", data.decay);
|
|
1468
|
+
loadProperty(this, "direction", data.direction);
|
|
1919
1469
|
if (data.distance !== undefined) {
|
|
1920
1470
|
this.distance = isNumber(data.distance)
|
|
1921
1471
|
? {
|
|
@@ -1924,12 +1474,8 @@
|
|
|
1924
1474
|
}
|
|
1925
1475
|
: { ...data.distance };
|
|
1926
1476
|
}
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
}
|
|
1930
|
-
if (data.enable !== undefined) {
|
|
1931
|
-
this.enable = data.enable;
|
|
1932
|
-
}
|
|
1477
|
+
loadRangeProperty(this, "drift", data.drift);
|
|
1478
|
+
loadProperty(this, "enable", data.enable);
|
|
1933
1479
|
this.gravity.load(data.gravity);
|
|
1934
1480
|
const outModes = data.outModes;
|
|
1935
1481
|
if (outModes !== undefined) {
|
|
@@ -1943,177 +1489,91 @@
|
|
|
1943
1489
|
}
|
|
1944
1490
|
}
|
|
1945
1491
|
this.path.load(data.path);
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
if (data.size !== undefined) {
|
|
1950
|
-
this.size = data.size;
|
|
1951
|
-
}
|
|
1952
|
-
if (data.speed !== undefined) {
|
|
1953
|
-
this.speed = setRangeValue(data.speed);
|
|
1954
|
-
}
|
|
1492
|
+
loadProperty(this, "random", data.random);
|
|
1493
|
+
loadProperty(this, "size", data.size);
|
|
1494
|
+
loadRangeProperty(this, "speed", data.speed);
|
|
1955
1495
|
this.spin.load(data.spin);
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
if (data.vibrate !== undefined) {
|
|
1960
|
-
this.vibrate = data.vibrate;
|
|
1961
|
-
}
|
|
1962
|
-
if (data.warp !== undefined) {
|
|
1963
|
-
this.warp = data.warp;
|
|
1964
|
-
}
|
|
1496
|
+
loadProperty(this, "straight", data.straight);
|
|
1497
|
+
loadProperty(this, "vibrate", data.vibrate);
|
|
1498
|
+
loadProperty(this, "warp", data.warp);
|
|
1965
1499
|
}
|
|
1966
1500
|
}
|
|
1967
1501
|
|
|
1968
|
-
class Stroke {
|
|
1502
|
+
class Stroke extends OptionLoader {
|
|
1969
1503
|
color;
|
|
1970
1504
|
opacity;
|
|
1971
|
-
width;
|
|
1972
|
-
|
|
1973
|
-
this.width = 0;
|
|
1974
|
-
}
|
|
1975
|
-
load(data) {
|
|
1976
|
-
if (isNull(data)) {
|
|
1977
|
-
return;
|
|
1978
|
-
}
|
|
1505
|
+
width = 0;
|
|
1506
|
+
doLoad(data) {
|
|
1979
1507
|
if (data.color !== undefined) {
|
|
1980
1508
|
this.color = AnimatableColor.create(this.color, data.color);
|
|
1981
1509
|
}
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
}
|
|
1985
|
-
if (data.opacity !== undefined) {
|
|
1986
|
-
this.opacity = setRangeValue(data.opacity);
|
|
1987
|
-
}
|
|
1510
|
+
loadRangeProperty(this, "width", data.width);
|
|
1511
|
+
loadRangeProperty(this, "opacity", data.opacity);
|
|
1988
1512
|
}
|
|
1989
1513
|
}
|
|
1990
1514
|
|
|
1991
|
-
class Paint {
|
|
1515
|
+
class Paint extends OptionLoader {
|
|
1992
1516
|
color;
|
|
1993
1517
|
fill;
|
|
1994
1518
|
stroke;
|
|
1995
|
-
|
|
1996
|
-
if (isNull(data)) {
|
|
1997
|
-
return;
|
|
1998
|
-
}
|
|
1519
|
+
doLoad(data) {
|
|
1999
1520
|
if (data.color !== undefined) {
|
|
2000
1521
|
this.color = AnimatableColor.create(this.color, data.color);
|
|
2001
1522
|
}
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
this.fill.load(data.fill);
|
|
2005
|
-
}
|
|
2006
|
-
if (data.stroke !== undefined) {
|
|
2007
|
-
this.stroke ??= new Stroke();
|
|
2008
|
-
this.stroke.load(data.stroke);
|
|
2009
|
-
}
|
|
1523
|
+
loadLazyProperty(this, "fill", data.fill, () => new Fill());
|
|
1524
|
+
loadLazyProperty(this, "stroke", data.stroke, () => new Stroke());
|
|
2010
1525
|
}
|
|
2011
1526
|
}
|
|
2012
1527
|
|
|
2013
1528
|
class ParticlesBounceFactor extends ValueWithRandom {
|
|
2014
|
-
|
|
2015
|
-
super();
|
|
2016
|
-
this.value = 1;
|
|
2017
|
-
}
|
|
1529
|
+
value = 1;
|
|
2018
1530
|
}
|
|
2019
1531
|
|
|
2020
|
-
class ParticlesBounce {
|
|
2021
|
-
horizontal;
|
|
2022
|
-
vertical;
|
|
2023
|
-
|
|
2024
|
-
this.horizontal = new ParticlesBounceFactor();
|
|
2025
|
-
this.vertical = new ParticlesBounceFactor();
|
|
2026
|
-
}
|
|
2027
|
-
load(data) {
|
|
2028
|
-
if (isNull(data)) {
|
|
2029
|
-
return;
|
|
2030
|
-
}
|
|
1532
|
+
class ParticlesBounce extends OptionLoader {
|
|
1533
|
+
horizontal = new ParticlesBounceFactor();
|
|
1534
|
+
vertical = new ParticlesBounceFactor();
|
|
1535
|
+
doLoad(data) {
|
|
2031
1536
|
this.horizontal.load(data.horizontal);
|
|
2032
1537
|
this.vertical.load(data.vertical);
|
|
2033
1538
|
}
|
|
2034
1539
|
}
|
|
2035
1540
|
|
|
2036
|
-
class ParticlesDensity {
|
|
2037
|
-
enable;
|
|
2038
|
-
height;
|
|
2039
|
-
width;
|
|
2040
|
-
|
|
2041
|
-
this.enable
|
|
2042
|
-
this.width
|
|
2043
|
-
this.height
|
|
2044
|
-
}
|
|
2045
|
-
load(data) {
|
|
2046
|
-
if (isNull(data)) {
|
|
2047
|
-
return;
|
|
2048
|
-
}
|
|
2049
|
-
if (data.enable !== undefined) {
|
|
2050
|
-
this.enable = data.enable;
|
|
2051
|
-
}
|
|
2052
|
-
const width = data.width;
|
|
2053
|
-
if (width !== undefined) {
|
|
2054
|
-
this.width = width;
|
|
2055
|
-
}
|
|
2056
|
-
const height = data.height;
|
|
2057
|
-
if (height !== undefined) {
|
|
2058
|
-
this.height = height;
|
|
2059
|
-
}
|
|
1541
|
+
class ParticlesDensity extends OptionLoader {
|
|
1542
|
+
enable = false;
|
|
1543
|
+
height = 1080;
|
|
1544
|
+
width = 1920;
|
|
1545
|
+
doLoad(data) {
|
|
1546
|
+
loadProperty(this, "enable", data.enable);
|
|
1547
|
+
loadProperty(this, "width", data.width);
|
|
1548
|
+
loadProperty(this, "height", data.height);
|
|
2060
1549
|
}
|
|
2061
1550
|
}
|
|
2062
1551
|
|
|
2063
|
-
class ParticlesNumberLimit {
|
|
2064
|
-
mode;
|
|
2065
|
-
value;
|
|
2066
|
-
|
|
2067
|
-
this
|
|
2068
|
-
this.value
|
|
2069
|
-
}
|
|
2070
|
-
load(data) {
|
|
2071
|
-
if (isNull(data)) {
|
|
2072
|
-
return;
|
|
2073
|
-
}
|
|
2074
|
-
if (data.mode !== undefined) {
|
|
2075
|
-
this.mode = data.mode;
|
|
2076
|
-
}
|
|
2077
|
-
if (data.value !== undefined) {
|
|
2078
|
-
this.value = data.value;
|
|
2079
|
-
}
|
|
1552
|
+
class ParticlesNumberLimit extends OptionLoader {
|
|
1553
|
+
mode = exports.LimitMode.delete;
|
|
1554
|
+
value = 0;
|
|
1555
|
+
doLoad(data) {
|
|
1556
|
+
loadProperty(this, "mode", data.mode);
|
|
1557
|
+
loadProperty(this, "value", data.value);
|
|
2080
1558
|
}
|
|
2081
1559
|
}
|
|
2082
1560
|
|
|
2083
|
-
class ParticlesNumber {
|
|
2084
|
-
density;
|
|
2085
|
-
limit;
|
|
2086
|
-
value;
|
|
2087
|
-
|
|
2088
|
-
this.density = new ParticlesDensity();
|
|
2089
|
-
this.limit = new ParticlesNumberLimit();
|
|
2090
|
-
this.value = 0;
|
|
2091
|
-
}
|
|
2092
|
-
load(data) {
|
|
2093
|
-
if (isNull(data)) {
|
|
2094
|
-
return;
|
|
2095
|
-
}
|
|
1561
|
+
class ParticlesNumber extends OptionLoader {
|
|
1562
|
+
density = new ParticlesDensity();
|
|
1563
|
+
limit = new ParticlesNumberLimit();
|
|
1564
|
+
value = 0;
|
|
1565
|
+
doLoad(data) {
|
|
2096
1566
|
this.density.load(data.density);
|
|
2097
1567
|
this.limit.load(data.limit);
|
|
2098
|
-
|
|
2099
|
-
this.value = data.value;
|
|
2100
|
-
}
|
|
1568
|
+
loadProperty(this, "value", data.value);
|
|
2101
1569
|
}
|
|
2102
1570
|
}
|
|
2103
1571
|
|
|
2104
|
-
class Shape {
|
|
2105
|
-
close;
|
|
2106
|
-
options;
|
|
2107
|
-
type;
|
|
2108
|
-
|
|
2109
|
-
this.close = true;
|
|
2110
|
-
this.options = {};
|
|
2111
|
-
this.type = "circle";
|
|
2112
|
-
}
|
|
2113
|
-
load(data) {
|
|
2114
|
-
if (isNull(data)) {
|
|
2115
|
-
return;
|
|
2116
|
-
}
|
|
1572
|
+
class Shape extends OptionLoader {
|
|
1573
|
+
close = true;
|
|
1574
|
+
options = {};
|
|
1575
|
+
type = "circle";
|
|
1576
|
+
doLoad(data) {
|
|
2117
1577
|
const options = data.options;
|
|
2118
1578
|
if (options !== undefined) {
|
|
2119
1579
|
for (const shape in options) {
|
|
@@ -2123,76 +1583,47 @@
|
|
|
2123
1583
|
}
|
|
2124
1584
|
}
|
|
2125
1585
|
}
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
}
|
|
2129
|
-
if (data.type !== undefined) {
|
|
2130
|
-
this.type = data.type;
|
|
2131
|
-
}
|
|
1586
|
+
loadProperty(this, "close", data.close);
|
|
1587
|
+
loadProperty(this, "type", data.type);
|
|
2132
1588
|
}
|
|
2133
1589
|
}
|
|
2134
1590
|
|
|
2135
1591
|
class ZIndex extends ValueWithRandom {
|
|
2136
|
-
opacityRate;
|
|
2137
|
-
sizeRate;
|
|
2138
|
-
velocityRate;
|
|
2139
|
-
|
|
2140
|
-
super();
|
|
2141
|
-
this.opacityRate
|
|
2142
|
-
this.sizeRate
|
|
2143
|
-
this.velocityRate
|
|
2144
|
-
}
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
if (data.sizeRate !== undefined) {
|
|
2154
|
-
this.sizeRate = data.sizeRate;
|
|
2155
|
-
}
|
|
2156
|
-
if (data.velocityRate !== undefined) {
|
|
2157
|
-
this.velocityRate = data.velocityRate;
|
|
2158
|
-
}
|
|
2159
|
-
}
|
|
2160
|
-
}
|
|
2161
|
-
|
|
2162
|
-
class ParticlesOptions {
|
|
2163
|
-
bounce;
|
|
2164
|
-
effect;
|
|
2165
|
-
groups;
|
|
2166
|
-
move;
|
|
2167
|
-
number;
|
|
1592
|
+
opacityRate = 1;
|
|
1593
|
+
sizeRate = 1;
|
|
1594
|
+
velocityRate = 1;
|
|
1595
|
+
doLoad(data) {
|
|
1596
|
+
super.doLoad(data);
|
|
1597
|
+
loadProperty(this, "opacityRate", data.opacityRate);
|
|
1598
|
+
loadProperty(this, "sizeRate", data.sizeRate);
|
|
1599
|
+
loadProperty(this, "velocityRate", data.velocityRate);
|
|
1600
|
+
}
|
|
1601
|
+
}
|
|
1602
|
+
|
|
1603
|
+
class ParticlesOptions extends OptionLoader {
|
|
1604
|
+
bounce = new ParticlesBounce();
|
|
1605
|
+
effect = new Effect();
|
|
1606
|
+
groups = {};
|
|
1607
|
+
move = new Move();
|
|
1608
|
+
number = new ParticlesNumber();
|
|
2168
1609
|
paint;
|
|
2169
1610
|
palette;
|
|
2170
|
-
reduceDuplicates;
|
|
2171
|
-
shape;
|
|
2172
|
-
zIndex;
|
|
1611
|
+
reduceDuplicates = false;
|
|
1612
|
+
shape = new Shape();
|
|
1613
|
+
zIndex = new ZIndex();
|
|
2173
1614
|
#container;
|
|
2174
1615
|
#pluginManager;
|
|
2175
1616
|
constructor(pluginManager, container) {
|
|
1617
|
+
super();
|
|
2176
1618
|
this.#pluginManager = pluginManager;
|
|
2177
1619
|
this.#container = container;
|
|
2178
|
-
this.bounce = new ParticlesBounce();
|
|
2179
|
-
this.effect = new Effect();
|
|
2180
|
-
this.groups = {};
|
|
2181
|
-
this.move = new Move();
|
|
2182
|
-
this.number = new ParticlesNumber();
|
|
2183
1620
|
this.paint = new Paint();
|
|
2184
1621
|
this.paint.color = new AnimatableColor();
|
|
2185
1622
|
this.paint.color.value = "#fff";
|
|
2186
1623
|
this.paint.fill = new Fill();
|
|
2187
1624
|
this.paint.fill.enable = true;
|
|
2188
|
-
this.reduceDuplicates = false;
|
|
2189
|
-
this.shape = new Shape();
|
|
2190
|
-
this.zIndex = new ZIndex();
|
|
2191
1625
|
}
|
|
2192
|
-
|
|
2193
|
-
if (isNull(data)) {
|
|
2194
|
-
return;
|
|
2195
|
-
}
|
|
1626
|
+
doLoad(data) {
|
|
2196
1627
|
if (data.palette) {
|
|
2197
1628
|
this.palette = data.palette;
|
|
2198
1629
|
this.#importPalette(this.palette);
|
|
@@ -2250,7 +1681,7 @@
|
|
|
2250
1681
|
}
|
|
2251
1682
|
}
|
|
2252
1683
|
}
|
|
2253
|
-
#importPalette
|
|
1684
|
+
#importPalette(palette) {
|
|
2254
1685
|
const paletteData = this.#pluginManager.getPalette(palette);
|
|
2255
1686
|
if (!paletteData) {
|
|
2256
1687
|
return;
|
|
@@ -2294,69 +1725,49 @@
|
|
|
2294
1725
|
mode: paletteData.blendMode,
|
|
2295
1726
|
},
|
|
2296
1727
|
});
|
|
2297
|
-
};
|
|
2298
|
-
}
|
|
2299
|
-
|
|
2300
|
-
function loadOptions(options, ...sourceOptionsArr) {
|
|
2301
|
-
for (const sourceOptions of sourceOptionsArr) {
|
|
2302
|
-
options.load(sourceOptions);
|
|
2303
1728
|
}
|
|
2304
1729
|
}
|
|
1730
|
+
|
|
2305
1731
|
function loadParticlesOptions(pluginManager, container, ...sourceOptionsArr) {
|
|
2306
1732
|
const options = new ParticlesOptions(pluginManager, container);
|
|
2307
1733
|
loadOptions(options, ...sourceOptionsArr);
|
|
2308
1734
|
return options;
|
|
2309
1735
|
}
|
|
2310
1736
|
|
|
2311
|
-
class Options {
|
|
2312
|
-
autoPlay;
|
|
1737
|
+
class Options extends OptionLoader {
|
|
1738
|
+
autoPlay = true;
|
|
2313
1739
|
background;
|
|
2314
|
-
clear;
|
|
2315
|
-
defaultThemes;
|
|
2316
|
-
delay;
|
|
2317
|
-
detectRetina;
|
|
2318
|
-
duration;
|
|
2319
|
-
fpsLimit;
|
|
1740
|
+
clear = true;
|
|
1741
|
+
defaultThemes = {};
|
|
1742
|
+
delay = 0;
|
|
1743
|
+
detectRetina = true;
|
|
1744
|
+
duration = 0;
|
|
1745
|
+
fpsLimit = 120;
|
|
2320
1746
|
fullScreen;
|
|
2321
|
-
hdr;
|
|
1747
|
+
hdr = true;
|
|
2322
1748
|
key;
|
|
2323
1749
|
name;
|
|
2324
1750
|
palette;
|
|
2325
1751
|
particles;
|
|
2326
|
-
pauseOnBlur;
|
|
2327
|
-
pauseOnOutsideViewport;
|
|
1752
|
+
pauseOnBlur = true;
|
|
1753
|
+
pauseOnOutsideViewport = true;
|
|
2328
1754
|
preset;
|
|
2329
1755
|
resize;
|
|
2330
|
-
smooth;
|
|
2331
|
-
style;
|
|
2332
|
-
zLayers;
|
|
1756
|
+
smooth = false;
|
|
1757
|
+
style = {};
|
|
1758
|
+
zLayers = 100;
|
|
2333
1759
|
#container;
|
|
2334
1760
|
#pluginManager;
|
|
2335
1761
|
constructor(pluginManager, container) {
|
|
1762
|
+
super();
|
|
2336
1763
|
this.#pluginManager = pluginManager;
|
|
2337
1764
|
this.#container = container;
|
|
2338
|
-
this.autoPlay = true;
|
|
2339
1765
|
this.background = new Background();
|
|
2340
|
-
this.clear = true;
|
|
2341
|
-
this.defaultThemes = {};
|
|
2342
|
-
this.delay = 0;
|
|
2343
1766
|
this.fullScreen = new FullScreen();
|
|
2344
|
-
this.detectRetina = true;
|
|
2345
|
-
this.duration = 0;
|
|
2346
|
-
this.fpsLimit = 120;
|
|
2347
|
-
this.hdr = true;
|
|
2348
1767
|
this.particles = loadParticlesOptions(this.#pluginManager, this.#container);
|
|
2349
|
-
this.pauseOnBlur = true;
|
|
2350
|
-
this.pauseOnOutsideViewport = true;
|
|
2351
1768
|
this.resize = new ResizeEvent();
|
|
2352
|
-
this.smooth = false;
|
|
2353
|
-
this.style = {};
|
|
2354
|
-
this.zLayers = 100;
|
|
2355
1769
|
}
|
|
2356
|
-
|
|
2357
|
-
if (isNull(data)) {
|
|
2358
|
-
return;
|
|
2359
|
-
}
|
|
1770
|
+
doLoad(data) {
|
|
2360
1771
|
if (data.preset !== undefined) {
|
|
2361
1772
|
this.preset = data.preset;
|
|
2362
1773
|
executeOnSingleOrMultiple(this.preset, preset => {
|
|
@@ -2367,44 +1778,18 @@
|
|
|
2367
1778
|
this.palette = data.palette;
|
|
2368
1779
|
this.#importPalette(this.palette);
|
|
2369
1780
|
}
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
if (data.delay !== undefined) {
|
|
2383
|
-
this.delay = setRangeValue(data.delay);
|
|
2384
|
-
}
|
|
2385
|
-
const detectRetina = data.detectRetina;
|
|
2386
|
-
if (detectRetina !== undefined) {
|
|
2387
|
-
this.detectRetina = detectRetina;
|
|
2388
|
-
}
|
|
2389
|
-
if (data.duration !== undefined) {
|
|
2390
|
-
this.duration = setRangeValue(data.duration);
|
|
2391
|
-
}
|
|
2392
|
-
const fpsLimit = data.fpsLimit;
|
|
2393
|
-
if (fpsLimit !== undefined) {
|
|
2394
|
-
this.fpsLimit = fpsLimit;
|
|
2395
|
-
}
|
|
2396
|
-
if (data.hdr !== undefined) {
|
|
2397
|
-
this.hdr = data.hdr;
|
|
2398
|
-
}
|
|
2399
|
-
if (data.pauseOnBlur !== undefined) {
|
|
2400
|
-
this.pauseOnBlur = data.pauseOnBlur;
|
|
2401
|
-
}
|
|
2402
|
-
if (data.pauseOnOutsideViewport !== undefined) {
|
|
2403
|
-
this.pauseOnOutsideViewport = data.pauseOnOutsideViewport;
|
|
2404
|
-
}
|
|
2405
|
-
if (data.zLayers !== undefined) {
|
|
2406
|
-
this.zLayers = data.zLayers;
|
|
2407
|
-
}
|
|
1781
|
+
loadProperty(this, "autoPlay", data.autoPlay);
|
|
1782
|
+
loadProperty(this, "clear", data.clear);
|
|
1783
|
+
loadProperty(this, "key", data.key);
|
|
1784
|
+
loadProperty(this, "name", data.name);
|
|
1785
|
+
loadRangeProperty(this, "delay", data.delay);
|
|
1786
|
+
loadProperty(this, "detectRetina", data.detectRetina);
|
|
1787
|
+
loadRangeProperty(this, "duration", data.duration);
|
|
1788
|
+
loadProperty(this, "fpsLimit", data.fpsLimit);
|
|
1789
|
+
loadProperty(this, "hdr", data.hdr);
|
|
1790
|
+
loadProperty(this, "pauseOnBlur", data.pauseOnBlur);
|
|
1791
|
+
loadProperty(this, "pauseOnOutsideViewport", data.pauseOnOutsideViewport);
|
|
1792
|
+
loadProperty(this, "zLayers", data.zLayers);
|
|
2408
1793
|
this.background.load(data.background);
|
|
2409
1794
|
const fullScreen = data.fullScreen;
|
|
2410
1795
|
if (isBoolean(fullScreen)) {
|
|
@@ -2416,14 +1801,12 @@
|
|
|
2416
1801
|
this.particles.load(data.particles);
|
|
2417
1802
|
this.resize.load(data.resize);
|
|
2418
1803
|
this.style = deepExtend(this.style, data.style);
|
|
2419
|
-
|
|
2420
|
-
this.smooth = data.smooth;
|
|
2421
|
-
}
|
|
1804
|
+
loadProperty(this, "smooth", data.smooth);
|
|
2422
1805
|
this.#pluginManager.plugins.forEach(plugin => {
|
|
2423
1806
|
plugin.loadOptions(this.#container, this, data);
|
|
2424
1807
|
});
|
|
2425
1808
|
}
|
|
2426
|
-
#importPalette
|
|
1809
|
+
#importPalette(palette) {
|
|
2427
1810
|
const paletteData = this.#pluginManager.getPalette(palette);
|
|
2428
1811
|
if (!paletteData) {
|
|
2429
1812
|
return;
|
|
@@ -2440,143 +1823,19 @@
|
|
|
2440
1823
|
palette,
|
|
2441
1824
|
},
|
|
2442
1825
|
});
|
|
2443
|
-
};
|
|
2444
|
-
#importPreset = preset => {
|
|
2445
|
-
this.load(this.#pluginManager.getPreset(preset));
|
|
2446
|
-
};
|
|
2447
|
-
}
|
|
2448
|
-
|
|
2449
|
-
function paintBase(context, dimension, baseColor) {
|
|
2450
|
-
context.fillStyle = baseColor ?? "rgba(0,0,0,0)";
|
|
2451
|
-
context.fillRect(originPoint.x, originPoint.y, dimension.width, dimension.height);
|
|
2452
|
-
}
|
|
2453
|
-
function paintImage(context, dimension, image, opacity) {
|
|
2454
|
-
if (!image) {
|
|
2455
|
-
return;
|
|
2456
|
-
}
|
|
2457
|
-
const prevAlpha = context.globalAlpha;
|
|
2458
|
-
context.globalAlpha = opacity;
|
|
2459
|
-
context.drawImage(image, originPoint.x, originPoint.y, dimension.width, dimension.height);
|
|
2460
|
-
context.globalAlpha = prevAlpha;
|
|
2461
|
-
}
|
|
2462
|
-
function clear(context, dimension) {
|
|
2463
|
-
context.clearRect(originPoint.x, originPoint.y, dimension.width, dimension.height);
|
|
2464
|
-
}
|
|
2465
|
-
function drawParticle(data) {
|
|
2466
|
-
const { container, context, particle, delta, colorStyles, radius, opacity, transform } = data, { effectDrawers, shapeDrawers } = container, pos = particle.getPosition(), transformData = particle.getTransformData(transform), drawScale = defaultZoom, drawPosition = {
|
|
2467
|
-
x: pos.x,
|
|
2468
|
-
y: pos.y,
|
|
2469
|
-
};
|
|
2470
|
-
context.setTransform(transformData.a, transformData.b, transformData.c, transformData.d, pos.x, pos.y);
|
|
2471
|
-
if (colorStyles.fill) {
|
|
2472
|
-
context.fillStyle = colorStyles.fill;
|
|
2473
|
-
}
|
|
2474
|
-
const fillEnabled = !!particle.fillEnabled, strokeWidth = particle.strokeWidth ?? minStrokeWidth;
|
|
2475
|
-
context.lineWidth = strokeWidth;
|
|
2476
|
-
if (colorStyles.stroke) {
|
|
2477
|
-
context.strokeStyle = colorStyles.stroke;
|
|
2478
|
-
}
|
|
2479
|
-
const drawData = {
|
|
2480
|
-
context,
|
|
2481
|
-
particle,
|
|
2482
|
-
radius,
|
|
2483
|
-
drawRadius: radius * drawScale,
|
|
2484
|
-
opacity,
|
|
2485
|
-
delta,
|
|
2486
|
-
pixelRatio: container.retina.pixelRatio,
|
|
2487
|
-
fill: fillEnabled,
|
|
2488
|
-
stroke: strokeWidth > minStrokeWidth,
|
|
2489
|
-
transformData,
|
|
2490
|
-
position: { ...pos },
|
|
2491
|
-
drawPosition,
|
|
2492
|
-
drawScale,
|
|
2493
|
-
};
|
|
2494
|
-
for (const plugin of container.plugins) {
|
|
2495
|
-
plugin.drawParticleTransform?.(drawData);
|
|
2496
|
-
}
|
|
2497
|
-
const effect = particle.effect ? effectDrawers.get(particle.effect) : undefined, shape = particle.shape ? shapeDrawers.get(particle.shape) : undefined;
|
|
2498
|
-
drawBeforeEffect(effect, drawData);
|
|
2499
|
-
drawShapeBeforeDraw(shape, drawData);
|
|
2500
|
-
drawShape(shape, drawData);
|
|
2501
|
-
drawShapeAfterDraw(shape, drawData);
|
|
2502
|
-
drawAfterEffect(effect, drawData);
|
|
2503
|
-
context.resetTransform();
|
|
2504
|
-
}
|
|
2505
|
-
function drawAfterEffect(drawer, data) {
|
|
2506
|
-
if (!drawer?.drawAfter) {
|
|
2507
|
-
return;
|
|
2508
|
-
}
|
|
2509
|
-
const { particle } = data;
|
|
2510
|
-
if (!particle.effect) {
|
|
2511
|
-
return;
|
|
2512
|
-
}
|
|
2513
|
-
drawer.drawAfter(data);
|
|
2514
|
-
}
|
|
2515
|
-
function drawBeforeEffect(drawer, data) {
|
|
2516
|
-
if (!drawer?.drawBefore) {
|
|
2517
|
-
return;
|
|
2518
|
-
}
|
|
2519
|
-
const { particle } = data;
|
|
2520
|
-
if (!particle.effect) {
|
|
2521
|
-
return;
|
|
2522
|
-
}
|
|
2523
|
-
drawer.drawBefore(data);
|
|
2524
|
-
}
|
|
2525
|
-
function drawShape(drawer, data) {
|
|
2526
|
-
if (!drawer) {
|
|
2527
|
-
return;
|
|
2528
|
-
}
|
|
2529
|
-
const { context, fill, particle, stroke } = data;
|
|
2530
|
-
if (!particle.shape) {
|
|
2531
|
-
return;
|
|
2532
|
-
}
|
|
2533
|
-
context.beginPath();
|
|
2534
|
-
drawer.draw(data);
|
|
2535
|
-
if (particle.shapeClose) {
|
|
2536
|
-
context.closePath();
|
|
2537
|
-
}
|
|
2538
|
-
if (fill) {
|
|
2539
|
-
context.fill();
|
|
2540
|
-
}
|
|
2541
|
-
if (stroke) {
|
|
2542
|
-
context.stroke();
|
|
2543
1826
|
}
|
|
2544
|
-
|
|
2545
|
-
|
|
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
|
-
}
|
|
2563
|
-
drawer.beforeDraw(data);
|
|
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
|
-
if (isNull(data)) {
|
|
4401
|
-
return;
|
|
4402
|
-
}
|
|
4403
|
-
if (data.factor !== undefined) {
|
|
4404
|
-
this.factor = data.factor;
|
|
4405
|
-
}
|
|
4406
|
-
if (data.value !== undefined) {
|
|
4407
|
-
this.value = data.value;
|
|
3644
|
+
if (isNull(data)) {
|
|
3645
|
+
return;
|
|
4408
3646
|
}
|
|
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
|
});
|
|
@@ -4754,13 +3988,6 @@
|
|
|
4754
3988
|
createRibbonState(particle);
|
|
4755
3989
|
}
|
|
4756
3990
|
}
|
|
4757
|
-
function getParticleBounds(particle) {
|
|
4758
|
-
const ref = particle, size = ref._container?.canvas?.size, width = size?.width, height = size?.height;
|
|
4759
|
-
if (width === undefined || height === undefined) {
|
|
4760
|
-
return undefined;
|
|
4761
|
-
}
|
|
4762
|
-
return { height, width };
|
|
4763
|
-
}
|
|
4764
3991
|
function getRibbonCount(particle) {
|
|
4765
3992
|
return Math.max(minRibbonCount, Math.round(getRangeValue(particle.shapeData?.count ?? defaultRibbonCount)));
|
|
4766
3993
|
}
|
|
@@ -4781,20 +4008,18 @@
|
|
|
4781
4008
|
return maxX >= -margin && maxY >= -margin && minX <= canvasSize.width + margin && minY <= canvasSize.height + margin;
|
|
4782
4009
|
}
|
|
4783
4010
|
class RibbonDrawer {
|
|
4784
|
-
#
|
|
4785
|
-
constructor(
|
|
4786
|
-
this.#
|
|
4011
|
+
#container;
|
|
4012
|
+
constructor(container) {
|
|
4013
|
+
this.#container = container;
|
|
4787
4014
|
}
|
|
4788
4015
|
draw(data) {
|
|
4789
|
-
const bounds =
|
|
4790
|
-
|
|
4791
|
-
prepareRibbonParticle(data.particle, bounds.width, bounds.height);
|
|
4792
|
-
}
|
|
4016
|
+
const bounds = this.#container.canvas.size;
|
|
4017
|
+
prepareRibbonParticle(data.particle, bounds.width, bounds.height);
|
|
4793
4018
|
if (data.particle.ribbonPoints && data.particle.ribbonPoints.length !== getRibbonCount(data.particle)) {
|
|
4794
4019
|
createRibbonState(data.particle);
|
|
4795
4020
|
}
|
|
4796
4021
|
updateRibbon(data);
|
|
4797
|
-
drawRibbon(data, this.#hdr);
|
|
4022
|
+
drawRibbon(data, this.#container.hdr);
|
|
4798
4023
|
}
|
|
4799
4024
|
getSidesCount(particle) {
|
|
4800
4025
|
const pointsLen = particle.ribbonPoints?.length;
|
|
@@ -4856,39 +4081,30 @@
|
|
|
4856
4081
|
}
|
|
4857
4082
|
|
|
4858
4083
|
async function loadRibbonShape(engine) {
|
|
4859
|
-
engine.checkVersion("4.
|
|
4084
|
+
engine.checkVersion("4.2.0");
|
|
4860
4085
|
await engine.pluginManager.register(e => {
|
|
4861
|
-
e.pluginManager.addShape(["ribbon"], (container) => Promise.resolve(new RibbonDrawer(container
|
|
4086
|
+
e.pluginManager.addShape(["ribbon"], (container) => Promise.resolve(new RibbonDrawer(container)));
|
|
4862
4087
|
});
|
|
4863
4088
|
}
|
|
4864
4089
|
|
|
4865
4090
|
class RibbonsOptions {
|
|
4866
|
-
angle;
|
|
4867
4091
|
colors;
|
|
4868
4092
|
count;
|
|
4869
4093
|
disableForReducedMotion;
|
|
4870
|
-
drift;
|
|
4871
4094
|
emitterSize;
|
|
4872
|
-
|
|
4095
|
+
positionX;
|
|
4873
4096
|
ribbonOptions;
|
|
4874
4097
|
scalar;
|
|
4875
|
-
spread;
|
|
4876
4098
|
ticks;
|
|
4877
4099
|
zIndex;
|
|
4878
4100
|
constructor() {
|
|
4879
|
-
this.angle = 90;
|
|
4880
4101
|
this.count = 5;
|
|
4881
|
-
this.spread = 0;
|
|
4882
|
-
this.drift = 0;
|
|
4883
4102
|
this.emitterSize = {
|
|
4884
4103
|
width: 100,
|
|
4885
4104
|
height: 0,
|
|
4886
4105
|
};
|
|
4106
|
+
this.positionX = 50;
|
|
4887
4107
|
this.ticks = 200;
|
|
4888
|
-
this.position = {
|
|
4889
|
-
x: 50,
|
|
4890
|
-
y: 0,
|
|
4891
|
-
};
|
|
4892
4108
|
this.colors = ["#FF0055", "#00D1FF", "#FFD23F", "#61FF7E", "#B284FF"];
|
|
4893
4109
|
this.ribbonOptions = {
|
|
4894
4110
|
angle: 45,
|
|
@@ -4919,13 +4135,12 @@
|
|
|
4919
4135
|
}
|
|
4920
4136
|
get origin() {
|
|
4921
4137
|
return {
|
|
4922
|
-
x: this.
|
|
4923
|
-
y:
|
|
4138
|
+
x: this.positionX / percentDenominator,
|
|
4139
|
+
y: 0,
|
|
4924
4140
|
};
|
|
4925
4141
|
}
|
|
4926
4142
|
set origin(value) {
|
|
4927
|
-
this.
|
|
4928
|
-
this.position.y = value.y * percentDenominator;
|
|
4143
|
+
this.positionX = value.x * percentDenominator;
|
|
4929
4144
|
}
|
|
4930
4145
|
get particleCount() {
|
|
4931
4146
|
return this.count;
|
|
@@ -4933,26 +4148,24 @@
|
|
|
4933
4148
|
set particleCount(value) {
|
|
4934
4149
|
this.count = value;
|
|
4935
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
|
+
}
|
|
4936
4160
|
load(data) {
|
|
4937
4161
|
if (isNull(data)) {
|
|
4938
4162
|
return;
|
|
4939
4163
|
}
|
|
4940
|
-
if (data.angle !== undefined) {
|
|
4941
|
-
this.angle = data.angle;
|
|
4942
|
-
}
|
|
4943
4164
|
const count = data.count ?? data.particleCount;
|
|
4944
4165
|
if (count !== undefined) {
|
|
4945
4166
|
this.count = count;
|
|
4946
4167
|
}
|
|
4947
|
-
|
|
4948
|
-
this.spread = data.spread;
|
|
4949
|
-
}
|
|
4950
|
-
if (data.drift !== undefined) {
|
|
4951
|
-
this.drift = data.drift;
|
|
4952
|
-
}
|
|
4953
|
-
if (data.ticks !== undefined) {
|
|
4954
|
-
this.ticks = data.ticks;
|
|
4955
|
-
}
|
|
4168
|
+
loadProperty(this, "ticks", data.ticks);
|
|
4956
4169
|
if (data.emitterSize) {
|
|
4957
4170
|
if (data.emitterSize.width !== undefined) {
|
|
4958
4171
|
this.emitterSize.width = data.emitterSize.width;
|
|
@@ -4961,20 +4174,20 @@
|
|
|
4961
4174
|
this.emitterSize.height = data.emitterSize.height;
|
|
4962
4175
|
}
|
|
4963
4176
|
}
|
|
4964
|
-
|
|
4965
|
-
if (
|
|
4966
|
-
|
|
4967
|
-
|
|
4968
|
-
|
|
4969
|
-
|
|
4970
|
-
|
|
4971
|
-
|
|
4972
|
-
if (position) {
|
|
4973
|
-
if (position.x !== undefined) {
|
|
4974
|
-
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
|
+
};
|
|
4975
4185
|
}
|
|
4976
|
-
|
|
4977
|
-
|
|
4186
|
+
const position = data.position;
|
|
4187
|
+
if (position) {
|
|
4188
|
+
if (position.x !== undefined) {
|
|
4189
|
+
this.positionX = position.x;
|
|
4190
|
+
}
|
|
4978
4191
|
}
|
|
4979
4192
|
}
|
|
4980
4193
|
if (data.colors !== undefined) {
|
|
@@ -4988,15 +4201,9 @@
|
|
|
4988
4201
|
if (data.ribbonOptions !== undefined) {
|
|
4989
4202
|
this.ribbonOptions = deepExtend({}, data.ribbonOptions);
|
|
4990
4203
|
}
|
|
4991
|
-
|
|
4992
|
-
|
|
4993
|
-
|
|
4994
|
-
if (data.zIndex !== undefined) {
|
|
4995
|
-
this.zIndex = data.zIndex;
|
|
4996
|
-
}
|
|
4997
|
-
if (data.disableForReducedMotion !== undefined) {
|
|
4998
|
-
this.disableForReducedMotion = data.disableForReducedMotion;
|
|
4999
|
-
}
|
|
4204
|
+
loadProperty(this, "scalar", data.scalar);
|
|
4205
|
+
loadProperty(this, "zIndex", data.zIndex);
|
|
4206
|
+
loadProperty(this, "disableForReducedMotion", data.disableForReducedMotion);
|
|
5000
4207
|
}
|
|
5001
4208
|
}
|
|
5002
4209
|
|
|
@@ -5005,7 +4212,7 @@
|
|
|
5005
4212
|
await container.addEmitter?.({
|
|
5006
4213
|
startCount: actualOptions.count,
|
|
5007
4214
|
position: {
|
|
5008
|
-
x: actualOptions.
|
|
4215
|
+
x: actualOptions.positionX,
|
|
5009
4216
|
y: emitterTop,
|
|
5010
4217
|
},
|
|
5011
4218
|
shape: {
|
|
@@ -5145,7 +4352,7 @@
|
|
|
5145
4352
|
name: "ribbons",
|
|
5146
4353
|
startCount: actualOptions.count,
|
|
5147
4354
|
position: {
|
|
5148
|
-
x: actualOptions.
|
|
4355
|
+
x: actualOptions.positionX,
|
|
5149
4356
|
y: emitterTop,
|
|
5150
4357
|
},
|
|
5151
4358
|
shape: {
|
|
@@ -5197,7 +4404,7 @@
|
|
|
5197
4404
|
|
|
5198
4405
|
let initPromise = null;
|
|
5199
4406
|
async function doInitPlugins(engine) {
|
|
5200
|
-
engine.checkVersion("4.
|
|
4407
|
+
engine.checkVersion("4.2.0");
|
|
5201
4408
|
await engine.pluginManager.register(async (e) => {
|
|
5202
4409
|
const emittersRegister = async (engine) => {
|
|
5203
4410
|
await loadEmittersPluginSimple(engine);
|
|
@@ -5264,7 +4471,7 @@
|
|
|
5264
4471
|
ribbons.init = async () => {
|
|
5265
4472
|
await initPlugins(tsParticles);
|
|
5266
4473
|
};
|
|
5267
|
-
ribbons.version = "4.
|
|
4474
|
+
ribbons.version = "4.2.0";
|
|
5268
4475
|
globalThis.ribbons = ribbons;
|
|
5269
4476
|
|
|
5270
4477
|
const globalObject = globalThis;
|
|
@@ -5325,7 +4532,7 @@
|
|
|
5325
4532
|
return;
|
|
5326
4533
|
}
|
|
5327
4534
|
this.draw(ctx => {
|
|
5328
|
-
|
|
4535
|
+
ctx.clearRect(originPoint.x, originPoint.y, this.#canvasManager.size.width, this.#canvasManager.size.height);
|
|
5329
4536
|
});
|
|
5330
4537
|
}
|
|
5331
4538
|
clear() {
|
|
@@ -5387,7 +4594,7 @@
|
|
|
5387
4594
|
plugin.drawParticleSetup?.(context, particle, delta);
|
|
5388
4595
|
}
|
|
5389
4596
|
this.#applyPreDrawUpdaters(context, particle, radius, opacity, colorStyles, transform);
|
|
5390
|
-
drawParticle({
|
|
4597
|
+
this.#drawParticle({
|
|
5391
4598
|
container,
|
|
5392
4599
|
context,
|
|
5393
4600
|
particle,
|
|
@@ -5406,7 +4613,7 @@
|
|
|
5406
4613
|
drawParticlePlugins(particle, delta) {
|
|
5407
4614
|
this.draw(ctx => {
|
|
5408
4615
|
for (const plugin of this.#drawParticlePlugins) {
|
|
5409
|
-
drawParticlePlugin(ctx, plugin, particle, delta);
|
|
4616
|
+
this.#drawParticlePlugin(ctx, plugin, particle, delta);
|
|
5410
4617
|
}
|
|
5411
4618
|
});
|
|
5412
4619
|
}
|
|
@@ -5506,12 +4713,19 @@
|
|
|
5506
4713
|
}
|
|
5507
4714
|
paintBase(baseColor) {
|
|
5508
4715
|
this.draw(ctx => {
|
|
5509
|
-
|
|
4716
|
+
ctx.fillStyle = baseColor ?? "rgba(0,0,0,0)";
|
|
4717
|
+
ctx.fillRect(originPoint.x, originPoint.y, this.#canvasManager.size.width, this.#canvasManager.size.height);
|
|
5510
4718
|
});
|
|
5511
4719
|
}
|
|
5512
4720
|
paintImage(image, opacity) {
|
|
5513
4721
|
this.draw(ctx => {
|
|
5514
|
-
|
|
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;
|
|
5515
4729
|
});
|
|
5516
4730
|
}
|
|
5517
4731
|
setContext(context) {
|
|
@@ -5525,15 +4739,15 @@
|
|
|
5525
4739
|
}
|
|
5526
4740
|
stop() {
|
|
5527
4741
|
this.draw(ctx => {
|
|
5528
|
-
|
|
4742
|
+
ctx.clearRect(originPoint.x, originPoint.y, this.#canvasManager.size.width, this.#canvasManager.size.height);
|
|
5529
4743
|
});
|
|
5530
4744
|
}
|
|
5531
|
-
#applyPostDrawUpdaters
|
|
4745
|
+
#applyPostDrawUpdaters(particle) {
|
|
5532
4746
|
for (const updater of this.#postDrawUpdaters) {
|
|
5533
4747
|
updater.afterDraw?.(particle);
|
|
5534
4748
|
}
|
|
5535
|
-
}
|
|
5536
|
-
#applyPreDrawUpdaters
|
|
4749
|
+
}
|
|
4750
|
+
#applyPreDrawUpdaters(ctx, particle, radius, zOpacity, colorStyles, transform) {
|
|
5537
4751
|
for (const updater of this.#preDrawUpdaters) {
|
|
5538
4752
|
if (updater.getColorStyles) {
|
|
5539
4753
|
const { fill, stroke } = updater.getColorStyles(particle, ctx, radius, zOpacity);
|
|
@@ -5552,8 +4766,114 @@
|
|
|
5552
4766
|
}
|
|
5553
4767
|
updater.beforeDraw?.(particle);
|
|
5554
4768
|
}
|
|
5555
|
-
}
|
|
5556
|
-
#
|
|
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) {
|
|
5557
4877
|
let fColor, sColor;
|
|
5558
4878
|
for (const plugin of this.#colorPlugins) {
|
|
5559
4879
|
if (!fColor && plugin.particleFillColor) {
|
|
@@ -5569,7 +4889,7 @@
|
|
|
5569
4889
|
this.#reusablePluginColors[fColorIndex] = fColor;
|
|
5570
4890
|
this.#reusablePluginColors[sColorIndex] = sColor;
|
|
5571
4891
|
return this.#reusablePluginColors;
|
|
5572
|
-
}
|
|
4892
|
+
}
|
|
5573
4893
|
}
|
|
5574
4894
|
|
|
5575
4895
|
const transferredCanvases = new WeakMap(), getTransferredCanvas = (canvas) => {
|
|
@@ -5701,6 +5021,7 @@
|
|
|
5701
5021
|
obs.observe(element, { attributes: true });
|
|
5702
5022
|
});
|
|
5703
5023
|
this.initPlugins();
|
|
5024
|
+
this.#initContext();
|
|
5704
5025
|
this.render.init();
|
|
5705
5026
|
}
|
|
5706
5027
|
initBackground() {
|
|
@@ -5710,7 +5031,7 @@
|
|
|
5710
5031
|
}
|
|
5711
5032
|
const elementStyle = element.style, color = rangeColorToRgb(this.#pluginManager, background.color);
|
|
5712
5033
|
if (color) {
|
|
5713
|
-
elementStyle.backgroundColor = getStyleFromRgb(color, container.hdr, background.opacity);
|
|
5034
|
+
elementStyle.backgroundColor = getStyleFromRgb(color, container.actualOptions.hdr, background.opacity);
|
|
5714
5035
|
}
|
|
5715
5036
|
else {
|
|
5716
5037
|
elementStyle.backgroundColor = "";
|
|
@@ -5732,7 +5053,7 @@
|
|
|
5732
5053
|
if (this.#generated && this.domElement) {
|
|
5733
5054
|
this.domElement.remove();
|
|
5734
5055
|
}
|
|
5735
|
-
const
|
|
5056
|
+
const domCanvas = isHtmlCanvasElement(canvas) ? canvas : undefined;
|
|
5736
5057
|
this.domElement = domCanvas;
|
|
5737
5058
|
this.#generated = domCanvas ? domCanvas.dataset[generatedAttribute] === "true" : false;
|
|
5738
5059
|
this.renderCanvas = domCanvas ? getTransferredCanvas(domCanvas) : canvas;
|
|
@@ -5753,26 +5074,6 @@
|
|
|
5753
5074
|
const pxRatio = this.#container.retina.pixelRatio, retinaSize = this.size;
|
|
5754
5075
|
renderCanvas.height = retinaSize.height = standardSize.height * pxRatio;
|
|
5755
5076
|
renderCanvas.width = retinaSize.width = standardSize.width * pxRatio;
|
|
5756
|
-
const canSupportHdrQuery = safeMatchMedia("(color-gamut: p3)");
|
|
5757
|
-
this.render.setContextSettings({
|
|
5758
|
-
alpha: true,
|
|
5759
|
-
colorSpace: canSupportHdrQuery?.matches && container.hdr ? "display-p3" : "srgb",
|
|
5760
|
-
desynchronized: true,
|
|
5761
|
-
willReadFrequently: false,
|
|
5762
|
-
});
|
|
5763
|
-
this.render.setContext(renderCanvas.getContext("2d", this.render.settings));
|
|
5764
|
-
this.#safeMutationObserver(obs => {
|
|
5765
|
-
obs.disconnect();
|
|
5766
|
-
});
|
|
5767
|
-
container.retina.init();
|
|
5768
|
-
this.initBackground();
|
|
5769
|
-
this.#safeMutationObserver(obs => {
|
|
5770
|
-
const element = this.domElement;
|
|
5771
|
-
if (!element || !(element instanceof Node)) {
|
|
5772
|
-
return;
|
|
5773
|
-
}
|
|
5774
|
-
obs.observe(element, { attributes: true });
|
|
5775
|
-
});
|
|
5776
5077
|
}
|
|
5777
5078
|
resize() {
|
|
5778
5079
|
const element = this.domElement;
|
|
@@ -5840,12 +5141,30 @@
|
|
|
5840
5141
|
await container.refresh();
|
|
5841
5142
|
}
|
|
5842
5143
|
}
|
|
5843
|
-
#applyResizePlugins
|
|
5144
|
+
#applyResizePlugins() {
|
|
5844
5145
|
for (const plugin of this.#resizePlugins) {
|
|
5845
5146
|
plugin.resize?.();
|
|
5846
5147
|
}
|
|
5847
|
-
}
|
|
5848
|
-
#
|
|
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() {
|
|
5849
5168
|
const element = this.domElement, options = this.#container.actualOptions;
|
|
5850
5169
|
if (!element) {
|
|
5851
5170
|
return;
|
|
@@ -5866,8 +5185,8 @@
|
|
|
5866
5185
|
}
|
|
5867
5186
|
element.style.setProperty(key, value, "important");
|
|
5868
5187
|
}
|
|
5869
|
-
}
|
|
5870
|
-
#repairStyle
|
|
5188
|
+
}
|
|
5189
|
+
#repairStyle() {
|
|
5871
5190
|
const element = this.domElement;
|
|
5872
5191
|
if (!element) {
|
|
5873
5192
|
return;
|
|
@@ -5886,27 +5205,27 @@
|
|
|
5886
5205
|
}
|
|
5887
5206
|
observer.observe(element, { attributes: true });
|
|
5888
5207
|
});
|
|
5889
|
-
}
|
|
5890
|
-
#resetOriginalStyle
|
|
5208
|
+
}
|
|
5209
|
+
#resetOriginalStyle() {
|
|
5891
5210
|
const element = this.domElement, originalStyle = this.#originalStyle;
|
|
5892
5211
|
if (!element || !originalStyle) {
|
|
5893
5212
|
return;
|
|
5894
5213
|
}
|
|
5895
5214
|
setStyle(element, originalStyle, true);
|
|
5896
|
-
}
|
|
5897
|
-
#safeMutationObserver
|
|
5215
|
+
}
|
|
5216
|
+
#safeMutationObserver(callback) {
|
|
5898
5217
|
if (!this.#mutationObserver) {
|
|
5899
5218
|
return;
|
|
5900
5219
|
}
|
|
5901
5220
|
callback(this.#mutationObserver);
|
|
5902
|
-
}
|
|
5903
|
-
#setFullScreenStyle
|
|
5221
|
+
}
|
|
5222
|
+
#setFullScreenStyle() {
|
|
5904
5223
|
const element = this.domElement;
|
|
5905
5224
|
if (!element) {
|
|
5906
5225
|
return;
|
|
5907
5226
|
}
|
|
5908
5227
|
setStyle(element, getFullScreenStyle(this.#container.actualOptions.fullScreen.zIndex), true);
|
|
5909
|
-
}
|
|
5228
|
+
}
|
|
5910
5229
|
}
|
|
5911
5230
|
|
|
5912
5231
|
class EventListeners {
|
|
@@ -5931,7 +5250,7 @@
|
|
|
5931
5250
|
removeListeners() {
|
|
5932
5251
|
this.#manageListeners(false);
|
|
5933
5252
|
}
|
|
5934
|
-
#handleVisibilityChange
|
|
5253
|
+
#handleVisibilityChange() {
|
|
5935
5254
|
const container = this.#container, options = container.actualOptions;
|
|
5936
5255
|
if (!options.pauseOnBlur) {
|
|
5937
5256
|
return;
|
|
@@ -5949,8 +5268,8 @@
|
|
|
5949
5268
|
container.draw(true);
|
|
5950
5269
|
}
|
|
5951
5270
|
}
|
|
5952
|
-
}
|
|
5953
|
-
#handleWindowResize
|
|
5271
|
+
}
|
|
5272
|
+
#handleWindowResize() {
|
|
5954
5273
|
if (this.#resizeTimeout) {
|
|
5955
5274
|
clearTimeout(this.#resizeTimeout);
|
|
5956
5275
|
this.#resizeTimeout = undefined;
|
|
@@ -5960,13 +5279,13 @@
|
|
|
5960
5279
|
await canvas.windowResize();
|
|
5961
5280
|
};
|
|
5962
5281
|
this.#resizeTimeout = setTimeout(() => void handleResize(), this.#container.actualOptions.resize.delay * millisecondsToSeconds$1);
|
|
5963
|
-
}
|
|
5964
|
-
#manageListeners
|
|
5282
|
+
}
|
|
5283
|
+
#manageListeners(add) {
|
|
5965
5284
|
const handlers = this.#handlers;
|
|
5966
5285
|
this.#manageResize(add);
|
|
5967
5286
|
manageListener(document, visibilityChangeEvent, handlers.visibilityChange, add, false);
|
|
5968
|
-
}
|
|
5969
|
-
#manageResize
|
|
5287
|
+
}
|
|
5288
|
+
#manageResize(add) {
|
|
5970
5289
|
const handlers = this.#handlers, container = this.#container, options = container.actualOptions;
|
|
5971
5290
|
if (!options.resize.enable) {
|
|
5972
5291
|
return;
|
|
@@ -5993,7 +5312,7 @@
|
|
|
5993
5312
|
});
|
|
5994
5313
|
this.#resizeObserver.observe(canvasEl);
|
|
5995
5314
|
}
|
|
5996
|
-
}
|
|
5315
|
+
}
|
|
5997
5316
|
}
|
|
5998
5317
|
|
|
5999
5318
|
function loadEffectData(effect, effectOptions, id, reduceDuplicates) {
|
|
@@ -6020,6 +5339,131 @@
|
|
|
6020
5339
|
data.setCb(data.radius);
|
|
6021
5340
|
}
|
|
6022
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
|
+
}
|
|
6023
5467
|
class Particle {
|
|
6024
5468
|
backColor;
|
|
6025
5469
|
bubble;
|
|
@@ -6145,88 +5589,20 @@
|
|
|
6145
5589
|
const rotateData = this.getRotateData(), rotating = this.isRotating;
|
|
6146
5590
|
this.#cachedTransform.a = rotateData.cos * (externalTransform.a ?? defaultTransform.a);
|
|
6147
5591
|
this.#cachedTransform.b = rotating
|
|
6148
|
-
? rotateData.sin * (externalTransform.b ?? identity$
|
|
5592
|
+
? rotateData.sin * (externalTransform.b ?? identity$2)
|
|
6149
5593
|
: (externalTransform.b ?? defaultTransform.b);
|
|
6150
5594
|
this.#cachedTransform.c = rotating
|
|
6151
|
-
? -rotateData.sin * (externalTransform.c ?? identity$
|
|
5595
|
+
? -rotateData.sin * (externalTransform.c ?? identity$2)
|
|
6152
5596
|
: (externalTransform.c ?? defaultTransform.c);
|
|
6153
5597
|
this.#cachedTransform.d = rotateData.cos * (externalTransform.d ?? defaultTransform.d);
|
|
6154
5598
|
return this.#cachedTransform;
|
|
6155
5599
|
}
|
|
6156
5600
|
init(id, position, overrideOptions, group) {
|
|
6157
5601
|
const container = this.#container;
|
|
6158
|
-
this
|
|
6159
|
-
this.
|
|
6160
|
-
this.justWarped = false;
|
|
6161
|
-
this.effectClose = true;
|
|
6162
|
-
this.shapeClose = true;
|
|
6163
|
-
this.pathRotation = false;
|
|
6164
|
-
this.lastPathTime = 0;
|
|
6165
|
-
this.destroyed = false;
|
|
6166
|
-
this.unbreakable = false;
|
|
6167
|
-
this.isRotating = false;
|
|
6168
|
-
this.rotation = 0;
|
|
6169
|
-
this.misplaced = false;
|
|
6170
|
-
this.retina = {
|
|
6171
|
-
maxDistance: {},
|
|
6172
|
-
maxSpeed: 0,
|
|
6173
|
-
moveDrift: 0,
|
|
6174
|
-
moveSpeed: 0,
|
|
6175
|
-
sizeAnimationSpeed: 0,
|
|
6176
|
-
};
|
|
6177
|
-
this.size = {
|
|
6178
|
-
value: 1,
|
|
6179
|
-
max: 1,
|
|
6180
|
-
min: 1,
|
|
6181
|
-
enable: false,
|
|
6182
|
-
};
|
|
6183
|
-
this.outType = exports.ParticleOutType.normal;
|
|
6184
|
-
this.ignoresResizeRatio = true;
|
|
6185
|
-
const mainOptions = container.actualOptions, particlesOptions = loadParticlesOptions(this.#pluginManager, container, mainOptions.particles), reduceDuplicates = particlesOptions.reduceDuplicates, effectType = particlesOptions.effect.type, shapeType = particlesOptions.shape.type;
|
|
6186
|
-
this.effect = itemFromSingleOrMultiple(effectType, this.id, reduceDuplicates);
|
|
6187
|
-
this.shape = itemFromSingleOrMultiple(shapeType, this.id, reduceDuplicates);
|
|
6188
|
-
const effectOptions = particlesOptions.effect, shapeOptions = particlesOptions.shape;
|
|
6189
|
-
if (overrideOptions) {
|
|
6190
|
-
if (overrideOptions.effect?.type && overrideOptions.effect.type !== this.effect) {
|
|
6191
|
-
const overrideEffectType = overrideOptions.effect.type, effect = itemFromSingleOrMultiple(overrideEffectType, this.id, reduceDuplicates);
|
|
6192
|
-
if (effect) {
|
|
6193
|
-
this.effect = effect;
|
|
6194
|
-
effectOptions.load(overrideOptions.effect);
|
|
6195
|
-
}
|
|
6196
|
-
}
|
|
6197
|
-
if (overrideOptions.shape?.type && overrideOptions.shape.type !== this.shape) {
|
|
6198
|
-
const overrideShapeType = overrideOptions.shape.type, shape = itemFromSingleOrMultiple(overrideShapeType, this.id, reduceDuplicates);
|
|
6199
|
-
if (shape) {
|
|
6200
|
-
this.shape = shape;
|
|
6201
|
-
shapeOptions.load(overrideOptions.shape);
|
|
6202
|
-
}
|
|
6203
|
-
}
|
|
6204
|
-
}
|
|
6205
|
-
if (this.effect === randomColorValue) {
|
|
6206
|
-
const availableEffects = [...this.#container.effectDrawers.keys()];
|
|
6207
|
-
this.effect = availableEffects[Math.floor(getRandom() * availableEffects.length)];
|
|
6208
|
-
}
|
|
6209
|
-
if (this.shape === randomColorValue) {
|
|
6210
|
-
const availableShapes = [...this.#container.shapeDrawers.keys()];
|
|
6211
|
-
this.shape = availableShapes[Math.floor(getRandom() * availableShapes.length)];
|
|
6212
|
-
}
|
|
6213
|
-
this.effectData = this.effect ? loadEffectData(this.effect, effectOptions, this.id, reduceDuplicates) : undefined;
|
|
6214
|
-
this.shapeData = this.shape ? loadShapeData(this.shape, shapeOptions, this.id, reduceDuplicates) : undefined;
|
|
6215
|
-
particlesOptions.load(overrideOptions);
|
|
6216
|
-
const effectData = this.effectData, shapeData = this.shapeData;
|
|
6217
|
-
if (effectData) {
|
|
6218
|
-
particlesOptions.load(effectData.particles);
|
|
6219
|
-
}
|
|
6220
|
-
if (shapeData) {
|
|
6221
|
-
particlesOptions.load(shapeData.particles);
|
|
6222
|
-
}
|
|
6223
|
-
this.effectClose = effectData?.close ?? particlesOptions.effect.close;
|
|
6224
|
-
this.shapeClose = shapeData?.close ?? particlesOptions.shape.close;
|
|
6225
|
-
this.options = particlesOptions;
|
|
5602
|
+
initParticleState(this, id, group);
|
|
5603
|
+
this.options = resolveParticleOptions(this, container, this.#pluginManager, overrideOptions);
|
|
6226
5604
|
container.retina.initParticle(this);
|
|
6227
|
-
|
|
6228
|
-
updater.preInit?.(this);
|
|
6229
|
-
}
|
|
5605
|
+
runUpdaterPreInit(container.particleUpdaters, this);
|
|
6230
5606
|
this.bubble = {
|
|
6231
5607
|
inRange: false,
|
|
6232
5608
|
};
|
|
@@ -6239,32 +5615,11 @@
|
|
|
6239
5615
|
this.velocity = this.initialVelocity.copy();
|
|
6240
5616
|
this.zIndexFactor = this.position.z / container.zLayers;
|
|
6241
5617
|
this.sides = 24;
|
|
6242
|
-
|
|
6243
|
-
if (this.effect) {
|
|
6244
|
-
effectDrawer = container.effectDrawers.get(this.effect);
|
|
6245
|
-
}
|
|
6246
|
-
if (effectDrawer?.loadEffect) {
|
|
6247
|
-
effectDrawer.loadEffect(this);
|
|
6248
|
-
}
|
|
6249
|
-
if (this.shape) {
|
|
6250
|
-
shapeDrawer = container.shapeDrawers.get(this.shape);
|
|
6251
|
-
}
|
|
6252
|
-
if (shapeDrawer?.loadShape) {
|
|
6253
|
-
shapeDrawer.loadShape(this);
|
|
6254
|
-
}
|
|
6255
|
-
const sideCountFunc = shapeDrawer?.getSidesCount;
|
|
6256
|
-
if (sideCountFunc) {
|
|
6257
|
-
this.sides = sideCountFunc(this);
|
|
6258
|
-
}
|
|
5618
|
+
initParticleDrawers(this, container);
|
|
6259
5619
|
this.spawning = false;
|
|
6260
|
-
|
|
6261
|
-
|
|
6262
|
-
|
|
6263
|
-
effectDrawer?.particleInit?.(container, this);
|
|
6264
|
-
shapeDrawer?.particleInit?.(container, this);
|
|
6265
|
-
for (const plugin of container.particleCreatedPlugins) {
|
|
6266
|
-
plugin.particleCreated?.(this);
|
|
6267
|
-
}
|
|
5620
|
+
runUpdaterInit(container.particleUpdaters, this);
|
|
5621
|
+
runDrawerInit(container, this);
|
|
5622
|
+
runParticleCreatedPlugins(container, this);
|
|
6268
5623
|
}
|
|
6269
5624
|
isInsideCanvas(direction) {
|
|
6270
5625
|
return this.#getInsideCanvasResult({ direction }).inside;
|
|
@@ -6278,15 +5633,15 @@
|
|
|
6278
5633
|
}
|
|
6279
5634
|
const angle = this.roll.angle;
|
|
6280
5635
|
if (this.roll.horizontal && this.roll.vertical) {
|
|
6281
|
-
const
|
|
5636
|
+
const adjustedAngle = normalizeAngle(angle, doublePI);
|
|
6282
5637
|
return adjustedAngle >= Math.PI * half$1 && adjustedAngle < Math.PI * triple * half$1;
|
|
6283
5638
|
}
|
|
6284
5639
|
if (this.roll.horizontal) {
|
|
6285
|
-
const
|
|
5640
|
+
const adjustedAngle = normalizeAngle(angle + Math.PI * half$1, doublePI);
|
|
6286
5641
|
return adjustedAngle >= Math.PI && adjustedAngle < Math.PI * double;
|
|
6287
5642
|
}
|
|
6288
5643
|
if (this.roll.vertical) {
|
|
6289
|
-
const
|
|
5644
|
+
const adjustedAngle = normalizeAngle(angle, doublePI);
|
|
6290
5645
|
return adjustedAngle >= Math.PI && adjustedAngle < Math.PI * double;
|
|
6291
5646
|
}
|
|
6292
5647
|
return false;
|
|
@@ -6299,10 +5654,10 @@
|
|
|
6299
5654
|
updater.reset?.(this);
|
|
6300
5655
|
}
|
|
6301
5656
|
}
|
|
6302
|
-
#calcPosition
|
|
5657
|
+
#calcPosition(position, zIndex) {
|
|
6303
5658
|
let tryCount = defaultRetryCount, posVec = position ? Vector3d.create(position.x, position.y, zIndex) : undefined;
|
|
6304
|
-
const container = this.#container, plugins = container.particlePositionPlugins, outModes = this.options.move.outModes, radius = this.getRadius(), canvasSize = container.canvas.size
|
|
6305
|
-
|
|
5659
|
+
const container = this.#container, plugins = container.particlePositionPlugins, outModes = this.options.move.outModes, radius = this.getRadius(), canvasSize = container.canvas.size;
|
|
5660
|
+
for (;;) {
|
|
6306
5661
|
for (const plugin of plugins) {
|
|
6307
5662
|
const pluginPos = plugin.particlePosition?.(posVec, this);
|
|
6308
5663
|
if (pluginPos) {
|
|
@@ -6330,9 +5685,8 @@
|
|
|
6330
5685
|
tryCount += tryCountIncrement;
|
|
6331
5686
|
posVec = undefined;
|
|
6332
5687
|
}
|
|
6333
|
-
|
|
6334
|
-
|
|
6335
|
-
#calculateVelocity = () => {
|
|
5688
|
+
}
|
|
5689
|
+
#calculateVelocity() {
|
|
6336
5690
|
const moveOptions = this.options.move, baseVelocity = getParticleBaseVelocity(this.direction), res = baseVelocity.copy();
|
|
6337
5691
|
if (moveOptions.direction === exports.MoveDirection.inside || moveOptions.direction === exports.MoveDirection.outside) {
|
|
6338
5692
|
return res;
|
|
@@ -6348,8 +5702,8 @@
|
|
|
6348
5702
|
res.length *= getRandom();
|
|
6349
5703
|
}
|
|
6350
5704
|
return res;
|
|
6351
|
-
}
|
|
6352
|
-
#fixHorizontal
|
|
5705
|
+
}
|
|
5706
|
+
#fixHorizontal(pos, radius, outMode) {
|
|
6353
5707
|
fixOutMode({
|
|
6354
5708
|
outMode,
|
|
6355
5709
|
checkModes: [exports.OutMode.bounce],
|
|
@@ -6358,8 +5712,8 @@
|
|
|
6358
5712
|
setCb: (value) => (pos.x += value),
|
|
6359
5713
|
radius,
|
|
6360
5714
|
});
|
|
6361
|
-
}
|
|
6362
|
-
#fixVertical
|
|
5715
|
+
}
|
|
5716
|
+
#fixVertical(pos, radius, outMode) {
|
|
6363
5717
|
fixOutMode({
|
|
6364
5718
|
outMode,
|
|
6365
5719
|
checkModes: [exports.OutMode.bounce],
|
|
@@ -6368,8 +5722,8 @@
|
|
|
6368
5722
|
setCb: (value) => (pos.y += value),
|
|
6369
5723
|
radius,
|
|
6370
5724
|
});
|
|
6371
|
-
}
|
|
6372
|
-
#getDefaultInsideCanvasResult
|
|
5725
|
+
}
|
|
5726
|
+
#getDefaultInsideCanvasResult(direction, outMode) {
|
|
6373
5727
|
const radius = this.getRadius(), canvasSize = this.#container.canvas.size, position = this.position, isBounce = outMode === exports.OutMode.bounce;
|
|
6374
5728
|
if (direction === exports.OutModeDirection.bottom) {
|
|
6375
5729
|
return {
|
|
@@ -6402,8 +5756,8 @@
|
|
|
6402
5756
|
position.x <= canvasSize.width + radius,
|
|
6403
5757
|
reason: "default",
|
|
6404
5758
|
};
|
|
6405
|
-
}
|
|
6406
|
-
#getInsideCanvasCallbackData
|
|
5759
|
+
}
|
|
5760
|
+
#getInsideCanvasCallbackData(direction, outMode) {
|
|
6407
5761
|
return {
|
|
6408
5762
|
canvasSize: this.#container.canvas.size,
|
|
6409
5763
|
direction,
|
|
@@ -6411,8 +5765,8 @@
|
|
|
6411
5765
|
particle: this,
|
|
6412
5766
|
radius: this.getRadius(),
|
|
6413
5767
|
};
|
|
6414
|
-
}
|
|
6415
|
-
#getInsideCanvasResult
|
|
5768
|
+
}
|
|
5769
|
+
#getInsideCanvasResult(data) {
|
|
6416
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;
|
|
6417
5771
|
if (!shapeCheck && !effectCheck) {
|
|
6418
5772
|
return defaultResult;
|
|
@@ -6427,8 +5781,8 @@
|
|
|
6427
5781
|
};
|
|
6428
5782
|
}
|
|
6429
5783
|
return shapeResult ?? effectResult ?? defaultResult;
|
|
6430
|
-
}
|
|
6431
|
-
#getRollColor
|
|
5784
|
+
}
|
|
5785
|
+
#getRollColor(color) {
|
|
6432
5786
|
if (!color || !this.roll || (!this.backColor && !this.roll.alter)) {
|
|
6433
5787
|
return color;
|
|
6434
5788
|
}
|
|
@@ -6442,8 +5796,8 @@
|
|
|
6442
5796
|
return alterHsl(color, this.roll.alter.type, this.roll.alter.value);
|
|
6443
5797
|
}
|
|
6444
5798
|
return color;
|
|
6445
|
-
}
|
|
6446
|
-
#initPosition
|
|
5799
|
+
}
|
|
5800
|
+
#initPosition(position) {
|
|
6447
5801
|
const container = this.#container, zIndexValue = Math.floor(getRangeValue(this.options.zIndex.value)), initialPosition = this.#calcPosition(position, clamp(zIndexValue, minZ, container.zLayers));
|
|
6448
5802
|
if (!initialPosition) {
|
|
6449
5803
|
throw new Error("a valid position cannot be found for particle");
|
|
@@ -6466,8 +5820,8 @@
|
|
|
6466
5820
|
break;
|
|
6467
5821
|
}
|
|
6468
5822
|
this.offset = Vector.origin;
|
|
6469
|
-
}
|
|
6470
|
-
#normalizeInsideCanvasResult
|
|
5823
|
+
}
|
|
5824
|
+
#normalizeInsideCanvasResult(result, reason) {
|
|
6471
5825
|
if (typeof result === "boolean") {
|
|
6472
5826
|
return {
|
|
6473
5827
|
inside: result,
|
|
@@ -6479,7 +5833,7 @@
|
|
|
6479
5833
|
margin: result.margin,
|
|
6480
5834
|
reason: result.reason ?? reason,
|
|
6481
5835
|
};
|
|
6482
|
-
}
|
|
5836
|
+
}
|
|
6483
5837
|
}
|
|
6484
5838
|
|
|
6485
5839
|
class SpatialHashGrid {
|
|
@@ -6832,10 +6186,10 @@
|
|
|
6832
6186
|
}
|
|
6833
6187
|
this.#resizeFactor = undefined;
|
|
6834
6188
|
}
|
|
6835
|
-
#addToPool
|
|
6189
|
+
#addToPool(...particles) {
|
|
6836
6190
|
this.#pool.push(...particles);
|
|
6837
|
-
}
|
|
6838
|
-
#applyDensity
|
|
6191
|
+
}
|
|
6192
|
+
#applyDensity(options, pluginsCount, group, groupOptions) {
|
|
6839
6193
|
const numberOptions = options.number;
|
|
6840
6194
|
if (!numberOptions.density.enable) {
|
|
6841
6195
|
if (group === undefined) {
|
|
@@ -6859,36 +6213,19 @@
|
|
|
6859
6213
|
else if (particlesCount > particlesNumber) {
|
|
6860
6214
|
this.removeQuantity(particlesCount - particlesNumber, group);
|
|
6861
6215
|
}
|
|
6862
|
-
}
|
|
6863
|
-
#createBuckets
|
|
6216
|
+
}
|
|
6217
|
+
#createBuckets(zLayers) {
|
|
6864
6218
|
const bucketCount = Math.max(Math.floor(zLayers), one);
|
|
6865
6219
|
return Array.from({ length: bucketCount }, () => []);
|
|
6866
|
-
}
|
|
6867
|
-
#getBucketIndex
|
|
6220
|
+
}
|
|
6221
|
+
#getBucketIndex(zIndex) {
|
|
6868
6222
|
const maxBucketIndex = this.#zBuckets.length - one;
|
|
6869
6223
|
if (maxBucketIndex <= minIndex) {
|
|
6870
6224
|
return minIndex;
|
|
6871
6225
|
}
|
|
6872
6226
|
return Math.min(Math.max(Math.floor(zIndex), minIndex), maxBucketIndex);
|
|
6873
|
-
}
|
|
6874
|
-
#
|
|
6875
|
-
let start = minIndex, end = bucket.length;
|
|
6876
|
-
while (start < end) {
|
|
6877
|
-
const middle = Math.floor((start + end) / double), middleParticle = bucket[middle];
|
|
6878
|
-
if (!middleParticle) {
|
|
6879
|
-
end = middle;
|
|
6880
|
-
continue;
|
|
6881
|
-
}
|
|
6882
|
-
if (middleParticle.id < particleId) {
|
|
6883
|
-
start = middle + one;
|
|
6884
|
-
}
|
|
6885
|
-
else {
|
|
6886
|
-
end = middle;
|
|
6887
|
-
}
|
|
6888
|
-
}
|
|
6889
|
-
return start;
|
|
6890
|
-
};
|
|
6891
|
-
#initDensityFactor = densityOptions => {
|
|
6227
|
+
}
|
|
6228
|
+
#initDensityFactor(densityOptions) {
|
|
6892
6229
|
const container = this.#container;
|
|
6893
6230
|
if (!densityOptions.enable) {
|
|
6894
6231
|
return defaultDensityFactor;
|
|
@@ -6898,16 +6235,16 @@
|
|
|
6898
6235
|
return defaultDensityFactor;
|
|
6899
6236
|
}
|
|
6900
6237
|
return ((canvasSize.width * canvasSize.height) / (densityOptions.height * densityOptions.width * pxRatio ** squareExp));
|
|
6901
|
-
}
|
|
6902
|
-
#insertParticleIntoBucket
|
|
6238
|
+
}
|
|
6239
|
+
#insertParticleIntoBucket(particle) {
|
|
6903
6240
|
const bucketIndex = this.#getBucketIndex(particle.position.z), bucket = this.#zBuckets[bucketIndex];
|
|
6904
6241
|
if (!bucket) {
|
|
6905
6242
|
return;
|
|
6906
6243
|
}
|
|
6907
|
-
bucket.
|
|
6244
|
+
bucket.push(particle);
|
|
6908
6245
|
this.#particleBuckets.set(particle.id, bucketIndex);
|
|
6909
|
-
}
|
|
6910
|
-
#removeParticle
|
|
6246
|
+
}
|
|
6247
|
+
#removeParticle(index, group, override) {
|
|
6911
6248
|
const particle = this.#array[index];
|
|
6912
6249
|
if (!particle) {
|
|
6913
6250
|
return false;
|
|
@@ -6923,22 +6260,20 @@
|
|
|
6923
6260
|
});
|
|
6924
6261
|
this.#addToPool(particle);
|
|
6925
6262
|
return true;
|
|
6926
|
-
}
|
|
6927
|
-
#removeParticleFromBucket
|
|
6263
|
+
}
|
|
6264
|
+
#removeParticleFromBucket(particle) {
|
|
6928
6265
|
const bucketIndex = this.#particleBuckets.get(particle.id) ?? this.#getBucketIndex(particle.position.z), bucket = this.#zBuckets[bucketIndex];
|
|
6929
6266
|
if (!bucket) {
|
|
6930
6267
|
this.#particleBuckets.delete(particle.id);
|
|
6931
6268
|
return;
|
|
6932
6269
|
}
|
|
6933
|
-
const
|
|
6934
|
-
if (
|
|
6935
|
-
|
|
6936
|
-
return;
|
|
6270
|
+
const idx = bucket.findIndex(p => p.id === particle.id);
|
|
6271
|
+
if (idx >= minIndex) {
|
|
6272
|
+
bucket.splice(idx, deleteCount);
|
|
6937
6273
|
}
|
|
6938
|
-
bucket.splice(particleIndex, deleteCount);
|
|
6939
6274
|
this.#particleBuckets.delete(particle.id);
|
|
6940
|
-
}
|
|
6941
|
-
#resetBuckets
|
|
6275
|
+
}
|
|
6276
|
+
#resetBuckets(zLayers) {
|
|
6942
6277
|
const bucketCount = Math.max(Math.floor(zLayers), one);
|
|
6943
6278
|
if (this.#zBuckets.length !== bucketCount) {
|
|
6944
6279
|
this.#zBuckets = this.#createBuckets(bucketCount);
|
|
@@ -6947,8 +6282,8 @@
|
|
|
6947
6282
|
for (const bucket of this.#zBuckets) {
|
|
6948
6283
|
bucket.length = minIndex;
|
|
6949
6284
|
}
|
|
6950
|
-
}
|
|
6951
|
-
#updateParticleBucket
|
|
6285
|
+
}
|
|
6286
|
+
#updateParticleBucket(particle) {
|
|
6952
6287
|
const newBucketIndex = this.#getBucketIndex(particle.position.z), currentBucketIndex = this.#particleBuckets.get(particle.id);
|
|
6953
6288
|
if (currentBucketIndex === undefined) {
|
|
6954
6289
|
this.#insertParticleIntoBucket(particle);
|
|
@@ -6959,9 +6294,9 @@
|
|
|
6959
6294
|
}
|
|
6960
6295
|
const currentBucket = this.#zBuckets[currentBucketIndex];
|
|
6961
6296
|
if (currentBucket) {
|
|
6962
|
-
const
|
|
6963
|
-
if (
|
|
6964
|
-
currentBucket.splice(
|
|
6297
|
+
const idx = currentBucket.findIndex(p => p.id === particle.id);
|
|
6298
|
+
if (idx >= minIndex) {
|
|
6299
|
+
currentBucket.splice(idx, deleteCount);
|
|
6965
6300
|
}
|
|
6966
6301
|
}
|
|
6967
6302
|
const newBucket = this.#zBuckets[newBucketIndex];
|
|
@@ -6969,10 +6304,16 @@
|
|
|
6969
6304
|
this.#particleBuckets.set(particle.id, newBucketIndex);
|
|
6970
6305
|
return;
|
|
6971
6306
|
}
|
|
6972
|
-
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
|
+
}
|
|
6973
6314
|
this.#particleBuckets.set(particle.id, newBucketIndex);
|
|
6974
|
-
}
|
|
6975
|
-
#updateParticlesPhase1
|
|
6315
|
+
}
|
|
6316
|
+
#updateParticlesPhase1(delta) {
|
|
6976
6317
|
const particlesToDelete = new Set(), resizeFactor = this.#resizeFactor;
|
|
6977
6318
|
for (const particle of this.#array) {
|
|
6978
6319
|
if (resizeFactor && !particle.ignoresResizeRatio) {
|
|
@@ -6998,8 +6339,8 @@
|
|
|
6998
6339
|
this.grid.insert(particle);
|
|
6999
6340
|
}
|
|
7000
6341
|
return particlesToDelete;
|
|
7001
|
-
}
|
|
7002
|
-
#updateParticlesPhase2
|
|
6342
|
+
}
|
|
6343
|
+
#updateParticlesPhase2(delta, particlesToDelete) {
|
|
7003
6344
|
for (const particle of this.#array) {
|
|
7004
6345
|
if (particle.destroyed) {
|
|
7005
6346
|
particlesToDelete.add(particle);
|
|
@@ -7015,7 +6356,7 @@
|
|
|
7015
6356
|
}
|
|
7016
6357
|
this.#updateParticleBucket(particle);
|
|
7017
6358
|
}
|
|
7018
|
-
}
|
|
6359
|
+
}
|
|
7019
6360
|
}
|
|
7020
6361
|
|
|
7021
6362
|
class Retina {
|
|
@@ -7377,7 +6718,7 @@
|
|
|
7377
6718
|
}
|
|
7378
6719
|
return refresh;
|
|
7379
6720
|
}
|
|
7380
|
-
#nextFrame
|
|
6721
|
+
#nextFrame(timestamp) {
|
|
7381
6722
|
try {
|
|
7382
6723
|
if (!this.#smooth &&
|
|
7383
6724
|
this.#lastFrameTime !== undefined &&
|
|
@@ -7405,7 +6746,7 @@
|
|
|
7405
6746
|
catch (e) {
|
|
7406
6747
|
getLogger().error("error in animation loop", e);
|
|
7407
6748
|
}
|
|
7408
|
-
}
|
|
6749
|
+
}
|
|
7409
6750
|
}
|
|
7410
6751
|
|
|
7411
6752
|
var Container$1 = /*#__PURE__*/Object.freeze({
|
|
@@ -7451,7 +6792,7 @@
|
|
|
7451
6792
|
BlendPluginInstance: BlendPluginInstance
|
|
7452
6793
|
});
|
|
7453
6794
|
|
|
7454
|
-
const
|
|
6795
|
+
const moveSpeedFactor = 60, minSpinRadius = 0, spinFactor = 0.01, defaultPathDelay = 0, noDecay = 1;
|
|
7455
6796
|
function applyDistance(particle) {
|
|
7456
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;
|
|
7457
6798
|
if (!hDistance && !vDistance) {
|
|
@@ -7484,7 +6825,7 @@
|
|
|
7484
6825
|
}
|
|
7485
6826
|
function move(particle, moveOptions, moveSpeed, maxSpeed, moveDrift, reduceFactor, delta) {
|
|
7486
6827
|
applyPath(particle, delta);
|
|
7487
|
-
const gravityOptions = particle.gravity, gravityFactor = gravityOptions?.enable && gravityOptions.inverse ? -identity$
|
|
6828
|
+
const gravityOptions = particle.gravity, gravityFactor = gravityOptions?.enable && gravityOptions.inverse ? -identity$2 : identity$2;
|
|
7488
6829
|
if (moveDrift && moveSpeed) {
|
|
7489
6830
|
particle.velocity.x += (moveDrift * delta.factor) / (moveSpeedFactor * moveSpeed);
|
|
7490
6831
|
}
|
|
@@ -7504,7 +6845,7 @@
|
|
|
7504
6845
|
particle.velocity.y = velocity.y / moveSpeed;
|
|
7505
6846
|
}
|
|
7506
6847
|
}
|
|
7507
|
-
const zIndexOptions = particle.options.zIndex, zVelocityFactor = (identity$
|
|
6848
|
+
const zIndexOptions = particle.options.zIndex, zVelocityFactor = (identity$2 - particle.zIndexFactor) ** zIndexOptions.velocityRate;
|
|
7508
6849
|
velocity.multTo(zVelocityFactor);
|
|
7509
6850
|
velocity.multTo(reduceFactor);
|
|
7510
6851
|
const { position } = particle;
|
|
@@ -7530,13 +6871,13 @@
|
|
|
7530
6871
|
const maxCanvasSize = Math.max(container.canvas.size.width, container.canvas.size.height), halfMaxSize = maxCanvasSize * half$1;
|
|
7531
6872
|
if (particle.spin.radius > halfMaxSize) {
|
|
7532
6873
|
particle.spin.radius = halfMaxSize;
|
|
7533
|
-
particle.spin.acceleration *= -identity$
|
|
6874
|
+
particle.spin.acceleration *= -identity$2;
|
|
7534
6875
|
}
|
|
7535
6876
|
else if (particle.spin.radius < minSpinRadius) {
|
|
7536
6877
|
particle.spin.radius = minSpinRadius;
|
|
7537
|
-
particle.spin.acceleration *= -identity$
|
|
6878
|
+
particle.spin.acceleration *= -identity$2;
|
|
7538
6879
|
}
|
|
7539
|
-
particle.spin.angle += moveSpeed * spinFactor * (identity$
|
|
6880
|
+
particle.spin.angle += moveSpeed * spinFactor * (identity$2 - particle.spin.radius / maxCanvasSize);
|
|
7540
6881
|
}
|
|
7541
6882
|
function applyPath(particle, delta) {
|
|
7542
6883
|
const particlesOptions = particle.options, pathOptions = particlesOptions.move.path, pathEnabled = pathOptions.enable;
|
|
@@ -7553,13 +6894,13 @@
|
|
|
7553
6894
|
particle.velocity.addTo(path);
|
|
7554
6895
|
}
|
|
7555
6896
|
if (pathOptions.clamp) {
|
|
7556
|
-
particle.velocity.x = clamp(particle.velocity.x, -identity$
|
|
7557
|
-
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);
|
|
7558
6899
|
}
|
|
7559
6900
|
particle.lastPathTime -= pathDelay;
|
|
7560
6901
|
}
|
|
7561
6902
|
function getProximitySpeedFactor(particle) {
|
|
7562
|
-
return particle.slow.inRange ? particle.slow.factor : identity$
|
|
6903
|
+
return particle.slow.inRange ? particle.slow.factor : identity$2;
|
|
7563
6904
|
}
|
|
7564
6905
|
function initSpin(container, particle) {
|
|
7565
6906
|
const options = particle.options, spinOptions = options.move.spin;
|
|
@@ -7843,7 +7184,7 @@
|
|
|
7843
7184
|
mediaQuery.addEventListener("change", handleChange);
|
|
7844
7185
|
await Promise.resolve();
|
|
7845
7186
|
}
|
|
7846
|
-
#handleMotionChange
|
|
7187
|
+
#handleMotionChange(mediaQuery) {
|
|
7847
7188
|
const container = this.#container, motion = container.actualOptions.motion;
|
|
7848
7189
|
if (!motion) {
|
|
7849
7190
|
return;
|
|
@@ -7859,7 +7200,7 @@
|
|
|
7859
7200
|
else {
|
|
7860
7201
|
container.retina.reduceFactor = defaultReduce;
|
|
7861
7202
|
}
|
|
7862
|
-
}
|
|
7203
|
+
}
|
|
7863
7204
|
}
|
|
7864
7205
|
|
|
7865
7206
|
var MotionPluginInstance$1 = /*#__PURE__*/Object.freeze({
|
|
@@ -7952,7 +7293,13 @@
|
|
|
7952
7293
|
this.#paused = !this.options.autoPlay;
|
|
7953
7294
|
this.#particlesOptions = particlesOptions;
|
|
7954
7295
|
this.#size = this.#calcSize();
|
|
7955
|
-
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 };
|
|
7956
7303
|
this.#lifeCount = this.options.life.count ?? defaultLifeCount;
|
|
7957
7304
|
this.#immortal = this.#lifeCount <= minLifeCount;
|
|
7958
7305
|
if (this.options.domId) {
|
|
@@ -8023,7 +7370,13 @@
|
|
|
8023
7370
|
? initialPosition
|
|
8024
7371
|
: this.#calcPosition();
|
|
8025
7372
|
this.#size = this.#calcSize();
|
|
8026
|
-
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 };
|
|
8027
7380
|
this.#shape?.resize(this.position, this.size);
|
|
8028
7381
|
}
|
|
8029
7382
|
update(delta) {
|
|
@@ -8123,7 +7476,7 @@
|
|
|
8123
7476
|
return size;
|
|
8124
7477
|
})());
|
|
8125
7478
|
}
|
|
8126
|
-
#destroy
|
|
7479
|
+
#destroy() {
|
|
8127
7480
|
this.#mutationObserver?.disconnect();
|
|
8128
7481
|
this.#mutationObserver = undefined;
|
|
8129
7482
|
this.#resizeObserver?.disconnect();
|
|
@@ -8132,7 +7485,7 @@
|
|
|
8132
7485
|
this.#container.dispatchEvent("emitterDestroyed", {
|
|
8133
7486
|
emitter: this,
|
|
8134
7487
|
});
|
|
8135
|
-
}
|
|
7488
|
+
}
|
|
8136
7489
|
#emit() {
|
|
8137
7490
|
if (this.#paused) {
|
|
8138
7491
|
return;
|
|
@@ -8192,7 +7545,7 @@
|
|
|
8192
7545
|
}
|
|
8193
7546
|
}
|
|
8194
7547
|
}
|
|
8195
|
-
#prepareToDie
|
|
7548
|
+
#prepareToDie() {
|
|
8196
7549
|
if (this.#paused) {
|
|
8197
7550
|
return;
|
|
8198
7551
|
}
|
|
@@ -8200,8 +7553,8 @@
|
|
|
8200
7553
|
if ((this.#lifeCount > minLifeCount || this.#immortal) && duration !== undefined && duration > minDuration) {
|
|
8201
7554
|
this.#duration = duration * millisecondsToSeconds$1;
|
|
8202
7555
|
}
|
|
8203
|
-
}
|
|
8204
|
-
#setColorAnimation
|
|
7556
|
+
}
|
|
7557
|
+
#setColorAnimation(animation, initValue, maxValue, factor = defaultColorAnimationFactor) {
|
|
8205
7558
|
const container = this.#container;
|
|
8206
7559
|
if (!animation.enable) {
|
|
8207
7560
|
return initValue;
|
|
@@ -8210,7 +7563,7 @@
|
|
|
8210
7563
|
? (delay * millisecondsToSeconds$1) / container.retina.reduceFactor
|
|
8211
7564
|
: Infinity, colorSpeed = getRangeValue(animation.speed);
|
|
8212
7565
|
return (initValue + (colorSpeed * container.fpsLimit) / emitFactor + colorOffset * factor) % maxValue;
|
|
8213
|
-
}
|
|
7566
|
+
}
|
|
8214
7567
|
}
|
|
8215
7568
|
|
|
8216
7569
|
var EmitterInstance$1 = /*#__PURE__*/Object.freeze({
|
|
@@ -8233,6 +7586,7 @@
|
|
|
8233
7586
|
exports.MoveCenter = MoveCenter;
|
|
8234
7587
|
exports.MoveGravity = MoveGravity;
|
|
8235
7588
|
exports.MovePath = MovePath;
|
|
7589
|
+
exports.OptionLoader = OptionLoader;
|
|
8236
7590
|
exports.Options = Options;
|
|
8237
7591
|
exports.OptionsColor = OptionsColor;
|
|
8238
7592
|
exports.OutModes = OutModes;
|
|
@@ -8257,9 +7611,7 @@
|
|
|
8257
7611
|
exports.alterHsl = alterHsl;
|
|
8258
7612
|
exports.animate = animate;
|
|
8259
7613
|
exports.areBoundsInside = areBoundsInside;
|
|
8260
|
-
exports.arrayRandomIndex = arrayRandomIndex;
|
|
8261
7614
|
exports.calcExactPositionOrRandomFromSize = calcExactPositionOrRandomFromSize;
|
|
8262
|
-
exports.calcExactPositionOrRandomFromSizeRanged = calcExactPositionOrRandomFromSizeRanged;
|
|
8263
7615
|
exports.calcPositionFromSize = calcPositionFromSize;
|
|
8264
7616
|
exports.calcPositionOrRandomFromSize = calcPositionOrRandomFromSize;
|
|
8265
7617
|
exports.calcPositionOrRandomFromSizeRanged = calcPositionOrRandomFromSizeRanged;
|
|
@@ -8271,11 +7623,9 @@
|
|
|
8271
7623
|
exports.circleBounce = circleBounce;
|
|
8272
7624
|
exports.circleBounceDataFromParticle = circleBounceDataFromParticle;
|
|
8273
7625
|
exports.clamp = clamp;
|
|
8274
|
-
exports.clear = clear;
|
|
8275
7626
|
exports.cloneStyle = cloneStyle;
|
|
8276
7627
|
exports.collisionVelocity = collisionVelocity;
|
|
8277
7628
|
exports.colorMix = colorMix;
|
|
8278
|
-
exports.colorToHsl = colorToHsl;
|
|
8279
7629
|
exports.colorToRgb = colorToRgb;
|
|
8280
7630
|
exports.countOffset = countOffset;
|
|
8281
7631
|
exports.decayOffset = decayOffset;
|
|
@@ -8302,16 +7652,8 @@
|
|
|
8302
7652
|
exports.deleteCount = deleteCount;
|
|
8303
7653
|
exports.double = double;
|
|
8304
7654
|
exports.doublePI = doublePI;
|
|
8305
|
-
exports.drawAfterEffect = drawAfterEffect;
|
|
8306
|
-
exports.drawBeforeEffect = drawBeforeEffect;
|
|
8307
|
-
exports.drawParticle = drawParticle;
|
|
8308
|
-
exports.drawParticlePlugin = drawParticlePlugin;
|
|
8309
|
-
exports.drawShape = drawShape;
|
|
8310
|
-
exports.drawShapeAfterDraw = drawShapeAfterDraw;
|
|
8311
|
-
exports.drawShapeBeforeDraw = drawShapeBeforeDraw;
|
|
8312
7655
|
exports.empty = empty;
|
|
8313
7656
|
exports.executeOnSingleOrMultiple = executeOnSingleOrMultiple;
|
|
8314
|
-
exports.findItemFromSingleOrMultiple = findItemFromSingleOrMultiple;
|
|
8315
7657
|
exports.generatedAttribute = generatedAttribute;
|
|
8316
7658
|
exports.generatedFalse = generatedFalse;
|
|
8317
7659
|
exports.generatedTrue = generatedTrue;
|
|
@@ -8330,23 +7672,21 @@
|
|
|
8330
7672
|
exports.getParticleDirectionAngle = getParticleDirectionAngle;
|
|
8331
7673
|
exports.getPosition = getPosition;
|
|
8332
7674
|
exports.getRandom = getRandom;
|
|
7675
|
+
exports.getRandomFn = getRandomFn;
|
|
8333
7676
|
exports.getRandomInRange = getRandomInRange;
|
|
8334
7677
|
exports.getRandomRgbColor = getRandomRgbColor;
|
|
8335
7678
|
exports.getRangeMax = getRangeMax;
|
|
8336
7679
|
exports.getRangeMin = getRangeMin;
|
|
8337
7680
|
exports.getRangeValue = getRangeValue;
|
|
8338
|
-
exports.getSize = getSize;
|
|
8339
7681
|
exports.getStyleFromHsl = getStyleFromHsl;
|
|
8340
7682
|
exports.getStyleFromRgb = getStyleFromRgb;
|
|
8341
7683
|
exports.hMax = hMax;
|
|
8342
7684
|
exports.hMin = hMin;
|
|
8343
7685
|
exports.hPhase = hPhase;
|
|
8344
7686
|
exports.half = half$1;
|
|
8345
|
-
exports.hasMatchMedia = hasMatchMedia;
|
|
8346
7687
|
exports.hslToRgb = hslToRgb;
|
|
8347
7688
|
exports.hslaToRgba = hslaToRgba;
|
|
8348
|
-
exports.identity = identity$
|
|
8349
|
-
exports.initParticleNumericAnimationValue = initParticleNumericAnimationValue;
|
|
7689
|
+
exports.identity = identity$2;
|
|
8350
7690
|
exports.inverseFactorNumerator = inverseFactorNumerator;
|
|
8351
7691
|
exports.isArray = isArray;
|
|
8352
7692
|
exports.isBoolean = isBoolean;
|
|
@@ -8363,28 +7703,34 @@
|
|
|
8363
7703
|
exports.lMax = lMax;
|
|
8364
7704
|
exports.lMin = lMin;
|
|
8365
7705
|
exports.lengthOffset = lengthOffset;
|
|
7706
|
+
exports.loadExtendProperty = loadExtendProperty;
|
|
7707
|
+
exports.loadLazyProperty = loadLazyProperty;
|
|
8366
7708
|
exports.loadMinIndex = loadMinIndex;
|
|
7709
|
+
exports.loadNestedProperty = loadNestedProperty;
|
|
7710
|
+
exports.loadOptionProperty = loadOptionProperty;
|
|
8367
7711
|
exports.loadOptions = loadOptions;
|
|
8368
7712
|
exports.loadParticlesOptions = loadParticlesOptions;
|
|
7713
|
+
exports.loadProperty = loadProperty;
|
|
8369
7714
|
exports.loadRandomFactor = loadRandomFactor;
|
|
7715
|
+
exports.loadRangeProperty = loadRangeProperty;
|
|
8370
7716
|
exports.manageListener = manageListener;
|
|
8371
|
-
exports.
|
|
7717
|
+
exports.maxNits = maxNits;
|
|
8372
7718
|
exports.midColorValue = midColorValue;
|
|
8373
7719
|
exports.millisecondsToSeconds = millisecondsToSeconds$1;
|
|
8374
7720
|
exports.minCount = minCount;
|
|
7721
|
+
exports.minDistance = minDistance;
|
|
8375
7722
|
exports.minFpsLimit = minFpsLimit;
|
|
8376
7723
|
exports.minIndex = minIndex;
|
|
8377
7724
|
exports.minLimit = minLimit;
|
|
7725
|
+
exports.minRadius = minRadius$2;
|
|
8378
7726
|
exports.minStrokeWidth = minStrokeWidth;
|
|
8379
|
-
exports.minVelocity = minVelocity
|
|
7727
|
+
exports.minVelocity = minVelocity;
|
|
8380
7728
|
exports.minZ = minZ;
|
|
8381
7729
|
exports.minimumSize = minimumSize;
|
|
8382
7730
|
exports.mix = mix;
|
|
8383
7731
|
exports.none = none;
|
|
8384
7732
|
exports.one = one;
|
|
8385
7733
|
exports.originPoint = originPoint;
|
|
8386
|
-
exports.paintBase = paintBase;
|
|
8387
|
-
exports.paintImage = paintImage;
|
|
8388
7734
|
exports.parseAlpha = parseAlpha;
|
|
8389
7735
|
exports.percentDenominator = percentDenominator;
|
|
8390
7736
|
exports.phaseNumerator = phaseNumerator;
|
|
@@ -8403,7 +7749,6 @@
|
|
|
8403
7749
|
exports.sMin = sMin;
|
|
8404
7750
|
exports.sNormalizedOffset = sNormalizedOffset;
|
|
8405
7751
|
exports.safeDocument = safeDocument;
|
|
8406
|
-
exports.safeIntersectionObserver = safeIntersectionObserver;
|
|
8407
7752
|
exports.safeMatchMedia = safeMatchMedia;
|
|
8408
7753
|
exports.safeMutationObserver = safeMutationObserver;
|
|
8409
7754
|
exports.setAnimationFunctions = setAnimationFunctions;
|
|
@@ -8419,14 +7764,13 @@
|
|
|
8419
7764
|
exports.triple = triple;
|
|
8420
7765
|
exports.tryCountIncrement = tryCountIncrement;
|
|
8421
7766
|
exports.tsParticles = tsParticles;
|
|
8422
|
-
exports.updateAnimation = updateAnimation;
|
|
8423
7767
|
exports.updateColor = updateColor;
|
|
8424
7768
|
exports.updateColorValue = updateColorValue;
|
|
8425
7769
|
exports.visibilityChangeEvent = visibilityChangeEvent;
|
|
8426
7770
|
exports.zIndexFactorOffset = zIndexFactorOffset;
|
|
8427
7771
|
|
|
8428
7772
|
}));
|
|
8429
|
-
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 });
|
|
8430
7774
|
globalThis.__tsParticlesInternals = globalThis.__tsParticlesInternals || {};
|
|
8431
7775
|
if (!globalThis.__tsParticlesInternals.engine || !globalThis.__tsParticlesInternals.engine.tsParticles) {
|
|
8432
7776
|
globalThis.__tsParticlesInternals.engine = globalThis.__tsParticlesInternals.bundles.ribbons || {};
|