From 69840b41fc587b53bac872f8a47b044364273314 Mon Sep 17 00:00:00 2001 From: dario Date: Sat, 16 May 2026 22:07:14 +0200 Subject: [PATCH] add new animation RotatingRainbowBeamerBlack new animation that disables the lights on the projector side of the room mostly copied from the kitchenlight effect by tessak9 --- animation.py | 25 ++++++++++++++++++++++++- dmx.py | 4 +++- views/index.tpl | 6 +++++- 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/animation.py b/animation.py index f131be8..d20750c 100644 --- a/animation.py +++ b/animation.py @@ -239,6 +239,29 @@ class RotatingRainbowKitchenWhite(Animation): def name(self): return "kitchenlight" +class RotatingRainbowBeamerBlack(Animation): + def __init__(self, looptime=50.0): + super(RotatingRainbowBeamerBlack, self).__init__() + self.looptime = looptime + pass + + def update(self, index, count): + """ + Same as RotatingRainbow but the lights on the projector side are mapped to black + """ + if (index in [2, 4, 5, 6]): + rgb = (0, 0, 0) + else: + hue = (time() / self.looptime + (index + 0.0) / count) % 1.0 + rgb = hsv_to_rgb(hue, 1, 1) + return rgb + + def __str__(self): + return f"{type(self).__name__}" + + def name(self): + return "beamermode" + class Chase(Steady): def __init__(self, color, looptime=1.0): @@ -306,4 +329,4 @@ def hsv_to_rgb(h, s, v): return [int(r * 255), int(g * 255), int(b * 255)] def rgb_to_hsv(r, g, b): - return colorsys.rgb_to_hsv(r/255,g/255,b/255) \ No newline at end of file + return colorsys.rgb_to_hsv(r/255,g/255,b/255) diff --git a/dmx.py b/dmx.py index edafb2f..e7fdd5c 100644 --- a/dmx.py +++ b/dmx.py @@ -6,7 +6,7 @@ from time import sleep from typing import Union from animation import Animation, Off, RandomSingle, Steady, FadeTo, RotatingRainbow, Chase, TwoColor, Caramelldansen, \ - Hackertours, RotatingRainbowKitchenWhite + Hackertours, RotatingRainbowKitchenWhite, RotatingRainbowBeamerBlack def ledlog(value): @@ -154,6 +154,8 @@ class DMX: animation = Hackertours(self._color) elif animation == "kitchenlight": animation = RotatingRainbowKitchenWhite() + elif animation == "beamermode": + animation = RotatingRainbowBeamerBlack() else: raise ValueError(f"No such animation {animation}") self._animation = animation diff --git a/views/index.tpl b/views/index.tpl index 02d19f1..07c0b15 100644 --- a/views/index.tpl +++ b/views/index.tpl @@ -25,6 +25,10 @@
+
+
+ +
% end
@@ -50,4 +54,4 @@
- \ No newline at end of file +