Beispiel #1
0
if None != cliargs.X:
    bitmap = np.zeros([140, 140])
    for x in range(40):
        for y in range(40):
            bitmap[x][y] = 0x00ffffff
        #bitmap[116-x][x]=0x00ffffff
    screen = Screen(sections)
    screen.send(bitmap)
    time.sleep(0.1)
    print "done"
    exit(0)

if None != cliargs.palette:
    from palette import ColorPalette
    screen = Screen(sections)
    palette = ColorPalette(CSVfilename=cliargs.palette)
    bitmap = np.zeros([140, 140])
    i = 0
    while True:
        bitmap[:] = palette.get32bitColor(i)
        startTime = time.time()
        screen.send(bitmap)
        endTime = time.time()
        i += 1
        if i > 255:
            i = 0
        print(endTime - startTime)
        timeToWait = 1 / 48. - (endTime - startTime)
        if timeToWait < 0:
            timeToWait = 0
        time.sleep(timeToWait)
Beispiel #2
0
if None != cliargs.X:
    bitmap = np.zeros([140,140])
    for x in range(40):
        for y in range(40):
            bitmap[x][y]=0x00ffffff
        #bitmap[116-x][x]=0x00ffffff
    screen = Screen(sections)
    screen.send(bitmap)
    time.sleep(0.1)
    print "done"
    exit(0)

if None != cliargs.palette:
    from palette import ColorPalette
    screen = Screen(sections)
    palette = ColorPalette(CSVfilename=cliargs.palette)
    bitmap = np.zeros([140, 140])
    i = 0
    while True:
        bitmap[:] = palette.get32bitColor(i)
        startTime = time.time()
        screen.send(bitmap)
        endTime = time.time()
        i += 1;
        if i > 255:
            i = 0
        print (endTime - startTime)
        timeToWait = 1/48. - (endTime - startTime)
        if timeToWait < 0:
            timeToWait = 0
        time.sleep(timeToWait)
Beispiel #3
0
                  wavelength=width * 8.0,
                  xScrollSpeed=1,
                  yScrollSpeed=0,
                  amplitude=95,
                  offset=140)

grass = NoiseParams(octaves=4,
                    persistence=0.702,
                    lacunarity=2.0,
                    wavelength=width / 8,
                    xScrollSpeed=0,
                    yScrollSpeed=5,
                    amplitude=120,
                    offset=120)

mainPalette = ColorPalette(CSVfilename=paletteFileCSV)

screen = Screen(sections)  #, ['127.0.0.1:7891'])
screen.dimm(0)

targetFPS = 24
targetFrameTime = 1. / targetFPS
timeCounter = int(random.random() * 65535)
print("eina.. Control+C to stop")
while True:
    startTime = time.time()
    screen.render(width, height, timeCounter / 640., [grass, sun], mainPalette)
    endTime = time.time()
    timeToWait = targetFrameTime - (endTime - startTime)
    print "Frame time: ", (endTime - startTime)
    if timeToWait < 0:
Beispiel #4
0
dotargetFPS = 1
targetFPS = 24
targetFrameTime = 1. / targetFPS
timeCounter = int(random.random() * 65535)

currentEffectID = 4
effectsSize = 0

updateMode = 0  # 0 - events, 1 - continuous

listen_address = ('localhost', 54321)
send_address = ('localhost', 12345)
paired = 0

greenPalette = ColorPalette(CSVfilename="palettes/green_grass")
rainbowPalette = ColorPalette(CSVfilename="palettes/rainbow")
pinkPalette = ColorPalette(CSVfilename="palettes/pink")
mainPalette = greenPalette


class NoiseParams:
    octaves = 1
    persistence = 0.5
    lacunarity = 2.0
    wavelength = 32
    xScrollSpeed = 0
    yScrollSpeed = 0
    amplitude = 127
    offset = 128
Beispiel #5
0
def test_reference_color_must_be_rank_2():
    with raises(ValueError):
        ColorPalette(ColorArray(np.random.random((2, 2, 3))))
Beispiel #6
0
def test_reference_color_must_be_color_array(random_2_3_array):
    with raises(ValueError):
        ColorPalette(random_2_3_array)
Beispiel #7
0
def random_lab_color_palette(random_lab_pair):
    return ColorPalette(random_lab_pair)