feat(theme): Add Alert Pulsing effect for NERV theme
This commit is contained in:
@@ -18,3 +18,21 @@ class StatusFlicker:
|
||||
def get_alpha(self) -> float:
|
||||
# Modulate between 0.7 and 1.0 using sin wave
|
||||
return 0.85 + 0.15 * math.sin(time.time() * 20.0)
|
||||
|
||||
class AlertPulsing:
|
||||
def __init__(self):
|
||||
self.active = False
|
||||
|
||||
def update(self, status: str):
|
||||
self.active = status.lower().startswith("error")
|
||||
|
||||
def render(self, width: float, height: float):
|
||||
if not self.active:
|
||||
return
|
||||
draw_list = imgui.get_foreground_draw_list()
|
||||
# sin(t) is between -1 and 1
|
||||
# scale to 0 to 1: (sin(t) + 1) / 2
|
||||
# multiply by (0.2 - 0.05) = 0.15 and add 0.05
|
||||
alpha = 0.05 + 0.15 * ((math.sin(time.time() * 4.0) + 1.0) / 2.0)
|
||||
color = imgui.get_color_u32((1.0, 0.0, 0.0, alpha))
|
||||
draw_list.add_rect((0.0, 0.0), (width, height), color, 0.0, 0, 10.0)
|
||||
|
||||
Reference in New Issue
Block a user