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:
33
effects/sparks.py
Normal file
33
effects/sparks.py
Normal file
@@ -0,0 +1,33 @@
|
||||
import hyperion
|
||||
import time
|
||||
import colorsys
|
||||
import random
|
||||
|
||||
# Get the parameters
|
||||
rotationTime = float(hyperion.args.get('rotation-time', 3.0))
|
||||
brightness = float(hyperion.args.get('brightness', 1.0))
|
||||
saturation = float(hyperion.args.get('saturation', 1.0))
|
||||
reverse = bool(hyperion.args.get('reverse', False))
|
||||
|
||||
# Check parameters
|
||||
rotationTime = max(0.1, rotationTime)
|
||||
brightness = max(0.0, min(brightness, 1.0))
|
||||
saturation = max(0.0, min(saturation, 1.0))
|
||||
|
||||
# Initialize the led data
|
||||
ledData = bytearray()
|
||||
for i in range(hyperion.ledCount):
|
||||
ledData += bytearray((0, 0, 0))
|
||||
|
||||
sleepTime = 0.05
|
||||
|
||||
# Start the write data loop
|
||||
while not hyperion.abort():
|
||||
ledData[:] = bytearray(3*hyperion.ledCount)
|
||||
for i in range(hyperion.ledCount):
|
||||
if random.random() < 0.005:
|
||||
ledData[i*3] = 255
|
||||
ledData[i*3+1] = 255
|
||||
ledData[i*3+2] = 255
|
||||
hyperion.setColor(ledData)
|
||||
time.sleep(sleepTime)
|
Reference in New Issue
Block a user