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)
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()