コード例 #1
0
    def run(self, strip):
        strip.clear()

        for i in range(self.pixel_min, self.pixel_max):
            strip.add(position=i, pixel=self.hsv)
        Effect.run(self, strip=strip)

        return strip
コード例 #2
0
    def run(self, strip):
        strip.off()
        for i in range(self.pixel_min, self.pixel_max):
            if i % 3 == self._iterations:
                strip.add(position=i, pixel=self.hsv)

        Effect.run(self, strip=strip)

        if self._iterations < 0:
            self._iterations = 2

        return strip
コード例 #3
0
    def run(self, strip):
        strip.clear()
        for i in range(self.pixel_min, self.pixel_max):
            color = 1 / float(self.pixel_max - self.pixel_min)
            hsv = (color*((i+self._iterations) % (self.pixel_max - self.pixel_min)), 1, self.hsv[2])
            strip.add(position=i, pixel=hsv)

        Effect.run(self, strip=strip)

        if self._iterations < 0:
            self._iterations = self.pixel_max - self.pixel_min

        return strip
コード例 #4
0
    def run(self, strip):
        if self._iterations > (self.pixel_max - self.pixel_min):
            position = (self.pixel_max - self.pixel_min) * 2 - self._iterations
            # growing
            new_pixel = self.hsv
            strip.add(position=position, pixel=new_pixel)
        elif self._iterations <= (self.pixel_max - self.pixel_min):
            # shrinking
            strip.remove(self._iterations)
        Effect.run(self, strip=strip)
        if self._iterations < 0:
            self._iterations = (self.pixel_max - self.pixel_min) * 2

        return strip
コード例 #5
0
    def run(self, strip):

        #dim all pixel
        for i in range(self.pixel_min, self.pixel_max):
            currentPixel = strip.get(i)
            if (currentPixel == None):
                strip.add(position=i, pixel=(0, 0, 0))
            else:
                strip.set(position=i,
                          pixel=(currentPixel[0], currentPixel[1],
                                 currentPixel[2] * 0.98))

        #light up new pixel
        if self._newPositionTimer < 0:
            self._newPositionTimer = self._newPositionSpeed
            newDot = random.randint(0, self.pixel_max - self.pixel_min)
            newColor = self._currentColor + random.uniform(-0.15, 0.15)
            if newColor >= 1:
                newColor -= 1.0
            elif newColor < 0:
                newColor += 1.0
            strip.set(position=newDot,
                      pixel=(newColor, self.hsv[1], self.hsv[2]))
        else:
            self._newPositionTimer -= 1

        #switch to next color
        if self._newColorTimer < 0:
            self._newColorTimer = self._newColorSpeed
            self._currentColor += 0.01
        else:
            self._newColorTimer -= 1

        Effect.run(self, strip=strip)

        if self._iterations < 0:
            self._iterations = 2

        return strip
コード例 #6
0
    def run(self, strip):

        #dim all pixel
        for i in range(self.pixel_min, self.pixel_max):
            currentPixel = strip.get(i)
            if (currentPixel == None):
                strip.add(position=i, pixel=(0, 0, 0))
            else:
                strip.set(position=i,
                          pixel=(currentPixel[0], currentPixel[1],
                                 currentPixel[2] * 0.9))

        pos = int(self._ledCount * 0.5 * (1 + math.sin(
            (self._iterations / self._iterationCount - 1) * 2 * math.pi)))
        strip.set(position=pos, pixel=self.hsv)

        Effect.run(self, strip=strip)

        if self._iterations < 0:
            self._iterations = self._iterationCount

        return strip