def update(self): if self.ticks in self.pips: self.solid = self.pips.get(self.ticks) log.info(self.solid) self.brightness = 255 if self.solid > 0: self.solid -= 1 else: if self.brightness > 20: self.brightness = int(self.brightness * 0.7) else: self.brightness = 0 log.info(self.brightness) self.image.fill((self.brightness, self.brightness, self.brightness)) if self.ticks == get_fps() * 12: raise StopIteration self.ticks += 1
def __init__(self): self.rect = pygame.Rect((0, 0), MADRIX_SIZE) self.pip_count = 0 self.image = pygame.Surface(MADRIX_SIZE, pygame.SRCALPHA) self.ticks = 0 self.solid = 0 self.brightness = 0 self.pips = { 5 * get_fps(): int(get_fps() * SHORTPIP), 6 * get_fps(): int(get_fps() * SHORTPIP), 7 * get_fps(): int(get_fps() * SHORTPIP), 8 * get_fps(): int(get_fps() * SHORTPIP), 9 * get_fps(): int(get_fps() * SHORTPIP), 10 * get_fps(): int(get_fps() * LONGPIP) }
def __init__(self): self.rect = pygame.Rect((0, 0), MADRIX_SIZE) self.pip_count = 0 self.image = pygame.Surface(MADRIX_SIZE, pygame.SRCALPHA) self.ticks = 0 self.solid = 0 self.brightness = 0 self.pips = { 5*get_fps(): int(get_fps()*SHORTPIP), 6*get_fps(): int(get_fps()*SHORTPIP), 7*get_fps(): int(get_fps()*SHORTPIP), 8*get_fps(): int(get_fps()*SHORTPIP), 9*get_fps(): int(get_fps()*SHORTPIP), 10*get_fps(): int(get_fps()*LONGPIP) }