示例#1
0
    def __init__(self, matrix, config):
        super(Art, self).__init__(matrix,
                                  self.generate,
                                  maxticks=20,
                                  interpolate=False)

        self.colormap = Colormap(130)
        self.colormap.flat(0, 130, BLACK)

        self.colormap.flat(20, 30, BLUE)
        self.colormap.flat(50, 60, YELLOW)
        self.colormap.flat(80, 90, RED)
        self.colormap.flat(110, 120, GREEN)

        self.colormap.soften()

        self.diamond.generate()
示例#2
0
    def __init__(self, matrix):
        self.diamond = DiamondSquare(matrix.width*16, matrix.height, (matrix.width+matrix.height)/4)
        self.matrix = OPCMatrix(matrix.width*16, matrix.height, None, zigzag=matrix.zigzag)
        self.colormap = Colormap(100)

        self.colormap.gradient( 0, 45, (0, 0, 200), (40, 40, 255))
        self.colormap.gradient(45, 50, (40, 40, 255), (240, 240, 10))
        self.colormap.gradient(50, 60, (80, 60, 40), (0, 255, 0))
        self.colormap.gradient(60, 80, (0, 255, 0), (0, 200, 0))
        self.colormap.gradient(80, 95, (0, 200, 0), (120, 120, 120))
        self.colormap.gradient(95, 100, (120, 120, 120), (255, 255, 255))
示例#3
0
文件: plasma2.py 项目: ak15199/rop
    def __init__(self, matrix, config):
        super(Art, self).__init__(matrix, self.generate, maxticks=20,
                                  interpolate=False)

        self.colormap = Colormap(130)
        self.colormap.flat(0, 130, BLACK)

        self.colormap.flat(20, 30, BLUE)
        self.colormap.flat(50, 60, YELLOW)
        self.colormap.flat(80, 90, RED)
        self.colormap.flat(110, 120, GREEN)

        self.colormap.soften()

        self.diamond.generate()
示例#4
0
    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
示例#5
0
文件: plasma2.py 项目: ak15199/rop
class Art(DiamondSquare):

    description = "Thin plasma using DiamondSquare and colormap rotation"

    def __init__(self, matrix, config):
        super(Art, self).__init__(matrix, self.generate, maxticks=20,
                                  interpolate=False)

        self.colormap = Colormap(130)
        self.colormap.flat(0, 130, BLACK)

        self.colormap.flat(20, 30, BLUE)
        self.colormap.flat(50, 60, YELLOW)
        self.colormap.flat(80, 90, RED)
        self.colormap.flat(110, 120, GREEN)

        self.colormap.soften()

        self.diamond.generate()

    def generate(self, matrix, diamond):
        self.colormap.rotate()
        self.diamond.translate(matrix, colormap=self.colormap)
示例#6
0
class Art(object):

    description = "Terrain traversal (experimental)"

    def __init__(self, matrix):
        self.diamond = DiamondSquare(matrix.width*16, matrix.height, (matrix.width+matrix.height)/4)
        self.matrix = OPCMatrix(matrix.width*16, matrix.height, None, zigzag=matrix.zigzag)
        self.colormap = Colormap(100)

        self.colormap.gradient( 0, 45, (0, 0, 200), (40, 40, 255))
        self.colormap.gradient(45, 50, (40, 40, 255), (240, 240, 10))
        self.colormap.gradient(50, 60, (80, 60, 40), (0, 255, 0))
        self.colormap.gradient(60, 80, (0, 255, 0), (0, 200, 0))
        self.colormap.gradient(80, 95, (0, 200, 0), (120, 120, 120))
        self.colormap.gradient(95, 100, (120, 120, 120), (255, 255, 255))

    def start(self, matrix):
        matrix.setFirmwareConfig(nointerp=True)
        self.x = 0
        self.diamond.generate(self.matrix, colormap=self.colormap)

    def refresh(self, matrix):
        matrix.copy(self.matrix, self.x, 0)
        self.x += 1

    def interval(self):
        return 60
示例#7
0
class Art(DiamondSquare):

    description = "Thin plasma using DiamondSquare and colormap rotation"

    def __init__(self, matrix, config):
        super(Art, self).__init__(matrix,
                                  self.generate,
                                  maxticks=20,
                                  interpolate=False)

        self.colormap = Colormap(130)
        self.colormap.flat(0, 130, BLACK)

        self.colormap.flat(20, 30, BLUE)
        self.colormap.flat(50, 60, YELLOW)
        self.colormap.flat(80, 90, RED)
        self.colormap.flat(110, 120, GREEN)

        self.colormap.soften()

        self.diamond.generate()

    def generate(self, matrix, diamond):
        self.colormap.rotate()
        self.diamond.translate(matrix, colormap=self.colormap)