Example #1
0
 def __init__(self, spacing, color_change_length, wait=.05):
     super(ColorChase, self).__init__(wait=wait)
     self.color_counter = ModCounter(len(Colors.COLORS))
     self.spacing = spacing
     self.spacing_counter = ModCounter(spacing)
     self.color_change_counter = ModCounter(color_change_length)
     self.name = "Color Chase"
     self.color = Colors.COLORS[0]
Example #2
0
class MultiAnimation(BaseAnimation):
    def __init__(self, animations, substrips):
        smallest_wait = min([animation.wait for animation in animations])
        super(MultiAnimation, self).__init__(wait=smallest_wait)
        print self.wait
        assert(len(animations) == len(substrips))
        self.animations = animations
        self.substrips = substrips
Example #3
0
 def setup(self, strip):
     super(RandomChoice, self).setup(strip)
     self.i = 0
     self.counter = ModCounter(len(strip))
     self.blink_counter = 0
     self.winner = random.randint(1 * len(strip), 2 * len(strip))
     self.wait = .02
     self.color = random.choice(Colors.COLORS).rgb()
Example #4
0
class AutoRun(BaseAnimation):
    def __init__(self, animations, change_time=30):
        super(AutoRun, self).__init__(wait=1)
        if len(animations) == 0:
            raise Exception("AutoRun animation must be initialized with one or more Animations")
        self.animations = animations
        self.counter = ModCounter(len(self.animations))
        self.current_animation = animations[self.counter.i]
        self.current_animation_start_time = datetime.datetime.now()
        self.change_time = datetime.timedelta(seconds=change_time)
Example #5
0
class ColorWipe(BaseAnimation):
    def __init__(self, wait=0.01):
        super(ColorWipe, self).__init__(wait)
        self.color = Colors.BLACKOUT
        self.name = "Color Wipe"

    def setup(self, strip):
        super(ColorWipe, self).setup(strip)
        self.counter = ModCounter(len(strip))
        self.counter.reset()

    def step(self, strip):
        if self.counter == 0:
            rand = self.color
            while rand == self.color:
                rand = random.choice(Colors.COLORS)
            self.color = rand
        strip.setPixelColor(self.counter.i, self.color.rgb())
        self.counter += 1
        return True
Example #6
0
class ColorWipe(BaseAnimation):
    def __init__(self, wait=.01):
        super(ColorWipe, self).__init__(wait)
        self.color = Colors.BLACKOUT
        self.name = "Color Wipe"

    def setup(self, strip):
        super(ColorWipe, self).setup(strip)
        self.counter = ModCounter(len(strip))
        self.counter.reset()

    def step(self, strip):
        if self.counter == 0:
            rand = self.color
            while rand == self.color:
                rand = random.choice(Colors.COLORS)
            self.color = rand
        strip.setPixelColor(self.counter.i, self.color.rgb())
        self.counter += 1
        return True
Example #7
0
    def __init__(self, handler, noStrip=NO_STRIP_ATTACHED):
        super(Animator, self).__init__(SOCKET_NAME, handler)
        self.queue = Queue.Queue(1)
        if noStrip:
            strip = Strip.SimulationStrip(STRIP_LENGTH, ROW_LENGTH)
        else:
            strip = Strip.HardwareStrip(STRIP_LENGTH)
        self.strip = strip

        self.counter = ModCounter(len(Animation.DYNAMIC_ANIMATIONS))

        self.stepper = Stepper(self.queue,
                               Animation.ANIMATIONS[Animation.BLACKOUT], strip)
        self.stepper.start()

        if GPIO_AVAILABLE:
            self.buttonmonitor = ButtonMonitor()
            self.buttonmonitor.start()

        self.processCommand(ButtonEvent.SINGLEPRESS)
Example #8
0
 def setup(self, strip):
     super(ColorWipe, self).setup(strip)
     self.counter = ModCounter(len(strip))
     self.counter.reset()
Example #9
0
 def __init__(self, wait=1):
     super(ColorRotate, self).__init__(wait=wait)
     self.name = "Color Rotate"
     self.counter = ModCounter(len(Colors.COLORS))
Example #10
0
 def __init__(self, wait=.001):
     super(ColorStrobe, self).__init__(wait)
     self.name = "Color Strobe"
     self.toggle = True
     self.counter = ModCounter(384)
Example #11
0
 def setup(self, strip):
     super(ColorWipe, self).setup(strip)
     self.counter = ModCounter(len(strip))
     self.counter.reset()
Example #12
0
 def __init__(self, wait=0.01):
     super(RainbowCycle, self).__init__(wait)
     self.counter = ModCounter(384)
     self.name = "Rainbow Cycle"