Compare commits

..

1 commit

Author SHA1 Message Date
djerun 92adc6ea9b [hotfix] disable trap for photosensitive creatures 2024-07-29 22:36:15 +02:00
2 changed files with 24 additions and 9 deletions

View file

@ -48,9 +48,9 @@ class RandomSingle(Animation):
by Max & Lightmoll (https://lght.ml) by Max & Lightmoll (https://lght.ml)
from 2022-06-08 from 2022-06-08
""" """
def __init__(self, color): def __init__(self, color, looptime=60):
super().__init__() super().__init__()
self.PERIOD = 4 * 30 #frames self.PERIOD = looptime * 30 #frames
self.color = self._rand_color() self.color = self._rand_color()
self.last_colors = [] self.last_colors = []
self.frame_counter = 0 self.frame_counter = 0
@ -92,10 +92,10 @@ class TwoColor(Steady):
by Max & Lightmoll (https://lght.ml) by Max & Lightmoll (https://lght.ml)
from 2022-06-08 from 2022-06-08
""" """
def __init__(self, color): def __init__(self, color, looptime=60):
super().__init__(color) super().__init__(color)
self.start_time = time() self.start_time = time()
self.PERIOD = 0.5 #s self.PERIOD = looptime * 0.5 #s
self.COL_1 = color #input color self.COL_1 = color #input color
self.COL_2 = (255-self.r, 255-self.g, 255-self.b) #compl. color self.COL_2 = (255-self.r, 255-self.g, 255-self.b) #compl. color
@ -174,7 +174,7 @@ class Caramelldansen(Steady):
class FadeTo(Steady): class FadeTo(Steady):
def __init__(self, color, t=2.0): def __init__(self, color, t=60.0):
super(FadeTo, self).__init__(color) super(FadeTo, self).__init__(color)
self.t = t self.t = t
self.start = time() self.start = time()
@ -192,7 +192,7 @@ class FadeTo(Steady):
class RotatingRainbow(Animation): class RotatingRainbow(Animation):
def __init__(self, looptime=50.0): def __init__(self, looptime=60.0):
super(RotatingRainbow, self).__init__() super(RotatingRainbow, self).__init__()
self.looptime = looptime self.looptime = looptime
pass pass
@ -216,7 +216,7 @@ class RotatingRainbow(Animation):
class Chase(Steady): class Chase(Steady):
def __init__(self, color, looptime=1.0): def __init__(self, color, looptime=60.0):
super(Chase, self).__init__(color) super(Chase, self).__init__(color)
self.looptime = looptime self.looptime = looptime
@ -234,7 +234,7 @@ class Chase(Steady):
class ChaseRandom(Animation): class ChaseRandom(Animation):
def __init__(self, color, looptime=1.0): def __init__(self, color, looptime=60.0):
super(Chase, self).__init__(color) super(Chase, self).__init__(color)
self.looptime = looptime self.looptime = looptime
@ -256,4 +256,4 @@ def hsv_to_rgb(h, s, v):
return [int(r * 255), int(g * 255), int(b * 255)] return [int(r * 255), int(g * 255), int(b * 255)]
def rgb_to_hsv(r, g, b): def rgb_to_hsv(r, g, b):
return colorsys.rgb_to_hsv(r/255,g/255,b/255) return colorsys.rgb_to_hsv(r/255,g/255,b/255)

View file

@ -17,10 +17,25 @@
<input type="radio" class="js_animation" name="state" id="animation_white" value="steady"/> <input type="radio" class="js_animation" name="state" id="animation_white" value="steady"/>
<label for="animation_white">Steady</label> <label for="animation_white">Steady</label>
</div> </div>
<div>
<input type="radio" class="js_animation" name="state" id="animation_chase" value="chase"/>
<label for="animation_chase">Chase</label>
</div>
<div> <div>
<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>
<div>
<input type="radio" class="js_animation" name="state" id="animation_randomsingle" value="randomsingle"/>
<label for="animation_randomsingle">Random Single</label>
<div>
<input type="radio" class="js_animation" name="state" id="animation_twocolor" value="twocolor"/>
<label for="animation_twocolor">Complementary</label>
</div>
<div>
<input type="radio" class="js_animation" name="state" id="animation_caramelldansen" value="caramelldansen"/>
<label for="animation_caramelldansen">Caramelldansen</label>
</div>
</fieldset> </fieldset>
<fieldset class="colors"> <fieldset class="colors">
<legend>Color</legend> <legend>Color</legend>