예제 #1
0
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument(
        '--row', choices=['sine', 'single', 'fader', 'rainbow', 'linear'], default='rainbow')
    args = parser.parse_args()

    # TODO: copy and paste is bad, mkay.
    client = opc.Client('localhost:7890')
    if not client.can_connect():
        print('Connection Failed')
        return 1

    STATE.fps = 30

    with open('layout/hoeLayout.json') as f:
        hoe_layout = layout.Layout(json.load(f))

    osc_queue = Queue.Queue()
    server = osc_utils.create_osc_server()
    # pylint: disable=no-value-for-parameter
    server.addMsgHandler("/input/fader", lambda *args: osc_queue.put(args[2][-1]))

    coordinated = CoordinatedTransition()
    rotation = Rotate(hoe_layout.columns, coordinated.first())
    up_speed = consistent_speed_to_pixels(1)  # rows / second

    if args.row == 'single':
        row = SingleColumn(hoe_layout, rotation)
    elif args.row == 'rainbow':
        r_row = RainbowRow(hoe_layout, rotation)
        b_row = ConstantRow(hoe_layout, 5)
        row = r_row
        #row = SwapRow(
        #    (r_row, b_row),
        #    (lambda: utils.randrange(10, 25), lambda: utils.randrange(4, 5)))
    elif args.row == 'fader':
        row = FaderRow(hoe_layout, osc_queue)
    elif args.row == 'sine':
        row = SineRow(hoe_layout)
    elif args.row == 'linear':
        row = LinearBrightness(hoe_layout)

    if args.row == 'linear':
        effect = UpAndRotateEffect(
            hoe_layout, row, up_speed, rotate_speed=consistent_speed_to_pixels(0))
    else:
        effect = UpAndRotateEffect(hoe_layout, row, up_speed, rotate_speed=coordinated.second())
    #effect = UpAndExpandEffect(hoe_layout)
    render = Render(client, osc_queue, hoe_layout, [effect])
    render.run_forever()
예제 #2
0
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument('n', type=int)
    args = parser.parse_args()
    # TODO: copy and paste is bad, mkay.
    client = opc.Client('localhost:7890')
    if not client.can_connect():
        print('Connection Failed')
        return 1

    with open('layout/hoeLayout.json') as f:
        hoe_layout = layout.Layout(json.load(f))

    STATE.layout = hoe_layout
    background = Breathe(hoe_layout, args.n)
    render = su.Render(client, None, hoe_layout, [background])
    render.run_forever()
def main():
    # TODO: copy and paste is bad, mkay.
    client = opc.Client('localhost:7890')
    if not client.can_connect():
        print('Connection Failed')
        return 1

    with open('layout/hoeLayout.json') as f:
        hoe_layout = layout.Layout(json.load(f))

    osc_queue = Queue.Queue()
    server = osc_utils.create_osc_server()
    # pylint: disable=no-value-for-parameter
    server.addMsgHandler("/input/button", lambda *args: set_direction(osc_queue, *args))
    interaction = MazeEffect(hoe_layout, osc_queue)
    render = su.Render(client, osc_queue, hoe_layout, [interaction])
    render.run_forever()
예제 #4
0
def main():
    # TODO: copy and paste is bad, mkay.
    client = opc.Client('localhost:7890')
    if not client.can_connect():
        print('Connection Failed')
        return 1

    with open('layout/hoeLayout.json') as f:
        hoe_layout = layout.Layout(json.load(f))

    osc_queue = Queue.Queue()
    server = osc_utils.create_osc_server()
    # pylint: disable=no-value-for-parameter
    server.addMsgHandler("/input/button",
                         lambda *args: stl.add_station_id(osc_queue, *args))
    server.addMsgHandler("/input/fader", handle_fader)
    background = su.Effect(hoe_layout, TargetRow(hoe_layout, osc_queue))
    render = su.Render(client, osc_queue, hoe_layout, [background])
    render.run_forever()
예제 #5
0
def main():
    global ROTATION_SPEED
    parser = argparse.ArgumentParser()
    parser.add_argument(
        '--row',
        choices=['sine', 'single', 'fader', 'rainbow', 'linear'],
        default='rainbow')
    args = parser.parse_args()

    # TODO: copy and paste is bad, mkay.
    client = opc.Client('localhost:7890')
    if not client.can_connect():
        print('Connection Failed')
        return 1

    STATE.fps = 30

    with open('layout/hoeLayout.json') as f:
        hoe_layout = layout.Layout(json.load(f))

    osc_queue = Queue.Queue()
    server = osc_utils.create_osc_server()
    # pylint: disable=no-value-for-parameter
    server.addMsgHandler("/input/fader",
                         lambda *args: osc_queue.put(args[2][-1]))
    if args.row == 'single':
        row = SingleColumn(hoe_layout)
    elif args.row == 'rainbow':
        row = RainbowRow(hoe_layout)
    elif args.row == 'fader':
        row = FaderRow(hoe_layout, osc_queue)
    elif args.row == 'sine':
        row = SineRow(hoe_layout)
    elif args.row == 'linear':
        row = LinearBrightness(hoe_layout)
    effect = UpAndRotateEffect(hoe_layout, row)
    #effect = UpAndExpandEffect(hoe_layout)
    render = Render(client, osc_queue, hoe_layout, [effect])
    render.run_forever()