Fix fading

master
Raphaël Vinot 2015-05-31 22:09:02 +02:00
parent d30db8879f
commit 0b648aadd4
1 changed files with 12 additions and 10 deletions

View File

@ -4,10 +4,10 @@ from prepare import prepare
import random import random
# Config, will be checked upstream # Config, will be checked upstream
height = 25 height = 32
width = 15 width = 8
framerate = 10 framerate = 20
brightness = 1 brightness = 0.05
##################################### #####################################
#receiver_IP = "10.2.113.151" #receiver_IP = "10.2.113.151"
#receiver_IP = "10.24.147.20" #receiver_IP = "10.24.147.20"
@ -15,9 +15,9 @@ receiver_IP = "dummy"
receiver_port = 9999 receiver_port = 9999
# Do we have one single long line? # Do we have one single long line?
long_line = True long_line = False
# Type of installation (see details in data_generator) # Type of installation (see details in data_generator)
type = 2 type = 1
# TODO: test with real serial # TODO: test with real serial
# https://www.pjrc.com/teensy/td_uart.html # https://www.pjrc.com/teensy/td_uart.html
@ -28,7 +28,7 @@ current_px = 0
cur_color = None cur_color = None
cur_len = 0 cur_len = 0
len_change_choice = [7, 11, 13, 17, 19] len_change_choice = [5, 7, 9]
def setup(): def setup():
global ledTCP global ledTCP
@ -54,9 +54,11 @@ def draw():
col = pixels[len(pixels) -1] col = pixels[len(pixels) -1]
else: else:
col = pixels[px] col = pixels[px]
if i == cur_len: if i == 0:
col = color(red(col) * 0.7, green(col) * 0.7, blue(col) * 0.7)
pixels[px] = col pixels[px] = col
else:
fading = (1/(float(i)/3))
pixels[px] = color(red(col) * fading, green(col) * fading, blue(col) * fading)
px -=1 px -=1
updatePixels() updatePixels()