self.img[h][x] = 44 * (r&1) r >>= 1 for y in range(h): for x in range(w): s = 0 for dx in (-1, 0, 1): if 0 <= x+dx < w: s += self.img[y+1][(x+dx)%w] self.img[y][x] = (self.img[y][x]>>1) + (self.img[y][x]>>2) + self.mapping[min(s,255)] #self.img[y][x] = (self.img[y][x]>>1) + self.mapping[min(s,255)] img = [ self.img[y][x] for y in range(self.h) for x in range(self.w) ] return b''.join( self.colortab[ img[ix] ] for ix in self.map ) if __name__ == '__main__': pos = calcpos.flatten(calcpos.positions) s = VirtualScreen(windowsize=(500, 500), positions=pos) a = Fire(8, 8) fps = 25. metronome = sync.Metronome(fps) metronome.start() while True: s.push_data(a.next()) metronome.sync()
for details about the copyright. """ """ Simple ``move'' animation. Use w,a,s,d to move, q to stop""" import led import sync import curses s = led.LedScreen() ci = CursesInput() pos = (0, 0) lastch = -1 metronome = sync.Metronome(fps=25.) metronome.start() try: while True: for x in range(12): for y in range(10): s[(x, y)] = 25, 25, 25 # Set our pos s[(pos[0], pos[1])] = 255, 0, 0 f = ci.poll() # quit if f == q if f == 'q': break