Exemplo n.º 1
0
 def __init__(self, sheep, num_of_spins):
     SheepAnimation.__init__(self, sheep)
     self.num_of_spins = num_of_spins
     self.effects = [
         ConfettiEffect(
             self.sheep.get_head_indexes() + self.sheep.get_legs_indexes() +
             self.sheep.get_ears_indexes(), 0.1),
         FadingSnakeEffect(self.sheep.get_body_indexes(), 1),
     ]
Exemplo n.º 2
0
    def __init__(self, sheep, props):
        SheepAnimation.__init__(self, sheep, props)

        self.hue = 'Rainbow'
        if self.props != None:
            if 'hue_start' in self.props:
                self.hue = self.props['hue_start']

        self.restart_effect()
        self.previous_time = 1
Exemplo n.º 3
0
    def __init__(self, sheep, props):
        SheepAnimation.__init__(self, sheep, props)

        leds_percent_per_beat = 0.4
        brightness = 1.0
        if self.props != None:
            if 'leds_percent_per_beat' in self.props:
                leds_percent_per_beat = self.props['leds_percent_per_beat']
            if 'brightness' in self.props:
                brightness = self.props['brightness']

        self.effect = ConfettiEffect(self.sheep.get_all_indexes(),
                                     leds_percent_per_beat, brightness)
Exemplo n.º 4
0
    def __init__(self, sheep, hue, num_of_spins):
        SheepAnimation.__init__(self, sheep)
        self.num_of_spins = num_of_spins
        self.current_spin = -1
        self.color = [
            int(c * 255) for c in colorsys.hsv_to_rgb(hue, 1.0, 0.25)
        ]
        hue2 = Colors.reduce_by_1(hue + 0.5)
        self.headColor = [
            int(c * 255) for c in colorsys.hsv_to_rgb(hue2, 1.0, 0.25)
        ]

        self.legsColor1 = self.color  #Colors.adjacent_color(self.color)[0]
        self.legsColor2 = self.headColor  #Colors.adjacent_color(self.color)[1]
Exemplo n.º 5
0
    def __init__(self, sheep, props):
        SheepAnimation.__init__(self, sheep, props)
        self.color_type = ColorType.RAINBOW
        if self.props != None:

            if 'hue_start' in self.props:
                if self.props['hue_start'] == 'Rainbow':
                    self.color_type = ColorType.RAINBOW
                else:
                    self.color_type = ColorType.COLOR
                    self.hue = self.props['hue_start']

        self.restart_effect()
        self.previous_time = 1
Exemplo n.º 6
0
    def __init__(self, sheep, props):
        SheepAnimation.__init__(self, sheep, props)

        stars_percent = props['stars_percent'] if props and 'stars_percent' in props else 0.1
        self.stars_per_cycle = int(stars_percent * len(sheep.get_all_indexes()))
        self.timed_color = ConstTimedColor([255, 255, 255])

        if self.props != None:
            if 'stars_color' in self.props:
                timed_color = TimedColorFactory(self.props['stars_color'])
                if timed_color is not None:
                    self.timed_color = timed_color

        self.previous_time = 1.0

        self.restart_effect()
Exemplo n.º 7
0
    def __init__(self, sheep, props):
        SheepAnimation.__init__(self, sheep, props)

        self.effects = []

        self.effects.append(
            AlwaysOnEffect(self.sheep.get_ears_indexes(), [255, 0, 0]))

        self.effects.append(
            FireEffect(self.sheep.get_leg12_side1_indexes()[::-1]))
        self.effects.append(FireEffect(self.sheep.get_leg12_side2_indexes()))
        self.effects.append(
            FireEffect(self.sheep.get_leg34_side1_indexes()[::-1]))
        self.effects.append(FireEffect(self.sheep.get_leg34_side2_indexes()))

        self.effects.append(FireEffect(self.sheep.get_head_up1()))
        self.effects.append(FireEffect(self.sheep.get_head_up2()))

        for i in range(self.sheep.get_num_of_body_parts()):
            body_part = self.sheep.get_body_part_indexes(i)

            if i < 4:
                up = body_part[:len(body_part) / 2]
                down = body_part[len(body_part) / 2:]

                self.effects.append(FireEffect(up[::-1]))
                self.effects.append(FireEffect(down))

            elif i == 4:
                continue

            elif i == 5:
                body_part4 = self.sheep.get_body_part_indexes(4)

                up = body_part[:len(body_part) / 2]
                up = body_part4 + up
                down = body_part[len(body_part) / 2:]

                self.effects.append(FireEffect(up))
                self.effects.append(FireEffect(down[::-1]))

            elif i > 5:
                up = body_part[:len(body_part) / 2]
                down = body_part[len(body_part) / 2:]

                self.effects.append(FireEffect(up))
                self.effects.append(FireEffect(down[::-1]))
Exemplo n.º 8
0
    def __init__(self, sheep, num_of_spins, num_of_lights):
        SheepAnimation.__init__(self, sheep)
        self.num_of_spins = num_of_spins * 2
        self.current_spin = -1
        self.num_of_lights = num_of_lights

        self.elements = [
            self.sheep.get_head_indexes(),
            self.sheep.get_leg12_side1_indexes(),
            self.sheep.get_leg12_side2_indexes(),
            self.sheep.get_leg34_side1_indexes(),
            self.sheep.get_leg34_side2_indexes()
        ]
        if (len(self.sheep.get_inner_ear_indexes()) > 0):
            self.elements.append(self.sheep.get_inner_ear_indexes())
        if (len(self.sheep.get_outer_ear_indexes()) > 0):
            self.elements.append(self.sheep.get_outer_ear_indexes())
        for i in range(self.sheep.get_num_of_body_parts()):
            self.elements.append(self.sheep.get_body_part_indexes(i))

        self.hues = [0] * len(self.elements)
        for i in range(len(self.elements)):
            self.hues[i] = random.random()
Exemplo n.º 9
0
 def __init__(self, sheep, props):
     SheepAnimation.__init__(self, sheep, props)
     self.create_effects()
Exemplo n.º 10
0
 def __init__(self, sheep, num_of_spins, starting_hue):
     SheepAnimation.__init__(self, sheep)
     self.num_of_spins = num_of_spins
     self.current_spin = -1
     self.hue1 = starting_hue
Exemplo n.º 11
0
 def __init__(self, sheep, props):
     SheepAnimation.__init__(self, sheep, props)
     self.previous_time = 1
     self.effects = []
     self.cycle_num = 0
Exemplo n.º 12
0
 def __init__(self, sheep, color):
     SheepAnimation.__init__(self, sheep)
     self.color = color
     self.effects = []
     self.currentBlinkBodyNum = -1;
Exemplo n.º 13
0
 def __init__(self, sheep, num_of_spins):
     SheepAnimation.__init__(self, sheep)
     self.num_of_spins = num_of_spins
     self.current_spin = -1
     self.create_effects()
Exemplo n.º 14
0
 def __init__(self, sheep, leds_percent_per_cycle):
     SheepAnimation.__init__(self, sheep)
     self.effect = ConfettiEffect(self.sheep.get_all_indexes(), leds_percent_per_cycle)