コード例 #1
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())
コード例 #2
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
コード例 #3
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
コード例 #4
0
ファイル: SpikeEffect.py プロジェクト: LedBurn/LedBurnLEDs
 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