Skip to content
Snippets Groups Projects
Unverified Commit abe7f29d authored by Tommimon's avatar Tommimon Committed by Luca Weiss
Browse files

examples: fix starlight effect

Before this fix there sometimes in the last iteration of the while loop
elapsed was grater than fade_time and that resulted in a tiny full
brightness blink at the end of the effect (when the key should be almost
turned off).
parent 7e952111
No related branches found
No related tags found
Loading
......@@ -48,16 +48,15 @@ def starlight_key(device, row, col, active):
elapsed = 0
while elapsed < fade_time:
elapsed = time.time() - start_time
value = 1 - elapsed / fade_time
rgb = colorsys.hsv_to_rgb(hue, 1, value)
color = tuple(map(lambda x: int(256 * x), rgb))
device.fx.advanced.matrix[row, col] = color
value -= 0.01
# print(device, color)
time.sleep(1 / 60)
elapsed = time.time() - start_time
device.fx.advanced.matrix[row, col] = (0, 0, 0)
active[(row, col)] = False
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment