mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
5 more effects
Former-commit-id: e6a826299ad48143cb155e7113a34bd6d3b20246
This commit is contained in:
25
effects/random.py
Normal file
25
effects/random.py
Normal file
@@ -0,0 +1,25 @@
|
||||
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.001
|
||||
|
||||
# Start the write data loop
|
||||
while not hyperion.abort():
|
||||
hyperion.setColor(ledData)
|
||||
for i in range(hyperion.ledCount):
|
||||
if random.randrange(10) == 1:
|
||||
hue = random.random()
|
||||
sat = 1.0
|
||||
val = random.random()
|
||||
rgb = colorsys.hsv_to_rgb(hue, sat, val)
|
||||
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)
|
Reference in New Issue
Block a user