def static_red_green(self): red_green_segment = [(255, 20, 10), (255, 20, 10), (255, 20, 10), (255, 20, 10), (255, 20, 10), (255, 20, 10), (255, 20, 10), (255, 20, 10), (255, 20, 10), (255, 20, 10), (255, 20, 10), (255, 20, 10), (255, 20, 10), (255, 20, 10), (255, 20, 10), (255, 20, 10), (255, 20, 10), (255, 20, 10), (255, 20, 10), (255, 20, 10), (255, 20, 10), (255, 20, 10), (255, 20, 10), (255, 20, 10), (255, 20, 10), (255, 20, 10), (255, 20, 10), (255, 20, 10), (255, 20, 10), (229, 45, 8), (204, 71, 7), (180, 98, 6), (154, 124, 5), (129, 149, 4), (105, 176, 3), (79, 202, 2), (54, 228, 1), (30, 255, 0), (30, 255, 0), (30, 255, 0), (30, 255, 0), (30, 255, 0), (30, 255, 0), (30, 255, 0), (30, 255, 0), (30, 255, 0), (30, 255, 0), (30, 255, 0), (30, 255, 0), (30, 255, 0), (30, 255, 0), (30, 255, 0), (30, 255, 0), (30, 255, 0), (30, 255, 0), (30, 255, 0), (30, 255, 0), (30, 255, 0), (54, 228, 1), (79, 202, 2), (105, 176, 3), (129, 149, 4), (154, 124, 5), (180, 98, 6), (204, 71, 7), (229, 45, 8)] transition = SmoothBlend(self.strip) for led_num in range(self.strip.num_leds): transition.set_pixel( led_num, *(red_green_segment[led_num % len(red_green_segment)])) transition.blend()
def run(self): transition = SmoothBlend(self.strip) for led in range(self.strip.num_leds): normal_distance = led / (self.strip.num_leds - 1) component1 = linear_dim(self.p.value['color1'], 1 - normal_distance) component2 = linear_dim(self.p.value['color2'], normal_distance) led_color = add_tuples(component1, component2) transition.set_pixel(led, *led_color) transition.blend()
def run(self): transition = SmoothBlend(self.strip) for led in range(self.strip.num_leds): normal_distance = led / (self.strip.num_leds - 1) component1 = linear_dim(self.p['color1'], 1 - normal_distance) component2 = linear_dim(self.p['color2'], normal_distance) led_color = add_tuples(component1, component2) transition.set_pixel(led, *led_color) transition.blend()
def chunk_blendover(self, num_cycles: int = 1): transition = SmoothBlend(self.strip) chunk_size = 60 red = 255, 0, 0 green = 0, 255, 0 blendtime_sec = lambda: self.velocity pause_sec = lambda: 3 * self.velocity for _ in range(num_cycles): for led_num in range(self.strip.num_leds): if led_num % (2 * chunk_size) < 1.5 * chunk_size: transition.set_pixel(led_num, *red) else: transition.set_pixel(led_num, *green) transition.blend(blendtime_sec()) self.sleep(pause_sec()) for led_num in range(self.strip.num_leds): if led_num % (2 * chunk_size) < 0.5 * chunk_size: transition.set_pixel(led_num, *green) else: transition.set_pixel(led_num, *red) transition.blend(blendtime_sec()) self.sleep(pause_sec())
def static_red_green(self): red_green_segment = [(255, 20, 10), (255, 20, 10), (255, 20, 10), (255, 20, 10), (255, 20, 10), (255, 20, 10), (255, 20, 10), (255, 20, 10), (255, 20, 10), (255, 20, 10), (255, 20, 10), (255, 20, 10), (255, 20, 10), (255, 20, 10), (255, 20, 10), (255, 20, 10), (255, 20, 10), (255, 20, 10), (255, 20, 10), (255, 20, 10), (255, 20, 10), (255, 20, 10), (255, 20, 10), (255, 20, 10), (255, 20, 10), (255, 20, 10), (255, 20, 10), (255, 20, 10), (255, 20, 10), (229, 45, 8), (204, 71, 7), (180, 98, 6), (154, 124, 5), (129, 149, 4), (105, 176, 3), (79, 202, 2), (54, 228, 1), (30, 255, 0), (30, 255, 0), (30, 255, 0), (30, 255, 0), (30, 255, 0), (30, 255, 0), (30, 255, 0), (30, 255, 0), (30, 255, 0), (30, 255, 0), (30, 255, 0), (30, 255, 0), (30, 255, 0), (30, 255, 0), (30, 255, 0), (30, 255, 0), (30, 255, 0), (30, 255, 0), (30, 255, 0), (30, 255, 0), (30, 255, 0), (54, 228, 1), (79, 202, 2), (105, 176, 3), (129, 149, 4), (154, 124, 5), (180, 98, 6), (204, 71, 7), (229, 45, 8)] transition = SmoothBlend(self.strip) for led_num in range(self.strip.num_leds): transition.set_pixel(led_num, *(red_green_segment[led_num % len(red_green_segment)])) transition.blend()