Пример #1
0
    def _set_eye_xy_flat_pos(self, x, y, do_party, do_business, in_sky):
        #
        # Basic formula is pan = atan(x), tilt = atan( (y * sin(pan)) / x )
        #

        # if y < -0.5:
        #     y = -0.5

        # self.lastXPos = x
        # self.lastYPos = y

        #y = .125

        # Units for X and Y real are "height of the eye" = 1. Scaling out so
        # that we can tweak it more here than in touch and can define a reasonable
        # addressable area
        xr = config.get("xy_scale")["x"] * x
        yr = config.get("xy_scale")["y"] * (y + 0.5)

        if do_party:
            self.p_eye_pos = eyes.xy_to_pnt([xr, yr], True, in_sky)

            # pan_rads = math.atan2(xr,1)
            # tilt_rads = math.atan2( yr * math.sin(math.fabs(pan_rads)), xr)
            # self.p_eye_pos[PAN] = math.degrees(pan_rads)
            # self.p_eye_pos[TILT] = math.degrees(tilt_rads) - 90
            # if self.p_eye_pos[TILT]  < 0:
            #     self.p_eye_pos[TILT]  += 360
            # if self.p_eye_pos[TILT]  > 180:
            #     self.p_eye_pos[TILT]  = 360-self.p_eye_pos[TILT] 

            # print "P x=%f y=%f pan=%f tilt=%f" % (xr,yr, self.p_eye_pos[PAN] , self.p_eye_pos[TILT] )
            # if self.p_eye_pos[TILT]  > 135:
            #     self.p_eye_pos[TILT]  = 135

            # if in_sky:
            #     self.p_eye_pos[PAN]  = 360-self.p_eye_pos[PAN] 

            self._notify_eye_changed(True)

        if do_business:
            # xr -= 0.25 # This is (roughly) the distance between the lights in light_to_ground units
            # pan_rads = math.atan2(xr,1)
            # tilt_rads = math.atan2( yr * math.sin(math.fabs(pan_rads)), xr)
            # self.b_eye_pos[PAN] = math.degrees(pan_rads)
            # self.b_eye_pos[TILT] = math.degrees(tilt_rads) - 90
            # if self.b_eye_pos[TILT] < 0:
            #     self.b_eye_pos[TILT] += 360
            # if self.b_eye_pos[TILT] > 180:
            #     self.b_eye_pos[TILT] = 360-self.b_eye_pos[TILT]

            # print "B x=%f y=%f pan=%f tilt=%f" % (xr,yr, self.b_eye_pos[PAN], self.b_eye_pos[TILT])
            # if self.b_eye_pos[TILT] > 135:
            #     self.b_eye_pos[TILT] = 135

            # if in_sky:
            #     self.b_eye_pos[PAN] = 360-self.b_eye_pos[PAN]

            self.b_eye_pos = eyes.xy_to_pnt([xr, yr], False, in_sky)
            self._notify_eye_changed(False)
Пример #2
0
    def __init__(self, sheep_sides):
        looping_show.LoopingShow.__init__(self, sheep_sides)

        self.closed = eye_effect.EyeEffect(shutter_type=eye_effect.SHUTTER_CLOSED)

        self.fast_strobe = eye_effect.EyeEffect(shutter_type=eye_effect.SHUTTER_STROBE, shutter_speed=1.0)

        self.slow_strobe = eye_effect.EyeEffect(shutter_type=eye_effect.SHUTTER_STROBE, shutter_speed=0.6)

        # I think big_splat and circle_0 are probably best because they
        # are the neighbors of 0, so presumably will have the best look
        # when being swapped in
        self.ltw_effect = eye_effect.EyeEffect(gobo=eye_effect.GOBOS["big_splat"], gobo_shake_speed=0.42)
        self.pulse_effect = eye_effect.EyeEffect(shutter_type=eye_effect.SHUTTER_PULSE, shutter_speed=0.2)
        self.p_pos_beacon = [0, -90]
        self.b_pos_beacon = eyes.xy_to_pnt([0,0], False, False)


        self.set_steps([
            (3.000, "setup"),
            # Eyes off, move them to the target location

            (1.000, "hey"),
            # Strobe at the target

            (1.000, "hey_off"),
            # off

            (1.000, "you"),
            # Strobe at the target

            (1.000, "you_off"),
            # off, dimmer to 0

            (1.000, "come"),
            # Fade up with dimmer

            (1.000, "come_off"),
            # Fade down with dimmer

            (1.000, "here"),
            # Fade up with dimmer

            (1.000, "here_off"),
            # Fade down with dimmer

            (3.000, "light_the_way"),
            # L - shutter closed, position for beacon
            # R - Large circle gobo, with gobo shake, traces a path back
            # to xy 0,0

            (3.000, "beacon")
            # L - pointed straight up. Pulsing
            # R - pointed at 0, 0. Pulsing

        ])
Пример #3
0
    def update_at_progress_in_step(self, progress, new_loop, loop_instance, step_progress, step_name):

        if new_loop:
            # Choose a new random location for the eyes to move to
            self.target_xy_pos = [
                random.uniform(TARGET_ZONE[0][0], TARGET_ZONE[1][0]), 
                random.uniform(TARGET_ZONE[0][1], TARGET_ZONE[1][1])
            ]

            self.p_target = eyes.xy_to_pnt(self.target_xy_pos, True)
            self.b_target = eyes.xy_to_pnt(self.target_xy_pos, False)

        self.pe.clear()
        self.be.clear()

        c_pos = eyes.EYE_COLOR_WHITE
        if self.cm.modifiers[3]:
            c_pos = self.cm.chosen_colors_pos[0]
        if self.cm.modifiers[4]:
            c_pos = eyes.EYE_COLOR_RED

        self.pe.color_pos = c_pos
        self.be.color_pos = c_pos

        #print "Step %s %f" % (step_name, step_progress)

        if step_name == "setup":
            # Eyes off, move them to the target location
            self.pe.effect = self.closed
            self.be.effect = self.closed

            self.pe.pos = self.p_target
            self.be.pos = self.b_target
            return

        if step_name == "hey":            
            # Strobe at the target
            # self.pe.effect = self.fast_strobe
            # self.be.effect = self.fast_strobe
            self.pe.pos = self.p_target
            self.be.pos = self.b_target
            return

        if step_name == "hey_off":            
            # off
            self.pe.effect = self.closed
            self.be.effect = self.closed
            self.pe.pos = self.p_target
            self.be.pos = self.b_target
            return


        if step_name == "you":            
            # Strobe at the target
            self.pe.effect = self.slow_strobe
            self.be.effect = self.slow_strobe
            self.pe.pos = self.p_target
            self.be.pos = self.b_target
            return

        if step_name == "you_off":            
            # off
            self.pe.effect = self.closed
            self.be.effect = self.closed
            self.pe.pos = self.p_target
            self.be.pos = self.b_target
            return


        if step_name == "come":            
            # Fade up with dimmer
            self.pe.effect = None
            self.be.effect = None

            self.pe.dimmer = step_progress
            self.be.dimmer = step_progress
            self.pe.pos = self.p_target
            self.be.pos = self.b_target
            return

        if step_name == "come_off":
            # Fade down with dimmer
            self.pe.effect = None
            self.be.effect = None

            self.pe.dimmer = 1.0 - step_progress
            self.be.dimmer = 1.0 - step_progress
            self.pe.pos = self.p_target
            self.be.pos = self.b_target
            return

        if step_name == "here":            
            # Fade up with dimmer
            self.pe.effect = None
            self.be.effect = None

            self.pe.dimmer = step_progress
            self.be.dimmer = step_progress
            self.pe.pos = self.p_target
            self.be.pos = self.b_target
            return

        if step_name == "here_off":
            # Fade down with dimmer
            self.pe.effect = None
            self.be.effect = None

            self.pe.dimmer = 1.0 - step_progress
            self.be.dimmer = 1.0 - step_progress
            self.pe.pos = self.p_target
            self.be.pos = self.b_target
            return

        if step_name == "light_the_way":
            # L - shutter closed, position for beacon
            self.pe.effect = self.closed
            self.pe.pos = self.p_pos_beacon

            # R -Gobo, with gobo shake, traces a path back
            # to xy 0,0
            xy_pos = [
                tween.easeInOutQuad(self.target_xy_pos[0], 0, step_progress),
                tween.easeInOutQuad(self.target_xy_pos[1], 0, step_progress),
            ]
            self.be.effect = self.ltw_effect
            self.be.set_xy_pos(xy_pos, False)
            return

        if step_name == "beacon":
            # L - pointed straight up. Pulsing
            # R - pointed at 0, 0. Pulsing
            self.pe.effect = self.pulse_effect
            self.pe.pos = self.p_pos_beacon

            self.be.effect = self.pulse_effect
            self.be.pos = self.b_pos_beacon
            return