Dateien nach "app/animations" hochladen

This commit is contained in:
Till-Immer committed 2026-10-08 14:45:21 +00:00
1 parent 8f8d206166
commit 1c5b8c5685
5 files changed
+256

No files matched your search

+46
View File
@@ -0,0 +1,46 @@
"""Gaming animation – strong pulse through gaming colors."""
from __future__ import annotations
import colorsys
from .base import Animation
class GamingAnimation(Animation):
name = "gaming"
interval = 0.09
# HSB hues
COLORS = [
220 / 360, # blue
190 / 360, # cyan
275 / 360, # violet
300 / 360, # magenta
]
def on_start(self) -> None:
super().on_start()
self._color_idx = 0
self._brightness = 40.0
self._direction = 1.0
def tick(self) -> None:
self._brightness += self._direction * 4
if self._brightness >= 95:
self._brightness = 95
self._direction = -1
if self._brightness <= 25:
self._brightness = 25
self._direction = 1
self._color_idx = (self._color_idx + 1) % len(self.COLORS)
h = self.COLORS[self._color_idx]
r, g, b = colorsys.hsv_to_rgb(h, 1.0, 1.0)
self.shelly.set_color(
int(r * 255),
int(g * 255),
int(b * 255),
gain=int(self._brightness),
)