def add_for_single_leaf(self, leaf):
     rand_leaf_color = self.get_rand_leaf_color()
     self.effects.append(
         SpikeEffect(
             leaf[0][::1 if self.direction_type ==
                     DirectionType.ALL_UP else -1],
             ConstTimedColor(rand_leaf_color), 0.5, self.max_height))
     self.effects.append(
         SpikeEffect(
             leaf[1][::1 if self.direction_type ==
                     DirectionType.ALL_DOWN else -1],
             ConstTimedColor(rand_leaf_color), 0.5, self.max_height))
Beispiel #2
0
 def set_is_input_mode(self, val):
     if self.is_input_mode == val:
         return
     if val:
         self.head_spike = SpikeEffect(self.sheep.get_head_indexes(), ConstTimedColor([255, 0, 0]), 1.0, len(self.sheep.get_head_indexes()), True)
     else:
         self.head_spike = None
     self.is_input_mode = val
Beispiel #3
0
 def add_effect_for_index(self, index, location_percent):
     start_t = random.uniform(0.0, 0.4)
     dark_time = 1.0 - random.uniform(0.00, 0.4)
     on_tot_time = dark_time - start_t
     on_start_t = start_t + random.uniform(0.1, on_tot_time / 2.0)
     on_end_t = dark_time - random.uniform(0.1, on_tot_time / 2.0)
     rgb_color = Colors.hls_to_rgb(random.random(), random.uniform(0, 0.5), 1.0)
     self.effects.append(
         StarEffect([index], ConstTimedColor(rgb_color), start_t, on_start_t, on_end_t, dark_time, location_percent))
Beispiel #4
0
 def set_is_input_mode(self, val):
     if self.is_input_mode == val:
         return
     if val:
         self.top_spike = SpikeEffect(self.top_pixels,
                                      ConstTimedColor([255, 0, 0]), 1.0,
                                      len(self.top_pixels), False)
     else:
         self.top_spike = None
     self.is_input_mode = val
Beispiel #5
0
    def __init__(self, sheep, props):
        SheepAnimation.__init__(self, sheep, props)

        stars_percent = props['stars_percent'] if props and 'stars_percent' in props else 0.1
        self.stars_per_cycle = int(stars_percent * len(sheep.get_all_indexes()))
        self.timed_color = ConstTimedColor([255, 255, 255])

        if self.props != None:
            if 'stars_color' in self.props:
                timed_color = TimedColorFactory(self.props['stars_color'])
                if timed_color is not None:
                    self.timed_color = timed_color

        self.previous_time = 1.0

        self.restart_effect()
Beispiel #6
0
    def __init__(self, lake, props):
        LakeAnimation.__init__(self, lake, props)
        self.effects = []

        self.previous_time = 0

        stars_percent = props[
            'stars_percent'] if props and 'stars_percent' in props else 0.1
        self.stars_per_cycle = int(stars_percent * len(self.lake.whole_lake))
        self.timed_color = ConstTimedColor([255, 255, 255])

        if self.props != None:
            if 'stars_color' in self.props:
                timed_color = TimedColorFactory(self.props['stars_color'])
                if timed_color is not None:
                    self.timed_color = timed_color

        self.restart_effect()