Exemple #1
0
    def apply(self, time_percent):

        if time_percent < 0.5:
            c = time_percent * 0.25
        else:
            c = (1.0 - time_percent) * 0.25
        c = c +0.01
        c = math.pow(c, 0.5)

        for i in self.flower.get_leaves():
            self.flower.get_array()[i*3:i*3+3] = Colors.change_rgb_lightness([128, 0, 128], c)
        for i in self.flower.get_seeds():
            self.flower.get_array()[i*3:i*3+3] = Colors.change_rgb_lightness([255, 255, 0], c)
        for i in self.flower.bottom_parts:
            self.flower.get_array()[i*3:i*3+3] = Colors.change_rgb_lightness([0, 255, 0], c)
Exemple #2
0
 def apply(self, time_percent):
     for i in range(0, self.grass.num_of_leaves()):
         leaf = self.grass.get_leaves_array()[i]
         loc = self.grass.leaf_loc_percent(i)
         c = self.timed_color.get_color(time_percent, loc)
         brightness = self.loc_to_brightness(time_percent, loc) * self.global_brightness(time_percent)
         c = Colors.change_rgb_lightness(c, Colors.fix_lightness_percent(brightness))
         AlwaysOnEffect(leaf[0] + leaf[1], c).apply(time_percent, self.grass.get_array())
    def apply(self, time_percent):

        if time_percent < 0.5:
            c = time_percent * 0.25
        else:
            c = (1.0 - time_percent) * 0.25
        c = c + 0.01
        c = math.pow(c, 0.5)

        for i in self.tree.get_stem():
            self.tree.get_array()[i * 3:i * 3 +
                                  3] = Colors.change_rgb_lightness(
                                      [184, 134, 11], c)
        for i in self.tree.get_leaves():
            self.tree.get_array()[i * 3:i * 3 +
                                  3] = Colors.change_rgb_lightness([0, 255, 0],
                                                                   c)
Exemple #4
0
    def apply(self, time_precent, parent_array):

        if (time_precent < 0.5):
            power = time_precent * 2
        else:
            power = (1.0 - time_precent) * 2
        fixed_power = Colors.fix_lightness_percent(power)

        color = self.timed_color.get_color(time_precent, None)
        fixed_color = Colors.change_rgb_lightness(color, fixed_power)

        for i in self.indexes:
            parent_array[i*3 : i*3+3] = fixed_color
Exemple #5
0
    def apply(self, time_percent):

        if time_percent < 0.5:
            c = time_percent * 0.25
        else:
            c = (1.0 - time_percent) * 0.25
        c = c + 0.01
        c = math.pow(c, 0.5)

        for i in self.ui_element.get_all_indexes():
            self.ui_element.get_array()[i * 3:i * 3 +
                                        3] = Colors.change_rgb_lightness(
                                            self.color, c)
Exemple #6
0
    def apply(self, time_percent):

        if time_percent < 0.5:
            c = time_percent * 0.25
        else:
            c = (1.0 - time_percent) * 0.25
        c = c +0.01
        c = math.pow(c, 0.5)

        for i in self.sheep.get_all_indexes():
            self.sheep.get_array()[i*3:i*3+3] = Colors.change_rgb_lightness([64, 64, 64], c)

        if self.head_spike is not None:
            time_percent = (time_percent % 0.25) * 4.0
            self.head_spike.apply(time_percent, self.sheep.get_array())
Exemple #7
0
    def apply(self, time_precent, parent_array):

        if time_precent > self.dark_time:
            l = 0
        elif time_precent > self.on_time_end:
            l = (self.dark_time - time_precent) / (self.dark_time -
                                                   self.on_time_end)
        elif time_precent > self.on_time_start:
            l = random.uniform(0.8, 1.0)
        elif time_precent > self.start_time:
            l = (time_precent - self.start_time) / (self.on_time_start -
                                                    self.start_time)
        else:
            l = 0

        color = self.timed_color.get_color(time_precent, self.location_percent)
        fixed_color = Colors.change_rgb_lightness(
            color, Colors.fix_lightness_percent(l))

        for i in self.indexes:
            parent_array[i * 3:i * 3 + 3] = fixed_color
Exemple #8
0
 def get_color_for_index(self, time_percent, top_pixel, bottom_pixel, i):
     if i >= bottom_pixel and i <= top_pixel:
         i_percent = float(i - bottom_pixel) / float(top_pixel - bottom_pixel)
         return Colors.change_rgb_lightness(self.timed_color.get_color(time_percent, i_percent),
                                             Colors.fix_lightness_percent(i_percent))
     return None