Beispiel #1
0
    def generate_splotch(cls, world_size, color=None, position=None):
        COLORS = [[255, 0, 0], [0, 255, 0], [0, 0, 255]]

        color = color or Pixel.from_tuple(COLORS[randint(0, len(COLORS) - 1)])

        if position is None:
            position = randint(0, world_size)

        radius = randint(0, 2)
        splotch = SolidEdgeSplotch(color, position, radius)

        #dynamic activity
        splotch.add_dynamic(
            ExpandFade(maximum_radius=10,
                       expansion_rate_ms=200,
                       destroy_on_max=True))

        return splotch
Beispiel #2
0
 def _process_arg_value(self, value):
     if str(value).startswith("Pixel|"):
         rgb = hex_to_RGB(value.split("|")[-1])
         return Pixel.from_tuple(rgb)
     return value