mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
add fading effect like in a cinema. sped start and end color are selectable in json file
rename loop effects to more meaningfull names Former-commit-id: bed033e19d7cb38b0d5f11313a9f927ac8121194
This commit is contained in:
34
effects/traces.py
Normal file
34
effects/traces.py
Normal file
@@ -0,0 +1,34 @@
|
||||
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 = 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":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
|
||||
while not hyperion.abort():
|
||||
for r in runners:
|
||||
if r["c"] == 0:
|
||||
#ledData[r["pos"]*3+r["i"]] = 0
|
||||
r["c"] = r["step"]
|
||||
r["pos"] = (r["pos"]+1)%hyperion.ledCount
|
||||
ledData[r["pos"]*3+r["i"]] = int(r["lvl"]*(0.2+0.8*random.random()))
|
||||
else:
|
||||
r["c"] -= 1
|
||||
|
||||
hyperion.setColor(ledData)
|
||||
time.sleep(sleepTime)
|
Reference in New Issue
Block a user