mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
clear code and change the decrement of value to make it even
Former-commit-id: c13cb44cfe48314c087cf6b80257317a38f260ba
This commit is contained in:
parent
faee31c83f
commit
e6ebd6696b
@ -11,17 +11,20 @@ percentage = int(hyperion.args.get('percentage', 10))
|
||||
rotationTime = max(0.1, rotationTime)
|
||||
percentage = max(1, min(percentage, 100))
|
||||
|
||||
# Process parameters
|
||||
factor = percentage/100.0
|
||||
hsv = colorsys.rgb_to_hsv(color[0]/255.0, color[1]/255.0, color[2]/255.0)
|
||||
|
||||
# Initialize the led data
|
||||
factor = float(percentage)/100.0
|
||||
snakeLeds = int(hyperion.ledCount*factor)
|
||||
snakeLeds = max(1, int(hyperion.ledCount*factor))
|
||||
decrement = hsv[2]/snakeLeds
|
||||
ledData = bytearray()
|
||||
|
||||
for i in range(hyperion.ledCount-snakeLeds):
|
||||
ledData += bytearray((0, 0, 0))
|
||||
|
||||
for i in range(1, snakeLeds+1):
|
||||
hsv = colorsys.rgb_to_hsv(float(color[0])/float(255), float(color[1])/float(255), float(color[2])/float(255))
|
||||
rgb = colorsys.hsv_to_rgb(hsv[0], hsv[1], hsv[2]/float(snakeLeds+1-i))
|
||||
for i in range(snakeLeds):
|
||||
rgb = colorsys.hsv_to_rgb(hsv[0], hsv[1], hsv[2]-(i*decrement))
|
||||
ledData += bytearray((int(rgb[0]*255), int(rgb[1]*255), int(rgb[2]*255)))
|
||||
|
||||
# Calculate the sleep time and rotation increment
|
||||
|
Loading…
Reference in New Issue
Block a user