A2: name Sheen tuning knobs + SmoothStep crossfade easing

This commit is contained in:
2026-06-16 12:29:57 +02:00
parent c1765ce8ca
commit e98cefa0b2
2 changed files with 11 additions and 3 deletions
+7 -2
View File
@@ -522,7 +522,10 @@ public sealed class ThemeRegistry
)
{
var t = (float)(now - _crossfadeStartTickMs) / CrossfadeDurationMs;
snapshot = ThemeAbgrCacheLerp.Lerp(_previousAbgrSnapshot.Value, _active.AbgrCache, t);
// A2: SmoothStep easing so the fade eases in/out instead of a
// linear ramp. MUST stay in lockstep with TryGetActiveCrossfade (K8).
var te = t * t * (3f - 2f * t);
snapshot = ThemeAbgrCacheLerp.Lerp(_previousAbgrSnapshot.Value, _active.AbgrCache, te);
}
else
{
@@ -548,7 +551,9 @@ public sealed class ThemeRegistry
return false;
var t = (float)elapsed / CrossfadeDurationMs;
lerped = ThemeAbgrCacheLerp.Lerp(_previousAbgrSnapshot.Value, _active.AbgrCache, t);
// A2: SmoothStep easing -- keep identical to ArmCrossfade (K8).
var te = t * t * (3f - 2f * t);
lerped = ThemeAbgrCacheLerp.Lerp(_previousAbgrSnapshot.Value, _active.AbgrCache, te);
return true;
}
@@ -22,6 +22,9 @@ internal static class DrawListExtensions
// highlight, not a saturated accent flash (effect level "subtle").
private const float SheenTintStrength = 0.35f;
// A2 tuning knob: peak alpha at t=0, fading linearly to 0 over the sweep.
private const byte SheenPeakAlpha = 0x40;
private static readonly Dictionary<string, DateTime> SheenStarts = new();
// Test-observability hook for HoverSheenAllocStep: lets the self-test
@@ -57,7 +60,7 @@ internal static class DrawListExtensions
return;
var t = (float)(elapsed / SheenDurationSeconds);
var alpha = (byte)Math.Round(0x40 * (1f - t));
var alpha = (byte)Math.Round(SheenPeakAlpha * (1f - t));
// Tint the sweep toward the accent hue, then stamp the falloff alpha.
// accentRgba is RGBA; convert to ABGR FIRST or the draw-list swaps R/B.
var accentAbgr = ColourUtil.RgbaToAbgr(accentRgba);