tsparticles 4.3.2 → 4.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/index.js +1 -1
- package/browser/index.lazy.js +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.lazy.js +1 -1
- package/esm/index.js +1 -1
- package/esm/index.lazy.js +1 -1
- package/package.json +15 -15
- package/report.html +1 -1
- package/tsparticles.bundle.js +315 -115
- package/tsparticles.bundle.min.js +1 -1
- package/tsparticles.js +2 -2
- package/tsparticles.min.js +1 -1
package/tsparticles.bundle.js
CHANGED
|
@@ -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.4.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) :
|
|
@@ -880,7 +880,7 @@
|
|
|
880
880
|
return this.#domArray;
|
|
881
881
|
}
|
|
882
882
|
get version() {
|
|
883
|
-
return "4.
|
|
883
|
+
return "4.4.0";
|
|
884
884
|
}
|
|
885
885
|
addEventListener(type, listener) {
|
|
886
886
|
this.#eventDispatcher.addEventListener(type, listener);
|
|
@@ -961,6 +961,10 @@
|
|
|
961
961
|
}
|
|
962
962
|
|
|
963
963
|
function initEngine() {
|
|
964
|
+
const existing = globalThis.tsParticles;
|
|
965
|
+
if (existing?.pluginManager) {
|
|
966
|
+
return existing;
|
|
967
|
+
}
|
|
964
968
|
return new Engine();
|
|
965
969
|
}
|
|
966
970
|
|
|
@@ -1058,6 +1062,15 @@
|
|
|
1058
1062
|
AnimationMode["random"] = "random";
|
|
1059
1063
|
})(exports.AnimationMode || (exports.AnimationMode = {}));
|
|
1060
1064
|
|
|
1065
|
+
exports.HdrMode = void 0;
|
|
1066
|
+
(function (HdrMode) {
|
|
1067
|
+
HdrMode["standard"] = "standard";
|
|
1068
|
+
HdrMode["natural"] = "natural";
|
|
1069
|
+
HdrMode["vivid"] = "vivid";
|
|
1070
|
+
HdrMode["cinematic"] = "cinematic";
|
|
1071
|
+
HdrMode["dynamic"] = "dynamic";
|
|
1072
|
+
})(exports.HdrMode || (exports.HdrMode = {}));
|
|
1073
|
+
|
|
1061
1074
|
exports.LimitMode = void 0;
|
|
1062
1075
|
(function (LimitMode) {
|
|
1063
1076
|
LimitMode["delete"] = "delete";
|
|
@@ -1323,6 +1336,29 @@
|
|
|
1323
1336
|
}
|
|
1324
1337
|
}
|
|
1325
1338
|
|
|
1339
|
+
const defaultPeakNits = 400, minPeakNits = 0, toStringValue = (value) => String(value);
|
|
1340
|
+
class HDROptions extends OptionLoader {
|
|
1341
|
+
enable = true;
|
|
1342
|
+
mode = exports.HdrMode.standard;
|
|
1343
|
+
peakNits = defaultPeakNits;
|
|
1344
|
+
doLoad(data) {
|
|
1345
|
+
if (data.enable !== undefined && !isBoolean(data.enable)) {
|
|
1346
|
+
throw new Error(`Invalid HDR "enable" value: expected a boolean, got "${String(data.enable)}"`);
|
|
1347
|
+
}
|
|
1348
|
+
if (data.mode !== undefined &&
|
|
1349
|
+
(typeof data.mode !== "string" || !Object.values(exports.HdrMode).includes(data.mode))) {
|
|
1350
|
+
throw new Error(`Invalid HDR "mode" value: expected one of ${Object.values(exports.HdrMode).join(", ")}, got "${toStringValue(data.mode)}"`);
|
|
1351
|
+
}
|
|
1352
|
+
if (data.peakNits !== undefined &&
|
|
1353
|
+
(!isNumber(data.peakNits) || !Number.isFinite(data.peakNits) || data.peakNits <= minPeakNits)) {
|
|
1354
|
+
throw new Error(`Invalid HDR "peakNits" value: expected a positive number, got "${String(data.peakNits)}"`);
|
|
1355
|
+
}
|
|
1356
|
+
loadProperty(this, "enable", data.enable);
|
|
1357
|
+
loadProperty(this, "mode", data.mode);
|
|
1358
|
+
loadProperty(this, "peakNits", data.peakNits);
|
|
1359
|
+
}
|
|
1360
|
+
}
|
|
1361
|
+
|
|
1326
1362
|
class ResizeEvent extends OptionLoader {
|
|
1327
1363
|
delay = 0.5;
|
|
1328
1364
|
enable = true;
|
|
@@ -1766,7 +1802,7 @@
|
|
|
1766
1802
|
duration = 0;
|
|
1767
1803
|
fpsLimit = 120;
|
|
1768
1804
|
fullScreen;
|
|
1769
|
-
hdr
|
|
1805
|
+
hdr;
|
|
1770
1806
|
key;
|
|
1771
1807
|
name;
|
|
1772
1808
|
palette;
|
|
@@ -1786,6 +1822,7 @@
|
|
|
1786
1822
|
this.#container = container;
|
|
1787
1823
|
this.background = new Background();
|
|
1788
1824
|
this.fullScreen = new FullScreen();
|
|
1825
|
+
this.hdr = new HDROptions();
|
|
1789
1826
|
this.particles = loadParticlesOptions(this.#pluginManager, this.#container);
|
|
1790
1827
|
this.resize = new ResizeEvent();
|
|
1791
1828
|
}
|
|
@@ -1808,7 +1845,15 @@
|
|
|
1808
1845
|
loadProperty(this, "detectRetina", data.detectRetina);
|
|
1809
1846
|
loadRangeProperty(this, "duration", data.duration);
|
|
1810
1847
|
loadProperty(this, "fpsLimit", data.fpsLimit);
|
|
1811
|
-
|
|
1848
|
+
const hdrData = data.hdr;
|
|
1849
|
+
if (isBoolean(hdrData)) {
|
|
1850
|
+
this.hdr.enable = hdrData;
|
|
1851
|
+
this.hdr.mode = exports.HdrMode.standard;
|
|
1852
|
+
this.hdr.peakNits = 400;
|
|
1853
|
+
}
|
|
1854
|
+
else {
|
|
1855
|
+
this.hdr.load(hdrData);
|
|
1856
|
+
}
|
|
1812
1857
|
loadProperty(this, "pauseOnBlur", data.pauseOnBlur);
|
|
1813
1858
|
loadProperty(this, "pauseOnOutsideViewport", data.pauseOnOutsideViewport);
|
|
1814
1859
|
loadProperty(this, "zLayers", data.zLayers);
|
|
@@ -1851,7 +1896,7 @@
|
|
|
1851
1896
|
}
|
|
1852
1897
|
}
|
|
1853
1898
|
|
|
1854
|
-
const styleCache = new Map(), maxStyleCacheSize = 2000, rgbFixedPrecision = 2, hslFixedPrecision = 2, hdrRgbFixedPrecision = 4, hdrHslFixedPrecision = 4, sdrReferenceWhiteNits = 203,
|
|
1899
|
+
const styleCache = new Map(), maxStyleCacheSize = 2000, rgbFixedPrecision = 2, hslFixedPrecision = 2, hdrRgbFixedPrecision = 4, hdrHslFixedPrecision = 4, sdrReferenceWhiteNits = 203, acesA = 2.51, acesB = 0.03, acesC = 2.43, acesD = 0.59, acesE = 0.14, saturationBoost = 1.15, lightnessBoost = 1.05, temperatureR = 1.05, temperatureB = 0.95, contrastFactor = 1.1, luminanceR = 0.2126, luminanceG = 0.7152, luminanceB = 0.0722, dynamicLuminanceFactor = 2, channelCount = 3, srgbThreshold = 0.04045, srgbDivisor = 12.92, srgbOffset = 0.055, srgbScale = 1.055, srgbExponent = 2.4, linearThreshold = 0.0031308, linearScale = 12.92;
|
|
1855
1900
|
function getCachedStyle(key, generator) {
|
|
1856
1901
|
let cached = styleCache.get(key);
|
|
1857
1902
|
if (!cached) {
|
|
@@ -1863,6 +1908,48 @@
|
|
|
1863
1908
|
}
|
|
1864
1909
|
return cached;
|
|
1865
1910
|
}
|
|
1911
|
+
function acesFilmic(x) {
|
|
1912
|
+
return clamp((x * (acesA * x + acesB)) / (x * (acesC * x + acesD) + acesE), none, one);
|
|
1913
|
+
}
|
|
1914
|
+
function srgbToLinear(c) {
|
|
1915
|
+
return c <= srgbThreshold ? c / srgbDivisor : Math.pow((c + srgbOffset) / srgbScale, srgbExponent);
|
|
1916
|
+
}
|
|
1917
|
+
function linearToSrgb(c) {
|
|
1918
|
+
return c <= linearThreshold ? c * linearScale : srgbScale * Math.pow(c, one / srgbExponent) - srgbOffset;
|
|
1919
|
+
}
|
|
1920
|
+
function applyHdrModeAdjustments(r, g, b, mode, maxChannel) {
|
|
1921
|
+
switch (mode) {
|
|
1922
|
+
case exports.HdrMode.vivid: {
|
|
1923
|
+
const avg = (r + g + b) / channelCount;
|
|
1924
|
+
return {
|
|
1925
|
+
b: clamp(clamp(avg + (b - avg) * saturationBoost, none, maxChannel) * lightnessBoost, none, maxChannel),
|
|
1926
|
+
g: clamp(clamp(avg + (g - avg) * saturationBoost, none, maxChannel) * lightnessBoost, none, maxChannel),
|
|
1927
|
+
r: clamp(clamp(avg + (r - avg) * saturationBoost, none, maxChannel) * lightnessBoost, none, maxChannel),
|
|
1928
|
+
};
|
|
1929
|
+
}
|
|
1930
|
+
case exports.HdrMode.cinematic: {
|
|
1931
|
+
const tempR = r * temperatureR, tempB = b * temperatureB, avg = (tempR + g + tempB) / channelCount;
|
|
1932
|
+
return {
|
|
1933
|
+
b: clamp(avg + (tempB - avg) * contrastFactor, none, maxChannel),
|
|
1934
|
+
g: clamp(avg + (g - avg) * contrastFactor, none, maxChannel),
|
|
1935
|
+
r: clamp(avg + (tempR - avg) * contrastFactor, none, maxChannel),
|
|
1936
|
+
};
|
|
1937
|
+
}
|
|
1938
|
+
case exports.HdrMode.dynamic: {
|
|
1939
|
+
const luminance = luminanceR * r + luminanceG * g + luminanceB * b, vividWeight = Math.min(one, luminance * dynamicLuminanceFactor), naturalWeight = one - vividWeight, avg = (r + g + b) / channelCount, vividR = clamp(avg + (r - avg) * saturationBoost, none, maxChannel) * lightnessBoost, vividG = clamp(avg + (g - avg) * saturationBoost, none, maxChannel) * lightnessBoost, vividB = clamp(avg + (b - avg) * saturationBoost, none, maxChannel) * lightnessBoost;
|
|
1940
|
+
return {
|
|
1941
|
+
b: clamp(b * naturalWeight + vividB * vividWeight, none, maxChannel),
|
|
1942
|
+
g: clamp(g * naturalWeight + vividG * vividWeight, none, maxChannel),
|
|
1943
|
+
r: clamp(r * naturalWeight + vividR * vividWeight, none, maxChannel),
|
|
1944
|
+
};
|
|
1945
|
+
}
|
|
1946
|
+
case exports.HdrMode.standard:
|
|
1947
|
+
return { b, g, r };
|
|
1948
|
+
case exports.HdrMode.natural:
|
|
1949
|
+
default:
|
|
1950
|
+
return { b, g, r };
|
|
1951
|
+
}
|
|
1952
|
+
}
|
|
1866
1953
|
function stringToRgba(pluginManager, input) {
|
|
1867
1954
|
if (!input) {
|
|
1868
1955
|
return;
|
|
@@ -2030,30 +2117,65 @@
|
|
|
2030
2117
|
r: getRgbInRangeValue(),
|
|
2031
2118
|
};
|
|
2032
2119
|
}
|
|
2033
|
-
function getStyleFromRgb(color, hdr, opacity) {
|
|
2034
|
-
const rgbPrecision = hdr ? hdrRgbFixedPrecision : rgbFixedPrecision, op = opacity ?? defaultOpacity$3, key =
|
|
2035
|
-
|
|
2120
|
+
function getStyleFromRgb(color, hdr, opacity, peakNits, mode) {
|
|
2121
|
+
const rgbPrecision = hdr ? hdrRgbFixedPrecision : rgbFixedPrecision, op = opacity ?? defaultOpacity$3, key = hdr
|
|
2122
|
+
? `rgb-${color.r.toFixed(rgbPrecision)}-${color.g.toFixed(rgbPrecision)}-${color.b.toFixed(rgbPrecision)}-hdr-${op.toString()}-${(peakNits ?? maxNits).toString()}-${mode ?? exports.HdrMode.standard}`
|
|
2123
|
+
: `rgb-${color.r.toFixed(rgbPrecision)}-${color.g.toFixed(rgbPrecision)}-${color.b.toFixed(rgbPrecision)}-sdr-${op.toString()}`;
|
|
2124
|
+
return getCachedStyle(key, () => hdr ? getHdrStyleFromRgb(color, opacity, peakNits, mode) : getSdrStyleFromRgb(color, opacity));
|
|
2125
|
+
}
|
|
2126
|
+
function getHdrStyleFromRgb(color, opacity, peakNits = maxNits, mode = exports.HdrMode.standard) {
|
|
2127
|
+
const headroom = peakNits / sdrReferenceWhiteNits, middleGray = 0.18, mapped = hdrToneMapColor(color, headroom, middleGray, mode);
|
|
2128
|
+
return `color(display-p3 ${mapped.r.toString()} ${mapped.g.toString()} ${mapped.b.toString()} / ${(opacity ?? defaultOpacity$3).toString()})`;
|
|
2129
|
+
}
|
|
2130
|
+
function hdrToneMapColor(color, headroom, middleGray, mode) {
|
|
2131
|
+
const rNorm = color.r / rgbMax, gNorm = color.g / rgbMax, bNorm = color.b / rgbMax;
|
|
2132
|
+
if (mode !== exports.HdrMode.natural && mode !== exports.HdrMode.vivid && mode !== exports.HdrMode.cinematic && mode !== exports.HdrMode.dynamic) {
|
|
2133
|
+
return { b: bNorm, g: gNorm, r: rNorm };
|
|
2134
|
+
}
|
|
2135
|
+
const maxChannel = Math.max(one, headroom), luminance = luminanceR * rNorm + luminanceG * gNorm + luminanceB * bNorm, mappedLuminance = hdrToneMap(luminance, headroom, middleGray), scale = luminance > none ? mappedLuminance / luminance : one;
|
|
2136
|
+
return applyHdrModeAdjustments(clamp(rNorm * scale, none, maxChannel), clamp(gNorm * scale, none, maxChannel), clamp(bNorm * scale, none, maxChannel), mode, maxChannel);
|
|
2036
2137
|
}
|
|
2037
|
-
function
|
|
2038
|
-
|
|
2039
|
-
|
|
2138
|
+
function hdrToneMap(normalized, headroom, middleGray) {
|
|
2139
|
+
if (normalized <= middleGray) {
|
|
2140
|
+
return acesFilmic(normalized);
|
|
2141
|
+
}
|
|
2142
|
+
const expanded = normalized + (normalized - middleGray) * (headroom - one);
|
|
2143
|
+
return acesFilmic(expanded);
|
|
2040
2144
|
}
|
|
2041
2145
|
function getSdrStyleFromRgb(color, opacity) {
|
|
2042
2146
|
return `rgba(${color.r.toString()}, ${color.g.toString()}, ${color.b.toString()}, ${(opacity ?? defaultOpacity$3).toString()})`;
|
|
2043
2147
|
}
|
|
2044
|
-
function getStyleFromHsl(color, hdr, opacity) {
|
|
2045
|
-
const hslPrecision = hdr ? hdrHslFixedPrecision : hslFixedPrecision, op = opacity ?? defaultOpacity$3, key =
|
|
2148
|
+
function getStyleFromHsl(color, hdr, opacity, peakNits, mode) {
|
|
2149
|
+
const hslPrecision = hdr ? hdrHslFixedPrecision : hslFixedPrecision, op = opacity ?? defaultOpacity$3, key = hdr
|
|
2150
|
+
? `hsl-${color.h.toFixed(hslPrecision)}-${color.s.toFixed(hslPrecision)}-${color.l.toFixed(hslPrecision)}-hdr-${op.toString()}-${(peakNits ?? maxNits).toString()}-${mode ?? exports.HdrMode.standard}`
|
|
2151
|
+
: `hsl-${color.h.toFixed(hslPrecision)}-${color.s.toFixed(hslPrecision)}-${color.l.toFixed(hslPrecision)}-sdr-${op.toString()}`;
|
|
2046
2152
|
return getCachedStyle(key, () => hdr
|
|
2047
|
-
? getStyleFromRgb(hslToRgbFloat(color), true, opacity)
|
|
2153
|
+
? getStyleFromRgb(hslToRgbFloat(color), true, opacity, peakNits, mode)
|
|
2048
2154
|
: `hsla(${color.h.toString()}, ${color.s.toString()}%, ${color.l.toString()}%, ${op.toString()})`);
|
|
2049
2155
|
}
|
|
2050
|
-
function colorMix(color1, color2, size1, size2) {
|
|
2156
|
+
function colorMix(color1, color2, size1, size2, hdr) {
|
|
2051
2157
|
let rgb1 = color1, rgb2 = color2;
|
|
2052
2158
|
if (!("r" in rgb1)) {
|
|
2053
|
-
rgb1 = hslToRgb(color1);
|
|
2159
|
+
rgb1 = hdr ? hslToRgbFloat(color1) : hslToRgb(color1);
|
|
2054
2160
|
}
|
|
2055
2161
|
if (!("r" in rgb2)) {
|
|
2056
|
-
rgb2 = hslToRgb(color2);
|
|
2162
|
+
rgb2 = hdr ? hslToRgbFloat(color2) : hslToRgb(color2);
|
|
2163
|
+
}
|
|
2164
|
+
if (hdr) {
|
|
2165
|
+
const lin1 = {
|
|
2166
|
+
b: srgbToLinear(rgb1.b / rgbMax),
|
|
2167
|
+
g: srgbToLinear(rgb1.g / rgbMax),
|
|
2168
|
+
r: srgbToLinear(rgb1.r / rgbMax),
|
|
2169
|
+
}, lin2 = {
|
|
2170
|
+
b: srgbToLinear(rgb2.b / rgbMax),
|
|
2171
|
+
g: srgbToLinear(rgb2.g / rgbMax),
|
|
2172
|
+
r: srgbToLinear(rgb2.r / rgbMax),
|
|
2173
|
+
}, totalWeight = size1 + size2;
|
|
2174
|
+
return {
|
|
2175
|
+
b: linearToSrgb((lin1.b * size1 + lin2.b * size2) / totalWeight) * rgbMax,
|
|
2176
|
+
g: linearToSrgb((lin1.g * size1 + lin2.g * size2) / totalWeight) * rgbMax,
|
|
2177
|
+
r: linearToSrgb((lin1.r * size1 + lin2.r * size2) / totalWeight) * rgbMax,
|
|
2178
|
+
};
|
|
2057
2179
|
}
|
|
2058
2180
|
return {
|
|
2059
2181
|
b: mix(rgb1.b, rgb2.b, size1, size2),
|
|
@@ -2061,14 +2183,14 @@
|
|
|
2061
2183
|
r: mix(rgb1.r, rgb2.r, size1, size2),
|
|
2062
2184
|
};
|
|
2063
2185
|
}
|
|
2064
|
-
function getLinkColor(p1, p2, linkColor) {
|
|
2186
|
+
function getLinkColor(p1, p2, linkColor, hdr) {
|
|
2065
2187
|
if (linkColor === randomColorValue) {
|
|
2066
2188
|
return getRandomRgbColor();
|
|
2067
2189
|
}
|
|
2068
2190
|
else if (linkColor === midColorValue) {
|
|
2069
2191
|
const sourceColor = p1.getFillColor() ?? p1.getStrokeColor(), destColor = p2?.getFillColor() ?? p2?.getStrokeColor();
|
|
2070
2192
|
if (sourceColor && destColor && p2) {
|
|
2071
|
-
return colorMix(sourceColor, destColor, p1.getRadius(), p2.getRadius());
|
|
2193
|
+
return colorMix(sourceColor, destColor, p1.getRadius(), p2.getRadius(), hdr);
|
|
2072
2194
|
}
|
|
2073
2195
|
else {
|
|
2074
2196
|
const hslColor = sourceColor ?? destColor;
|
|
@@ -2164,7 +2286,7 @@
|
|
|
2164
2286
|
colorValue.velocity = defaultVelocity;
|
|
2165
2287
|
}
|
|
2166
2288
|
}
|
|
2167
|
-
function updateColorValue(data, decrease, delta,
|
|
2289
|
+
function updateColorValue(data, decrease, delta, _hdr) {
|
|
2168
2290
|
const minLoops = 0, minDelay = 0, identity = 1, minVelocity = 0, minOffset = 0, velocityFactor = 3.6;
|
|
2169
2291
|
if (!data.enable ||
|
|
2170
2292
|
((data.maxLoops ?? minLoops) > minLoops && (data.loops ?? minLoops) > (data.maxLoops ?? minLoops))) {
|
|
@@ -2177,7 +2299,7 @@
|
|
|
2177
2299
|
if ((data.delayTime ?? minDelay) > minDelay && data.time < (data.delayTime ?? minDelay)) {
|
|
2178
2300
|
return;
|
|
2179
2301
|
}
|
|
2180
|
-
const offset = data.offset ? randomInRangeValue(data.offset) : minOffset, velocity = (
|
|
2302
|
+
const offset = data.offset ? randomInRangeValue(data.offset) : minOffset, velocity = (data.velocity ?? minVelocity) * delta.factor + offset * velocityFactor, decay = data.decay ?? identity, max = data.max, min = data.min;
|
|
2181
2303
|
if (!decrease || data.status === exports.AnimationStatus.increasing) {
|
|
2182
2304
|
data.value += velocity;
|
|
2183
2305
|
if (data.value > max) {
|
|
@@ -2209,9 +2331,9 @@
|
|
|
2209
2331
|
return;
|
|
2210
2332
|
}
|
|
2211
2333
|
const { h, s, l } = color;
|
|
2212
|
-
updateColorValue(h, false, delta
|
|
2213
|
-
updateColorValue(s, true, delta
|
|
2214
|
-
updateColorValue(l, true, delta
|
|
2334
|
+
updateColorValue(h, false, delta);
|
|
2335
|
+
updateColorValue(s, true, delta);
|
|
2336
|
+
updateColorValue(l, true, delta);
|
|
2215
2337
|
}
|
|
2216
2338
|
function alterHsl(color, type, value) {
|
|
2217
2339
|
return {
|
|
@@ -2454,7 +2576,7 @@
|
|
|
2454
2576
|
}
|
|
2455
2577
|
|
|
2456
2578
|
async function loadInteractivityPlugin(engine) {
|
|
2457
|
-
engine.checkVersion("4.
|
|
2579
|
+
engine.checkVersion("4.4.0");
|
|
2458
2580
|
await engine.pluginManager.register(e => {
|
|
2459
2581
|
const interactivityEngine = e, interactivityPluginManager = interactivityEngine.pluginManager;
|
|
2460
2582
|
interactivityPluginManager.addPlugin(new InteractivityPlugin(interactivityPluginManager));
|
|
@@ -2694,7 +2816,7 @@
|
|
|
2694
2816
|
}
|
|
2695
2817
|
|
|
2696
2818
|
async function loadAbsorbersInteraction(engine) {
|
|
2697
|
-
engine.checkVersion("4.
|
|
2819
|
+
engine.checkVersion("4.4.0");
|
|
2698
2820
|
await engine.pluginManager.register(async (e) => {
|
|
2699
2821
|
const pluginManager = e.pluginManager, instancesManager = await getAbsorbersInstancesManager(e);
|
|
2700
2822
|
ensureInteractivityPluginLoaded(e);
|
|
@@ -2742,7 +2864,7 @@
|
|
|
2742
2864
|
}
|
|
2743
2865
|
|
|
2744
2866
|
async function loadAbsorbersPluginSimple(engine) {
|
|
2745
|
-
engine.checkVersion("4.
|
|
2867
|
+
engine.checkVersion("4.4.0");
|
|
2746
2868
|
await engine.pluginManager.register(async (e) => {
|
|
2747
2869
|
const pluginManager = e.pluginManager, instancesManager = await getAbsorbersInstancesManager(e);
|
|
2748
2870
|
pluginManager.addPlugin(new AbsorbersPlugin(instancesManager));
|
|
@@ -3068,7 +3190,7 @@
|
|
|
3068
3190
|
}
|
|
3069
3191
|
|
|
3070
3192
|
async function loadDestroyUpdater(engine) {
|
|
3071
|
-
engine.checkVersion("4.
|
|
3193
|
+
engine.checkVersion("4.4.0");
|
|
3072
3194
|
await engine.pluginManager.register(e => {
|
|
3073
3195
|
e.pluginManager.addParticleUpdater("destroy", container => {
|
|
3074
3196
|
return Promise.resolve(new DestroyUpdater(e.pluginManager, container));
|
|
@@ -3386,7 +3508,7 @@
|
|
|
3386
3508
|
})(EmitterClickMode || (EmitterClickMode = {}));
|
|
3387
3509
|
|
|
3388
3510
|
async function loadEmittersInteraction(engine) {
|
|
3389
|
-
engine.checkVersion("4.
|
|
3511
|
+
engine.checkVersion("4.4.0");
|
|
3390
3512
|
await engine.pluginManager.register(async (e) => {
|
|
3391
3513
|
const instancesManager = await getEmittersInstancesManager(e);
|
|
3392
3514
|
ensureInteractivityPluginLoaded(e);
|
|
@@ -3429,7 +3551,7 @@
|
|
|
3429
3551
|
}
|
|
3430
3552
|
|
|
3431
3553
|
async function loadEmittersPluginSimple(engine) {
|
|
3432
|
-
engine.checkVersion("4.
|
|
3554
|
+
engine.checkVersion("4.4.0");
|
|
3433
3555
|
await engine.pluginManager.register(async (e) => {
|
|
3434
3556
|
const instancesManager = await getEmittersInstancesManager(e);
|
|
3435
3557
|
await addEmittersShapesManager(e);
|
|
@@ -3486,7 +3608,7 @@
|
|
|
3486
3608
|
}
|
|
3487
3609
|
|
|
3488
3610
|
async function loadEmittersShapeCircle(engine) {
|
|
3489
|
-
engine.checkVersion("4.
|
|
3611
|
+
engine.checkVersion("4.4.0");
|
|
3490
3612
|
await engine.pluginManager.register((e) => {
|
|
3491
3613
|
ensureEmittersPluginLoaded(e);
|
|
3492
3614
|
e.pluginManager.addEmitterShapeGenerator?.("circle", new EmittersCircleShapeGenerator());
|
|
@@ -3567,7 +3689,7 @@
|
|
|
3567
3689
|
}
|
|
3568
3690
|
|
|
3569
3691
|
async function loadEmittersShapeSquare(engine) {
|
|
3570
|
-
engine.checkVersion("4.
|
|
3692
|
+
engine.checkVersion("4.4.0");
|
|
3571
3693
|
await engine.pluginManager.register((e) => {
|
|
3572
3694
|
ensureEmittersPluginLoaded(e);
|
|
3573
3695
|
e.pluginManager.addEmitterShapeGenerator?.("square", new EmittersSquareShapeGenerator());
|
|
@@ -3749,7 +3871,7 @@
|
|
|
3749
3871
|
}
|
|
3750
3872
|
|
|
3751
3873
|
async function loadExternalDragInteraction(engine) {
|
|
3752
|
-
engine.checkVersion("4.
|
|
3874
|
+
engine.checkVersion("4.4.0");
|
|
3753
3875
|
await engine.pluginManager.register((e) => {
|
|
3754
3876
|
ensureInteractivityPluginLoaded(e);
|
|
3755
3877
|
e.pluginManager.addInteractor?.("externalDrag", container => {
|
|
@@ -3922,7 +4044,7 @@
|
|
|
3922
4044
|
}
|
|
3923
4045
|
|
|
3924
4046
|
async function loadExternalTrailInteraction(engine) {
|
|
3925
|
-
engine.checkVersion("4.
|
|
4047
|
+
engine.checkVersion("4.4.0");
|
|
3926
4048
|
await engine.pluginManager.register((e) => {
|
|
3927
4049
|
ensureInteractivityPluginLoaded(e);
|
|
3928
4050
|
e.pluginManager.addInteractor?.("externalTrail", container => {
|
|
@@ -4058,7 +4180,7 @@
|
|
|
4058
4180
|
}
|
|
4059
4181
|
|
|
4060
4182
|
async function loadRollUpdater(engine) {
|
|
4061
|
-
engine.checkVersion("4.
|
|
4183
|
+
engine.checkVersion("4.4.0");
|
|
4062
4184
|
await engine.pluginManager.register(e => {
|
|
4063
4185
|
e.pluginManager.addParticleUpdater("roll", () => {
|
|
4064
4186
|
return Promise.resolve(new RollUpdater(e.pluginManager));
|
|
@@ -4104,7 +4226,7 @@
|
|
|
4104
4226
|
}
|
|
4105
4227
|
|
|
4106
4228
|
async function loadBlendPlugin(engine) {
|
|
4107
|
-
engine.checkVersion("4.
|
|
4229
|
+
engine.checkVersion("4.4.0");
|
|
4108
4230
|
await engine.pluginManager.register(e => {
|
|
4109
4231
|
e.pluginManager.addPlugin(new BlendPlugin());
|
|
4110
4232
|
});
|
|
@@ -4141,7 +4263,7 @@
|
|
|
4141
4263
|
}
|
|
4142
4264
|
|
|
4143
4265
|
async function loadCircleShape(engine) {
|
|
4144
|
-
engine.checkVersion("4.
|
|
4266
|
+
engine.checkVersion("4.4.0");
|
|
4145
4267
|
await engine.pluginManager.register(e => {
|
|
4146
4268
|
e.pluginManager.addShape(["circle"], () => {
|
|
4147
4269
|
return Promise.resolve(new CircleDrawer());
|
|
@@ -4189,7 +4311,7 @@
|
|
|
4189
4311
|
}
|
|
4190
4312
|
|
|
4191
4313
|
async function loadHexColorPlugin(engine) {
|
|
4192
|
-
engine.checkVersion("4.
|
|
4314
|
+
engine.checkVersion("4.4.0");
|
|
4193
4315
|
await engine.pluginManager.register(e => {
|
|
4194
4316
|
e.pluginManager.addColorManager("hex", new HexColorManager());
|
|
4195
4317
|
});
|
|
@@ -4242,7 +4364,7 @@
|
|
|
4242
4364
|
}
|
|
4243
4365
|
|
|
4244
4366
|
async function loadHslColorPlugin(engine) {
|
|
4245
|
-
engine.checkVersion("4.
|
|
4367
|
+
engine.checkVersion("4.4.0");
|
|
4246
4368
|
await engine.pluginManager.register(e => {
|
|
4247
4369
|
e.pluginManager.addColorManager("hsl", new HslColorManager());
|
|
4248
4370
|
});
|
|
@@ -4266,7 +4388,7 @@
|
|
|
4266
4388
|
}
|
|
4267
4389
|
|
|
4268
4390
|
async function loadMovePlugin(engine) {
|
|
4269
|
-
engine.checkVersion("4.
|
|
4391
|
+
engine.checkVersion("4.4.0");
|
|
4270
4392
|
await engine.pluginManager.register(e => {
|
|
4271
4393
|
const moveEngine = e, movePluginManager = moveEngine.pluginManager;
|
|
4272
4394
|
movePluginManager.initializers.pathGenerators ??= new Map();
|
|
@@ -4482,7 +4604,7 @@
|
|
|
4482
4604
|
}
|
|
4483
4605
|
|
|
4484
4606
|
async function loadOpacityUpdater(engine) {
|
|
4485
|
-
engine.checkVersion("4.
|
|
4607
|
+
engine.checkVersion("4.4.0");
|
|
4486
4608
|
await engine.pluginManager.register(e => {
|
|
4487
4609
|
e.pluginManager.addParticleUpdater("opacity", container => {
|
|
4488
4610
|
return Promise.resolve(new OpacityUpdater(container));
|
|
@@ -4827,7 +4949,7 @@
|
|
|
4827
4949
|
}
|
|
4828
4950
|
|
|
4829
4951
|
async function loadOutModesUpdater(engine) {
|
|
4830
|
-
engine.checkVersion("4.
|
|
4952
|
+
engine.checkVersion("4.4.0");
|
|
4831
4953
|
await engine.pluginManager.register(e => {
|
|
4832
4954
|
e.pluginManager.addParticleUpdater("outModes", container => {
|
|
4833
4955
|
return Promise.resolve(new OutOfCanvasUpdater(container));
|
|
@@ -4898,7 +5020,7 @@
|
|
|
4898
5020
|
}
|
|
4899
5021
|
|
|
4900
5022
|
async function loadPaintUpdater(engine) {
|
|
4901
|
-
engine.checkVersion("4.
|
|
5023
|
+
engine.checkVersion("4.4.0");
|
|
4902
5024
|
await engine.pluginManager.register(e => {
|
|
4903
5025
|
e.pluginManager.addParticleUpdater("paint", container => {
|
|
4904
5026
|
return Promise.resolve(new PaintUpdater(e.pluginManager, container));
|
|
@@ -4953,7 +5075,7 @@
|
|
|
4953
5075
|
}
|
|
4954
5076
|
|
|
4955
5077
|
async function loadRgbColorPlugin(engine) {
|
|
4956
|
-
engine.checkVersion("4.
|
|
5078
|
+
engine.checkVersion("4.4.0");
|
|
4957
5079
|
await engine.pluginManager.register(e => {
|
|
4958
5080
|
e.pluginManager.addColorManager("rgb", new RgbColorManager());
|
|
4959
5081
|
});
|
|
@@ -5038,7 +5160,7 @@
|
|
|
5038
5160
|
}
|
|
5039
5161
|
|
|
5040
5162
|
async function loadSizeUpdater(engine) {
|
|
5041
|
-
engine.checkVersion("4.
|
|
5163
|
+
engine.checkVersion("4.4.0");
|
|
5042
5164
|
await engine.pluginManager.register(e => {
|
|
5043
5165
|
e.pluginManager.addParticleUpdater("size", container => {
|
|
5044
5166
|
return Promise.resolve(new SizeUpdater(container));
|
|
@@ -5047,7 +5169,7 @@
|
|
|
5047
5169
|
}
|
|
5048
5170
|
|
|
5049
5171
|
async function loadBasic(engine) {
|
|
5050
|
-
engine.checkVersion("4.
|
|
5172
|
+
engine.checkVersion("4.4.0");
|
|
5051
5173
|
await engine.pluginManager.register(async (e) => {
|
|
5052
5174
|
await Promise.all([
|
|
5053
5175
|
loadBlendPlugin(e),
|
|
@@ -5070,7 +5192,7 @@
|
|
|
5070
5192
|
easingsFunctions.set("ease-in-out-quad", value => (value < 0.5 ? 2 * value ** 2 : 1 - (-2 * value + 2) ** 2 / 2));
|
|
5071
5193
|
|
|
5072
5194
|
async function loadEasingQuadPlugin(engine) {
|
|
5073
|
-
engine.checkVersion("4.
|
|
5195
|
+
engine.checkVersion("4.4.0");
|
|
5074
5196
|
await engine.pluginManager.register(e => {
|
|
5075
5197
|
for (const [easing, easingFn] of easingsFunctions) {
|
|
5076
5198
|
e.pluginManager.addEasing(easing, easingFn);
|
|
@@ -5178,7 +5300,7 @@
|
|
|
5178
5300
|
}
|
|
5179
5301
|
|
|
5180
5302
|
async function loadEmojiShape(engine) {
|
|
5181
|
-
engine.checkVersion("4.
|
|
5303
|
+
engine.checkVersion("4.4.0");
|
|
5182
5304
|
await engine.pluginManager.register(e => {
|
|
5183
5305
|
e.pluginManager.addShape(validTypes$1, () => Promise.resolve(new EmojiDrawer()));
|
|
5184
5306
|
});
|
|
@@ -5411,7 +5533,7 @@
|
|
|
5411
5533
|
};
|
|
5412
5534
|
|
|
5413
5535
|
async function loadExternalAttractInteraction(engine) {
|
|
5414
|
-
engine.checkVersion("4.
|
|
5536
|
+
engine.checkVersion("4.4.0");
|
|
5415
5537
|
await engine.pluginManager.register((e) => {
|
|
5416
5538
|
ensureInteractivityPluginLoaded(e);
|
|
5417
5539
|
e.pluginManager.addInteractor?.("externalAttract", container => {
|
|
@@ -5600,7 +5722,7 @@
|
|
|
5600
5722
|
}
|
|
5601
5723
|
|
|
5602
5724
|
async function loadExternalBounceInteraction(engine) {
|
|
5603
|
-
engine.checkVersion("4.
|
|
5725
|
+
engine.checkVersion("4.4.0");
|
|
5604
5726
|
await engine.pluginManager.register((e) => {
|
|
5605
5727
|
ensureInteractivityPluginLoaded(e);
|
|
5606
5728
|
e.pluginManager.addInteractor?.("externalBounce", container => {
|
|
@@ -5887,7 +6009,7 @@
|
|
|
5887
6009
|
mod.strokeColor = undefined;
|
|
5888
6010
|
const pColor = particle.getFillColor();
|
|
5889
6011
|
if (pColor) {
|
|
5890
|
-
const mixedColor = rgbToHsl(colorMix(pColor, mod.finalColor, ratioOffset - ratio, ratio));
|
|
6012
|
+
const mixedColor = rgbToHsl(colorMix(pColor, mod.finalColor, ratioOffset - ratio, ratio, this.container.hdr));
|
|
5891
6013
|
mod.fillColor = mixedColor;
|
|
5892
6014
|
mod.strokeColor = mixedColor;
|
|
5893
6015
|
}
|
|
@@ -6000,7 +6122,7 @@
|
|
|
6000
6122
|
}
|
|
6001
6123
|
|
|
6002
6124
|
async function loadExternalBubbleInteraction(engine) {
|
|
6003
|
-
engine.checkVersion("4.
|
|
6125
|
+
engine.checkVersion("4.4.0");
|
|
6004
6126
|
await engine.pluginManager.register((e) => {
|
|
6005
6127
|
ensureInteractivityPluginLoaded(e);
|
|
6006
6128
|
e.pluginManager.addInteractor?.("externalBubble", container => {
|
|
@@ -6039,10 +6161,10 @@
|
|
|
6039
6161
|
if (!color1 || !color2) {
|
|
6040
6162
|
return;
|
|
6041
6163
|
}
|
|
6042
|
-
const sourcePos = p1.getPosition(), destPos = p2.getPosition(), midRgb = colorMix(color1, color2, p1.getRadius(), p2.getRadius()), grad = context.createLinearGradient(sourcePos.x, sourcePos.y, destPos.x, destPos.y);
|
|
6043
|
-
grad.addColorStop(gradientMin, getStyleFromHsl(color1, container.hdr, opacity));
|
|
6044
|
-
grad.addColorStop(clamp(gradStop, gradientMin, gradientMax), getStyleFromRgb(midRgb, container.hdr, opacity));
|
|
6045
|
-
grad.addColorStop(gradientMax, getStyleFromHsl(color2, container.hdr, opacity));
|
|
6164
|
+
const sourcePos = p1.getPosition(), destPos = p2.getPosition(), midRgb = colorMix(color1, color2, p1.getRadius(), p2.getRadius(), container.hdr), grad = context.createLinearGradient(sourcePos.x, sourcePos.y, destPos.x, destPos.y);
|
|
6165
|
+
grad.addColorStop(gradientMin, getStyleFromHsl(color1, container.hdr, opacity, container.peakNits, container.hdrMode));
|
|
6166
|
+
grad.addColorStop(clamp(gradStop, gradientMin, gradientMax), getStyleFromRgb(midRgb, container.hdr, opacity, container.peakNits, container.hdrMode));
|
|
6167
|
+
grad.addColorStop(gradientMax, getStyleFromHsl(color2, container.hdr, opacity, container.peakNits, container.hdrMode));
|
|
6046
6168
|
return grad;
|
|
6047
6169
|
}
|
|
6048
6170
|
function drawConnectLine(context, width, lineStyle, begin, end) {
|
|
@@ -6128,7 +6250,7 @@
|
|
|
6128
6250
|
}
|
|
6129
6251
|
|
|
6130
6252
|
async function loadExternalConnectInteraction(engine) {
|
|
6131
|
-
engine.checkVersion("4.
|
|
6253
|
+
engine.checkVersion("4.4.0");
|
|
6132
6254
|
await engine.pluginManager.register((e) => {
|
|
6133
6255
|
ensureInteractivityPluginLoaded(e);
|
|
6134
6256
|
e.pluginManager.addInteractor?.("externalConnect", container => {
|
|
@@ -6232,7 +6354,7 @@
|
|
|
6232
6354
|
}
|
|
6233
6355
|
|
|
6234
6356
|
async function loadExternalDestroyInteraction(engine) {
|
|
6235
|
-
engine.checkVersion("4.
|
|
6357
|
+
engine.checkVersion("4.4.0");
|
|
6236
6358
|
await engine.pluginManager.register((e) => {
|
|
6237
6359
|
ensureInteractivityPluginLoaded(e);
|
|
6238
6360
|
e.pluginManager.addInteractor?.("externalDestroy", async (container) => {
|
|
@@ -6272,16 +6394,16 @@
|
|
|
6272
6394
|
}
|
|
6273
6395
|
|
|
6274
6396
|
const defaultWidth = 0;
|
|
6275
|
-
function drawGrabLine(context, width, begin, end, colorLine, opacity, hdr = false) {
|
|
6397
|
+
function drawGrabLine(context, width, begin, end, colorLine, opacity, hdr = false, peakNits, mode) {
|
|
6276
6398
|
drawLine$1(context, begin, end);
|
|
6277
|
-
context.strokeStyle = getStyleFromRgb(colorLine, hdr, opacity);
|
|
6399
|
+
context.strokeStyle = getStyleFromRgb(colorLine, hdr, opacity, peakNits, mode);
|
|
6278
6400
|
context.lineWidth = width;
|
|
6279
6401
|
context.stroke();
|
|
6280
6402
|
}
|
|
6281
6403
|
function drawGrab(container, particle, lineColor, opacity, mousePos) {
|
|
6282
6404
|
container.canvas.render.draw(ctx => {
|
|
6283
6405
|
const beginPos = particle.getPosition();
|
|
6284
|
-
drawGrabLine(ctx, particle.retina.linksWidth ?? defaultWidth, beginPos, mousePos, lineColor, opacity, container.hdr);
|
|
6406
|
+
drawGrabLine(ctx, particle.retina.linksWidth ?? defaultWidth, beginPos, mousePos, lineColor, opacity, container.hdr, container.peakNits, container.hdrMode);
|
|
6285
6407
|
});
|
|
6286
6408
|
}
|
|
6287
6409
|
|
|
@@ -6337,7 +6459,7 @@
|
|
|
6337
6459
|
const linksOptions = interactivity.modes.grab.links;
|
|
6338
6460
|
container.particles.grabLineColor = getLinkRandomColor(this.#pluginManager, optColor, linksOptions.blink, linksOptions.consent);
|
|
6339
6461
|
}
|
|
6340
|
-
const colorLine = getLinkColor(particle, undefined, container.particles.grabLineColor);
|
|
6462
|
+
const colorLine = getLinkColor(particle, undefined, container.particles.grabLineColor, container.hdr);
|
|
6341
6463
|
if (!colorLine) {
|
|
6342
6464
|
continue;
|
|
6343
6465
|
}
|
|
@@ -6356,7 +6478,7 @@
|
|
|
6356
6478
|
}
|
|
6357
6479
|
|
|
6358
6480
|
async function loadExternalGrabInteraction(engine) {
|
|
6359
|
-
engine.checkVersion("4.
|
|
6481
|
+
engine.checkVersion("4.4.0");
|
|
6360
6482
|
await engine.pluginManager.register((e) => {
|
|
6361
6483
|
ensureInteractivityPluginLoaded(e);
|
|
6362
6484
|
e.pluginManager.addInteractor?.("externalGrab", container => {
|
|
@@ -6426,7 +6548,7 @@
|
|
|
6426
6548
|
}
|
|
6427
6549
|
|
|
6428
6550
|
async function loadExternalParallaxInteraction(engine) {
|
|
6429
|
-
engine.checkVersion("4.
|
|
6551
|
+
engine.checkVersion("4.4.0");
|
|
6430
6552
|
await engine.pluginManager.register((e) => {
|
|
6431
6553
|
ensureInteractivityPluginLoaded(e);
|
|
6432
6554
|
e.pluginManager.addInteractor?.("externalParallax", container => {
|
|
@@ -6469,7 +6591,7 @@
|
|
|
6469
6591
|
}
|
|
6470
6592
|
|
|
6471
6593
|
async function loadExternalPauseInteraction(engine) {
|
|
6472
|
-
engine.checkVersion("4.
|
|
6594
|
+
engine.checkVersion("4.4.0");
|
|
6473
6595
|
await engine.pluginManager.register((e) => {
|
|
6474
6596
|
ensureInteractivityPluginLoaded(e);
|
|
6475
6597
|
e.pluginManager.addInteractor?.("externalPause", container => {
|
|
@@ -6541,7 +6663,7 @@
|
|
|
6541
6663
|
}
|
|
6542
6664
|
|
|
6543
6665
|
async function loadExternalPushInteraction(engine) {
|
|
6544
|
-
engine.checkVersion("4.
|
|
6666
|
+
engine.checkVersion("4.4.0");
|
|
6545
6667
|
await engine.pluginManager.register((e) => {
|
|
6546
6668
|
ensureInteractivityPluginLoaded(e);
|
|
6547
6669
|
e.pluginManager.addInteractor?.("externalPush", container => {
|
|
@@ -6595,7 +6717,7 @@
|
|
|
6595
6717
|
}
|
|
6596
6718
|
|
|
6597
6719
|
async function loadExternalRemoveInteraction(engine) {
|
|
6598
|
-
engine.checkVersion("4.
|
|
6720
|
+
engine.checkVersion("4.4.0");
|
|
6599
6721
|
await engine.pluginManager.register((e) => {
|
|
6600
6722
|
ensureInteractivityPluginLoaded(e);
|
|
6601
6723
|
e.pluginManager.addInteractor?.("externalRemove", container => {
|
|
@@ -6901,7 +7023,7 @@
|
|
|
6901
7023
|
}
|
|
6902
7024
|
|
|
6903
7025
|
async function loadExternalRepulseInteraction(engine) {
|
|
6904
|
-
engine.checkVersion("4.
|
|
7026
|
+
engine.checkVersion("4.4.0");
|
|
6905
7027
|
await engine.pluginManager.register((e) => {
|
|
6906
7028
|
ensureInteractivityPluginLoaded(e);
|
|
6907
7029
|
const pluginManager = e.pluginManager;
|
|
@@ -6995,7 +7117,7 @@
|
|
|
6995
7117
|
}
|
|
6996
7118
|
|
|
6997
7119
|
async function loadExternalSlowInteraction(engine) {
|
|
6998
|
-
engine.checkVersion("4.
|
|
7120
|
+
engine.checkVersion("4.4.0");
|
|
6999
7121
|
await engine.pluginManager.register((e) => {
|
|
7000
7122
|
ensureInteractivityPluginLoaded(e);
|
|
7001
7123
|
e.pluginManager.addInteractor?.("externalSlow", container => {
|
|
@@ -7007,12 +7129,12 @@
|
|
|
7007
7129
|
const shapeTypes = ["image", "images"];
|
|
7008
7130
|
const stringStart = 0, defaultOpacity = 1;
|
|
7009
7131
|
const currentColorRegex = /(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d.]+%?\))|currentcolor/gi;
|
|
7010
|
-
function replaceColorSvg(imageShape, color, opacity, hdr = false) {
|
|
7132
|
+
function replaceColorSvg(imageShape, color, opacity, hdr = false, peakNits, mode) {
|
|
7011
7133
|
const { svgData } = imageShape;
|
|
7012
7134
|
if (!svgData) {
|
|
7013
7135
|
return "";
|
|
7014
7136
|
}
|
|
7015
|
-
const colorStyle = getStyleFromHsl(color, hdr, opacity);
|
|
7137
|
+
const colorStyle = getStyleFromHsl(color, hdr, opacity, peakNits, mode);
|
|
7016
7138
|
if (svgData.includes("fill")) {
|
|
7017
7139
|
return svgData.replaceAll(currentColorRegex, () => colorStyle);
|
|
7018
7140
|
}
|
|
@@ -7054,8 +7176,8 @@
|
|
|
7054
7176
|
}
|
|
7055
7177
|
image.loading = false;
|
|
7056
7178
|
}
|
|
7057
|
-
function replaceImageColor(image, imageData, color, particle, hdr = false) {
|
|
7058
|
-
const svgColoredData = replaceColorSvg(image, color, particle.opacity?.value ?? defaultOpacity, hdr), imageRes = {
|
|
7179
|
+
function replaceImageColor(image, imageData, color, particle, hdr = false, peakNits, mode) {
|
|
7180
|
+
const svgColoredData = replaceColorSvg(image, color, particle.opacity?.value ?? defaultOpacity, hdr, peakNits, mode), imageRes = {
|
|
7059
7181
|
color,
|
|
7060
7182
|
data: {
|
|
7061
7183
|
...image,
|
|
@@ -7167,7 +7289,7 @@
|
|
|
7167
7289
|
void (async () => {
|
|
7168
7290
|
let imageRes;
|
|
7169
7291
|
if (image.svgData && color) {
|
|
7170
|
-
imageRes = await replaceImageColor(image, imageData, color, particle, container.hdr);
|
|
7292
|
+
imageRes = await replaceImageColor(image, imageData, color, particle, container.hdr, container.peakNits, container.hdrMode);
|
|
7171
7293
|
}
|
|
7172
7294
|
else {
|
|
7173
7295
|
imageRes = {
|
|
@@ -7304,7 +7426,7 @@
|
|
|
7304
7426
|
};
|
|
7305
7427
|
}
|
|
7306
7428
|
async function loadImageShape(engine) {
|
|
7307
|
-
engine.checkVersion("4.
|
|
7429
|
+
engine.checkVersion("4.4.0");
|
|
7308
7430
|
await engine.pluginManager.register(e => {
|
|
7309
7431
|
addLoadImageToEngine(e);
|
|
7310
7432
|
e.pluginManager.addPlugin(new ImagePreloaderPlugin(e));
|
|
@@ -7449,7 +7571,7 @@
|
|
|
7449
7571
|
}
|
|
7450
7572
|
|
|
7451
7573
|
async function loadLifeUpdater(engine) {
|
|
7452
|
-
engine.checkVersion("4.
|
|
7574
|
+
engine.checkVersion("4.4.0");
|
|
7453
7575
|
await engine.pluginManager.register(e => {
|
|
7454
7576
|
e.pluginManager.addParticleUpdater("life", container => {
|
|
7455
7577
|
return Promise.resolve(new LifeUpdater(container));
|
|
@@ -7475,7 +7597,7 @@
|
|
|
7475
7597
|
}
|
|
7476
7598
|
|
|
7477
7599
|
async function loadLineShape(engine) {
|
|
7478
|
-
engine.checkVersion("4.
|
|
7600
|
+
engine.checkVersion("4.4.0");
|
|
7479
7601
|
await engine.pluginManager.register(e => {
|
|
7480
7602
|
e.pluginManager.addShape(["line"], () => Promise.resolve(new LineDrawer()));
|
|
7481
7603
|
});
|
|
@@ -7559,7 +7681,7 @@
|
|
|
7559
7681
|
}
|
|
7560
7682
|
|
|
7561
7683
|
async function loadParticlesAttractInteraction(engine) {
|
|
7562
|
-
engine.checkVersion("4.
|
|
7684
|
+
engine.checkVersion("4.4.0");
|
|
7563
7685
|
await engine.pluginManager.register((e) => {
|
|
7564
7686
|
ensureInteractivityPluginLoaded(e);
|
|
7565
7687
|
e.pluginManager.addInteractor?.("particlesAttract", container => {
|
|
@@ -7769,7 +7891,7 @@
|
|
|
7769
7891
|
}
|
|
7770
7892
|
|
|
7771
7893
|
async function loadParticlesCollisionsInteraction(engine) {
|
|
7772
|
-
engine.checkVersion("4.
|
|
7894
|
+
engine.checkVersion("4.4.0");
|
|
7773
7895
|
await engine.pluginManager.register((e) => {
|
|
7774
7896
|
ensureInteractivityPluginLoaded(e);
|
|
7775
7897
|
e.pluginManager.addPlugin(new OverlapPlugin());
|
|
@@ -7982,7 +8104,7 @@
|
|
|
7982
8104
|
const linkColor = linksOptions.id !== undefined
|
|
7983
8105
|
? container.particles.linksColors.get(linksOptions.id)
|
|
7984
8106
|
: container.particles.linksColor;
|
|
7985
|
-
return getLinkColor(p1, p2, linkColor);
|
|
8107
|
+
return getLinkColor(p1, p2, linkColor, container.hdr);
|
|
7986
8108
|
}
|
|
7987
8109
|
#setColor(p1) {
|
|
7988
8110
|
if (!p1.options.links) {
|
|
@@ -8023,7 +8145,7 @@
|
|
|
8023
8145
|
}
|
|
8024
8146
|
|
|
8025
8147
|
async function loadParticlesLinksInteraction(engine) {
|
|
8026
|
-
engine.checkVersion("4.
|
|
8148
|
+
engine.checkVersion("4.4.0");
|
|
8027
8149
|
await engine.pluginManager.register((e) => {
|
|
8028
8150
|
const pluginManager = e.pluginManager;
|
|
8029
8151
|
ensureInteractivityPluginLoaded(e);
|
|
@@ -8113,19 +8235,19 @@
|
|
|
8113
8235
|
}
|
|
8114
8236
|
|
|
8115
8237
|
async function loadGenericPolygonShape(engine) {
|
|
8116
|
-
engine.checkVersion("4.
|
|
8238
|
+
engine.checkVersion("4.4.0");
|
|
8117
8239
|
await engine.pluginManager.register(e => {
|
|
8118
8240
|
e.pluginManager.addShape(["polygon"], () => Promise.resolve(new PolygonDrawer()));
|
|
8119
8241
|
});
|
|
8120
8242
|
}
|
|
8121
8243
|
async function loadTriangleShape(engine) {
|
|
8122
|
-
engine.checkVersion("4.
|
|
8244
|
+
engine.checkVersion("4.4.0");
|
|
8123
8245
|
await engine.pluginManager.register(e => {
|
|
8124
8246
|
e.pluginManager.addShape(["triangle"], () => Promise.resolve(new TriangleDrawer()));
|
|
8125
8247
|
});
|
|
8126
8248
|
}
|
|
8127
8249
|
async function loadPolygonShape(engine) {
|
|
8128
|
-
engine.checkVersion("4.
|
|
8250
|
+
engine.checkVersion("4.4.0");
|
|
8129
8251
|
await Promise.all([
|
|
8130
8252
|
loadGenericPolygonShape(engine),
|
|
8131
8253
|
loadTriangleShape(engine),
|
|
@@ -8230,7 +8352,7 @@
|
|
|
8230
8352
|
}
|
|
8231
8353
|
|
|
8232
8354
|
async function loadRotateUpdater(engine) {
|
|
8233
|
-
engine.checkVersion("4.
|
|
8355
|
+
engine.checkVersion("4.4.0");
|
|
8234
8356
|
await engine.pluginManager.register(e => {
|
|
8235
8357
|
e.pluginManager.addParticleUpdater("rotate", container => {
|
|
8236
8358
|
return Promise.resolve(new RotateUpdater(container));
|
|
@@ -8254,7 +8376,7 @@
|
|
|
8254
8376
|
}
|
|
8255
8377
|
|
|
8256
8378
|
async function loadSquareShape(engine) {
|
|
8257
|
-
engine.checkVersion("4.
|
|
8379
|
+
engine.checkVersion("4.4.0");
|
|
8258
8380
|
await engine.pluginManager.register(e => {
|
|
8259
8381
|
e.pluginManager.addShape(["edge", "square"], () => Promise.resolve(new SquareDrawer()));
|
|
8260
8382
|
});
|
|
@@ -8288,14 +8410,14 @@
|
|
|
8288
8410
|
}
|
|
8289
8411
|
|
|
8290
8412
|
async function loadStarShape(engine) {
|
|
8291
|
-
engine.checkVersion("4.
|
|
8413
|
+
engine.checkVersion("4.4.0");
|
|
8292
8414
|
await engine.pluginManager.register(e => {
|
|
8293
8415
|
e.pluginManager.addShape(["star"], () => Promise.resolve(new StarDrawer()));
|
|
8294
8416
|
});
|
|
8295
8417
|
}
|
|
8296
8418
|
|
|
8297
8419
|
async function loadSlim(engine) {
|
|
8298
|
-
engine.checkVersion("4.
|
|
8420
|
+
engine.checkVersion("4.4.0");
|
|
8299
8421
|
await engine.pluginManager.register(async (e) => {
|
|
8300
8422
|
const loadInteractivityForSlim = async (e) => {
|
|
8301
8423
|
await loadInteractivityPlugin(e);
|
|
@@ -8412,7 +8534,7 @@
|
|
|
8412
8534
|
}
|
|
8413
8535
|
|
|
8414
8536
|
async function loadTextShape(engine) {
|
|
8415
|
-
engine.checkVersion("4.
|
|
8537
|
+
engine.checkVersion("4.4.0");
|
|
8416
8538
|
await engine.pluginManager.register(e => {
|
|
8417
8539
|
e.pluginManager.addShape(validTypes, () => Promise.resolve(new TextDrawer()));
|
|
8418
8540
|
});
|
|
@@ -8521,7 +8643,7 @@
|
|
|
8521
8643
|
}
|
|
8522
8644
|
|
|
8523
8645
|
async function loadTiltUpdater(engine) {
|
|
8524
|
-
engine.checkVersion("4.
|
|
8646
|
+
engine.checkVersion("4.4.0");
|
|
8525
8647
|
await engine.pluginManager.register(e => {
|
|
8526
8648
|
e.pluginManager.addParticleUpdater("tilt", container => {
|
|
8527
8649
|
return Promise.resolve(new TiltUpdater(container));
|
|
@@ -8597,12 +8719,12 @@
|
|
|
8597
8719
|
if (!twinkleFillRgb) {
|
|
8598
8720
|
return undefined;
|
|
8599
8721
|
}
|
|
8600
|
-
return getStyleFromHsl(twinkleFillRgb, container.hdr, twinklingOpacity);
|
|
8722
|
+
return getStyleFromHsl(twinkleFillRgb, container.hdr, twinklingOpacity, container.peakNits, container.hdrMode);
|
|
8601
8723
|
}, getTwinkleStrokeStyle = () => {
|
|
8602
8724
|
if (!twinkleStrokeRgb) {
|
|
8603
8725
|
return undefined;
|
|
8604
8726
|
}
|
|
8605
|
-
return getStyleFromHsl(twinkleStrokeRgb, container.hdr, twinklingOpacity);
|
|
8727
|
+
return getStyleFromHsl(twinkleStrokeRgb, container.hdr, twinklingOpacity, container.peakNits, container.hdrMode);
|
|
8606
8728
|
}, twinkleFillStyle = getTwinkleFillStyle(), twinkleStrokeStyle = getTwinkleStrokeStyle(), res = {}, needsTwinkle = twinkling && (!!twinkleFillStyle || !!twinkleStrokeStyle);
|
|
8607
8729
|
res.fill = needsTwinkle ? twinkleFillStyle : undefined;
|
|
8608
8730
|
res.stroke = needsTwinkle ? twinkleStrokeStyle : undefined;
|
|
@@ -8625,7 +8747,7 @@
|
|
|
8625
8747
|
}
|
|
8626
8748
|
|
|
8627
8749
|
async function loadTwinkleUpdater(engine) {
|
|
8628
|
-
engine.checkVersion("4.
|
|
8750
|
+
engine.checkVersion("4.4.0");
|
|
8629
8751
|
await engine.pluginManager.register(e => {
|
|
8630
8752
|
e.pluginManager.addParticleUpdater("twinkle", container => {
|
|
8631
8753
|
return Promise.resolve(new TwinkleUpdater(e.pluginManager, container));
|
|
@@ -8727,7 +8849,7 @@
|
|
|
8727
8849
|
}
|
|
8728
8850
|
|
|
8729
8851
|
async function loadWobbleUpdater(engine) {
|
|
8730
|
-
engine.checkVersion("4.
|
|
8852
|
+
engine.checkVersion("4.4.0");
|
|
8731
8853
|
await engine.pluginManager.register(e => {
|
|
8732
8854
|
e.pluginManager.addParticleUpdater("wobble", container => {
|
|
8733
8855
|
return Promise.resolve(new WobbleUpdater(container));
|
|
@@ -8736,7 +8858,7 @@
|
|
|
8736
8858
|
}
|
|
8737
8859
|
|
|
8738
8860
|
async function loadFull(engine) {
|
|
8739
|
-
engine.checkVersion("4.
|
|
8861
|
+
engine.checkVersion("4.4.0");
|
|
8740
8862
|
await engine.pluginManager.register(async (e) => {
|
|
8741
8863
|
const loadEmittersPluginBundle = async (e) => {
|
|
8742
8864
|
await loadEmittersPlugin(e);
|
|
@@ -8887,7 +9009,11 @@
|
|
|
8887
9009
|
if (!fColor && !sColor) {
|
|
8888
9010
|
return;
|
|
8889
9011
|
}
|
|
8890
|
-
const container = this.#container, zIndexOptions = particle.options.zIndex, zIndexFactor = zIndexFactorOffset - particle.zIndexFactor, { fillOpacity, opacity, strokeOpacity } = particle.getOpacity(), transform = this.#reusableTransform, colorStyles = this.#reusableColorStyles, fill = fColor
|
|
9012
|
+
const container = this.#container, zIndexOptions = particle.options.zIndex, zIndexFactor = zIndexFactorOffset - particle.zIndexFactor, { fillOpacity, opacity, strokeOpacity } = particle.getOpacity(), transform = this.#reusableTransform, colorStyles = this.#reusableColorStyles, fill = fColor
|
|
9013
|
+
? getStyleFromHsl(fColor, container.hdr, fillOpacity * opacity, container.peakNits, container.hdrMode)
|
|
9014
|
+
: undefined, stroke = sColor
|
|
9015
|
+
? getStyleFromHsl(sColor, container.hdr, strokeOpacity * opacity, container.peakNits, container.hdrMode)
|
|
9016
|
+
: fill;
|
|
8891
9017
|
transform.a = transform.b = transform.c = transform.d = undefined;
|
|
8892
9018
|
colorStyles.fill = fill;
|
|
8893
9019
|
colorStyles.stroke = stroke;
|
|
@@ -9221,7 +9347,9 @@
|
|
|
9221
9347
|
if (typeof background.element === "string") {
|
|
9222
9348
|
if (typeof document !== "undefined") {
|
|
9223
9349
|
const node = document.querySelector(background.element);
|
|
9224
|
-
if (
|
|
9350
|
+
if ((typeof HTMLCanvasElement !== "undefined" && node instanceof HTMLCanvasElement) ||
|
|
9351
|
+
(typeof HTMLVideoElement !== "undefined" && node instanceof HTMLVideoElement) ||
|
|
9352
|
+
(typeof HTMLImageElement !== "undefined" && node instanceof HTMLImageElement)) {
|
|
9225
9353
|
this.#backgroundElement = node;
|
|
9226
9354
|
}
|
|
9227
9355
|
else if (node) {
|
|
@@ -9232,10 +9360,10 @@
|
|
|
9232
9360
|
}
|
|
9233
9361
|
}
|
|
9234
9362
|
}
|
|
9235
|
-
else if (background.element instanceof HTMLCanvasElement ||
|
|
9236
|
-
background.element instanceof OffscreenCanvas ||
|
|
9237
|
-
background.element instanceof HTMLVideoElement ||
|
|
9238
|
-
background.element instanceof HTMLImageElement) {
|
|
9363
|
+
else if ((typeof HTMLCanvasElement !== "undefined" && background.element instanceof HTMLCanvasElement) ||
|
|
9364
|
+
(typeof OffscreenCanvas !== "undefined" && background.element instanceof OffscreenCanvas) ||
|
|
9365
|
+
(typeof HTMLVideoElement !== "undefined" && background.element instanceof HTMLVideoElement) ||
|
|
9366
|
+
(typeof HTMLImageElement !== "undefined" && background.element instanceof HTMLImageElement)) {
|
|
9239
9367
|
this.#backgroundElement = background.element;
|
|
9240
9368
|
}
|
|
9241
9369
|
}
|
|
@@ -9303,6 +9431,7 @@
|
|
|
9303
9431
|
zoom = defaultZoom;
|
|
9304
9432
|
#container;
|
|
9305
9433
|
#generated;
|
|
9434
|
+
#hdrMediaListeners;
|
|
9306
9435
|
#mutationObserver;
|
|
9307
9436
|
#originalStyle;
|
|
9308
9437
|
#pluginManager;
|
|
@@ -9367,7 +9496,6 @@
|
|
|
9367
9496
|
});
|
|
9368
9497
|
this.resize();
|
|
9369
9498
|
this.#initStyle();
|
|
9370
|
-
this.initBackground();
|
|
9371
9499
|
this.#safeMutationObserver(obs => {
|
|
9372
9500
|
const element = this.domElement;
|
|
9373
9501
|
if (!element || !(element instanceof Node)) {
|
|
@@ -9377,6 +9505,8 @@
|
|
|
9377
9505
|
});
|
|
9378
9506
|
this.initPlugins();
|
|
9379
9507
|
this.#initContext();
|
|
9508
|
+
this.initBackground();
|
|
9509
|
+
this.#initHdrListeners();
|
|
9380
9510
|
this.render.init();
|
|
9381
9511
|
}
|
|
9382
9512
|
initBackground() {
|
|
@@ -9386,7 +9516,8 @@
|
|
|
9386
9516
|
}
|
|
9387
9517
|
const elementStyle = element.style, color = rangeColorToRgb(this.#pluginManager, background.color);
|
|
9388
9518
|
if (color) {
|
|
9389
|
-
|
|
9519
|
+
const hdrOptions = container.actualOptions.hdr;
|
|
9520
|
+
elementStyle.backgroundColor = getStyleFromRgb(color, container.hdr, background.opacity, hdrOptions.peakNits, hdrOptions.mode);
|
|
9390
9521
|
}
|
|
9391
9522
|
else {
|
|
9392
9523
|
elementStyle.backgroundColor = "";
|
|
@@ -9483,6 +9614,7 @@
|
|
|
9483
9614
|
obs.disconnect();
|
|
9484
9615
|
});
|
|
9485
9616
|
this.#mutationObserver = undefined;
|
|
9617
|
+
this.#removeHdrListeners();
|
|
9486
9618
|
this.render.stop();
|
|
9487
9619
|
}
|
|
9488
9620
|
async windowResize() {
|
|
@@ -9502,9 +9634,16 @@
|
|
|
9502
9634
|
}
|
|
9503
9635
|
}
|
|
9504
9636
|
#initContext() {
|
|
9505
|
-
const container = this.#container, canSupportHdr = container.actualOptions.hdr &&
|
|
9637
|
+
const container = this.#container, canSupportHdr = container.actualOptions.hdr.enable &&
|
|
9506
9638
|
safeMatchMedia("(color-gamut: p3)")?.matches &&
|
|
9507
9639
|
safeMatchMedia("(dynamic-range: high)")?.matches;
|
|
9640
|
+
container.hdr = canSupportHdr ?? false;
|
|
9641
|
+
container.hdrMode = container.actualOptions.hdr.mode;
|
|
9642
|
+
container.peakNits = container.actualOptions.hdr.peakNits;
|
|
9643
|
+
const renderCanvas = this.renderCanvas;
|
|
9644
|
+
if (!renderCanvas) {
|
|
9645
|
+
return;
|
|
9646
|
+
}
|
|
9508
9647
|
this.render.setContextSettings({
|
|
9509
9648
|
alpha: true,
|
|
9510
9649
|
desynchronized: true,
|
|
@@ -9513,11 +9652,47 @@
|
|
|
9513
9652
|
? { colorSpace: "display-p3", colorType: "float16" }
|
|
9514
9653
|
: { colorSpace: "srgb" }),
|
|
9515
9654
|
});
|
|
9516
|
-
|
|
9517
|
-
|
|
9518
|
-
|
|
9655
|
+
let context;
|
|
9656
|
+
try {
|
|
9657
|
+
context = renderCanvas.getContext("2d", this.render.settings);
|
|
9658
|
+
}
|
|
9659
|
+
catch {
|
|
9660
|
+
context = null;
|
|
9661
|
+
}
|
|
9662
|
+
if (canSupportHdr && !context) {
|
|
9663
|
+
container.hdr = false;
|
|
9664
|
+
const sdrSettings = {
|
|
9665
|
+
alpha: true,
|
|
9666
|
+
desynchronized: true,
|
|
9667
|
+
willReadFrequently: false,
|
|
9668
|
+
colorSpace: "srgb",
|
|
9669
|
+
};
|
|
9670
|
+
this.render.setContextSettings(sdrSettings);
|
|
9671
|
+
try {
|
|
9672
|
+
context = renderCanvas.getContext("2d", sdrSettings);
|
|
9673
|
+
}
|
|
9674
|
+
catch {
|
|
9675
|
+
context = null;
|
|
9676
|
+
}
|
|
9519
9677
|
}
|
|
9520
|
-
this.render.setContext(
|
|
9678
|
+
this.render.setContext(context);
|
|
9679
|
+
}
|
|
9680
|
+
#initHdrListeners() {
|
|
9681
|
+
this.#removeHdrListeners();
|
|
9682
|
+
const p3Query = safeMatchMedia("(color-gamut: p3)"), hdrQuery = safeMatchMedia("(dynamic-range: high)"), handleChange = () => {
|
|
9683
|
+
this.#recreateRenderCanvas();
|
|
9684
|
+
this.#initContext();
|
|
9685
|
+
this.initBackground();
|
|
9686
|
+
}, listeners = [];
|
|
9687
|
+
if (p3Query) {
|
|
9688
|
+
p3Query.addEventListener("change", handleChange);
|
|
9689
|
+
listeners.push({ handler: handleChange, mql: p3Query });
|
|
9690
|
+
}
|
|
9691
|
+
if (hdrQuery) {
|
|
9692
|
+
hdrQuery.addEventListener("change", handleChange);
|
|
9693
|
+
listeners.push({ handler: handleChange, mql: hdrQuery });
|
|
9694
|
+
}
|
|
9695
|
+
this.#hdrMediaListeners = listeners;
|
|
9521
9696
|
}
|
|
9522
9697
|
#initStyle() {
|
|
9523
9698
|
const element = this.domElement, options = this.#container.actualOptions;
|
|
@@ -9541,6 +9716,25 @@
|
|
|
9541
9716
|
element.style.setProperty(key, value, "important");
|
|
9542
9717
|
}
|
|
9543
9718
|
}
|
|
9719
|
+
#recreateRenderCanvas() {
|
|
9720
|
+
const renderCanvas = this.renderCanvas;
|
|
9721
|
+
if (!renderCanvas) {
|
|
9722
|
+
return;
|
|
9723
|
+
}
|
|
9724
|
+
if (this.domElement) {
|
|
9725
|
+
return;
|
|
9726
|
+
}
|
|
9727
|
+
this.renderCanvas = new OffscreenCanvas(renderCanvas.width, renderCanvas.height);
|
|
9728
|
+
}
|
|
9729
|
+
#removeHdrListeners() {
|
|
9730
|
+
if (!this.#hdrMediaListeners) {
|
|
9731
|
+
return;
|
|
9732
|
+
}
|
|
9733
|
+
for (const { handler, mql } of this.#hdrMediaListeners) {
|
|
9734
|
+
mql.removeEventListener("change", handler);
|
|
9735
|
+
}
|
|
9736
|
+
this.#hdrMediaListeners = undefined;
|
|
9737
|
+
}
|
|
9544
9738
|
#repairStyle() {
|
|
9545
9739
|
const element = this.domElement;
|
|
9546
9740
|
if (!element) {
|
|
@@ -9925,9 +10119,9 @@
|
|
|
9925
10119
|
}
|
|
9926
10120
|
getOpacity() {
|
|
9927
10121
|
const zIndexOptions = this.options.zIndex, zIndexFactor = zIndexFactorOffset - this.zIndexFactor, zOpacityFactor = zIndexFactor ** zIndexOptions.opacityRate, baseOpacity = getRangeValue(this.opacity?.value ?? defaultOpacity$3), modifierOpacity = this.#applyModifiers(undefined, m => m.opacity), opacity = modifierOpacity ?? baseOpacity, fillOpacity = this.fillOpacity ?? defaultOpacity$3, strokeOpacity = this.strokeOpacity ?? defaultOpacity$3;
|
|
9928
|
-
this.#cachedOpacityData.fillOpacity =
|
|
10122
|
+
this.#cachedOpacityData.fillOpacity = fillOpacity;
|
|
9929
10123
|
this.#cachedOpacityData.opacity = opacity * zOpacityFactor;
|
|
9930
|
-
this.#cachedOpacityData.strokeOpacity =
|
|
10124
|
+
this.#cachedOpacityData.strokeOpacity = strokeOpacity;
|
|
9931
10125
|
return this.#cachedOpacityData;
|
|
9932
10126
|
}
|
|
9933
10127
|
getPosition() {
|
|
@@ -10782,6 +10976,7 @@
|
|
|
10782
10976
|
effectDrawers;
|
|
10783
10977
|
fpsLimit;
|
|
10784
10978
|
hdr;
|
|
10979
|
+
hdrMode;
|
|
10785
10980
|
id;
|
|
10786
10981
|
pageHidden;
|
|
10787
10982
|
particleCreatedPlugins;
|
|
@@ -10789,6 +10984,7 @@
|
|
|
10789
10984
|
particlePositionPlugins;
|
|
10790
10985
|
particleUpdaters;
|
|
10791
10986
|
particles;
|
|
10987
|
+
peakNits;
|
|
10792
10988
|
plugins;
|
|
10793
10989
|
retina;
|
|
10794
10990
|
shapeDrawers;
|
|
@@ -10819,6 +11015,8 @@
|
|
|
10819
11015
|
this.id = Symbol(id);
|
|
10820
11016
|
this.fpsLimit = 120;
|
|
10821
11017
|
this.hdr = false;
|
|
11018
|
+
this.hdrMode = exports.HdrMode.standard;
|
|
11019
|
+
this.peakNits = 400;
|
|
10822
11020
|
this.#smooth = false;
|
|
10823
11021
|
this.#delay = 0;
|
|
10824
11022
|
this.#duration = 0;
|
|
@@ -10958,8 +11156,9 @@
|
|
|
10958
11156
|
this.updateActualOptions();
|
|
10959
11157
|
this.canvas.initBackground();
|
|
10960
11158
|
this.canvas.resize();
|
|
10961
|
-
const { delay, duration, fpsLimit,
|
|
10962
|
-
this.
|
|
11159
|
+
const { delay, duration, fpsLimit, smooth, zLayers } = this.actualOptions, hdrOptions = this.actualOptions.hdr;
|
|
11160
|
+
this.hdrMode = hdrOptions.mode;
|
|
11161
|
+
this.peakNits = hdrOptions.peakNits;
|
|
10963
11162
|
this.zLayers = zLayers;
|
|
10964
11163
|
this.#duration = getRangeValue(duration) * millisecondsToSeconds;
|
|
10965
11164
|
this.#delay = getRangeValue(delay) * millisecondsToSeconds;
|
|
@@ -12378,10 +12577,10 @@
|
|
|
12378
12577
|
}
|
|
12379
12578
|
}
|
|
12380
12579
|
#getCachedStyle(rgb) {
|
|
12381
|
-
const key = `${rgb.r},${rgb.g},${rgb.b}`;
|
|
12580
|
+
const key = `${rgb.r},${rgb.g},${rgb.b}-${this.#container.hdr}-${this.#container.peakNits}-${this.#container.hdrMode}`;
|
|
12382
12581
|
let style = this.#colorCache.get(key);
|
|
12383
12582
|
if (!style) {
|
|
12384
|
-
style = getStyleFromRgb(rgb, this.#container.hdr);
|
|
12583
|
+
style = getStyleFromRgb(rgb, this.#container.hdr, undefined, this.#container.peakNits, this.#container.hdrMode);
|
|
12385
12584
|
this.#colorCache.set(key, style);
|
|
12386
12585
|
}
|
|
12387
12586
|
return style;
|
|
@@ -12492,7 +12691,7 @@
|
|
|
12492
12691
|
context.beginPath();
|
|
12493
12692
|
context.arc(originPoint.x, originPoint.y, this.size, minAngle, maxAngle, false);
|
|
12494
12693
|
context.closePath();
|
|
12495
|
-
context.fillStyle = getStyleFromRgb(this.color, this.#container.hdr, this.opacity);
|
|
12694
|
+
context.fillStyle = getStyleFromRgb(this.color, this.#container.hdr, this.opacity, this.#container.peakNits, this.#container.hdrMode);
|
|
12496
12695
|
context.fill();
|
|
12497
12696
|
}
|
|
12498
12697
|
resize() {
|
|
@@ -12972,6 +13171,7 @@
|
|
|
12972
13171
|
exports.ColorAnimation = ColorAnimation;
|
|
12973
13172
|
exports.Fill = Fill;
|
|
12974
13173
|
exports.FullScreen = FullScreen;
|
|
13174
|
+
exports.HDROptions = HDROptions;
|
|
12975
13175
|
exports.HslAnimation = HslAnimation;
|
|
12976
13176
|
exports.Move = Move;
|
|
12977
13177
|
exports.MoveAngle = MoveAngle;
|