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
def __init__(self, matrix, generate, maxticks=DFLTTICKS, interpolate=True): self.diamond = DiamondSquareAlgorithm(matrix.width, matrix.height) self.matrix = OPCMatrix(matrix.width, matrix.height, None) self.generate = generate self.ticks = 0 self.maxticks = maxticks self.interpolate = interpolate
def initialize(): global generator matrix = OPCMatrix(M_WIDTH, M_HEIGHT, "raw") arts = ImportPlugins("art", ["template.py"], [], matrix) if len(arts) == 0: matrix.terminate() print "Couldn't find any art to execute" exit(1) generator = frameGenerator(arts, matrix)
def __init__(self): matrix = OPCMatrix(M_WIDTH, M_HEIGHT, "echo", fliplr=True) arts = ImportPlugins("art", ["template.py"], [], None, matrix, config.config) if len(arts) == 0: matrix.terminate() print "Couldn't find any art to execute" exit(1) self.generator = self._frameGenerator(arts, matrix) self.packet = None
def __init__(self, matrix, config): self.angle = 0 self.hue = getHueGen(0.01) self.radius = sqrt(matrix.numpix) * self.FITHALF self.center = Point(matrix.midWidth, matrix.midHeight) self.pieslice = self._pieslice(-30, 30) # used to help with scaling small displays # freq will have a value of 1 for kilopix displays and hold a # larger value for smaller displays (up to 4) self.freq = min(4, max(1, 1024.0 / matrix.numpix)) self.clock = 0 # create mask self.mask = OPCMatrix(matrix.width, matrix.height, None) self.mask.fillPoly(self.pieslice, WHITE) matrix.fillPoly(self.pieslice, WHITE) # create intermediate buffers self.intermediate1 = OPCMatrix(matrix.width, matrix.height, None) self.intermediate2 = OPCMatrix(matrix.width, matrix.height, None) # create private buffer for final rendering before rotate/display self.private = OPCMatrix(matrix.width, matrix.height, None)
def main(): global matrix parser = argparse.ArgumentParser() parser.add_argument("-c", "--count", type=int, help="run for count cycles through all of the art", default=DFLT_CYCLE_COUNT) parser.add_argument("-f", "--fliptime", type=int, help="run art for FLIPTIME secs before transitioning", default=DFLT_FLIPTIME_SECS) parser.add_argument("-p", "--profile", help="switch on and report profiling detail", action="store_true") parser.add_argument("art", help="Optional list of arts", nargs="*") args = parser.parse_args() if args.profile: if args.count: prof.on() else: logging.error("Will not profile without --count being set") matrix = OPCMatrix(_v("WIDTH", 16), _v("HEIGHT", 16), _v("DRIVER", "ansi"), _v("ZIGZAG", False), _v("FLIPUP", False), _v("FLIPLR", False)) progress(0, 10) arts = ImportPlugins("art", [], args.art, progress, matrix, config.config) if len(arts) == 0: matrix.terminate() print("Couldn't find any art to execute") exit(1) run(arts, args) matrixDone() if args.profile: prof.dumptimings()
def __init__(self, matrix, config): self.width = matrix.width * SCALE self.height = matrix.height * SCALE self.matrix = OPCMatrix(self.width, self.height, None) self.diamond = DiamondSquareAlgorithm( self.matrix.width, self.matrix.height, (self.matrix.width + self.matrix.height) / 4) self.colormap = Colormap(palette=OrderedDict([ (rgb["NavyBlue"], 20), (rgb["blue"], 15), (rgb["yellow3"], 5), (rgb["LawnGreen"], 10), (rgb["ForestGreen"], 20), (rgb["gray50"], 15), (rgb["snow1"], 5), ])) self.diamond.generate() self.diamond.translate(self.matrix, colormap=self.colormap) self.matrix.blur() self.theta = 0 self.radius = 0
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 __init__(self, matrix, config): self.matrix = OPCMatrix(matrix.width, matrix.height, None) self.x = 5 self.hue = 0 self.ys = []