added new animation RotatingRainbowKitchenWhite #7
3 changed files with 33 additions and 1 deletions
24
animation.py
24
animation.py
|
|
@ -216,6 +216,30 @@ class RotatingRainbow(Animation):
|
||||||
return "rainbow"
|
return "rainbow"
|
||||||
|
|
||||||
|
|
||||||
|
class RotatingRainbowKitchenWhite(Animation):
|
||||||
|
def __init__(self, looptime=50.0):
|
||||||
|
super(RotatingRainbowKitchenWhite, self).__init__()
|
||||||
|
self.looptime = looptime
|
||||||
|
pass
|
||||||
|
|
||||||
|
def update(self, index, count):
|
||||||
|
"""
|
||||||
|
Same as RotatingRainbow but the two lights above the kitchen are mapped to white
|
||||||
|
"""
|
||||||
|
if (index == 2 or index == 7):
|
||||||
|
rgb = (255, 255, 255)
|
||||||
|
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 "kitchenlight"
|
||||||
|
|
||||||
|
|
||||||
class Chase(Steady):
|
class Chase(Steady):
|
||||||
def __init__(self, color, looptime=1.0):
|
def __init__(self, color, looptime=1.0):
|
||||||
super(Chase, self).__init__(color)
|
super(Chase, self).__init__(color)
|
||||||
|
|
|
||||||
4
dmx.py
4
dmx.py
|
|
@ -6,7 +6,7 @@ from time import sleep
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
from animation import Animation, Off, RandomSingle, Steady, FadeTo, RotatingRainbow, Chase, TwoColor, Caramelldansen, \
|
from animation import Animation, Off, RandomSingle, Steady, FadeTo, RotatingRainbow, Chase, TwoColor, Caramelldansen, \
|
||||||
Hackertours
|
Hackertours, RotatingRainbowKitchenWhite
|
||||||
|
|
||||||
|
|
||||||
def ledlog(value):
|
def ledlog(value):
|
||||||
|
|
@ -152,6 +152,8 @@ class DMX:
|
||||||
animation = RandomSingle(self._color)
|
animation = RandomSingle(self._color)
|
||||||
elif animation == "hackertours":
|
elif animation == "hackertours":
|
||||||
animation = Hackertours(self._color)
|
animation = Hackertours(self._color)
|
||||||
|
elif animation == "kitchenlight":
|
||||||
|
animation = RotatingRainbowKitchenWhite()
|
||||||
else:
|
else:
|
||||||
raise ValueError(f"No such animation {animation}")
|
raise ValueError(f"No such animation {animation}")
|
||||||
self._animation = animation
|
self._animation = animation
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,12 @@
|
||||||
<input type="radio" class="js_animation" name="state" id="animation_rainbow" value="rainbow"/>
|
<input type="radio" class="js_animation" name="state" id="animation_rainbow" value="rainbow"/>
|
||||||
<label for="animation_rainbow">Rainbow</label>
|
<label for="animation_rainbow">Rainbow</label>
|
||||||
</div>
|
</div>
|
||||||
|
% if room == "big":
|
||||||
|
<div>
|
||||||
|
<input type="radio" class="js_animation" name="state" id="animation_kitchenlight" value="kitchenlight"/>
|
||||||
|
<label for="animation_kitchenlight">Kitchenlight</label>
|
||||||
|
</div>
|
||||||
|
% end
|
||||||
<div>
|
<div>
|
||||||
<input type="radio" class="js_animation" name="state" id="animation_hackertours" value="hackertours"/>
|
<input type="radio" class="js_animation" name="state" id="animation_hackertours" value="hackertours"/>
|
||||||
<label for="animation_hackertours">Hackertours</label>
|
<label for="animation_hackertours">Hackertours</label>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue