self.hue = 0 def start(self, now): self.rotate.start(now) def __call__(self, now, **kwargs): row = np.zeros((self.layout.columns, 3), np.uint8) row[10, :] = (255, 0, 0) #color_utils.hsv2rgb((self.hue, 255, 255)) self.hue = (self.hue + 16) % 256 return self.rotate(row, now) SCENES = [ fm.FountainScene( 'stroboscopic-complement', tags=[af.Scene.TAG_PRODUCTION], background_effects=[make_stroboscopic_effect_complement()]), fm.FountainScene( 'stroboscopic-analogous', tags=[af.Scene.TAG_PRODUCTION], background_effects=[make_stroboscopic_effect_analogous()]), fm.FountainScene( 'stream-up', tags=[af.Scene.TAG_PRODUCTION], background_effects=[make_stream_up()]), # Not production fm.FountainScene( 'stream-up-single', background_effects=[make_stream_up_single()]) ]
def get_pixels(self): shape = (STATE.layout.rows * STATE.layout.columns, 3) np_value_to_color = np.vectorize(self.value_to_color) # print '---' # print 'max', np.max(self.ripple_state) # print 'min', np.min(self.ripple_state) v = np.array(np_value_to_color(self.ripple_state)) # moveaxis is because v starts off as a (3, 216, 66) array # and we actually want (216, 66, 3) v = np.moveaxis(v, 0, 2) return v def swap_buffers(self): self.previous_ripple_state, self.ripple_state = \ self.ripple_state, self.previous_ripple_state SCENES = [ # It would be nicer to have the ripple OVER the launched effects, but c'est la vie. fm.FountainScene( "ripple", tags=[Scene.TAG_EXAMPLE, Scene.TAG_PRODUCTION], background_effects=[ Ripple() # Ripple( # color=blue, # light_color=(200, 138, 255), # dark_color=(20, 1, 85)) ]) ]
return self.curr_row >= STATE.layout.rows class LaunchRows(MultiEffect): 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))) FOUNTAINS = [ fm.FountainDefinition("simple_rising_row", SolidRow, arg_generators=fm.get_default_arg_generators( end_col=fm.pick_random_start_column)) ] SCENES = [ fm.FountainScene( "groupdemo", tags=[Scene.TAG_EXAMPLE], # Not production background_effects=[SolidBackground(color=(30, 30, 30))], foreground_names=["simple_rising_row"]) ]
def pick_different_border_color(section, button): return hoe.stations.BUTTON_COLORS[choice( [i for i in range(5) if i != button])] FOUNTAINS = [ fm.FountainDefinition("roman", roman_candle_fountain, tags=['fireworks'], arg_generators=fm.get_default_arg_generators( border_color=pick_different_border_color)), fm.FountainDefinition("aroundtheworld", around_the_world_fountain, tags=['fireworks'], arg_generators=fm.get_default_arg_generators( border_color=pick_different_border_color)), fm.FountainDefinition("fzero", fzero_fountain, tags=['fireworks'], arg_generators=fm.get_default_arg_generators( border_color=pick_different_border_color)), ] SCENES = [ #TODO Fader background and pulses fm.FountainScene("fireworks", background_effects=[], tags=[Scene.TAG_EXAMPLE, Scene.TAG_PRODUCTION], foreground_tags=['fireworks']) ]
if self.is_near_collition(self.location): self.hits[self.location] = 1 self.n_hits += 1 self.my_pixels[self.location] = self.color() self.location = self.get_starting_location() hits += 1 self.draw(pixels) def draw(self, pixels): pixels[:] = self.my_pixels[:] def is_near_collition(self, location): shape = (STATE.layout.rows, STATE.layout.columns) location = np.array(self.location) for move in (t.UP, t.DOWN, t.LEFT, t.RIGHT): loc = t.move(location, move, shape) pt = self.hits[tuple(loc)] if pt: return True else: return False SCENES = [ fm.FountainScene( 'diffusion-limited-aggregation', tags=[af.Scene.TAG_PRODUCTION], background_effects=[Dla()] ), ]
# arg_generators= { # 'target_color' : lambda section, button: BUTTON_COLORS[button], # 'start_color' : lambda section, button: map(lambda c: c*0.1, BUTTON_COLORS[button]), # 'section' : fm.pass_section # } # ) ] SCENES = [ Game("buttonchaser", tags=[Scene.TAG_PRODUCTION], collaboration_manager=ButtonChaseController(draw_bottom_layer=True), effects=[ButtonRainbow(max_value=255 - 30), Pulser()]), fm.FountainScene(name="wedges", tags=[Scene.TAG_EXAMPLE, Scene.TAG_PRODUCTION], background_effects=[], foreground_names=['wedge']), # fm.FountainScene( # name="plainfountain", # background_effects=[SolidBackground(color=(30,30,30))] # ), # Scene( # "sinedots", # tags=[Scene.TAG_EXAMPLE], # collaboration_manager=NoOpCollaborationManager(), # effects=[ # SolidBackground(color=(30, 30, 30)), # examples.SampleEffectLauncher(), # FunctionFrameRotator( # func=FunctionFrameRotator.no_op, # start_offsets=5 * np.sin(np.linspace(0, 8 * np.pi, STATE.layout.rows)))