diff --git a/effects/snake.py b/effects/snake.py index c400c775..2ae5cb37 100644 --- a/effects/snake.py +++ b/effects/snake.py @@ -17,14 +17,13 @@ hsv = colorsys.rgb_to_hsv(color[0]/255.0, color[1]/255.0, color[2]/255.0) # Initialize the led data 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(snakeLeds): - rgb = colorsys.hsv_to_rgb(hsv[0], hsv[1], hsv[2]-(i*decrement)) +for i in range(1,snakeLeds+1): + rgb = colorsys.hsv_to_rgb(hsv[0], hsv[1], hsv[2]/i) ledData += bytearray((int(rgb[0]*255), int(rgb[1]*255), int(rgb[2]*255))) # Calculate the sleep time and rotation increment @@ -38,5 +37,5 @@ increment %= hyperion.ledCount # Start the write data loop while not hyperion.abort(): hyperion.setColor(ledData) - ledData = ledData[-increment:] + ledData[:-increment] + ledData = ledData[increment:] + ledData[:increment] time.sleep(sleepTime)