Example #1
0
    def update_at_progress(self, progress, new_loop, loop_instance):

        if new_loop:
            if self.cm.modifiers[0]:
                self.foreground = random_color(luminosity="light")
                self.background = self.foreground.copy()
                self.background.h += 0.5
            else:
                self.background = self.cm.chosen_colors[1]
                self.foreground = self.cm.chosen_colors[0]

            self.color_list = morph.transition_list(self.foreground,
                                                    self.background,
                                                    steps=16)
            self.clear()

        mode = self.step_mode(4)

        # _list defines what we loop over
        if mode == 3:
            _list = ice_geom.ICICLES
        elif mode == 2:
            _list = ice_geom.COLS
        elif mode == 1:
            _list = ice_geom.ROWS
        elif mode == 0:
            _list = ice_geom.SLICES
        # if mode == 4:
        #     _list = sheep.ALL
        # elif mode == 3:
        #     _list = [sheep.FACE, sheep.HEAD, sheep.EARS, sheep.THROAT, sheep.BREAST, sheep.SHOULDER, sheep.RACK, sheep.LOIN, sheep.LEG, sheep.BUTT, sheep.TAIL]
        # elif mode == 2:
        #     _list = sheep.FRONT_SPIRAL
        # elif mode == 1:
        #     _list = sheep.VSTRIPES
        # elif mode == 0:
        #     _list = sheep.HSTRIPES

        # Because progress will never actually hit 1.0, this will always
        # produce a valid list index
        to_light = int(progress * len(_list))

        for i in range(0, len(_list)):
            c = self.background
            if self.cm.modifiers[1]:
                c = color.BLACK

            if i <= to_light:
                x = i
                if len(_list) < len(self.color_list) / 2:
                    x = i * 2
                c_ix = x % len(self.color_list)

                if self.cm.modifiers[2] and (loop_instance % 2 == 0):
                    c_ix = len(self.color_list) - 1 - c_ix

                c = self.color_list[c_ix]

            el = _list[i]
            self.ss.both.set_cell(el, c)
Example #2
0
    def update_at_progress(self, progress, new_loop, loop_instance):

        if new_loop:
            if self.cm.modifiers[0]:
                self.foreground = random_color(luminosity="light")
                self.background = self.foreground.copy()
                self.background.h += 0.5
            else:
                self.background = self.cm.chosen_colors[1]
                self.foreground = self.cm.chosen_colors[0]

            self.color_list = morph.transition_list(self.foreground, self.background, steps=16)
            self.clear()


        mode = self.step_mode(4)

        # _list defines what we loop over
        if mode == 3:            
            _list = ice_geom.ICICLES
        elif mode == 2:            
            _list = ice_geom.COLS
        elif mode == 1:
            _list = ice_geom.ROWS
        elif mode == 0:
            _list = ice_geom.SLICES
        # if mode == 4:
        #     _list = sheep.ALL
        # elif mode == 3:
        #     _list = [sheep.FACE, sheep.HEAD, sheep.EARS, sheep.THROAT, sheep.BREAST, sheep.SHOULDER, sheep.RACK, sheep.LOIN, sheep.LEG, sheep.BUTT, sheep.TAIL]
        # elif mode == 2:
        #     _list = sheep.FRONT_SPIRAL
        # elif mode == 1:
        #     _list = sheep.VSTRIPES
        # elif mode == 0:
        #     _list = sheep.HSTRIPES

        # Because progress will never actually hit 1.0, this will always
        # produce a valid list index
        to_light = int(progress * len(_list))

        for i in range(0, len(_list)):
            c = self.background
            if self.cm.modifiers[1]:
                c = color.BLACK

            if i <= to_light:
                x = i
                if len(_list) < len(self.color_list) / 2:
                    x = i * 2
                c_ix = x % len(self.color_list)

                if self.cm.modifiers[2] and (loop_instance % 2 == 0):
                    c_ix = len(self.color_list) - 1 - c_ix

                c = self.color_list[c_ix]

            el = _list[i]
            self.ss.both.set_cell(el, c)
Example #3
0
File: areas.py Project: zrlram/leds
    def update_at_progress(self, progress, new_loop, loop_instance):

	# (loud, pitch) = self.audio.audio_input()

        if new_loop:
            #self.foreground = random_color(luminosity="light")
            self.foreground = random_color()
            self.background = self.foreground.copy()
            self.background.h += 0.5

            self.color_list = morph.transition_list(self.foreground, self.background, steps=16)

            self.clear()

            # udpate mode every now and then
            if (loop_instance % 5 == 0):
                self.mode = (self.mode + 1) % 4
                print "Changing mode to %s" % self.mode

            if self.mode == 0:
                self._list = [[x for x in range(model.numLEDs)]]
            elif self.mode ==1:
                self._list = model.HOR_RINGS_TOP_DOWN
            elif self.mode ==2:
                self._list = model.HOR_RINGS_MIDDLE_OUT
            elif self.mode ==3:
                self._list = model.HOR_RINGS_TOP_DOWN
                self._list.reverse()
            else:
                self._list = [[x for x in range(model.numLEDs)]]

        # Because progress will never actually hit 1.0, this will always
        # produce a valid list index
        to_light = int(progress * len(self._list))

        for i in range(0, len(self._list)):
            c = self.background

            if i <= to_light:
                x = i
                if len(self._list) < len(self.color_list) / 2:
                    x = i * 2
                c_ix = x % len(self.color_list)

                #if self.cm.modifiers[2] and (loop_instance % 2 == 0):
                #    c_ix = len(self.color_list) - 1 - c_ix

                c = self.color_list[c_ix]

	    c.v = loud
            c = hsv_to_rgb(c.hsv)
            for i in self._list[i]:
                self.geometry.set_pixel(i, c)

        self.geometry.draw()
Example #4
0
    def update_at_progress(self, progress, new_loop, loop_instance):

        if new_loop:
            #if self.mode==0:
            self.foreground = random_color(luminosity="light")
            self.background = self.foreground.copy()
            self.background.h += 0.5
            self.background.s += 0.2
            '''
            else:
                # TBD
                self.background = self.cm.chosen_colors[1]
                self.foreground = self.cm.chosen_colors[0]
            '''

            self.color_list = morph.transition_list(self.foreground, self.background, steps=16)
            self.clear()


        #mode = self.step_mode(5)

        if self.mode == 1:
            _list = HOR_RINGS_TOP_DOWN
        elif self.mode == 0:
            _list = VERT_RINGS

        # Because progress will never actually hit 1.0, this will always
        # produce a valid list index
        to_light = int(progress * len(_list))

        for i in range(0, len(_list)):
            c = self.background

            if i <= to_light:
                x = i
                if len(_list) < len(self.color_list) / 2:
                    x = i * 2
                c_ix = x % len(self.color_list)

                #if self.cm.modifiers[2] and (loop_instance % 2 == 0):
                if (loop_instance % 2 == 0):
                   c_ix = len(self.color_list) - 1 - c_ix

                c = self.color_list[c_ix]

            el = _list[i]

            c = hsv_to_rgb(c.hsv)
            for i in el:
                self.geometry.set_pixel(i, c)

        self.geometry.draw()