class Art(ArtBaseClass): description = "Barber-pole-esque (dirty)" def __init__(self, matrix, config): self.matrix = OPCMatrix(matrix.width, matrix.height, None) self.x = 5 self.hue = 0 self.ys = [] def start(self, matrix): self.ys = [random() for y in range(matrix.height)] def refresh(self, matrix): self.matrix.clear() self.hue += 1.0/(6*4*matrix.width) for y, z in enumerate(self.ys): val = (1+sin(radians(360*z)))/2 self.matrix.drawPixel(self.x, y, hsvToRgb(self.hue, 1, val)) self.ys = [y+0.08*random() for y in self.ys] self.x = (self.x+1)%matrix.width self.matrix.maskbelow(55, BLACK) matrix.fade(0.99) matrix.add(self.matrix) def interval(self): return 120
class Art(ArtBaseClass): description = "Barber-pole-esque (dirty)" def __init__(self, matrix, config): self.matrix = OPCMatrix(matrix.width, matrix.height, None) self.x = 5 self.hue = 0 self.ys = [] def start(self, matrix): self.ys = [random() for y in range(matrix.height)] def refresh(self, matrix): self.matrix.clear() self.hue += 1.0 / (6 * 4 * matrix.width) for y, z in enumerate(self.ys): val = (1 + sin(radians(360 * z))) / 2 self.matrix.drawPixel(self.x, y, hsvToRgb(self.hue, 1, val)) self.ys = [y + 0.08 * random() for y in self.ys] self.x = (self.x + 1) % matrix.width self.matrix.maskbelow(55, BLACK) matrix.fade(0.99) matrix.add(self.matrix) def interval(self): return 120
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)