コード例 #1
0
    def step(self, amt=1):
        self._led.all_off()

        self._last = self._start + self._step

        for j in range(0, self._num_segments):
            self._led.set((j * self._segment_size) + self._last, self._color)

        for i in range(self._tail):
            for j in range(0, self._num_segments):
                base_led = j * self._segment_size
                top_led = (j + 1) * self._segment_size
                lower_led = base_led + self._last - i
                if lower_led >= base_led:
                    self._led.set(
                        lower_led,
                        colors.color_scale(self._color,
                                           255 - (self._fadeAmt * i)))
                upper_led = base_led + self._last + i
                if upper_led < top_led:
                    self._led.set(
                        upper_led,
                        colors.color_scale(self._color,
                                           255 - (self._fadeAmt * i)))

        if self._start + self._step >= self._segment_size - 1:
            self._direction = -self._direction
        elif self._step <= 0:
            self._direction = -self._direction

        self._step += self._direction * amt
コード例 #2
0
    def step(self, amt=1):
        self._ledcolors = [(0, 0, 0) for i in range(self._size)]
        self.layout.all_off()

        for i in range(0, 3):
            self._currentpos[i] = self._start + self._steps[i]

            # average the colors together so they blend
            self._ledcolors[self._currentpos[i]] = map(
                lambda x, y: (x + y) // 2, self._color[i],
                self._ledcolors[self._currentpos[i]])
            for j in range(1, self._tail):
                if self._currentpos[i] - j >= 0:
                    self._ledcolors[self._currentpos[i] - j] = map(
                        lambda x, y: (x + y) // 2,
                        self._ledcolors[self._currentpos[i] - j],
                        colors.color_scale(self._color[i],
                                           255 - (self._fadeAmt * j)))
                if self._currentpos[i] + j < self._size:
                    self._ledcolors[self._currentpos[i] + j] = map(
                        lambda x, y: (x + y) // 2,
                        self._ledcolors[self._currentpos[i] + j],
                        colors.color_scale(self._color[i],
                                           255 - (self._fadeAmt * j)))
            if self._start + self._steps[i] >= self._end:
                self._direction[i] = -1
            elif self._start + self._steps[i] <= 0:
                self._direction[i] = 1

            # advance each searchlight at a slightly different speed
            self._steps[i] += self._direction[i] * amt * int(
                random.random() > (i * 0.05))

        for i, thiscolor in enumerate(self._ledcolors):
            self.layout.set(i, thiscolor)
コード例 #3
0
ファイル: stripeclock.py プロジェクト: hebrinkmann/lights
    def step(self, amt=1):
        now = datetime.datetime.now()
        minute = now.minute
        hour = now.hour + now.minute / 60.0

        if hour < 6.0:
            backgroundColor = self._color2
        elif hour < 18.0:
            backgroundColor = self._backgroundColor
        elif hour < 20.0:
            a = int(math.floor(max(0.0, (hour - 18.0) * 128.0)))
            backgroundColor = self._myadd(
                colors.color_scale(self._backgroundColor, 255 - a), colors.color_scale(self._color1, a)
            )
        elif hour < 22.0:
            a = int(math.floor(max(0.0, (hour - 20.0) * 128.0)))
            backgroundColor = self._myadd(
                colors.color_scale(self._color1, 255 - a), colors.color_scale(self._color2, a)
            )
        else:
            backgroundColor = self._color2

        height_f = 6 * minute / 60
        y = int(math.floor(height_f))
        fraction = height_f - y

        led = self._led
        led.fillScreen(backgroundColor)
        led.drawLine(0, y, led.width - 1, y, self._color)

        self._step += amt
コード例 #4
0
    def step(self, amt=1):
        self.layout.all_off()
        self.pick_led(self.speed)

        for i, val in enumerate(self.pixels):
            p_dir, p_color, p_level = val
            if p_dir == 1:
                p_level += self.speed
                if p_level > 255:
                    p_level = 255
                    p_dir = 2  # start dimming
                self.layout._set_base(i,
                                      bp_colors.color_scale(p_color, p_level))
            elif p_dir == 2:
                p_level -= self.speed
                if p_level < 0:
                    p_level = 0
                    p_dir = 0  # turn off
                self.layout._set_base(i,
                                      bp_colors.color_scale(p_color, p_level))

            self.pixels[i] = (p_dir, p_color, p_level)

        self._step += amt
        delay_time = MidiTransform.remap_cc_value(self.delay_control, 0, 1)
        time.sleep(delay_time)
コード例 #5
0
ファイル: leuchtturm.py プロジェクト: hebrinkmann/lights
 def __init__(self, led, start=0, end=-1, period = 20):
     #The base class MUST be initialized by calling super like this
     super(Leuchtturm, self).__init__(led, start, end)
     self._period = period
     #Create a color array to use in the animation
     redColor = colors.color_scale(colors.Red, 140)
     whiteColor = colors.color_scale(colors.White, 100)
     self._colors = [ redColor, whiteColor, redColor, whiteColor, redColor, colors.Off]
コード例 #6
0
    def step(self, amt=1):
        """step the animation forward."""
        # self._internalDelay = 35
        leds = self._size
        num_sections = len(self._color_array)
        section_len = leds / num_sections

        # clear the strip
        # self._led.fill((0, 0, 0), self._start, self._end)

        section_count = 0
        for color in self._color_array:
            curr_section_start = self._start + (section_count * section_len)

            if section_count == num_sections:
                curr_section_end = self._end
            else:
                curr_section_end = ((section_count + 1) * section_len) - 1

            # fill section with 25% brightness
            base_brightness = 60
            fill_color = colors.color_scale(color, base_brightness)
            self._led.fill(fill_color, curr_section_start, curr_section_end)

            # leader LED pos
            leader = self._step + curr_section_start

            # % of strip that should be trailers
            trailers_len = section_len / 3

            # set the leader
            self._led.set(leader, color)

            # trailer brightness steps
            b_step = (255 - base_brightness) / trailers_len

            # set the trailers
            for x in range(0, trailers_len):
                curr_trailer_index = leader - x
                # wrap-around
                if curr_trailer_index < curr_section_start:
                    curr_trailer_index = curr_section_end - \
                        abs(curr_trailer_index - curr_section_start)

                trailer_brightness = (
                    b_step * (trailers_len - x)) + base_brightness
                scaled_color = colors.color_scale(color, trailer_brightness)
                self._led.set(curr_trailer_index, scaled_color)

            section_count += 1

        self._step += amt
        if self._step > section_len:
            self._step = 0
コード例 #7
0
    def rain(self):

        if not self._rainTiming:
            self._rainTiming = random.randint(1, 5)

            numCols = random.randint(0, 3)
            cols = random.sample([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], numCols)

            for col in cols:
                temp = [0]
                temp.extend(self._rainCols[col])
                self._rainCols[col] = temp

            # self._rainCols[0].append(3)

        for colIdx, col in enumerate(self._rainCols):
            if col:  # Is this column active?
                addressed = {}
                for valIdx, val in enumerate(
                        col):  # Which elements in the column are active?
                    for packetIdx, packet in enumerate(individualCol[colIdx]):
                        if (colIdx == 0
                                or colIdx == 9) and 0 <= val - packetIdx <= 3:
                            addressed[packetIdx] = True
                            color = color_scale(
                                self._rainColor,
                                int(255 - 63 * (val - packetIdx)))
                            for point in packet:
                                self.layout.set(point, color)
                        elif packetIdx <= val and 0 <= val - packetIdx <= 3:
                            addressed[packetIdx] = True
                            color = color_scale(
                                self._rainColor,
                                int(255 - 63 * (val - packetIdx)))
                            for point in packet:
                                self.layout.set(point, color)
                        else:
                            if not packetIdx in addressed:
                                for point in packet:
                                    self.layout.setOff(point)

                    if (colIdx == 0 or colIdx
                            == 9) and self._rainCols[colIdx][valIdx] == 9:
                        self._rainCols[colIdx].remove(
                            9)  # First and last column only have 4 elements
                    elif self._rainCols[colIdx][valIdx] == 10:
                        self._rainCols[colIdx].remove(
                            10)  # Every other column has 5 elements
                    else:
                        self._rainCols[colIdx][valIdx] += 1

        self._rainTiming -= 1
コード例 #8
0
ファイル: lights.py プロジェクト: Lukanite/VCULights
	def setlights(self,substart, count):
		if (count > 8):
			count = 8
		if (count > 0):
			for j in range(count): #8 LEDS per indicator
				self._led.set(substart + j, colors.Red)
			if ((self._step/6)%2): #flash at 5fps
				for k in range(count, 8):
					self._led.set(substart + k, colors.color_scale((255,100,25),255))
			else: #all off
				for k in range(count, 8):
					self._led.set(substart + k, colors.color_scale((255,100,0),0))
		else: #no problems
					self._led.set(substart + (self._step/6)%8, colors.Green)
コード例 #9
0
    def step(self, amt = 1):
        self._led.all_off()

        self._last = self._start + self._step
        self._led.set(self._last, self._color)

        for i in range(self._tail):
            self._led.set(self._last - i, colors.color_scale(self._color, 255 - (self._fadeAmt * i)))
            self._led.set(self._last + i, colors.color_scale(self._color, 255 - (self._fadeAmt * i)))

        if self._start + self._step >= self._end:
            self._direction = -self._direction
        elif self._step <= 0:
            self._direction = -self._direction

        self._step += self._direction * amt
コード例 #10
0
    def step(self, amt=1):
        num_colors = int(MidiTransform.remap_cc_value(self.color_control, 1, 10))
        hue = int(MidiTransform.remap_cc_value(self.color_control, 1, 255))

        levels_count = int(MidiTransform.remap_cc_value(self.width_control, 5, 25))
        self._levels = self.wave_range(30, 255, levels_count)

        if num_colors > 1:
            hues = bp_colors.hue_gradient(0, hue, num_colors)
        else:
            hues = [hue]

        self._colors = list(map(lambda x: bp_colors.hue2rgb(x), hues))

        self._level_count = len(self._levels)
        self._color_count = len(self._colors)

        if self._step > self._level_count * self._color_count:
            self._step = 0

        c_index = (self._step // self._level_count) % self._color_count
        l_index = (self._step % self._level_count)

        color = self._colors[c_index]

        self.layout.fill(bp_colors.color_scale(color, self._levels[l_index]), self._start, self._end)

        self._step += amt

        delay_time = MidiTransform.remap_cc_value(self.delay_control, 0, 1)
        time.sleep(delay_time)
コード例 #11
0
    def __init__(self,
                 led,
                 imagePath,
                 offset=(0, 0),
                 bgcolor=colors.Off,
                 brightness=255):
        """Helper class for displaying image animations for GIF files or a set of bitmaps

        led - LEDMatrix instance
        imagePath - Path to either a single animated GIF image or folder of sequential bitmap files
        offset - X,Y tuple coordinates at which to place the top-left corner of the image
        bgcolor - RGB tuple color to replace any transparent pixels with. Avoids transparent showing as black
        brightness - Brightness value (0-255) to scale the image by. Otherwise uses master brightness at the time of creation
        """
        super(ImageAnim, self).__init__(led)

        self._bright = brightness
        if self._bright == 255 and led.masterBrightness != 255:
            self._bright = led.masterBrightness

        self._bgcolor = colors.color_scale(bgcolor, self._bright)
        self._offset = offset
        self._images = []
        self._count = 0

        if imagePath.endswith(".gif"):
            log.logger.info("Loading {0} ...".format(imagePath))
            img = Image.open(imagePath)
            if self._offset == (0, 0):
                w = 0
                h = 0
                if img.size[0] < self._led.width:
                    w = (self._led.width - img.size[0]) / 2
                if img.size[1] < self._led.height:
                    h = (self._led.height - img.size[1]) / 2
                self._offset = (w, h)

            for frame in ImageSequence.Iterator(img):
                self._images.append(
                    self._getBufferFromImage(frame, self._offset))
                self._count += 1
        else:
            imageList = glob.glob(imagePath + "/*.bmp")
            imageList.sort()

            self._count = len(imageList)
            if self._count == 0:
                raise ValueError("No images found!")

            for img in imageList:
                if self._offset == (0, 0):
                    if img.size[0] < self._led.width:
                        self._offset[0] = (self._led.width - img.size[0]) / 2
                    if img.size[1] < self._led.height:
                        self._offset[1] = (self._led.height - img.size[1]) / 2

                self._images.append(self._getBufferFromPath(img, self._offset))

        self._curImage = 0
コード例 #12
0
    def step(self, amt=1):
        led = self._led
        led.all_off()

        now = util.getNow()

        led.fillScreen(util.getSunColor(now))

        text = str(now.hour)
        (width, height) = font.str_dim(text, '6x4', final_sep=False)
        led.drawText(str(now.hour),
                     x=math.floor((led.width - width) / 2),
                     y=math.floor((led.height - height) / 2),
                     color=self.digitColor,
                     bg=None,
                     font='6x4')

        self.minutex = self.minutex * .25 + led.width * (
            now.minute * 60 + now.second) / 3600 * 0.75
        self.secondx = self.secondx * .25 + led.width * now.second / 60 * 0.75

        for x in range(0, led.width):
            minuteLevel = 128 - (x - self.minutex) * (x - self.minutex) * 60
            if minuteLevel < 0:
                minuteLevel = 0

            secondLevel = 128 - (x - self.secondx) * (x - self.secondx) * 60
            if (secondLevel < 0):
                secondLevel = 0

            pointerColor = colors.color_blend(
                colors.color_scale(colors.DarkGreen, secondLevel),
                colors.color_scale(colors.DarkRed, minuteLevel))
            if minuteLevel > secondLevel:
                pointerLevel = minuteLevel
            else:
                pointerLevel = secondLevel

            for y in range(0, led.height):
                color = colors.color_blend(
                    colors.color_scale(led.get(x, y), 256 - pointerLevel),
                    colors.color_scale(pointerColor, pointerLevel))

                led.set(x, y, color)

        self._step += amt
コード例 #13
0
ファイル: benchmark.py プロジェクト: GeorgeIoak/BiblioPixel
    def step(self, amt = 1):
        for y in range(h):
			for x in range(w):
				c = colors.hue2rgb_360(self._step)
				led.set(x, y, c)
				c = led.get(x, y)
				c = colors.hsv2rgb_rainbow((c[2], c[0], c[1]))
				c = colors.hue2rgb_rainbow(c[0])
				c = colors.hue2rgb_spectrum(c[1])
				c = colors.hue2rgb_raw(c[2])
				c = colors.color_scale(c, c[0])
				c = colors.color_scale(c, c[1])
				c = colors.color_scale(c, c[2])
				led.set(x, y, c)

        self._step += 1
        if self._step >= 360:
        	self._step = 0
コード例 #14
0
    def step(self, amt = 1):
        if self._step > self._level_count * self._color_count:
            self._step = 0

        c_index = (self._step / self._level_count) % self._color_count
        l_index = (self._step % self._level_count)
        color = self._colors[c_index];
        self._led.fill(colors.color_scale(color, self._levels[l_index]), self._start, self._end)

        self._step += amt
コード例 #15
0
ファイル: test.py プロジェクト: hebrinkmann/lights
    def step(self, amt = 1):
	for i in range(self._led.numLEDs):
		color = colors.color_scale(self._led.get(i), 245)
		
		if i == (self._step % self._led.numLEDs):
			color = colors.color_blend(color, colors.hue2rgb_spectrum(self._step % 127))

		self._led.set(i, color);
        #Increment the internal step by the given amount
        self._step += amt
コード例 #16
0
ファイル: fadedown.py プロジェクト: hebrinkmann/lights
    def step(self, amt = 1):
        passedTime = time.time() - self._startTime
        height_f = 6 - 6 * (passedTime) / self._duration
        y = int(math.floor(height_f))
        fraction = height_f - y
        fraction_255 = int(255 * fraction)

        led = self._led
        led.drawLine(0, y, led.width - 1, y, colors.color_scale(self._color, fraction_255))

        self._step += amt
コード例 #17
0
    def __init__(self, led, imagePath, offset=(0, 0), bgcolor=colors.Off, brightness=255):
        """Helper class for displaying image animations for GIF files or a set of bitmaps

        led - LEDMatrix instance
        imagePath - Path to either a single animated GIF image or folder of sequential bitmap files
        offset - X,Y tuple coordinates at which to place the top-left corner of the image
        bgcolor - RGB tuple color to replace any transparent pixels with. Avoids transparent showing as black
        brightness - Brightness value (0-255) to scale the image by. Otherwise uses master brightness at the time of creation
        """
        super(ImageAnim, self).__init__(led)

        self._bright = brightness
        if self._bright == 255 and led.masterBrightness != 255:
            self._bright = led.masterBrightness

        self._bgcolor = colors.color_scale(bgcolor, self._bright)
        self._offset = offset
        self._images = []
        self._count = 0

        if imagePath.endswith(".gif"):
            log.logger.info("Loading {0} ...".format(imagePath))
            img = Image.open(imagePath)
            if self._offset == (0, 0):
                w = 0
                h = 0
                if img.size[0] < self._led.width:
                    w = (self._led.width - img.size[0]) / 2
                if img.size[1] < self._led.height:
                    h = (self._led.height - img.size[1]) / 2
                self._offset = (w, h)

            for frame in ImageSequence.Iterator(img):
                self._images.append(
                    self._getBufferFromImage(frame, self._offset))
                self._count += 1
        else:
            imageList = glob.glob(imagePath + "/*.bmp")
            imageList.sort()

            self._count = len(imageList)
            if self._count == 0:
                raise ValueError("No images found!")

            for img in imageList:
                if self._offset == (0, 0):
                    if img.size[0] < self._led.width:
                        self._offset[0] = (self._led.width - img.size[0]) / 2
                    if img.size[1] < self._led.height:
                        self._offset[1] = (self._led.height - img.size[1]) / 2

                self._images.append(self._getBufferFromPath(img, self._offset))

        self._curImage = 0
コード例 #18
0
ファイル: stripeclock.py プロジェクト: hebrinkmann/lights
    def __init__(self, led, start=0, end=-1, backgroundColor=colors.White, clockColor=colors.Red):
        # The base class MUST be initialized by calling super like this
        super(StripeClock, self).__init__(led, start, end)
        self._backgroundColor = backgroundColor
        self._color = colors.color_blend(colors.color_scale(backgroundColor, 128), clockColor)
        self._color1 = (255, 212, 125)
        self._color2 = (245, 135, 76)
        self._myadd = lambda xs, ys: tuple(x + y for x, y in izip(xs, ys))

        print "Clock color:" + str(self._color)
        print "Background color:" + str(self._backgroundColor)
コード例 #19
0
ファイル: leuchtturm.py プロジェクト: hebrinkmann/lights
    def lightToX(self, x):
        direction = time.time() / self._period * self._led.width % self._led.width

        if 2 * (direction - x) > self._led.width:
            direction -= self._led.width

        if 2 * (x - direction) > self._led.width:
            direction += self._led.width

        intensity = int(255 - max(0, min(255, 128 * ((x - direction)) ** 2)))
        return colors.color_scale(colors.Orange, intensity)
コード例 #20
0
ファイル: ledstrip.py プロジェクト: cheetahray/Shanghai
 def rayanim(self,r,g,b,bright,animpos,animtime):
     self._bright = bright 
     self._color = colors.color_scale((b,r,g), self._bright)
     self.__sleeptime = animtime / ( math.fabs(self.__lastpos - animpos) + 4 )
     self.__animpos = animpos
     for i in range(self.__lastpos):
         self._led.set(i, self._color)
     self.__isartnet = False
     self.__interrupt = True
     self.__cv.acquire()
     self.__cv.notify()
     self.__cv.release()
コード例 #21
0
    def step(self, amt=1):
        self.layout.all_off()

        self._randomness = int(
            MidiTransform.remap_cc_value(self.randomness_control, 0,
                                         self._max_randomness))

        scaled_tail = int(
            MidiTransform.remap_cc_value(self.count_control, self._min_tail,
                                         self._max_tail))
        self._tail = scaled_tail

        scaled_fade = int(
            MidiTransform.remap_cc_value(self.utility_control_two, 1, 500))
        self._fadeAmt = scaled_fade // self._tail

        self.get_color()

        self._last = self._start + self._step
        self.layout.set(self._last, self._color)

        for i in range(self._tail):
            self.layout.set(
                self._last - i,
                bp_colors.color_scale(self._color, 255 - (self._fadeAmt * i)))
            self.layout.set(
                self._last + i,
                bp_colors.color_scale(self._color, 255 - (self._fadeAmt * i)))

        if self._start + self._step >= self._end:
            self._direction = -self._direction
        elif self._step <= 0:
            self._direction = -self._direction

        self._step += self._direction * amt

        delay_time = MidiTransform.remap_cc_value(self.delay_control, 0, 1)
        time.sleep(delay_time)

        self._random_counter = (self._random_counter + 1) % 30
コード例 #22
0
ファイル: test.py プロジェクト: drnikki/addressable-LED
def getLEDColor(event):
    # https://github.com/ManiacalLabs/BiblioPixel2/wiki/Colors-Module
    c = (0, 0, 255)

    # light purpley: ((0,255,255))
    # blue: ((0,0,255))
    # turquoise: (255,0,255))
    # red: (0,255, 0)

    if (event["Race"] == "White"):
        c = (255, 255, 255)
    if (event["Race"] == "Mexican"):
        c = (255, 0, 255)
    if (event["Race"] == "Indian" or event["Race"] == "navajo"):
        c = (0, 255, 255)

    if (event["Age"] > 18):
        c = colors.color_scale(c, 50)
    else:
        c = colors.color_scale(c, 100)

    return c
コード例 #23
0
    def get_color(self):
        if self.use_rgb:
            self._color = ColorMidiUtils.three_cc_to_color(
                self.red_control, self.green_control, self.blue_control)

        if self._random_counter == 0:
            self._random_seed = (self.color_control +
                                 random.randint(0, self._randomness)) % 127

        color = ColorMidiUtils.one_cc_to_color(self._random_seed)
        c_lev = MidiTransform.remap_cc_value(self.brightness_control, 0, 256)

        self._color = bp_colors.color_scale(color, c_lev)
コード例 #24
0
ファイル: twinkle.py プロジェクト: Tashus/beam
    def pick_led(self, speed):
        idx = random.randrange(0, self.layout.numLEDs)
        p_dir, p_color, p_level = self.pixels[idx]

        if random.randrange(0, 100) < self.density:
            if p_dir == 0:  # 0 is off
                p_level += speed
                p_dir = 1  # 1 is growing
                p_color = random.choice(self.colors)
                self.layout._set_base(idx,
                                      color_util.color_scale(p_color, p_level))

                self.pixels[idx] = p_dir, p_color, p_level
コード例 #25
0
 def step(self, amt=1):
     self.layout.all_off()
     t = time.localtime()
     for h in self.hands:
         segs = h['segments']
         point = (360 / segs) * (getattr(t, h['key']) % segs)
         self.layout.set(h['ring'], point, h['color'])
         if h['tail'] > 0:
             for i in range(h['tail']):
                 scaled = colors.color_scale(h['color'],
                                             255 - ((256 // h['tail']) * i))
                 self.layout.set(h['ring'], point + i, scaled)
                 self.layout.set(h['ring'], point - i, scaled)
コード例 #26
0
    def get_color(self):
        color_seed = MidiTransform.remap_cc_value(self.color_control, 0, 10)
        amount_change = MidiTransform.remap_cc_value(self.utility_control_one,
                                                     0.1, 5)
        if amount_change == 5:
            amount_change = 0

        base_color = (self._color_number + color_seed) % 359
        self._color_number = (base_color + amount_change) % 359

        color = bp_colors.hue2rgb_360(self._color_number)
        c_lev = MidiTransform.remap_cc_value(self.brightness_control, 0, 256)

        self._color = bp_colors.color_scale(color, c_lev)
コード例 #27
0
    def get_color(self):
        if self.use_rgb:
            color = ColorMidiUtils.three_cc_to_color(self.red_control,
                                                     self.green_control,
                                                     self.blue_control)
        else:
            color = ColorMidiUtils.one_cc_to_color(self.color_control)
            # allow animation to be set at white at the top of a controller
            if self.color_control == 127:
                color = bp_colors.White

        brightness_level = MidiTransform.remap_cc_value(
            self.brightness_control, 0, 256)
        self._color = bp_colors.color_scale(color, brightness_level)
コード例 #28
0
ファイル: lights.py プロジェクト: Lukanite/VCULights
	def progressbar(self): #Max 288 steps
		numlit = (((30-timerun)*10)/30)
		if (dataerror != 0): #flash red
			if ((self._step/6)%2): #flash at 5fps
				for n in range(10):
					self._led.set(47-n,colors.Red)
			else:
				for n in range(10):
					self._led.set(47-n,colors.color_scale((255,100,0),0))
		else:
			if (timerun < 29): 
				self._led.set(37,colors.Green) #Start indicator
				for m in range(numlit,10):
					self._led.set(47-m,colors.color_scale((255,100,0),0))
				for l in range(numlit):
					self._led.set(47-l,colors.color_scale((255-(255*timerun/30),255-(255*timerun/30),255),255))
			else:
				if ((self._step/6)%2): #flash at 5fps
					for n in range(10):
						self._led.set(47-n,colors.White)
				else:
					for n in range(10):
						self._led.set(47-n,colors.color_scale((255,100,0),0))
コード例 #29
0
    def step(self, amt = 1):
        for i, item in enumerate(self.items):
            self._led.set(i, item)

        if self.state == self.INITING:
            if self.init_step == 0:
                # let the blank linger
                time.sleep(1)

            # print('init')
            if self.init_step > 10:
                self.state = self.SORTING
                self.init_step = 0
            else:
                self.init_step += 1
                time.sleep(self.SLEEP_INIT)

        elif self.state == self.SORTING:
            # print('sorting')
            last = self.items[0]
            swaps = False
            for i, item in enumerate(self.items):
                hue_item = rgb2hsv(item)[0]
                hue_last = rgb2hsv(last)[0]
                if hue_item < hue_last:
                    swaps = True
                    self.items[i-1] = item
                    self._led.set(i-1, item)
                    self.items[i] = last
                    self._led.set(i, last)
                    time.sleep(self.SLEEP_SORT)
                    break
                last = self.items[i]
            if not swaps:
                self.state = self.FADING

        else:
            # print('fading')
            self.fade_step += 1
            if self.fade_step > 200:
                self._led.all_off()
                # print('done')
                self.init()
                self.state = self.INITING
                self.fade_step = 0
            else:
                for i, item in enumerate(self.items):
                    self._led.set(i, colors.color_scale(item, 255 - (self.fade_step)))
                time.sleep(self.SLEEP_FADE)
コード例 #30
0
ファイル: twinkle.py プロジェクト: Tashus/beam
    def step(self, amt=1):
        self.layout.all_off()
        self.pick_led(self.speed)

        for i, val in enumerate(self.pixels):
            p_dir, p_color, p_level = val
            if p_dir == 1:
                p_level += self.speed
                if p_level > 255:
                    p_level = 255
                    p_dir = 2  # start dimming
                self.layout._set_base(i,
                                      color_util.color_scale(p_color, p_level))
            elif p_dir == 2:
                p_level -= self.speed
                if p_level < 0:
                    p_level = 0
                    p_dir = 0  # turn off
                self.layout._set_base(i,
                                      color_util.color_scale(p_color, p_level))

            self.pixels[i] = (p_dir, p_color, p_level)

        self._step += amt
コード例 #31
0
    def __init__(self, layout, imagePath=None, offset=(0, 0), bgcolor=colors.Off,
                 brightness=255, cycles=1, seconds=None, random=False, use_file_fps=True):
        """Helper class for displaying image animations for GIF files or a set of bitmaps

        layout - layoutMatrix instance
        imagePath - Path to either a single animated GIF image or folder of GIF files
        offset - X,Y tuple coordinates at which to place the top-left corner of the image
        bgcolor - RGB tuple color to replace any transparent pixels with. Avoids transparent showing as black
        brightness - Brightness value (0-255) to scale the image by. Otherwise uses master brightness at the time of creation
        """
        super(ImageAnim, self).__init__(layout)

        self.cycles = cycles
        self.cycle_count = 0

        self.seconds = seconds
        self.last_start = 0

        self.random = random
        self.use_file_fps = use_file_fps

        self._bright = brightness

        self._bgcolor = colors.color_scale(bgcolor, self._bright)
        self._offset = offset
        self._image_buffers = [None, None]
        self._cur_img_buf = 1  # start here because loadNext swaps it

        if imagePath is None:
            cur_dir = os.path.dirname(os.path.realpath(__file__))
            imagePath = os.path.abspath(os.path.join(cur_dir, '../../Graphics/MarioRotating.gif'))

        self.imagePath = imagePath
        self.folder_mode = os.path.isdir(imagePath)
        self.gif_files = []
        self.gif_indices = []
        self.folder_index = -1
        self.load_thread = None

        if self.folder_mode:
            self.gif_files = glob.glob(self.imagePath + "/*.gif")
            self.gif_indices = list(range(len(self.gif_files)))
            self.loadNextGIF()  # first load is manual
            self.swapbuf()
            self.load_thread = None
        else:
            self.loadGIFFile(self.imagePath)
            self.swapbuf()
コード例 #32
0
 def pick_led(self, speed):
     idx = random.randrange(0, self.layout.numLEDs)
     p_dir, p_color, p_level = self.pixels[idx]
     if self.color_control == 127:
         self.colors = [(255, 240, 255), (245, 230, 233), (250, 230, 230)]
     else:
         self.colors = list(
             map(lambda color: self.change_color(color), self.colors))
     if random.randrange(0, 100) < self.density:
         if p_dir == 0:  # 0 is off
             p_level += speed
             p_dir = 1  # 1 is growing
             p_color = random.choice(self.colors)
             self.layout._set_base(idx,
                                   bp_colors.color_scale(p_color, p_level))
             self.pixels[idx] = p_dir, p_color, p_level
コード例 #33
0
    def step(self, amt = 1):
        for i in range(self._size):
            c = colors.hue_helper(i, self._size, self._step)
            d = self.decibels
            d -= 68
            d = max(0, d)
            percentage = d / 20
            percentage = min(percentage, 1.0)
            brightness = int(round(percentage * 255))
	    final = min(max(brightness, 25), 175)
            self._led.set(self._start + i, colors.color_scale(c, final))

        self._step += amt
        overflow = self._step - 256
        if overflow >= 0:
            self._step = overflow
コード例 #34
0
def _getBufferFromImage(img, led, bgcolor, bright, offset):
    duration = None
    if 'duration' in img.info:
        duration = img.info['duration']

    w = led.width - offset[0]
    if img.size[0] < w:
        w = img.size[0]

    h = led.height - offset[1]
    if img.size[1] < h:
        h = img.size[1]

    ox = offset[0]
    oy = offset[1]

    buffer = [0 for x in range(led.numLEDs * 3)]
    gamma = led.driver[0].gamma
    if bgcolor != (0, 0, 0):
        for i in range(led.numLEDs):
            buffer[i * 3 + 0] = gamma[bgcolor[0]]
            buffer[i * 3 + 1] = gamma[bgcolor[1]]
            buffer[i * 3 + 2] = gamma[bgcolor[2]]

    frame = Image.new("RGBA", img.size)
    frame.paste(img)

    for x in range(ox, w + ox):
        for y in range(oy, h + oy):
            if x < 0 or y < 0:
                continue
            pixel = led.matrix_map[y][x]
            r, g, b, a = frame.getpixel((x - ox, y - oy))
            if a == 0:
                r, g, b = bgcolor
            else:
                r = (r * a) >> 8
                g = (g * a) >> 8
                b = (b * a) >> 8
            if bright != 255:
                r, g, b = colors.color_scale((r, g, b), bright)

            buffer[pixel * 3 + 0] = gamma[r]
            buffer[pixel * 3 + 1] = gamma[g]
            buffer[pixel * 3 + 2] = gamma[b]

    return (duration, buffer)
コード例 #35
0
    def _getBufferFromImage(self, img, offset=(0, 0)):
        duration = None
        if 'duration' in img.info:
            duration = img.info['duration']

        w = self._led.width - offset[0]
        if img.size[0] < w:
            w = img.size[0]

        h = self._led.height - offset[1]
        if img.size[1] < h:
            h = img.size[1]

        ox = offset[0]
        oy = offset[1]

        buffer = [0 for x in range(self._led.bufByteCount)]
        gamma = self._led.driver[0].gamma
        if self._bgcolor != (0, 0, 0):
            for i in range(self._led.numLEDs):
                buffer[i * 3 + 0] = gamma[self._bgcolor[0]]
                buffer[i * 3 + 1] = gamma[self._bgcolor[1]]
                buffer[i * 3 + 2] = gamma[self._bgcolor[2]]

        frame = Image.new("RGBA", img.size)
        frame.paste(img)

        for x in range(ox, w + ox):
            for y in range(oy, h + oy):
                if x < 0 or y < 0:
                    continue
                pixel = self._led.matrix_map[y][x]
                r, g, b, a = frame.getpixel((x - ox, y - oy))
                if a == 0:
                    r, g, b = self._bgcolor
                else:
                    r = (r * a) >> 8
                    g = (g * a) >> 8
                    b = (b * a) >> 8
                if self._bright != 255:
                    r, g, b = colors.color_scale((r, g, b), self._bright)

                buffer[pixel * 3 + 0] = gamma[r]
                buffer[pixel * 3 + 1] = gamma[g]
                buffer[pixel * 3 + 2] = gamma[b]

        return (duration, buffer)
コード例 #36
0
    def step(self, amt=1):
        """step the animation."""
        leds = self._size
        num_colors = len(self._color_array)
        led_section = leds / num_colors

        pos = self._start
        for color in self._color_array:
            scale = 255 - self._step
            scaled_color = colors.color_scale(color, scale)
            self._led.fill(scaled_color, pos, pos + led_section)
            pos += led_section

        self._step += amt
        if self._step > 255:
            self._step = 0
            self._step += amt
コード例 #37
0
    def __init__(self, led, imagePath, offset=(0, 0), bgcolor=colors.Off, brightness=255, cycles=1, random=False, use_file_fps=True):
        """Helper class for displaying image animations for GIF files or a set of bitmaps

        led - LEDMatrix instance
        imagePath - Path to either a single animated GIF image or folder of GIF files
        offset - X,Y tuple coordinates at which to place the top-left corner of the image
        bgcolor - RGB tuple color to replace any transparent pixels with. Avoids transparent showing as black
        brightness - Brightness value (0-255) to scale the image by. Otherwise uses master brightness at the time of creation
        """
        super(ImageAnim, self).__init__(led)

        self.cycles = cycles
        self.cycle_count = 0

        self.random = random
        self.use_file_fps = use_file_fps

        self._bright = brightness
        if self._bright == 255 and led.masterBrightness != 255:
            self._bright = led.masterBrightness

        self._bgcolor = colors.color_scale(bgcolor, self._bright)
        self._offset = offset
        self._image_buffers = [None, None]
        self._cur_img_buf = 1  # start here because loadNext swaps it

        self.folder_mode = os.path.isdir(imagePath)
        self.gif_files = []
        self.gif_indices = []
        self.folder_index = -1
        self.load_thread = None

        if self.folder_mode:
            self.gif_files = glob.glob(imagePath + "/*.gif")
            self.gif_indices = range(len(self.gif_files))
            self.loadNextGIF()  # first load is manual
            self.swapbuf()
            self.load_thread = loadnextthread(self)
            self.load_thread.start()
            self.load_thread.loadNext()  # pre-load next image
        else:
            self.loadGIFFile(imagePath)
            self.swapbuf()

        self._curImage = 0
コード例 #38
0
    def step(self, amt=1):
        for i in range(self._size):
            chunk_size = MidiTransform.remap_cc_value(self.count_control, 1,
                                                      20)
            chunks = self._size / chunk_size
            color = bp_colors.hue_helper(i, chunks, self._step)
            brightness_level = MidiTransform.remap_cc_value(
                self.brightness_control, 0, 256)
            color = bp_colors.color_scale(color, brightness_level)
            self.layout.set(self._start + i, color)

        self._step += amt
        overflow = self._step - 256
        if overflow >= 0:
            self._step = overflow

        delay_time = MidiTransform.remap_cc_value(self.delay_control, 0, 1)
        time.sleep(delay_time)
コード例 #39
0
    def step(self, amt=1):
        self.layout.all_off()

        tail_len = 40 # Whatever
        bullet_pos = self._step % (self.layout.width + tail_len)

        for x, y in self.grid():
            if x <= bullet_pos and x > bullet_pos - tail_len:
                beam_state.brightness = 255 - ((bullet_pos - x) * (255 / tail_len))
                self.layout.set(x, y, color_util.color_scale(self.color, beam_state.brightness))

        if bullet_pos + 1 >= self.layout.width + tail_len:
            # Sequence is about to end; Reset the Zap!
            c_int = random.randint(0, len(beam_state.colors) - 1)
            self.color = color = beam_state.colors[c_int]
            self._step = 0
        else:
            self._step += amt
コード例 #40
0
    def step(self, amt = 1):
        now = util.getNow()
        startOfDay = util.getStartOfDay(now)

        led = self._led
        showMarker = True
        for x in range(0, led.width):
            for y in range(0, led.height):
                current = startOfDay + datetime.timedelta(days=1) * (x * led.height + y) / led.numLEDs
                color = util.getSunColor(current)

                if showMarker and current >= now:
                    color = colors.color_blend(colors.Red, colors.color_scale(color, 128))
                    showMarker = False

                led.set(x, y, color)

        return
コード例 #41
0
    def step(self, amt=1):
        self.layout.all_off()

        if self.pulse_speed == 0 and random.randrange(0, 100) <= self.chance:
            self.add_pulse()

        if self.pulse_speed > 0:
            self.layout.set(self.pulse_position, self.pulse_color)
            for i in range(self._tail):
                c = colors.color_scale(self.pulse_color,
                                       255 - (self._fadeAmt * i))
                self.layout.set(self.pulse_position - i, c)
                self.layout.set(self.pulse_position + i, c)

            if self.pulse_position > self._size + self._tail:
                self.pulse_speed = 0
            else:
                self.pulse_position += self.pulse_speed
コード例 #42
0
ファイル: fire.py プロジェクト: hebrinkmann/lights
    def step(self, amt = 1):
        led = self._led
        if self._step % 5 == 0:
            index0 = (self._step / 10) % 2
            index1 = ((self._step / 10) + 1) %2
            for y in range(led.height):
                for x in range(led.width):
                    p = 0
                    n = 0
                    if x - 1 >= 0:
                        p += self._buffer[index0][x - 1][y]
                        n += 1
                    if x + 1 < led.width:
                        p += self._buffer[index0][x + 1][y]
                        n += 1

                    if y - 1 >= 0:
                        p += self._buffer[index0][x][y - 1]
                        n += 1

                    if y + 1 < led.height:
                        p += self._buffer[index0][x][y + 1]
                        n += 1

                    p = p / n - random.uniform(0.0, 0.2)
                    if p < 0:
                        p = 0

                    if y + 1 < led.height:
                        self._buffer[index1][x][y + 1] = p
            for x in range(led.width):
                self._buffer[index1][x][0] = random.uniform(0.5, 1.0)

            for y in range(led.height):
                for x in range(led.width):
                    value = int(self._buffer[index1][x][y] * 255)
                    color = colors.color_scale(self._color, value)
                    led.setRGB(x, y, color[0], color[1], color[2])

        self._step += amt
コード例 #43
0
ファイル: ledmatrix.py プロジェクト: cheetahray/Shanghai
 def cleargb(self):
     #self._led.all_off()
     self._color = colors.color_scale((0,0,0), 0)
     #for i in range(40):
     self._led.drawRect(0,0,self.__width,40, self._color)
     self._led.update()
コード例 #44
0
 def _drawDrop(self, x, y, color):
     for i in range(self._tail):
         if y-i >= 0 and y-i < self._led.height:
             level = 255 - ((255/self._tail)*i)
             self._led.set(x, y-i, colors.color_scale(color, level))
コード例 #45
0
ファイル: mode-wave.py プロジェクト: SixSecondMonks/pylights
    def get_animation(self, led):
	color = colors.color_scale(colors.Red, 75)
        return Wave(led, color, 2)
コード例 #46
0
    def __init__(self, led, plist, offset=(0, 0), bgcolor=colors.Off, brightness=255):
        """

        :param offset:
        :param bgcolor:
        :param brightness:
        :param led: LEDMatrix
        :param plist: dict

        Helper class for building and displaying image animations for GIF files or a set of still bitmaps (png, gif,
        bmp, jpg) built from a playlist dictionary object.

        led - LEDMatrix instance
        plist - The dictionary loaded from the playlist.json file.
        offset - X,Y tuple coordinates at which to place the top-left corner of the image
        bgcolor - RGB tuple color to replace any transparent pixels with. Avoids transparent showing as black
        brightness - Brightness value (0-255) to scale the image by. Otherwise uses master brightness at the time of
                     instantiation.

        Key features of the playlist:
        1) It's JSON.  Example:
            {
              "1": {
                "file": "./anim/matrix.gif",
                "duration_s": 30,
                "frame_time_ms": 150
              },
              "2": {
                "file": "./anim/spinning balls.gif",
                "duration_s": 30,
                "frame_time_ms": 50
              },
              "3": {
                "file": "water.gif",
                "duration_s": 30
              }
            }
        2) Each item is indexed with something sortable.
        3) Each item contains the following attributes:
            file:  path to the file.  absolute path is tried first.  If not found, searches in ./anim and ./stills
            duration_s:  The duration in seconds that you wish to display the image or animation
            frame_time_ms:  The FPS, but in milliseconds

            Soon:
            fade_in:
            fade_out

        """
        super(PlaylistImageAnim, self).__init__(led)

        self._bright = brightness
        if self._bright == 255 and led.masterBrightness != 255:
            self._bright = led.masterBrightness

        self._bgcolor = colors.color_scale(bgcolor, self._bright)
        self._offset = offset
        self._images = []
        self._count = 0
        self._loopstarttime = None

        self.drawCurrentTime(brightness=255)

        # check that our playlist has things...
        assert plist is not None, "Playlist is undefined"
        assert len(plist) > 0, "Playlist is empty"
        print ("")
        print ("Found {0} items in playlist...".format(len(plist)))

        for key in sorted(plist):
            playlist_item = plist[key]
            print "%s: %s" % (key, playlist_item)

            img_file = ""
            duration_s = 30
            frame_time_ms = 150

            # find the image file.  if not found, skip.
            try:
                img_file = findfile(playlist_item[PLAYLIST_KEY_FILE])
            except IOError:
                print "{0} not found. Skipping.".format(img_file)
                continue  # skip to next item in dictionary

            # check the duration property.  if it's not there, default to 30
            try:
                if playlist_item[PLAYLIST_KEY_DURATION] > 0:
                    duration_s = playlist_item[PLAYLIST_KEY_DURATION]
            except KeyError:
                duration_s = 30

            # check the frame rate.  if not there, default to 150ms per frame
            try:
                if playlist_item[PLAYLIST_KEY_FRAME_TIME] > 0:
                    frame_time_ms = playlist_item[PLAYLIST_KEY_FRAME_TIME]
            except KeyError:
                frame_time_ms = 150

            # load the image
            img = Image.open(img_file)

            # debug print some image properties
            print "\t>>>>>>>>>> {}".format(img.filename)
            print "\tformat: {}".format(img.format)
            print "\tmode: {}".format(img.mode)
            print "\tsize: {}".format(img.size)
            print "\twidth: {}".format(img.width)
            print "\theight: {}".format(img.height)
            print "\tinfo: {}".format(img.info)
            if getattr(img, "is_animated", False):
                print "\tis_animated: {}".format(img.is_animated)
                print "\tn_frames: {}".format(img.n_frames)
            else:
                print "\tis_animated: False"
                print "\tn_frames: 0"
            print ""

            # assign everything back into the dictionary and we will make an array of those to produce the frames
            playlist_item[PLAYLIST_KEY_FILE] = img_file
            playlist_item[PLAYLIST_KEY_DURATION] = duration_s
            playlist_item[PLAYLIST_KEY_FRAME_TIME] = frame_time_ms

            # if this is a .gif, we need to pull an image for each frame and assign that a slot in the animation.
            # if it is another raster, just load it

            # TODO: Determine if animatd gifs can be resized in PIL and all frames are processed
            # TODO: Determine if there is some universal format that the images need to be translated into

            loopstart = self._count
            playlist_item[PLAYLIST_KEY_KEYFRAME] = loopstart
            if img_file.endswith(".gif"):
                for frame in ImageSequence.Iterator(img):
                    # copy the frame info from the playlist so we can just add a new binary
                    gif_playlist_item = playlist_item.copy()
                    gif_playlist_item[PLAYLIST_KEY_BINARYIMAGE] = self._getBufferFromImage(frame)
                    self._images.append(gif_playlist_item)
                    self._count += 1
                    playlist_item[PLAYLIST_KEY_KEYFRAME] = None
                    playlist_item[PLAYLIST_KEY_DURATION] = None
                # assign some things back to the final frame of the anim
                gif_playlist_item[PLAYLIST_KEY_LOOPSTART] = loopstart
                gif_playlist_item[PLAYLIST_KEY_DURATION] = duration_s
            else:
                playlist_item[PLAYLIST_KEY_BINARYIMAGE] = self._getBufferFromImage(img)
                self._images.append(playlist_item)
                self._count += 1
                playlist_item[PLAYLIST_KEY_LOOPSTART] = loopstart

        """
        # this code centers smaller images into the LED frame then adds them into the animation array, that is
        # later used by the .step method to update the frame in the LED.
        # In the playlist version, I want to resize all images to fit the matrix, so centering will not be needed.
        # Adding to the array will be needed.

        if imagePath.endswith(".gif"):
            log.logger.info("Loading {0} ...".format(imagePath))
            img = Image.open(imagePath)
            if self._offset == (0,0):
                w = 0
                h = 0
                if img.size[0] < self._led.width:
                    w = (self._led.width - img.size[0]) / 2
                if img.size[1] < self._led.height:
                    h = (self._led.height - img.size[1]) / 2
                self._offset = (w, h)

            for frame in ImageSequence.Iterator(img):
                self._images.append(self._getBufferFromImage(frame, self._offset))
                self._count += 1
        else:
            imageList = glob.glob(imagePath + "/*.bmp")
            imageList.sort()

            self._count = len(imageList)
            if self._count == 0:
                raise ValueError("No images found!")

            for img in imageList:
                if self._offset == (0,0):
                    if img.size[0] < self._led.width:
                        self._offset[0] = (self._led.width - img.size[0]) / 2
                    if img.size[1] < self._led.height:
                        self._offset[1] = (self._led.height - img.size[1]) / 2

                self._images.append(self._getBufferFromPath(img, self._offset))
        """

        self._curImage = 0

        time.sleep(3)
        # now fade out the clock
        for b in range(255, 0, -32):
            self.drawCurrentTime(brightness=b)
        self._led.all_off()
        self._led.update()
        time.sleep(1)  # 1 second
コード例 #47
0
ファイル: basic.py プロジェクト: SixSecondMonks/pylights
 def __init__(self, bounds, led, start=0, end=-1):
     super(RotatingColors, self).__init__(led, start, end)
     self.bounds = bounds
     names = filter(lambda x: "White" not in x and isinstance(getattr(colors, x), tuple), dir(colors))
     self.colors = map(lambda c: colors.color_scale(getattr(colors, c), 64), names)
     self.n = 0
コード例 #48
0
    # at the end of the month, fill with red
    led.fill(colors.Indigo)
    led.update()
    time.sleep(2)
    led.all_off()
    led.update()

## FORMAT g, r, b 
# green = (127,0,0)
# yellowish green = (255,255,0)
# white: (255,255,255)
# light purpley: ((0,255,255))
# blue: ((0,0,255))
# turquoise: (255,0,255))
# red: (0,255, 0)

led.fill((0,255, 0))
c=colors.color_scale((0,255,0), 50)
led.update()
##led.all_off()
time.sleep(2)
led.fill(c)
led.update()
led.all_off()
time.sleep(2)
led.update()




コード例 #49
0
def convert(arr):
    return [colors.color_scale(x, SCALE) for x in arr]
コード例 #50
0
def convert_one(c):
    return colors.color_scale(c, SCALE)
コード例 #51
0
 def _drawDrop(self, x, y, color):
     for i in range(self._tail):
         if y - i >= 0 and y - i < self._led.height:
             level = 255 - ((255 / self._tail) * i)
             self._led.set(x, y - i, colors.color_scale(color, level))
コード例 #52
0
def rand_color():
    #return (color_scale((randint(0,255),randint(0,255),randint(0,255)), randint(0,255)))
    return (color_scale((randint(0,255),randint(0,255),randint(0,255)), 255))
コード例 #53
0
 def __init__(self, led, start=0, end=-1):
     #The base class MUST be initialized by calling super like this
     super(Clock, self).__init__(led, start, end)
     self.minutex = 0
     self.secondx = 0
     self.digitColor = colors.color_scale(colors.White, 16)
コード例 #54
0
 def _drawDrop(self, x, y, z, color):
     for i in range(self._tail):
         if y - i >= 0 and y - i < self.y:
             level = 255 - ((255 // self._tail) * i)
             self.layout.set(x, y - i, z, colors.color_scale(color, level))
コード例 #55
0
    def __init__(self, led, start=0, end=-1):
        super(RainbowCycle, self).__init__(led, start, end)
        print(self._size)
#        self.frames = [[colors.hue_helper(c, self._size, i) for c in range(self._size)] for i in range(255)]
        frames = [    list(sum([colors.hue_helper(c, self._size, i) for c in range(self._size)], ()))     for i in range(255)]
        self.frames = map(lambda x: colors.color_scale(x, 175), frames)