def __init__(self, led, gamepad, players, onDie=None, onEnd=None): super(Jump, self).__init__(led) # intro self.addAnim(Wave.WaveMove(led, colors.White, cycles=5), max_steps=50) # game self.addAnim(JumpGame(led, gamepad, players, onDie=onDie, onEnd=onEnd), fps=55, untilComplete=True) # outro self.addAnim(Rainbows.RainbowCycle(led), fps=15)
def setup(self, led, color_str, speed_str='MEDIUM', min_led=0, max_led=-1, segment_ctrl=None): self.led = led self.set_fps(speed_str) color = bling_colors.get_first_color(color_str) self.animation = Wave.Wave(led, color=color, cycles=DEFAULT_CYCLES, start=min_led, end=max_led)
def main(): global led, presets parser = argparse.ArgumentParser(description='AllPixel OSC controller', formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument('--port', dest='port', default=7676, help='Port to listen on') parser.add_argument('--num-leds', dest='num_leds', default=194, help='Number of LEDs on strip') args = parser.parse_args() signal(SIGINT, sig_exit) signal(SIGTERM, sig_exit) osc = Server(args.port, UDP) osc.add_method("/off", None, set_off) osc.add_method("/presets", None, set_preset) driver = DriverSerial(type=LEDTYPE.WS2801, num=int(args.num_leds), c_order=ChannelOrder.GRB) led = LEDStrip(driver) presets += [ LarsonScanners.LarsonScanner(led, color=colors.Cyan, tail=60), LarsonScanners.LarsonRainbow(led, tail=60), Rainbows.Rainbow(led), PartyMode.PartyMode(led, [colors.White, colors.Blue]), FireFlies.FireFlies(led, [colors.Gold, colors.Red], width=12, count=4), WhiteTwinkle.WhiteTwinkle(led), Wave.Wave(led, color=colors.Cyan, cycles=4), ColorChase.ColorChase(led, color=colors.Cyan, width=20) ] set_preset('', [0, 50], '', '') while True: osc.recv(100)
wavegreenpixmap = pathgen(2, 13, 2, 7) wavecyanpixmap = pathgen(3, 12, 3, 6) wavewhitepixmap = pathgen(4, 11, 4, 5) # List of triple (animation arguments, slavedriver argument, fps) wavedatalist = [(waveblue, wavebluepixmap, 5), (wavered, waveredpixmap, 6), (wavegreen, wavegreenpixmap, 7), (wavecyan, wavecyanpixmap, 8), (wavewhite, wavewhitepixmap, 9)] # dummy LED strips must each have their own slavedrivers ledslaves = [LEDStrip(DriverSlave(len(sarg), pixmap=sarg, pixheights=-1), threadedUpdate=False) \ for aarg, sarg, fps in wavedatalist] # Make the animation list # Wave animations as list pairs (animation instances, fps) added animationlist = [(WA.Wave(ledslaves[i], *wd[0]), wd[2]) for i, wd in enumerate(wavedatalist)] # needed to run on pixelweb def genParams(): return {"start": 0, "end": -1, "animcopies": animationlist} if __name__ == '__main__': masteranimation = MasterAnimation(ledmaster, animationlist, runtime=2) # Master launches all in animationlist at preRun # Master steps when it gets a go ahdead signal from one of the # concurrent annimations masteranimation.run(
# Worm animations as list pairs (animation instances, fps) added animationlist = [(Worm(ledslaves[i], *wd[0]), wd[2]) for i, wd in enumerate(wormdatalist)] # add a matrix animation background ledslaveb = LEDMatrix(DriverSlave(160, None, 0), width=16, height=10, threadedUpdate=False) bloom = BA.Bloom(ledslaveb) animationlist.append((bloom, 10)) # add the wave strip animation on the outside boards wpixm = pathgen(0, 15, 0, 9) ledslavew = LEDStrip(DriverSlave(len(wpixm), wpixm, 1), threadedUpdate=False) wave = WA.Wave(ledslavew, (255, 0, 255), 1) animationlist.append((wave, 30)) # needed to run on pixelweb def genParams(): return {"start": 0, "end": -1, "animcopies": animationlist} if __name__ == '__main__': masteranimation = MasterAnimation(ledmaster, animationlist, runtime=1) # Master launches all in animationlist at preRun # Master steps when it gets a go ahdead signal from one of the # concurrent annimations
wavewhitepixmap = pathgen(4, 11, 4, 5) # List of triple (animation arguments, slavedriver argument, fps) wavedatalist = [(waveblue, wavebluepixmap, 5), (wavered, waveredpixmap, 6), (wavegreen, wavegreenpixmap, 7), (wavecyan, wavecyanpixmap, 8), (wavewhite, wavewhitepixmap, 9)] # dummy LED strips must each have their own slavedrivers ledslaves = [LEDStrip(DriverSlave(len(sarg), pixmap=sarg, pixheights=-1), threadedUpdate=False) \ for aarg, sarg, fps in wavedatalist] # Make the animation list # Wave animations as list pairs (animation instances, fps) added animationlist = [(WA.WaveMove(ledslaves[i], *wd[0]), wd[2]) for i, wd in enumerate(wavedatalist)] # needed to run on pixelweb def genParams(): return {"start":0, "end":-1, "animcopies": animationlist} if __name__ == '__main__': masteranimation = MasterAnimation(ledmaster, animationlist, runtime=10) # Master launches all in animationlist at preRun # Master steps when it gets a go ahdead signal from one of the # concurrent annimations masteranimation.run(fps=None, threaded = False) # if give fps for master will skip faster frames masteranimation.stopThread() #import threading
#!/usr/bin/env python from looped import create_led from BiblioPixelAnimations.strip import Rainbows, LarsonScanners, Wave, \ PixelPingPong, Alternates, ColorChase, ColorPattern, ColorWipe, \ FireFlies, HalvesRainbow, PartyMode, Searchlights, WhiteTwinkle from bibliopixel.animation import AnimationQueue from bibliopixel import colors import sys led = create_led(dev=len(sys.argv) > 1 and sys.argv[1] == 'test') queue = AnimationQueue(led) queue.addAnim(WhiteTwinkle.WhiteTwinkle(led), fps=20, max_steps=200) queue.addAnim(Searchlights.Searchlights(led), fps=50, max_steps=550) queue.addAnim(PartyMode.PartyMode(led, PartyMode.rainbow), fps=15, max_steps=50) queue.addAnim(HalvesRainbow.HalvesRainbow(led), fps=50, max_steps=150) queue.addAnim(FireFlies.FireFlies(led, FireFlies.rainbow), fps=20, max_steps=100) queue.addAnim(ColorWipe.ColorWipe(led, colors.Red), fps=40, max_steps=150) queue.addAnim(ColorPattern.ColorPattern(led, ColorPattern.rainbow, 3), fps=40, max_steps=150) queue.addAnim(ColorChase.ColorChase(led, colors.Blue), fps=40, max_steps=150) queue.addAnim(Alternates.Alternates(led), fps=5, max_steps=20) queue.addAnim(PixelPingPong.PixelPingPong(led, color=colors.White, max_led=led.numLEDs, total_pixels=2, fade_delay=4), fps=40, max_steps=150) queue.addAnim(Wave.WaveMove(led, colors.White, cycles=10), fps=40, max_steps=150) queue.addAnim(Wave.Wave(led, colors.White, cycles=10), fps=40, max_steps=150) queue.addAnim(LarsonScanners.LarsonRainbow(led), fps=40, max_steps=150) queue.addAnim(LarsonScanners.LarsonScanner(led, colors.White), fps=40, max_steps=150) queue.addAnim(Rainbows.RainbowCycle(led), fps=40, max_steps=150) # queue.addAnim(JumpIntro(led), untilComplete=True, max_steps=150) # queue.addAnim(JumpGame(led, gamepad, ['1', '2']), fps=40) queue.run()