Exemple #1
0
    def before_rendering(self, pixels, now, collaboration_state, osc_data):
        old_count = self.count()
        MultiEffect.before_rendering(self, pixels, now, collaboration_state, osc_data)

        for sid, buttons in osc_data.buttons.items():
            if buttons and self.button in buttons and not self._is_effect_on_in(sid):
                self.add_effect(SeizureMode(station=sid, duration=3))
Exemple #2
0
 def before_rendering(self, pixels, t, collaboration_state, osc_data):
     MultiEffect.before_rendering(self, pixels, t, collaboration_state,
                                  osc_data)
     for sid, buttons in osc_data.buttons.items():
         if buttons:
             self.add_effect(
                 SolidRow(color=(randrange(0, 255), randrange(0, 255),
                                 randrange(0, 255)),
                          start_col=11 * sid + randint(0, 11),
                          end_col=11 * (sid + 1) + randint(0, 11)))
Exemple #3
0
    def before_rendering(self, pixels, now, collaboration_state, osc_data):
        MultiEffect.before_rendering(self, pixels, now, collaboration_state, osc_data)

        if self._did_time_out(now):
            self._launch_effect(now)
            return

        for sid, buttons in osc_data.buttons.items():
            if buttons and self.launch_button in buttons:
                if sid != self.except_station:
                    self._launch_effect(now, sid)
Exemple #4
0
def roman_candle_fountain(start_col=16,
                          width=8,
                          color=(255, 0, 0),
                          border_color=(0, 255, 0),
                          border_thickness=4,
                          height=30):
    forward_cols = map(lambda col: col % STATE.layout.columns,
                       range(start_col, start_col + width))
    backward_cols = forward_cols[::-1]  # reverse

    sequence = forward_cols + backward_cols

    #+ forward_cols + backward_cols

    # print "forward_cols", forward_cols
    # print "backward_cols", backward_cols
    # print "sequence", sequence

    def make_line((i, col)):
        return RisingLine(height=height,
                          start_col=col,
                          delay=i * 100,
                          color=color,
                          border_color=border_color,
                          border_thickness=border_thickness)

    effects = map(make_line, enumerate(sequence))

    return MultiEffect(*effects)
Exemple #5
0
def fzero_fountain(start_col=16,
                   color=(0, 255, 255),
                   border_color=(255, 0, 0),
                   border_thickness=10,
                   height=50):
    """
        F-Zero Launcher - make a f-zero speed boost arrow around the start_col
        """
    # get 5 pixels to either side to select the 11 columns in this section
    cols = map(lambda c: c % STATE.layout.columns,
               range(start_col - 5, start_col + 5 + 1))

    # group them by levels to make an f-zero speed boost arrow
    levels = [[cols[5]], [cols[4], cols[6]], [cols[3], cols[7]],
              [cols[2], cols[8]], [cols[1], cols[9]], [cols[0], cols[10]]]

    def make_line((i, col)):
        # fade the colors on the edges
        def get_color():
            hsv = colorsys.rgb_to_hsv(color[0] // 255, color[1] // 255,
                                      color[2] // 255)
            rgb = colorsys.hsv_to_rgb(hsv[0], hsv[1], hsv[2] - (i * 0.12))
            return (rgb[0] * 255, rgb[1] * 255, rgb[2] * 255)

        return RisingLine(height=height,
                          start_col=col,
                          delay=i * 80,
                          color=get_color(),
                          border_color=border_color,
                          border_thickness=border_thickness)

    effects = map(make_line, enumerate(levels))

    return MultiEffect(*effects)
Exemple #6
0
def around_the_world_fountain(start_col=16,
                              color=(0, 255, 0),
                              border_color=(255, 0, 0),
                              border_thickness=6,
                              height=18,
                              reverse=True):
    """
    Arround the world launcher - shoot small lines all the way around the gazebo

    Define border_color and border_thickness to add a border.
    The border will be drawn *inside* the height, so make sure
    2*border_thickness < height
    """

    # [0, ..., 65]
    all_cols = range(0, STATE.layout.columns)
    # [start_col, ..., 65, 0, ..., start_col - 1]
    shifted = np.roll(all_cols, -start_col)

    if reverse:
        shifted = shifted[::-1]  # reverse

    # print "start_col", start_col
    # print "shifted", shifted

    def make_line((i, col)):
        return RisingLine(height=height,
                          start_col=col,
                          delay=i * 30,
                          color=color,
                          border_color=border_color,
                          border_thickness=border_thickness,
                          ceil=50)

    effects = map(make_line, enumerate(shifted))

    return MultiEffect(*effects)
Exemple #7
0
 def before_rendering(self, pixels, t, collaboration_state, osc_data):
     MultiEffect.before_rendering(self, pixels, t, collaboration_state, osc_data)
     for s in range(STATE.layout.sections):
         if osc_data.stations[s].buttons:
             self.launch_effect(t, s)
Exemple #8
0
 def __init__(self, button=2):
     MultiEffect.__init__(self)
     self.button = button
     self._update_buttons()
Exemple #9
0
 def __init__(self, except_station=None, time_out=15):
     MultiEffect.__init__(self)
     self.except_station = except_station
     self.last_launch = None
     self.time_out = time_out
     self.launch_button = 2
Exemple #10
0
 def before_rendering(self, pixels, t, collaboration_state, osc_data):
     MultiEffect.before_rendering(self, pixels, t, collaboration_state,
                                  osc_data)
     for s_id, buttons in osc_data.buttons.items():
         if buttons:
             self.launch_effect(t, s_id)
 def __init__(self, factory_method, launch_checker=button_launch_checker, **kwargs):
     MultiEffect.__init__(self)
     self.launch_checker = launch_checker
     self.factory_method = factory_method
     self.factory_args = kwargs