# Worm arguments wormblue = (bluedimming, pathgen(5, 10, 0, 9), 1, 1) wormred = (reddimming, pathgen(1, 14, 1, 8), 1, 1) wormgreen = (greendimming, pathgen(2, 13, 2, 7), 1, 1) wormcyan = (cyandimming, pathgen(3, 12, 3, 6), 1, 1) wormwhite = (whitedimming, pathgen(4, 11, 4, 5), 1, 1) # List of pair (animation arguments, fps) wormdatalist = [(wormblue, 24), (wormred, 2), (wormgreen, 16), (wormcyan, 12), (wormwhite, 8)] # dummy strips must each have their own slavedriver as thread is attached # to the driver ledslaves = [ LEDStrip(DriverSlave(160, 0), threadedUpdate=True) for _ in range(len(wormdatalist)) ] # Make the Worm animations an list pairs (animation, fps) wormlist = [(Worm(ledslaves[i], *d[0]), d[1]) for i, d in enumerate(wormdatalist)] masteranimation = MasterAnimation(ledmaster, [w._led for w, f in wormlist]) starttime = time.time() runtime = 1 # Master steps when it gets a go ahdead signal from one of the # concurrent annimations masteranimation.run(fps=36)
wormblue = (bluedimming, pathgen(5, 10, 0, 9), 1, 1, 6) wormred = (reddimming, pathgen(1, 14, 1, 8), 1, 1, 2) wormgreen = (greendimming, pathgen(2, 13, 2, 7), 1, 1, 3) wormcyan = (cyandimming, pathgen(3, 12, 3, 6), 1, 1, 4) wormwhite = (whitedimming, pathgen(4, 11, 4, 5), 1, 1, 5) # List of pair (animation arguments, fps) wormdatalist = [(wormblue, 24), (wormred, 20), (wormgreen, 16), (wormcyan, 12), (wormwhite, 8)] #wormdatalist = [(wormwhite, 8)] #wormdatalist = [] # dummy strips must each have their own slavedriver as thread is attached # to the driver ledslaves = [ LEDStrip(DriverSlave(160, pixheights=-1), threadedUpdate=True) for _ in range(len(wormdatalist)) ] # Make the Worm animations an list pairs (animation, fps) wormlist = [(Worm(ledslaves[i], *d[0]), d[1]) for i, d in enumerate(wormdatalist)] ledslaveb = LEDMatrix(DriverSlave(160, None, 0), width=16, height=10, threadedUpdate=True) bloom = BA.Bloom(ledslaveb) wormlist.append((bloom, 10)) #masteranimation = MasterAnimation(ledmaster, [w._led for w, f in wormlist])
wormbluepixmap = range(88, 160, 16) wormredpixmap = range(88, 0, -16) wormgreenpixmap = range(88, 160, 17) wormcyanpixmap = range(88, 0, -17) wormwhitepixmap = range(88, 96) wormwhite2pixmap = range(88, 80, -1) # List of triple (animation arguments, slavedriver argument, fps) wormdatalist = [(wormblue, wormbluepixmap, 10), (wormred, wormredpixmap, 12), (wormgreen, wormgreenpixmap, 10), (wormcyan, wormcyanpixmap, 12), (wormwhite, wormwhitepixmap, 16), (wormwhite2, wormwhite2pixmap, 16)] # 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 wormdatalist] # Make the animation list # Worm animations as list pairs (animation instances, fps) added animationlist = [(Worm(ledslaves[i], *wd[0]), wd[2]) for i, wd in enumerate(wormdatalist)] ledslaveb = LEDMatrix(DriverSlave(160, range(159, -1, -1), 0), width=16, height=10, threadedUpdate=False, masterBrightness=55) rain = MR.MatrixRain(ledslaveb, [colors.Green, colors.Cyan]) animationlist.append((rain, 10))
wavewhite = ((255, 255, 255), 1) # Wave slave driver arguments wavebluepixmap = pathgen(1, 15, 0, 9) waveredpixmap = pathgen(1, 14, 1, 8) 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)
# Worm arguments wormblue = (bluedimming, pathgen(5, 10, 0, 9), 1, 1) wormred = (reddimming, pathgen(1, 14, 1, 8), 1, 1) wormgreen = (greendimming, pathgen(2, 13, 2, 7), 1, 1) wormcyan = (cyandimming, pathgen(3, 12, 3, 6), 1, 1) wormwhite = (whitedimming, pathgen(4, 11, 4, 5), 1, 1) # List of pair (animation arguments, fps) wormdatalist = [(wormblue, 24), (wormred, 2), (wormgreen, 16), (wormcyan, 12), (wormwhite, 8)] # dummy strips must each have their own slavedriver as thread is attached # to the driver ledslaves = [ LEDStrip(DriverSlave(160), threadedUpdate=True) for _ in range(len(wormdatalist)) ] # Make the Worm animations an list pairs (animation, fps) wormlist = [(Worm(ledslaves[i], *d[0]), d[1]) for i, d in enumerate(wormdatalist)] ledslaveb = LEDMatrix(DriverSlave(160), width=16, height=10, threadedUpdate=True) bloom = BA.Bloom(ledslaveb) wormlist.append((bloom, 3)) masteranimation = MasterAnimation(ledmaster, [w._led for w, f in wormlist])
# Worm slave driver arguments wormbluepixmap = pathgen(3, 12, 0, 9) wormredpixmap = pathgen(4, 11, 1, 8) wormgreenpixmap = pathgen(5, 10, 2, 7) wormcyanpixmap = pathgen(6, 9, 3, 6) wormwhitepixmap = pathgen(7, 8, 4, 5) # List of triple (animation arguments, slavedriver argument, fps) wormdatalist = [(wormblue, wormbluepixmap, 20), (wormred, wormredpixmap, 20), (wormgreen, wormgreenpixmap, 19), (wormcyan, wormcyanpixmap, 21), (wormwhite, wormwhitepixmap, 16)] # dummy LED strips must each have their own slavedrivers ledslaves = [ LEDStrip(DriverSlave(len(sarg), pixmap=sarg, pixheights=-1), threadedUpdate=False, masterBrightness=255) for aarg, sarg, fps in wormdatalist ] # Make the animation list # Worm animations as list pairs (animation instances, fps) added animationlist = [(Worm(ledslaves[i], *wd[0]), wd[2]) for i, wd in enumerate(wormdatalist)] # needed to run on pixelweb def genParams(): return {"start": 0, "end": -1, "animcopies": animationlist}
bt = range(ind(nright, nbot), ind(nleft, nbot), -1) path = sleft + tp + sright + bt if len(path) == 0: path = [ind(nleft, nbot)] path = map(lambda x: (shift + x) % nled, path) log.logger.info("pathgen({}, {}, {}, {}, {}) is {}".format( nleft, nright, nbot, ntop, shift, path)) return path if __name__ == '__main__': drivermaster = DriverVisualizer(160, pixelSize=62, stayTop=False) # dummy strips must each have their own slavedriver as thread is attached # to the driver ledslaves = [ LEDStrip(DriverSlave(160, 0), threadedUpdate=True) for _ in range(5) ] ledmaster = LEDStrip(drivermaster, threadedUpdate=True) lnin = [255, 222, 200, 150, 125] bluedimming = [(0, 0, i) for i in lnin] reddimming = [(i, 0, 0) for i in lnin] greendimming = [(0, i, 0) for i in lnin] cyandimming = [(0, i, i) for i in lnin] whitedimming = [(i, i, i) for i in lnin] wormblue = Worm(ledslaves[0], bluedimming, pathgen(5, 10, 0, 9), 1, 1) wormred = Worm(ledslaves[1], reddimming, pathgen(1, 14, 1, 8), 1, 1) wormgreen = Worm(ledslaves[2], greendimming, pathgen(2, 13, 2, 7), 1, 1) wormcyan = Worm(ledslaves[3], cyandimming, pathgen(3, 12, 3, 6), 1, 1) wormwhite = Worm(ledslaves[4], whitedimming, pathgen(4, 11, 4, 5), 1, 1)
# Worm arguments wormblue = (bluedimming, pathgen(5, 10, 0, 9), 1, 1, 6) wormred = (reddimming, pathgen(1, 14, 1, 8), 1, 1, 2) wormgreen = (greendimming, pathgen(2, 13, 2, 7), 1, 1, 3) wormcyan = (cyandimming, pathgen(3, 12, 3, 6), 1, 1, 4) wormwhite = (whitedimming, pathgen(4, 11, 4, 5), 1, 1, 5) # List of pair (animation arguments, fps) wormdatalist = [(wormblue, 24), (wormred, 20), (wormgreen, 16), (wormcyan, 12), (wormwhite, 8)] #wormdatalist = [(wormwhite, 8)] #wormdatalist = [] # dummy strips must each have their own slavedriver as thread is attached # to the driver ledslaves = [LEDStrip(DriverSlave(160, pixheights=-1), threadedUpdate=True) for _ in range(len(wormdatalist))] # Make the Worm animations an list pairs (animation, fps) wormlist = [(Worm(ledslaves[i], *d[0]), d[1]) for i, d in enumerate(wormdatalist)] ledslaveb = LEDMatrix(DriverSlave(160, None, 0), width=16, height=10, threadedUpdate=True) bloom = BA.Bloom(ledslaveb) wormlist.append((bloom, 10)) def genParams(): return {"animcopies": wormlist} if __name__ == '__main__':
# Worm slavedriver argument for pixmap wormbluepixmap = pathgen(5, 10, 0, 9) wormredpixmap = pathgen(1, 14, 1, 8) wormgreenpixmap = pathgen(2, 13, 2, 7) wormcyanpixmap = pathgen(3, 12, 3, 6) wormwhitepixmap = pathgen(4, 11, 4, 5) # List of triple (animation arguments, slavedriver argument, fps) wormdatalist = [(wormblue, wormbluepixmap, 24), (wormred, wormredpixmap, 20), (wormgreen, wormgreenpixmap, 16), (wormcyan, wormcyanpixmap, 12), (wormwhite, wormwhitepixmap, 8)] # dummy LED strips must each have their own slavedriver as thread is attached # to the driver ledslaves = [LEDStrip(DriverSlave(len(sarg), pixmap=sarg, pixheights=-1), threadedUpdate=False) \ for aarg, sarg, fps in wormdatalist] # Make the animation list # 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))