class Phase(object): def __init__(self, matrix, color): self.matrix = OPCMatrix(matrix.width, matrix.height, None) self.color = color self.angle = random() * pi self.freq = (random() + 0.5) * 0.6 def clock(self, matrix): w = self.matrix.width h = self.matrix.height self.matrix.clear(self.color) for x in range(0, w, w / 4): self.matrix.fillRect(x, 0, w / 8, h, BLACK) for y in range(0, h, h / 4): self.matrix.fillRect(0, y, w, h / 8, BLACK) self.matrix.rotate(self.angle) self.angle += self.freq matrix.add(self.matrix)
class Phase(object): def __init__(self, matrix, color): self.matrix = OPCMatrix(matrix.width, matrix.height, None) self.color = color self.angle = random()*pi self.freq = (random()+0.5)*0.6 def clock(self, matrix): w = self.matrix.width h = self.matrix.height self.matrix.clear(self.color) for x in range(0, w, w/4): self.matrix.fillRect(x, 0, w/8, h, BLACK) for y in range(0, h, h/4): self.matrix.fillRect(0, y, w, h/8, BLACK) self.matrix.rotate(self.angle) self.angle += self.freq matrix.add(self.matrix)