hyperion.ng/effects/random.py
redpanther de5b284975 modify effects
- snake has a nice tail
- random is not so fast anymore
- merge sparks and sparks-color
- make more params available in json files


Former-commit-id: fc2a4f6f6ce2b44a35a75a9c0dbe36504b790be9
2016-01-20 22:36:21 +01:00

22 lines
638 B
Python

import hyperion, time, colorsys, random
# get args
sleepTime = float(hyperion.args.get('speed', 1.0))
saturation = float(hyperion.args.get('saturation', 1.0))
ledData = bytearray()
# Initialize the led data
for i in range(hyperion.ledCount):
ledData += bytearray((0,0,0))
# Start the write data loop
while not hyperion.abort():
hyperion.setColor(ledData)
for i in range(hyperion.ledCount):
if random.randrange(10) == 1:
rgb = colorsys.hsv_to_rgb(random.random(), saturation, random.random())
ledData[i*3 ] = int(255*rgb[0])
ledData[i*3+1] = int(255*rgb[1])
ledData[i*3+2] = int(255*rgb[2])
time.sleep(sleepTime)