lock threat: rescale intensity curve - gentler ramp, fail 5 = old fail 3

This commit is contained in:
Damocles 2026-04-22 23:18:35 +02:00
parent d561d6f5c3
commit e24678ddce

View file

@ -15,9 +15,15 @@ WlSessionLockSurface {
property real _unlockFade: 1
// Threat level: 0.0-1.0 based on fail count (5 fails = max)
// Threat level: eased curve so fails 1-2 are subtle, 3+ ramps up.
// Max ~0.6 at fail 5 (previously that was fail 3).
readonly property bool _threatEnabled: S.Modules.lock.threatEffect ?? true
readonly property real _threat: _threatEnabled ? Math.min(1.0, root.auth.failCount / 5) : 0
readonly property real _threat: {
if (!_threatEnabled || root.auth.failCount <= 0)
return 0;
const t = Math.min(1.0, root.auth.failCount / 5);
return t * t * 0.6; // quadratic: 1->0.024, 2->0.096, 3->0.216, 4->0.384, 5->0.6
}
property real _heartbeat: 0
// All visual content wrapped for threat shader
@ -318,7 +324,10 @@ WlSessionLockSurface {
}
}
// Heartbeat pulse - starts at fail 3, accelerates each fail
// Heartbeat pulse - starts at fail 3, ramps amplitude and speed
// Amplitude: fail 3 -> 0.4, fail 4 -> 0.7, fail 5+ -> 1.0
readonly property real _heartbeatAmp: Math.min(1.0, (root.auth.failCount - 2) * 0.3)
SequentialAnimation {
id: _heartbeatAnim
loops: Animation.Infinite
@ -329,14 +338,14 @@ WlSessionLockSurface {
target: root
property: "_heartbeat"
from: 0
to: 1
to: root._heartbeatAmp
duration: 80
easing.type: Easing.OutQuad
}
NumberAnimation {
target: root
property: "_heartbeat"
to: 0.15
to: root._heartbeatAmp * 0.15
duration: 100
easing.type: Easing.InQuad
}
@ -344,7 +353,7 @@ WlSessionLockSurface {
NumberAnimation {
target: root
property: "_heartbeat"
to: 0.5
to: root._heartbeatAmp * 0.5
duration: 80
easing.type: Easing.OutQuad
}
@ -355,9 +364,9 @@ WlSessionLockSurface {
duration: 120
easing.type: Easing.InQuad
}
// Pause between beats - shorter as fails mount
// Pause between beats - slower at fail 3, faster at 5+
PauseAnimation {
duration: Math.max(200, 800 - (root.auth.failCount - 3) * 150)
duration: Math.max(300, 1000 - (root.auth.failCount - 3) * 200)
}
onRunningChanged: if (!running)