Esempio n. 1
0
    def next_frame(self):
        while True:

            self.ss.both.clear()

            pan = self.cm.show_target[0] * math.pi
            tilt = self.cm.show_target[1] * math.pi

            color = self.cm.chosen_colors[0]
            if self.cm.modifiers[0]:
                color = random_color(luminosity="light");

            FOV_10.map_value(self.ss, pan, tilt, color, symmetry=self.cm.modifiers[1])


            # self.p.pan = self.cm.p_eye_pos[controls.PAN]
            # self.p.tilt = self.cm.p_eye_pos[controls.TILT]
            # self.b.pan = self.cm.b_eye_pos[controls.PAN]
            # self.b.tilt = self.cm.b_eye_pos[controls.TILT]

            yield 0.001
Esempio n. 2
0
    def next_frame(self):
        while True:

            self.ss.both.clear()

            pan = self.cm.show_target[0] * math.pi
            tilt = self.cm.show_target[1] * math.pi

            color = self.cm.chosen_colors[0]
            if self.cm.modifiers[0]:
                color = random_color(luminosity="light")

            FOV_10.map_value(self.ss,
                             pan,
                             tilt,
                             color,
                             symmetry=self.cm.modifiers[1])

            # self.p.pan = self.cm.p_eye_pos[controls.PAN]
            # self.p.tilt = self.cm.p_eye_pos[controls.TILT]
            # self.b.pan = self.cm.b_eye_pos[controls.PAN]
            # self.b.tilt = self.cm.b_eye_pos[controls.TILT]

            yield 0.001
Esempio n. 3
0
    def update_at_progress(self, progress, new_loop, loop_instance):

        if new_loop:
            # The start of a loop has red at the left shoulder and
            # blue at the right flank
            if self.cm.modifiers[0]:
                self.redColor = random_color()
                self.redPos = self.redColor.pos

                self.blueColor = self.redColor.copy()
                self.blueColor.h = self.blueColor.h + 0.3
                self.bluePos = self.blueColor.pos
            else:
                if self.cm.modifiers[1]:
                    # Use the chosen colors
                    self.redColor = self.cm.chosen_colors[0]
                    self.blueColor = self.cm.chosen_colors[1]
                    self.redPos = self.cm.chosen_colors_pos[0]
                    self.bluePos = self.cm.chosen_colors_pos[1]
                else:
                    # Just be red and blue cops
                    self.redColor = color.RGB(255,30,30)
                    self.blueColor = color.RGB(30,30,255);

                    self.redPos = eyes.EYE_COLOR_RED
                    self.bluePos = eyes.EYE_COLOR_BLUE

        # Panels
        # clear tham all
        if not self.cm.modifiers[2]:
            self.ss.both.clear()


        # mod 3 = reverse
        if not self.cm.modifiers[3]:
            if progress < 0.25: 
                # Red moving down right flank
                redPan = tween.linear(FLANK_FORWARD_R, FLANK_REAR_R, (progress / 0.25))
            elif progress < 0.5:
                redPan = tween.linear(FLANK_REAR_R, FLANK_REAR_L, (progress - 0.25) / 0.25)
            elif progress < 0.75:
                redPan = tween.linear(FLANK_REAR_L, FLANK_FORWARD_L, (progress - 0.50) / 0.25)
            else:
                redPan = tween.linear(FLANK_FORWARD_L, FLANK_FORWARD_R_WRAP, (progress - 0.75) / 0.25)
        else:
            if progress < 0.25: 
                # Red moving from rear R flank to front
                p = progress / 0.25
                redPan = tween.linear(FLANK_REAR_R, FLANK_FORWARD_R, p)
            elif progress < 0.5:
                p = (progress - 0.25) / 0.25
                redPan = tween.linear(FLANK_FORWARD_R_WRAP, FLANK_FORWARD_L, p)
            elif progress < 0.75:
                p = (progress - 0.50) / 0.25
                redPan = tween.linear(FLANK_FORWARD_L, FLANK_REAR_L, p)
            else:
                p = (progress - 0.75) / 0.25
                redPan = tween.linear(FLANK_REAR_L, FLANK_REAR_R, p)


        if redPan < 0:
            redPan += (2*math.pi)
        elif redPan > (2*math.pi):
            redPan -= (2*math.pi)

        bluePan = redPan + math.pi

        if bluePan < 0:
            bluePan += (2*math.pi)
        elif bluePan > (2*math.pi):
            bluePan -= (2*math.pi)


        FOV_10.map_value(self.ss, redPan, 0, self.redColor)
        FOV_10.map_value(self.ss, bluePan, 0, self.blueColor)


        # Eyes
        self.pe.pan = -90
        self.be.pan = -90;

        # mod 3 = reverse
        if not self.cm.modifiers[3]:
            if progress < 0.25: 
                # Red moving down right flank
                # Eyes off, getting ready for blue to hit the left shoulder
                self.pe.effect = self.closed
                self.be.effect = self.closed
                self.pe.tilt = self.pe_tilt_start
                self.be.tilt = self.be_tilt_start
                self.pe.color_pos = self.bluePos
                self.be.color_pos = self.bluePos

                self.pe.dimmer = 0.0
            elif progress < 0.5:
                # Tween from left to right
                self.pe.effect = None
                self.be.effect = None

                self.pe.tilt = tween.linear(self.pe_tilt_start, self.pe_tilt_end, (progress-0.25)/0.25)
                self.be.tilt = tween.linear(self.be_tilt_start, self.be_tilt_end, (progress-0.25)/0.25)

                self.pe.dimmer = 1.0
            elif progress < 0.75:
                # Reset eyes getting ready for red to hit
                self.pe.effect = self.closed
                self.be.effect = self.closed
                self.pe.tilt = self.pe_tilt_start
                self.be.tilt = self.be_tilt_start
                self.pe.color_pos = self.redPos
                self.be.color_pos = self.redPos

                self.pe.dimmer = 0.0
            else:
                # Tween from left to right
                self.pe.effect = None
                self.be.effect = None

                self.pe.tilt = tween.linear(self.pe_tilt_start, self.pe_tilt_end, (progress-0.75)/0.25)
                self.be.tilt = tween.linear(self.be_tilt_start, self.be_tilt_end, (progress-0.75)/0.25)

                self.pe.dimmer = 1.0

        else:
            # Reverse direction
            if progress < 0.25: 
                # Red moving from back of R flank to front
                # Reset eyes getting ready for red to hit
                self.pe.effect = self.closed
                self.be.effect = self.closed
                self.pe.tilt = self.pe_tilt_end
                self.be.tilt = self.be_tilt_end
                self.pe.color_pos = self.redPos
                self.be.color_pos = self.redPos

                self.pe.dimmer = 0.0


            elif progress < 0.5:
                # Red moving across breast from R to L 
                self.pe.effect = None
                self.be.effect = None

                p = (progress-0.25)/0.25
                self.pe.tilt = tween.linear(self.pe_tilt_end, self.pe_tilt_start, p)
                self.be.tilt = tween.linear(self.be_tilt_end, self.be_tilt_start, p)

                self.pe.dimmer = 1.0

            elif progress < 0.75:
                # Eyes off, getting ready for blue to hit the right shoulder
                self.pe.effect = self.closed
                self.be.effect = self.closed
                self.pe.tilt = self.pe_tilt_end
                self.be.tilt = self.be_tilt_end
                self.pe.color_pos = self.bluePos
                self.be.color_pos = self.bluePos

                self.pe.dimmer = 0.0

            else:
                # Tween from right to left using blue
                self.pe.effect = None
                self.be.effect = None

                p = (progress-0.75)/0.25
                self.pe.tilt = tween.linear(self.pe_tilt_end, self.pe_tilt_start, p)
                self.be.tilt = tween.linear(self.be_tilt_end, self.be_tilt_start, p)

                self.pe.dimmer = 1.0