ui: fix BigButton shake on startup (#37577)

_shake_start defaults to None, but `None or 0.0` treated it as
time zero, so any button rendered within 0.5s of window creation
would play the shake animation.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Adeeb Shihadeh
2026-03-06 17:18:41 -08:00
committed by GitHub
parent 363735f7ce
commit ac1dd692af
+3 -1
View File
@@ -194,7 +194,9 @@ class BigButton(Widget):
SHAKE_DURATION = 0.5
SHAKE_AMPLITUDE = 24.0
SHAKE_FREQUENCY = 32.0
t = rl.get_time() - (self._shake_start or 0.0)
if self._shake_start is None:
return 0.0
t = rl.get_time() - self._shake_start
if t > SHAKE_DURATION:
return 0.0
decay = 1.0 - t / SHAKE_DURATION