def __init__(self, layout, queue): self.layout = layout self.rotate = translations.Rotate(self.layout.columns, transitions.ConstantTransition(10)) # osc messages go here. self.queue = queue self.color = np.array((255, 255, 255)) # RED in HSV
def on_winning(self, now): for block in self.blocks: block.led_override = On() for target in self.targets: target.led_override = On() self.we_won = True self.rotate = translations.Rotate( STATE.layout.columns, transitions.ConstantTransition(STATE.layout.columns / 2), # if axis=0 (the default) we rotate up/down instead of # around axis=1).start(now)
def make_stroboscopic_effect_analogous(): rotation = translations.Rotate(STATE.layout.columns, transitions.ConstantTransition(16)) hue = transitions.HueTransition( start=functools.partial(np.random.randint, 0, 256), length=functools.partial(np.random.randint, 20, 80)) # I wish this had more red in it row = sources.RainbowRow( STATE.layout, rotation, sv=transitions.ConstantTransition((255, 255)), hue=hue) effect = translations.UpAndRotateEffect( STATE.layout, row, up_speed=distance.PixelsPerFrame(1), rotate_speed=transitions.CycleTransition((18, 8))) return effect
def make_stream_up_single(): # speed here is pixels / second rotation = translations.Rotate( STATE.layout.columns, transitions.ConstantTransition(1)) # I wish this had more red in it row = SingleColumn(STATE.layout, rotation) # the rotation units here are pixels / frame # mostly prefer to be slow, but the occasional spike up is interesting structure_rotation = transitions.ConstantTransition(2) effect = translations.UpAndRotateEffect( STATE.layout, row, up_speed=distance.PixelsPerFrame(1), rotate_speed=distance.VaryingPixelsPerFrame(structure_rotation)) return effect
def make_stream_up(): # speed here is pixels / second rotation = translations.Rotate(STATE.layout.columns, transitions.UniformRandTransition(5, 55)) hue = transitions.HueTransition( start=functools.partial(np.random.randint, 0, 256), length=functools.partial( np.random.choice, [32, 32, 32, 64, 64, 64, 96, 96, 96, 128, 128, 160, 160, 192, 224])) # I wish this had more red in it row = sources.RainbowRow(STATE.layout, rotation, sv=transitions.SvTransition(), hue=hue) # the rotation units here are pixels / frame # mostly prefer to be slow, but the occasional spike up is interesting structure_rotation = transitions.Choice(np.array([0, 0, 1, 1, 1, 2, 2, 3, 4]) * STATE.fps) effect = translations.UpAndRotateEffect( STATE.layout, row, up_speed=distance.PixelsPerFrame(1), rotate_speed=distance.VaryingPixelsPerFrame(structure_rotation) ) return effect
def __init__(self, layout, rotate=None, sv=None, hue=None): self.layout = layout self.rotate = rotate or translations.Rotate( self.layout.columns, transitions.ConstantTransition(10)) self.sv = sv or transitions.SvTransition() self.hue = hue or transitions.HueTransition()