Example #1
0
class Phase(object):
    def __init__(self, matrix, direction, color):
        self.matrix = OPCMatrix(matrix.width, matrix.height, None)
        self.color = (color)
        self.angle = random() * pi
        self.freq = (random() + 0.5) * 0.06
        self.direction = direction
        self.x = 0 if direction == "left" else self.matrix.width - 1

    def clock(self, matrix):
        self.matrix.fade(0.96)
        self.matrix.scroll(self.direction)
        y = self.matrix.midHeight + self.matrix.midHeight * sin(self.angle)
        h = self.matrix.height / 8
        self.matrix.drawLine(self.x, y - h, self.x, y + h, self.color)
        self.angle += self.freq
        matrix.add(self.matrix)
Example #2
0
class Phase(object):
    def __init__(self, matrix, direction, color):
        self.matrix = OPCMatrix(matrix.width, matrix.height, None)
        self.color = color
        self.angle = random() * pi
        self.freq = (random() + 0.5) * 0.06
        self.direction = direction
        self.x = 0 if direction == "left" else self.matrix.width - 1

    def clock(self, matrix):
        self.matrix.fade(0.96)
        self.matrix.scroll(self.direction)
        y = self.matrix.midHeight + self.matrix.midHeight * sin(self.angle)
        h = self.matrix.height / 8
        self.matrix.drawLine(self.x, y - h, self.x, y + h, self.color)
        self.angle += self.freq
        matrix.add(self.matrix)
Example #3
0
class Phase(object):
    def __init__(self, matrix, direction, color):
        self.matrix = OPCMatrix(matrix.width, matrix.height, None)
        self.color = (color)
        self.angle = random() * pi
        self.freq = (random() + 0.5) * 0.06
        self.direction = direction
        self.y = 0 if direction == "up" else self.matrix.height - 1
        #self.x = self.matrix.width/2 if direction == "left" else self.matrix.width/2+1

    def clock(self, matrix):
        self.matrix.fade(0.96)
        self.matrix.scroll(self.direction)
        x = self.matrix.midWidth + self.matrix.midWidth * sin(self.angle)
        w = self.matrix.width / 8
        self.matrix.drawLine(x - w, self.y, x + w, self.y, self.color)
        self.angle += self.freq
        matrix.add(self.matrix)
Example #4
0
class Phase(object):

    def __init__(self, matrix, direction, color):
        self.matrix = OPCMatrix(matrix.width, matrix.height, None)
        self.color = (color)
        self.angle = random()*pi
        self.freq = (random()+0.5)*0.06
        self.direction = direction
        self.y = 0 if direction == "up" else self.matrix.height-1
        #self.x = self.matrix.width/2 if direction == "left" else self.matrix.width/2+1

    def clock(self, matrix):
        self.matrix.fade(0.96)
        self.matrix.scroll(self.direction)
        x = self.matrix.midWidth + self.matrix.midWidth*sin(self.angle)
        w = self.matrix.width/8
        self.matrix.drawLine(x-w, self.y, x+w, self.y, self.color)
        self.angle += self.freq
        matrix.add(self.matrix)