diff --git a/effects/cinema-fade-in.json b/effects/cinema-fade-in.json new file mode 100644 index 00000000..2730c568 --- /dev/null +++ b/effects/cinema-fade-in.json @@ -0,0 +1,10 @@ +{ + "name" : "Cinema brighten lights", + "script" : "fade.py", + "args" : + { + "fade-time" : 5.0, + "color-start" : [ 136, 97, 7 ], + "color-end" : [ 238, 173, 47 ] + } +} diff --git a/effects/cinema-fade-off.json b/effects/cinema-fade-off.json new file mode 100644 index 00000000..7d7c20f8 --- /dev/null +++ b/effects/cinema-fade-off.json @@ -0,0 +1,10 @@ +{ + "name" : "Cinema dim lights", + "script" : "fade.py", + "args" : + { + "fade-time" : 5.0, + "color-start" : [ 238, 173, 47 ], + "color-end" : [ 136, 97, 7 ] + } +} diff --git a/effects/fade.py b/effects/fade.py new file mode 100644 index 00000000..950605d1 --- /dev/null +++ b/effects/fade.py @@ -0,0 +1,34 @@ +import hyperion, time + +def setColor(rgb): + hyperion.setColor( bytearray( hyperion.ledCount * rgb)) + +# Get the parameters +fadeTime = float(hyperion.args.get('fade-time', 5.0)) +colorStart = hyperion.args.get('color-start', (255,174,11)) +colorEnd = hyperion.args.get('color-end', (100,100,100)) + +color_step = ( + (colorEnd[0] - colorStart[0]) / 256.0, + (colorEnd[1] - colorStart[1]) / 256.0, + (colorEnd[2] - colorStart[2]) / 256.0 +) + +# fade color +for step in range(256): + if hyperion.abort(): + break + + setColor( ( + int( min(max(0, colorStart[0] + color_step[0]*step), 255) ), + int( min(max(0, colorStart[1] + color_step[1]*step), 255) ), + int( min(max(0, colorStart[2] + color_step[2]*step), 255) ) + ) ) + + time.sleep( fadeTime / 256 ) + +# maintain color until effect end +setColor(colorEnd) +while not hyperion.abort(): + time.sleep(1) + diff --git a/effects/loop.json b/effects/loop.json deleted file mode 100644 index c4e58803..00000000 --- a/effects/loop.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name" : "Loop", - "script" : "loop.py", - "args" : - { - } -} diff --git a/effects/loop2.json b/effects/loop2.json deleted file mode 100644 index ebedbe34..00000000 --- a/effects/loop2.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name" : "Loop2", - "script" : "loop2.py", - "args" : - { - } -} diff --git a/effects/loop2.py b/effects/loop2.py deleted file mode 100644 index 3498ac4e..00000000 --- a/effects/loop2.py +++ /dev/null @@ -1,33 +0,0 @@ -import hyperion -import time -import colorsys -import random - -# Initialize the led data -ledData = bytearray() -for i in range(hyperion.ledCount): - ledData += bytearray((0,0,0)) - -sleepTime = 0.005 - -runners = [ -{ "pos":0, "step":4 , "lvl":255}, -{ "pos":1, "step":5 , "lvl":255}, -{ "pos":2, "step":6 , "lvl":255}, -{ "pos":0, "step":7 , "lvl":255}, -{ "pos":1, "step":8 , "lvl":255}, -{ "pos":2, "step":9, "lvl":255}, -] - -# Start the write data loop -count = 0 -while not hyperion.abort(): - count += 1 - for r in runners: - if count%r["step"] == 0: - ledData[r["pos"]] = 0 - r["pos"] = (r["pos"]+3)%(hyperion.ledCount*3) - ledData[r["pos"]] = r["lvl"] - - hyperion.setColor(ledData) - time.sleep(sleepTime) diff --git a/effects/running_dots.json b/effects/running_dots.json new file mode 100644 index 00000000..8accd451 --- /dev/null +++ b/effects/running_dots.json @@ -0,0 +1,10 @@ +{ + "name" : "Running dots", + "script" : "running_dots.py", + "args" : + { + "speed" : 1.5, + "whiteLevel" : 100, + "colorLevel" : 230 + } +} diff --git a/effects/running_dots.py b/effects/running_dots.py new file mode 100644 index 00000000..16d8d039 --- /dev/null +++ b/effects/running_dots.py @@ -0,0 +1,43 @@ +import hyperion, time, colorsys, random + +# get options from args +sleepTime = float(hyperion.args.get('speed', 1.5)) * 0.005 +whiteLevel = int(hyperion.args.get('whiteLevel', 0)) +lvl = int(hyperion.args.get('colorLevel', 220)) + +# check value +whiteLevel = min( whiteLevel, 254 ) +lvl = min( lvl, 255 ) + +if whiteLevel >= lvl: + lvl = 255 + +# Initialize the led data +ledData = bytearray() +for i in range(hyperion.ledCount): + ledData += bytearray((0,0,0)) + +runners = [ + { "pos":0, "step": 4, "lvl":lvl}, + { "pos":1, "step": 5, "lvl":lvl}, + { "pos":2, "step": 6, "lvl":lvl}, + { "pos":0, "step": 7, "lvl":lvl}, + { "pos":1, "step": 8, "lvl":lvl}, + { "pos":2, "step": 9, "lvl":lvl}, + #{ "pos":0, "step":10, "lvl":lvl}, + #{ "pos":1, "step":11, "lvl":lvl}, + #{ "pos":2, "step":12, "lvl":lvl}, +] + +# Start the write data loop +counter = 0 +while not hyperion.abort(): + counter += 1 + for r in runners: + if counter % r["step"] == 0: + ledData[r["pos"]] = whiteLevel + r["pos"] = (r["pos"]+3) % (hyperion.ledCount*3) + ledData[r["pos"]] = r["lvl"] + + hyperion.setColor(ledData) + time.sleep(sleepTime) diff --git a/effects/traces.json b/effects/traces.json new file mode 100644 index 00000000..a2bfdabb --- /dev/null +++ b/effects/traces.json @@ -0,0 +1,8 @@ +{ + "name" : "Color traces", + "script" : "traces.py", + "args" : + { + "speed" : 1.0 + } +} diff --git a/effects/loop.py b/effects/traces.py similarity index 76% rename from effects/loop.py rename to effects/traces.py index 93011e97..7f6a8dfe 100644 --- a/effects/loop.py +++ b/effects/traces.py @@ -8,15 +8,15 @@ ledData = bytearray() for i in range(hyperion.ledCount): ledData += bytearray((0,0,0)) -sleepTime = 0.002 +sleepTime = float(hyperion.args.get('speed', 1.0)) * 0.004 runners = [ { "i":0, "pos":0, "c":0, "step":9 , "lvl":255}, { "i":1, "pos":0, "c":0, "step":8 , "lvl":255}, { "i":2, "pos":0, "c":0, "step":7 , "lvl":255}, -{ "i":0, "pos":0, "c":0, "step":6 , "lvl":0}, -{ "i":1, "pos":0, "c":0, "step":5 , "lvl":0}, -{ "i":2, "pos":0, "c":0, "step":4, "lvl":0}, +{ "i":0, "pos":0, "c":0, "step":6 , "lvl":100}, +{ "i":1, "pos":0, "c":0, "step":5 , "lvl":100}, +{ "i":2, "pos":0, "c":0, "step":4, "lvl":100}, ] # Start the write data loop