from screenfactory import create_screen from modules.animation import * import config screen = create_screen() animation = Animation(screen, "animations/punksprite") while True: if config.virtual_hardware: pygame.time.wait(10) for event in pygame.event.get(): pass else: time.sleep(0.01)
start = time.clock() end = start + 1 while time.clock() <= end: self.zoom = 1 + 16 * ((time.clock() - start) / (end - start))**2 self.brightness = min(1, 1 - ((time.clock() - start) / (end - start))) self.draw() time.sleep(0.1) self.reset(redraw=False) def resume_animation(self): start = time.clock() end = start + 0.5 while time.clock() <= end: self.zoom = ((time.clock() - start) / (end - start)) self.brightness = min(1, 1 * ((time.clock() - start) / (end - start))) self.draw() self.reset() if __name__ == '__main__': menu = Menu(create_screen(), create_menu_items()) while True: menu.tick() time.sleep(0.01)
import pygame from modules.langtons_ant import LangtonsAnt from screenfactory import create_screen import time import config screen = create_screen() langtons_ant = LangtonsAnt(screen, rule="RLLR") langtons_ant.start() while True: if config.virtual_hardware: pygame.time.wait(10) for event in pygame.event.get(): pass else: time.sleep(0.001)
self.reset(redraw=False) def resume_animation(self): start = time.clock() end = start + 0.5 while time.clock() <= end: self.zoom = ((time.clock() - start) / (end - start)) self.brightness = min(1, 1 * ((time.clock() - start) / (end - start))) self.draw() self.reset() if __name__ == '__main__': menu = Menu(create_screen(), create_menu_items()) try: while True: menu.tick() pygame.time.wait(10) except KeyboardInterrupt: try: sys.stdout.close() except: pass try: sys.stderr.close() except: pass